/* ============================================================
   OE Supplies — shared stylesheet (modern system, 2026-06-23)
   Source of truth for /tools/* pages. Mirrors index.html tokens.
   See DESIGN.md. Keep brand: white canvas, OE orange, navy anchor.
   ============================================================ */

:root {
  --primary: #e35732;
  --primary-dark: #c94a2a;
  --primary-soft: #fff3ec;
  --text: #111827;
  --muted: #6b7280;
  --bg: #ffffff;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --on-navy: #ffffff;
  --navy-muted: #94a3b8;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #b45309;
  --info: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 12px 28px rgba(15,23,42,.07);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.12);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
main { flex: 1; }

/* ---------- Animations (no-JS / reduced-motion safe) ---------- */
.animate-on-scroll { opacity: 1; transform: none; }
.js .animate-on-scroll { opacity: 0; transform: translateY(24px); transition: opacity .7s ease-out, transform .7s ease-out; }
.js .animate-on-scroll.visible { opacity: 1; transform: none; }
.stagger-children > * { opacity: 1; transform: none; }
.js .stagger-children > * { opacity: 0; transform: translateY(18px); transition: opacity .5s ease-out, transform .5s ease-out; }
.js .stagger-children.visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: none; }
.js .stagger-children.visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: none; }
.js .stagger-children.visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: none; }
.js .stagger-children.visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: none; }
.js .stagger-children.visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: none; }
.js .stagger-children.visible > *:nth-child(6) { transition-delay: 400ms; opacity: 1; transform: none; }
/* Catch-all so any child count (7+) still reveals — never hide content */
.js .stagger-children.visible > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .animate-on-scroll, .js .stagger-children > * { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- Header ---------- */
header {
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky; top: 0; z-index: 20; transition: box-shadow .3s ease, background .3s ease;
}
header.scrolled { box-shadow: 0 6px 24px rgba(15,23,42,.08); background: rgba(255,255,255,.92); }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.brand { display: flex; align-items: center; gap: .65rem; transition: opacity .2s ease; }
.brand:hover { opacity: .85; }
.brand-logo { height: 34px; width: auto; display: block; }
@media (min-width: 768px) { .brand-logo { height: 38px; } }
.brand-text-main { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .95rem; }
.brand-text-sub { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.nav-links { display: flex; gap: 1.5rem; font-size: .9rem; }
.nav-links a { color: var(--muted); font-weight: 500; transition: color .2s ease; }
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--primary); }
.nav-cta {
  font-size: .85rem; padding: .5rem 1.1rem; border-radius: 999px; color: #fff;
  background: var(--primary); font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(227,87,50,.28); transition: all .25s ease;
}
.nav-cta:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(227,87,50,.36); }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: .4rem; color: var(--text); font-size: 1.5rem; line-height: 1; }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff;
    flex-direction: column; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,.08); gap: .9rem; }
  .nav-links.open { display: flex; }
  .nav-cta { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  background: var(--primary); color: #fff; border-radius: 999px; padding: .8rem 1.6rem;
  border: none; font-size: .95rem; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: 0 12px 28px rgba(227,87,50,.3); transition: all .3s ease;
}
.btn:hover { background: var(--primary-dark); box-shadow: 0 16px 38px rgba(227,87,50,.42); transform: translateY(-2px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-outline {
  background: #fff; color: var(--text); border: 1.5px solid var(--border); border-radius: 999px;
  padding: .8rem 1.5rem; font-size: .95rem; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: .5rem; transition: all .25s ease;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.btn-sm { padding: .45rem .9rem; font-size: .82rem; box-shadow: none; }

/* ---------- Page hero (tool / hub) ---------- */
.tool-hero {
  padding: 3.5rem 0 2.5rem;
  background:
    radial-gradient(55% 60% at 12% -10%, var(--primary-soft) 0%, transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
  border-bottom: 1px solid var(--border);
}
.eyebrow { font-size: .76rem; text-transform: uppercase; letter-spacing: .18em; color: var(--primary); font-weight: 700; margin-bottom: .6rem; }
.tool-hero h1 { font-size: clamp(2rem, 3vw + 1rem, 2.85rem); letter-spacing: -.03em; line-height: 1.08; font-weight: 700; }
.tool-hero p { font-size: 1.1rem; color: var(--muted); max-width: 44rem; margin-top: .9rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--primary); font-weight: 600; }
.breadcrumb a:hover { color: var(--primary-dark); }

/* ---------- Tools hub grid ---------- */
.tools-grid { display: grid; gap: 1.4rem; padding: 3rem 0; }
@media (min-width: 640px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  display: flex; flex-direction: column; gap: .55rem; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 20px; padding: 1.6rem; box-shadow: var(--shadow-md);
  position: relative; overflow: hidden; transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.tool-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #f08a4b); opacity: 0; transition: opacity .3s ease; }
.tool-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.tool-card:hover::before { opacity: 1; }
.tool-card:hover .icon-tile { background: var(--primary); color: #fff; }
.icon-tile { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .25s ease, color .25s ease; }
.icon-tile svg { width: 24px; height: 24px; }
.tool-card h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.tool-card p { font-size: .92rem; color: var(--muted); }
.tool-card .go { margin-top: auto; font-size: .88rem; color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; padding-top: .4rem; }
.tool-card:hover .go { gap: .55rem; }

/* ---------- Tool form + results ---------- */
.tool-body { padding: 2.5rem 0 3.5rem; }
.tool-panel { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 1.75rem; box-shadow: var(--shadow-md); }
.tool-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.tool-form .grow { flex: 1 1 240px; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .78rem; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: .06em; }
input[type=text], input[type=number], input[type=url], select, textarea {
  font-family: inherit; font-size: .98rem; color: var(--text); padding: .7rem .85rem;
  border: 1px solid var(--border); border-radius: 12px; background: #fff; width: 100%;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(227,87,50,.15); }
textarea { resize: vertical; min-height: 110px; font-family: var(--mono); font-size: .9rem; }
.hint { font-size: .82rem; color: var(--muted); margin-top: .75rem; }

.result { margin-top: 1.75rem; }
.result.hidden { display: none; }
.result-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.result-head h2 { font-size: 1.15rem; font-weight: 700; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: .55rem 1.25rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { color: var(--text); word-break: break-word; font-family: var(--mono); font-size: .9rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.data-table td.mono, .data-table td .mono { font-family: var(--mono); font-size: .88rem; }

.codeblock { background: var(--navy); color: #e2e8f0; border-radius: 14px; padding: 1.1rem 1.25rem; font-family: var(--mono);
  font-size: .85rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; overflow-x: auto; max-height: 420px; }

.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .25rem .7rem; border-radius: 999px; }
.badge-ok { background: rgba(21,128,61,.1); color: var(--success); border: 1px solid rgba(21,128,61,.3); }
.badge-bad { background: rgba(220,38,38,.08); color: var(--danger); border: 1px solid rgba(220,38,38,.3); }
.badge-warn { background: rgba(180,83,9,.08); color: var(--warning); border: 1px solid rgba(180,83,9,.3); }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid rgba(227,87,50,.3); }

.error-box { background: rgba(220,38,38,.06); border: 1px solid rgba(220,38,38,.3); color: var(--danger); border-radius: 12px; padding: .85rem 1rem; font-size: .92rem; }

.copy-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: .25rem .6rem; font-size: .78rem; cursor: pointer; color: var(--muted); font-family: inherit; transition: all .2s ease; }
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* grade ring for SSL/security score */
.grade { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.grade-A { background: #15803d; } .grade-B { background: #65a30d; } .grade-C { background: #b45309; }
.grade-D { background: #ea580c; } .grade-F { background: #dc2626; }

/* ---------- Inline lead CTA on tool pages ---------- */
.tool-cta { margin-top: 2.5rem; background: var(--navy); border-radius: 20px; padding: 2rem; position: relative; overflow: hidden; }
.tool-cta::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 140% at 88% 0%, rgba(227,87,50,.28) 0%, transparent 60%); pointer-events: none; }
.tool-cta-inner { position: relative; display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between; }
.tool-cta h3 { color: #fff; font-size: 1.3rem; letter-spacing: -.02em; }
.tool-cta p { color: var(--navy-muted); margin-top: .4rem; font-size: 1rem; max-width: 34rem; }

/* ---------- Footer (navy) ---------- */
footer { background: var(--navy); padding: 3rem 0 2.25rem; font-size: .88rem; color: var(--navy-muted); margin-top: auto; }
.footer-top { display: grid; gap: 2rem; grid-template-columns: 1fr; margin-bottom: 2rem; }
@media (min-width: 760px) { .footer-top { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand .brand-text-main { color: #fff; }
.footer-brand .brand-text-sub { color: var(--navy-muted); }
.footer-brand p { color: var(--navy-muted); margin-top: .9rem; max-width: 22rem; font-size: .9rem; }
.footer-col h4 { color: #fff; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .9rem; }
.footer-col a { display: block; color: var(--navy-muted); margin-bottom: .55rem; transition: color .2s ease; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; display: flex; flex-wrap: wrap; gap: .8rem; justify-content: space-between; align-items: center; }
.footer-bottom a { color: var(--navy-muted); transition: color .2s ease; }
.footer-bottom a:hover { color: #fff; }
.footer-contact { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; }
