/* =====================================================================
   AMFID corporate theme  |  public/css/amfid-theme.css
   Black, zinc and gold. Dark is the default; light is opt in through
   public/js/theme-engine.js, which sets <html class="dark|light"
   data-theme="dark|light">.
   Used by: about.html, team.html, programmes/*, career.html
   ===================================================================== */

:root,
:root.dark,
:root[data-theme="dark"] {
  --bg:        #0A0A0A;
  --bg-2:      #0F0F10;
  --surface:   #131315;
  --surface-2: #18181B;           /* zinc 900 */
  --skeleton:  #27272A;           /* zinc 800 */
  --line:      rgba(250, 250, 250, 0.08);
  --line-2:    rgba(250, 250, 250, 0.14);
  --text:      #FAFAFA;
  --muted:     #A1A1AA;           /* zinc 400 */
  --faint:     #71717A;           /* zinc 500 */
  --gold:      #C8933A;           /* fills, borders, accents */
  --gold-l:    #E8B96A;
  --gold-ink:  #E0A852;           /* gold used as TEXT on the background */
  --gold-dim:  rgba(200, 147, 58, 0.14);
  --on-gold:   #0D0D0D;
  --glow:      rgba(200, 147, 58, 0.16);
  --shadow:    0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

:root.light,
:root[data-theme="light"] {
  --bg:        #FAFAF9;
  --bg-2:      #F4F4F5;           /* zinc 100 */
  --surface:   #FFFFFF;
  --surface-2: #F4F4F5;
  --skeleton:  #E4E4E7;           /* zinc 200 */
  --line:      rgba(9, 9, 11, 0.09);
  --line-2:    rgba(9, 9, 11, 0.16);
  --text:      #0D0D0D;
  --muted:     #52525B;           /* zinc 600 */
  --faint:     #71717A;
  --gold:      #C8933A;
  --gold-l:    #B5832F;
  --gold-ink:  #8B651F;           /* AA contrast on the light background */
  --gold-dim:  rgba(200, 147, 58, 0.12);
  --on-gold:   #0D0D0D;
  --glow:      rgba(200, 147, 58, 0.14);
  --shadow:    0 1px 2px rgba(9, 9, 11, 0.04), 0 24px 60px -34px rgba(9, 9, 11, 0.25);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: 'Syne', system-ui, sans-serif; font-weight: 700; margin: 0; letter-spacing: -0.035em; line-height: 1.02; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--gold); color: var(--on-gold); padding: 10px 14px; border-radius: 8px; font-family: 'Space Mono', monospace; font-size: 12px; }
