/* Ferrum public site — shares the product's own brand tokens (Inter /
   Space Grotesk / JetBrains Mono, oxide accent ramp, --bg/--border/--text
   ladder) so the site and the app feel like one thing. */

@font-face {
  font-family: "Inter";
  src: local("Inter"), local("Inter Var");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* oxide brand ramp — identical to the app's default accent */
  --accent-50: #fbeee6;
  --accent-100: #f5dac6;
  --accent-200: #eec0a0;
  --accent-300: #e39e72;
  --accent-400: #d97a49;
  --accent-500: #bd5a2c;
  --accent-600: #9c481f;
  --accent-700: #7c3a19;

  --status-ok: #3fb56c;
  --status-warn: #d6a92a;
  --status-error: #e2574c;
  --status-info: #5a8fd6;

  --bg: #101216;
  --bg-surface: #1a1d22;
  --bg-surface-hover: #20242a;
  --bg-elevated: #1f2329;
  --bg-muted: #24282f;
  --border: #2b3038;
  --border-strong: #3a414c;

  --text: #eef0f3;
  --text-dim: #a6adb9;
  --text-faint: #6b7280;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 0 1px rgba(217, 122, 73, 0.18), 0 12px 36px -14px rgba(189, 90, 44, 0.35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --measure: 68ch;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f2;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f4f6f8;
  --bg-elevated: #ffffff;
  --bg-muted: #eceff2;
  --border: #dde1e7;
  --border-strong: #c5cbd4;
  --text: #171a1f;
  --text-dim: #545b66;
  --text-faint: #838a94;
  --shadow-sm: 0 1px 2px rgba(23, 26, 31, 0.08);
  --shadow-md: 0 8px 24px -10px rgba(23, 26, 31, 0.18), 0 2px 6px rgba(23, 26, 31, 0.08);
  --shadow-lg: 0 24px 60px -20px rgba(23, 26, 31, 0.22), 0 4px 12px rgba(23, 26, 31, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1100px 520px at 12% -10%, rgba(189, 90, 44, 0.16), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(90, 143, 214, 0.08), transparent 55%);
  background-repeat: no-repeat;
}

:root[data-theme="light"] body {
  background-image:
    radial-gradient(1100px 520px at 12% -10%, rgba(189, 90, 44, 0.1), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(90, 143, 214, 0.06), transparent 55%);
}

::selection {
  background: var(--accent-500);
  color: #fff9f5;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-muted);
  border: 3px solid var(--bg);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}
* {
  scrollbar-color: var(--bg-muted) var(--bg);
  scrollbar-width: thin;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 3px;
  border-radius: 4px;
}

img {
  max-width: 100%;
  display: block;
}

code, pre, kbd, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

pre {
  margin: 0;
  overflow-x: auto;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(2.4rem, 3.2vw + 1.4rem, 4.4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.7rem, 1.4vw + 1.2rem, 2.5rem); }
h3 { font-size: clamp(1.2rem, 0.5vw + 1rem, 1.5rem); }

p {
  margin: 0;
  color: var(--text-dim);
  max-width: var(--measure);
}

.container {
  width: min(1180px, 100% - 3rem);
  margin-inline: auto;
}

/* ---------- top nav ---------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.topnav-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  margin-right: auto;
}

/* Ferrum's actual mark: a periodic-table tile for iron (element 26, Fe) —
 * the name's real etymology, not an arbitrary initial. Mirrors the app's own
 * BrandMark component (web/src/components/layout/BrandMark.tsx) exactly, so
 * this site and the product it's marketing carry the same logo. */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent-600);
  border: 1px solid var(--accent-700);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 4px;
  font-family: var(--font-mono);
}
.brand-mark .bm-num { font-size: 7px; font-weight: 600; opacity: 0.85; line-height: 1; }
.brand-mark .bm-sym { font-size: 12px; font-weight: 800; line-height: 1; text-align: center; letter-spacing: -0.02em; margin-top: -3px; }

.navlinks {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.94rem;
}

