/* =========================================================================
   IronWoods — design tokens
   Palette: deep ink navy ground, vault-gold accent, muted crash-red used
   sparingly for tail-risk cues. Fraunces for display type (gravity without
   cliché), Inter for body/UI, IBM Plex Mono for numerals and data labels.
   Signature element: the convex hedge payoff curve — flat, then a sharp
   upward break — echoed in the logo mark, dividers, and the hero chart.
   ========================================================================= */

:root {
  --ink:            #0A0E17;
  --ink-raised:     #10182A;
  --panel:          #131C30;
  --panel-border:   #24334E;
  --text:           #DCE4F5;
  --text-muted:     #8E9AB8;
  --text-faint:     #5C6786;

  --gold:           #C89B3C;
  --gold-bright:    #E7C579;
  --gold-dim:       #7A5F27;

  --crash:          #B8503F;
  --crash-bright:   #D9705C;
  --success:        #4E9E77;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

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

  --shadow-panel: 0 20px 50px -25px rgba(0, 0, 0, 0.65);
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(200, 155, 60, 0.08), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(184, 80, 63, 0.05), transparent 55%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  color: #F2F0E6;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.05rem; font-weight: 600; font-family: var(--font-body); }

p { margin: 0 0 1em; color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: var(--ink);
  padding: 0.6em 1em;
  z-index: 100;
}
.skip-link:focus { left: 0; }

button, input, select, textarea { font-family: inherit; }

::selection { background: var(--gold-dim); color: #fff; }

/* ---------- layout helpers ---------- */

.max-width { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ---------- header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 34px;
  height: 24px;
  overflow: visible;
}
.brand-mark path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #F2F0E6;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.primary-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.primary-nav a:hover { color: var(--text); text-decoration: none; }
.primary-nav a.active { color: var(--gold-bright); border-bottom-color: var(--gold); }

.nav-cta {
  padding: 8px 18px !important;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  color: var(--gold-bright) !important;
}
.nav-cta.active { border-color: var(--gold); }

/* Modern avatar-chip nav item, in place of a plain "Profile" text link */
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px !important;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text) !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
}
.profile-chip:hover {
  border-color: var(--gold-dim);
  text-decoration: none !important;
}
.profile-chip.active {
  border-color: var(--gold);
  background: rgba(200, 155, 60, 0.08);
}
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--gold-bright), var(--gold-dim));
  color: #17130A;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.chip-username { font-family: var(--font-mono); letter-spacing: -0.01em; }

.logout-form { margin: 0; }
.nav-logout {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}
.nav-logout:hover { color: var(--text); border-color: var(--text-faint); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); display: block; }

/* ---------- flash messages ---------- */

.flash-stack {
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  border: 1px solid;
}
.flash-error { background: rgba(184, 80, 63, 0.12); border-color: var(--crash); color: #F4C9C0; }
.flash-success { background: rgba(78, 158, 119, 0.12); border-color: var(--success); color: #BFE8D4; }

/* ---------- hero ---------- */

.hero { padding: 72px 24px 40px; }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 0 0 14px;
}

.hero-lede { font-size: 1.1rem; max-width: 46ch; }

.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

.payoff-chart { width: 100%; height: auto; }
.axis-line { stroke: var(--panel-border); stroke-width: 1.5; }
.axis-label { fill: var(--text-faint); font-family: var(--font-mono); font-size: 12px; }
.axis-label-y { writing-mode: vertical-rl; text-orientation: mixed; }
.payoff-curve { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.payoff-curve-flat { fill: none; stroke: var(--text-faint); stroke-width: 3; stroke-linecap: round; opacity: 0.5; }
.payoff-dot { fill: var(--ink); stroke: var(--gold-bright); stroke-width: 2; }
.curve-label { fill: var(--text-faint); font-family: var(--font-mono); font-size: 12px; }
.curve-label-strong { fill: var(--gold-bright); font-weight: 500; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--gold); color: #17130A; }
.btn-primary:hover { background: var(--gold-bright); }

.btn-secondary { background: var(--ink-raised); color: var(--text); border-color: var(--panel-border); }
.btn-secondary:hover { border-color: var(--text-faint); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--panel-border); }
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold-bright); }