.skip:focus { top: 12px; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.mono, .eyebrow { font-family: 'Space Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow { color: var(--gold-ink); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.muted { color: var(--muted); }
.gold { color: var(--gold-ink); }

/* ---------- utilities used in markup (Tailwind compatible names) ---------- */
.bg-zinc-800 { background-color: var(--skeleton); }
.rounded-lg  { border-radius: 10px; }
.aspect-square { aspect-ratio: 1 / 1; }
.animate-pulse { animation: amfid-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
@keyframes amfid-pulse { 50% { opacity: .5; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -0.06em; }
.brand em { font-style: normal; color: var(--gold); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { font-size: 14px; color: var(--muted); padding: 8px 12px; border-radius: 8px; transition: color .15s, background-color .15s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  color: var(--muted); transition: color .15s, border-color .15s, background-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--gold); }
.icon-btn svg { width: 17px; height: 17px; }
[data-theme-toggle] .i-sun { display: none; }
:root.light [data-theme-toggle] .i-sun { display: block; }
:root.light [data-theme-toggle] .i-moon { display: none; }

.menu-btn { display: none; }
.mobile-panel { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 9px;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; transition: transform .15s, background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn-gold:hover { background: var(--gold-l); border-color: var(--gold-l); color: var(--on-gold); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn .arrow { transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* Sign In link: quiet text link that becomes a high contrast action button
   once theme-engine.js confirms a session ("Go to Dashboard"). */
.actions [data-auth-link] { font-size: 14px; color: var(--muted); padding: 8px 12px; border-radius: 9px; transition: all .15s; }
.actions [data-auth-link]:hover { color: var(--text); }
.actions [data-auth-link].is-authed {
  color: var(--bg); background: var(--text); border: 1px solid var(--text);
  font-family: 'Syne', sans-serif; font-weight: 700; height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px;
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.actions [data-auth-link].is-authed::after { content: "→"; color: var(--gold); }
.actions [data-auth-link].is-authed:hover { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.actions [data-auth-link].is-authed:hover::after { color: var(--on-gold); }

/* ---------- hero ---------- */
.hero { position: relative; padding: 112px 0 88px; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before { /* faint engineering grid, faded at the edges */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; left: 50%; top: -260px; width: 900px; height: 520px; transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none;
}
.hero > .wrap { position: relative; z-index: 1; }
.display { font-size: clamp(40px, 7vw, 84px); line-height: .98; letter-spacing: -0.05em; max-width: 15ch; margin-top: 22px; }
.display em { font-family: 'Fraunces', serif; font-style: italic; font-weight: 300; color: var(--gold-ink); letter-spacing: -0.03em; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 60ch; margin-top: 22px; line-height: 1.6; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.crumbs { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }

/* ---------- sections + hairline grids ---------- */
.section { padding: 96px 0; border-bottom: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: 48px; }
.h2 { font-size: clamp(32px, 4.6vw, 54px); letter-spacing: -0.045em; margin-top: 14px; }
.h2 em { font-family: 'Fraunces', serif; font-style: italic; font-weight: 300; color: var(--gold-ink); }

.cells { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cells.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cells.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cell { background: var(--bg); padding: 32px; min-height: 180px; position: relative; transition: background-color .2s; }
.cell:hover { background: var(--bg-2); }
.cell .k { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--gold-ink); letter-spacing: .08em; }
.cell h3 { font-size: 21px; margin: 26px 0 10px; letter-spacing: -0.03em; }
.cell p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.cell.span-2 { grid-column: span 2; }
.cell.feature { background: linear-gradient(180deg, var(--gold-dim), transparent 70%), var(--bg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }

.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }

.statement { font-family: 'Syne', sans-serif; font-size: clamp(26px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -0.04em; max-width: 22ch; }
.prose p { color: var(--muted); font-size: 18px; line-height: 1.75; }
.prose p + p { margin-top: 18px; }
.prose strong { color: var(--text); font-weight: 400; font-style: italic; }

.note { border-left: 2px solid var(--gold); padding: 6px 0 6px 18px; color: var(--muted); font-size: 15px; }

/* ---------- lists / rows ---------- */
.rows { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); }
.row .k { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--gold-ink); }
.row h3 { font-size: 20px; }
.row p { color: var(--muted); font-size: 15px; margin-top: 6px; }
.row .tag { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--gold), var(--line)); }
.tl-item { position: relative; padding: 0 0 34px; }
.tl-item::before { content: ""; position: absolute; left: -27px; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); }
.tl-item .when { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--gold-ink); letter-spacing: .08em; text-transform: uppercase; }
.tl-item h3 { font-size: 20px; margin: 6px 0 6px; }
.tl-item p { color: var(--muted); font-size: 15px; }

/* ---------- team ---------- */
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 24px; transition: border-color .2s, transform .2s; }
.person:hover { border-color: var(--line-2); transform: translateY(-2px); }
.person .meta { padding: 20px 10px 0; }
.person .role { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-ink); }
.person h3 { font-size: 22px; margin: 8px 0 10px; }
.person p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.person .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag-chip { font-family: 'Space Mono', monospace; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 8px; }
.founder { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center; }
.founder .bg-zinc-800 { max-width: 440px; width: 100%; }
.founder h2 { font-size: clamp(34px, 4.4vw, 52px); margin: 12px 0 18px; }

/* ---------- caution tape marquee (programmes/tasks) ---------- */
.caution-clip { overflow: hidden; padding: 14px 0; }
.caution { position: relative; overflow: hidden; border-block: 1px solid var(--gold); transform: rotate(-1.2deg); margin: 0 -12px; z-index: 2; }
.caution .stripe { height: 10px; background: repeating-linear-gradient(-45deg, var(--gold) 0 14px, #0D0D0D 14px 28px); }
.caution .track-wrap { background: var(--gold); color: #0D0D0D; overflow: hidden; }
.caution .track { display: flex; width: max-content; animation: caution-crawl 38s linear infinite; }
.caution .track span { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; padding: 12px 0; white-space: nowrap; }
.caution .track span::after { content: "\25B2  CAUTION  \25B2"; margin: 0 28px; opacity: .75; }
.caution:hover .track { animation-play-state: paused; }
@keyframes caution-crawl { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- parameter table (programmes/tasks) ---------- */
.params { width: 100%; border-collapse: collapse; font-size: 15px; }
.params th, .params td { text-align: left; padding: 16px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.params th { font-family: 'Space Mono', monospace; font-weight: 400; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.params td:first-child { font-family: 'Syne', sans-serif; font-weight: 700; white-space: nowrap; }
.params td { color: var(--muted); }
.params td:first-child { color: var(--text); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }

/* ---------- sub nav (programmes) ---------- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 36px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; width: fit-content; background: var(--bg-2); }
.subnav a { font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 14px; border-radius: 8px; color: var(--muted); }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

/* ---------- CTA + footer ---------- */
.cta-band { padding: 96px 0; text-align: center; position: relative; overflow: hidden; }
.cta-band::before { content: ""; position: absolute; inset: auto 0 -320px; margin: auto; width: 900px; height: 520px; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; }
.cta-band .wrap { position: relative; }
.cta-band h2 { font-size: clamp(34px, 5vw, 60px); letter-spacing: -0.05em; max-width: 18ch; margin: 16px auto 28px; }
.cta-band .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.site-footer { padding: 48px 0; color: var(--faint); font-size: 14px; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--text); }

[hidden] { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .cells.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cells.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .founder { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 760px) {
  .nav, .actions .hide-sm { display: none; }
  .menu-btn { display: inline-grid; }
  /* Left edge drawer (Phase 4) */
  .mobile-panel {
    display: grid; align-content: start; position: fixed; inset: 0 auto 0 0; z-index: 120;
    width: min(320px, 86vw); height: 100dvh; overflow-y: auto; padding: 84px 18px 28px;
    background: var(--bg); border-right: 1px solid var(--line);
    transform: translateX(-100%); visibility: hidden; transition: transform .24s ease, visibility 0s .24s;
  }
  .mobile-panel.open { transform: none; visibility: visible; transition: transform .24s ease; box-shadow: 24px 0 60px rgba(0,0,0,.35); }
  .panel-shade { display: none; }
  :root.panel-open .panel-shade { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,.55); }
  :root.panel-open, :root.panel-open body { overflow: hidden; }
  .site-header .menu-btn { position: relative; z-index: 130; }
  :root.panel-open .site-header { z-index: 140; }
  .mobile-panel a { padding: 13px 6px; border-bottom: 1px solid var(--line); color: var(--muted); }
  .mobile-panel a[aria-current="page"] { color: var(--text); box-shadow: inset 3px 0 0 var(--gold); padding-left: 12px; }
  .panel-acc { border-bottom: 1px solid var(--line); }
  .panel-acc > summary { display: flex; justify-content: space-between; align-items: center; padding: 13px 6px; cursor: pointer; list-style: none; color: var(--muted); }
  .panel-acc > summary::-webkit-details-marker { display: none; }
  .panel-acc > summary::after { content: '+'; font-family: 'Space Mono', monospace; color: var(--gold-ink); }
  .panel-acc[open] > summary { color: var(--text); }
  .panel-acc[open] > summary::after { content: '\2212'; }
  .panel-acc > div { display: grid; padding: 0 0 8px 14px; border-left: 1px solid var(--line-2); margin-left: 6px; }
  .panel-acc > div a { border-bottom: 0; padding: 10px 8px; font-size: 15px; }
  .hero { padding: 72px 0 60px; }
  .section { padding: 68px 0; }
  .section-head { grid-template-columns: 1fr; gap: 14px; margin-bottom: 32px; }
  .cells.c2, .cells.c3, .cells.c4 { grid-template-columns: 1fr; }
  .cell.span-2 { grid-column: auto; }
  .cell { padding: 26px 22px; min-height: 0; }
  .team-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .cta-band { padding: 72px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .caution .track { animation: none; }
}