.navlinks a {
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.navlinks a:hover, .navlinks a[aria-current="page"] {
  color: var(--text);
}
.navlinks a[aria-current="page"] {
  border-color: var(--accent-500);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover { background: var(--bg-surface-hover); color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-moon { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: block; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.72rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(160deg, var(--accent-400), var(--accent-600));
  color: #fff9f5;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(217, 122, 73, 0.3), 0 16px 40px -14px rgba(189, 90, 44, 0.5); transform: translateY(-1px); }

.btn-ghost {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }

.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.86rem; border-radius: 8px; }

/* ---------- badges / pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-dim);
}
.pill.accent { color: var(--accent-300); border-color: color-mix(in srgb, var(--accent-500) 45%, var(--border)); background: color-mix(in srgb, var(--accent-500) 12%, var(--bg-surface)); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.ok { background: var(--status-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-ok) 25%, transparent); }
.dot.warn { background: var(--status-warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-warn) 25%, transparent); }
.dot.error { background: var(--status-error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-error) 25%, transparent); }
.dot.info { background: var(--status-info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-info) 25%, transparent); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 8rem;
  padding: 3.5rem 0 3rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2.5rem;
}
.footer-grid h4 {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 0.9rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.footer-grid a { text-decoration: none; color: var(--text-dim); }
.footer-grid a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- utilities ---------- */

.eyebrow-none { /* intentionally unused: no kicker labels on this site */ }

.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2.5rem; } .mt-5 { margin-top: 4rem; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08em 0.45em;
}

/* ---------- docs layout ---------- */

.doc-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3.5rem;
  padding: 3rem 0 6rem;
  align-items: start;
}

.doc-nav {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 1.6rem;
  font-size: 0.89rem;
}
.doc-nav h5 {
  margin: 0 0 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 700;
}
.doc-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.doc-nav a {
  display: block;
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  border-left: 2px solid transparent;
}
.doc-nav a:hover { color: var(--text); background: var(--bg-surface); }
.doc-nav a[aria-current="page"] { color: var(--accent-300); background: color-mix(in srgb, var(--accent-500) 10%, transparent); border-left-color: var(--accent-500); font-weight: 600; }

.doc-content { min-width: 0; max-width: var(--measure); }
.doc-content > .doc-kicker { color: var(--accent-300); font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; }
.doc-content h1 { margin-top: 0.4rem; }
.doc-content > p:first-of-type { font-size: 1.08rem; margin-top: 1rem; }
.doc-content h2 { margin-top: 3.2rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.doc-content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 2.5rem; }
.doc-content h3 { margin-top: 2.1rem; }
.doc-content p, .doc-content li { color: var(--text-dim); font-size: 0.98rem; }
.doc-content > *:not(:first-child) { margin-top: 1.1rem; }
.doc-content ul, .doc-content ol { padding-left: 1.3rem; display: grid; gap: 0.5rem; }
.doc-content strong { color: var(--text); font-weight: 600; }
.doc-content a:not(.btn) { color: var(--accent-300); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-400) 45%, transparent); text-underline-offset: 3px; }
.doc-content a:not(.btn):hover { text-decoration-color: currentColor; }

.doc-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.05rem 1.2rem;
  font-size: 0.86rem;
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}
.doc-content code {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  font-size: 0.87em;
}
.doc-content pre code { background: none; border: none; padding: 0; }

.doc-content table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.doc-content th, .doc-content td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-content th { color: var(--text-faint); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.doc-content td code { white-space: nowrap; }

.callout {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  display: flex;
  gap: 0.8rem;
  background: var(--bg-surface);
}
.callout svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 0.1rem; }
.callout.note { border-color: color-mix(in srgb, var(--status-info) 40%, var(--border)); }
.callout.note svg { color: var(--status-info); }
.callout.warn { border-color: color-mix(in srgb, var(--status-warn) 40%, var(--border)); }
.callout.warn svg { color: var(--status-warn); }
.callout p { margin: 0; font-size: 0.92rem; }

.step-list { counter-reset: step; list-style: none; padding-left: 0; }
.step-list li { counter-increment: step; position: relative; padding-left: 2.6rem; }
.step-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 1.8rem; height: 1.8rem;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; color: var(--text);
}

.doc-footnav { display: flex; justify-content: space-between; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--border); gap: 1rem; flex-wrap: wrap; }
.doc-footnav a { text-decoration: none; }
.doc-footnav .lbl { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.doc-footnav .ttl { font-weight: 600; color: var(--text); }

@media (max-width: 980px) {
  .doc-shell { grid-template-columns: 1fr; }
  .doc-nav { position: static; grid-template-columns: 1fr 1fr; display: grid; }
}

@media (max-width: 880px) {
  .navlinks { display: none; }
  .navlinks.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem min(1.5rem, 5vw);
    gap: 0.25rem;
  }
  .navlinks.is-open a { padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