.btn-block { width: 100%; }

/* ---------- strip / feature row ---------- */

.strip { border-top: 1px solid var(--panel-border); border-bottom: 1px solid var(--panel-border); margin-top: 40px; }
.strip-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.strip-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.strip-item p { margin: 0; font-size: 0.95rem; }

/* ---------- CTA band ---------- */

.cta-band { padding: 64px 24px; text-align: center; }
.cta-band-inner { max-width: 560px; margin: 0 auto; }
.cta-band h2 { margin-bottom: 10px; }

/* ---------- generic page header / content ---------- */

.page-header { max-width: var(--max-width); margin: 0 auto; padding: 64px 24px 24px; }
.page-header.narrow, .content-block.narrow { max-width: 720px; }
.page-lede { font-size: 1.08rem; max-width: 60ch; }

.content-block { max-width: var(--max-width); margin: 0 auto; padding: 12px 24px 80px; }
.content-inner { max-width: 760px; }
.content-block h2 { margin-top: 2em; }
.content-block h2:first-child { margin-top: 0; }

.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 24px 0 8px; }
.how-step { padding: 20px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); }
.how-num { font-family: var(--font-mono); color: var(--gold); font-size: 0.85rem; }
.how-step h3 { margin: 10px 0 8px; }
.how-step p { font-size: 0.92rem; margin: 0; }

.disclaimer {
  margin-top: 40px;
  padding: 16px 18px;
  border-left: 3px solid var(--gold-dim);
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ---------- forms ---------- */

.form-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-panel);
  margin-bottom: 24px;
}

.form-section-title {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  margin: 28px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--panel-border);
}
.form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.form-row { margin-bottom: 18px; }
.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.optional { font-weight: 400; color: var(--text-faint); }

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.label-row label { margin-bottom: 0; }
.forgot-link {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.forgot-link:hover { color: var(--gold-bright); }

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="password"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--ink-raised);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
}
.form-row textarea { resize: vertical; }

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.18);
}

.form-row input:disabled {
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.02);
  cursor: not-allowed;
}

.field-hint { font-size: 0.8rem; color: var(--text-faint); margin: 6px 0 0; }

.password-field { position: relative; display: flex; align-items: center; }
.password-field input { flex: 1; padding-right: 60px; }
.toggle-password {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 8px;
}
.toggle-password:hover { color: var(--gold-bright); }

.code-input {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  letter-spacing: 0.4em;
  text-align: center;
}

.link-button {
  background: none;
  border: none;
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 0;
  text-decoration: underline;
}

/* ---------- login method toggle (segmented control) ---------- */

.login-method-toggle {
  display: inline-flex;
  background: var(--ink-raised);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.login-method-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.login-method-toggle label {
  margin: 0;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.login-method-toggle input[type="radio"]:checked + label {
  background: var(--gold);
  color: #17130A;
}
.login-method-toggle input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ---------- auth pages ---------- */

.auth-section { display: flex; justify-content: center; padding: 64px 24px 96px; }
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-panel);
}
.auth-card-wide { max-width: 640px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-switch { margin-top: 20px; font-size: 0.9rem; text-align: center; }
.resend-form { text-align: center; margin-top: 14px; }

/* ---------- placeholder dashboard pages ---------- */

.placeholder-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px;
  text-align: center;
}
.placeholder-page h1 { font-size: 2.2rem; }

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

.site-footer { border-top: 1px solid var(--panel-border); margin-top: 40px; }
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}
.footer-brand { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.footer-brand span { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.footer-note, .footer-copy { font-size: 0.82rem; color: var(--text-faint); margin: 4px 0; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .strip-inner { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ink-raised);
    border-bottom: 1px solid var(--panel-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 24px 20px;
    display: none;
  }
  .primary-nav.open { display: flex; }
  .primary-nav a, .nav-logout { width: 100%; padding: 10px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
