/* =========================================================================
   AF Website — shared design system
   Adapted from the QVYON research brief (projects/project-dubai-research-brief.html):
   same palette, type stack, top bar, hero, section rule, pills and
   hairline-divided rows. Numbered section heads are intentionally NOT used
   here — numbering is reserved for reports (the research brief itself).
   ========================================================================= */

:root {
  --teal: #00D5D0;
  --on-teal: #04201F;
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --bar: 56px;
}

/* dark is the fallback when no data-theme is set (e.g. JS disabled) */
html:not([data-theme="light"]) {
  --bg: #060A0B; --surface: #0D1516; --raised: #121C1D;
  --ink: #E9F2F1; --ink-2: #C3D2D1; --muted: #8DA3A2; --line: #1D2A2B;
  --accent: #00D5D0; --pale: #0F3B3A;
  --tier-outsource: #00D5D0; --tier-thought: #F2B33D; --tier-judgment: #FF7A66;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #F4F7F6; --surface: #FFFFFF; --raised: #EDF2F1;
  --ink: #071213; --ink-2: #2B4244; --muted: #4C6163; --line: #D3DDDC;
  --accent: #007674; --pale: #C2F4F3;
  --tier-outsource: #007674; --tier-thought: #9A6200; --tier-judgment: #C23A2B;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 400 15.5px/1.55 var(--body); -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--teal); color: var(--on-teal); }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ---- top bar ---------------------------------------------------------- */
.top-bar {
  position: sticky; top: 0; z-index: 10; height: var(--bar);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-bar .wrap { height: 100%; display: flex; align-items: center; gap: 22px; }
.brand { font: 600 13px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; margin-right: auto; white-space: nowrap; }
.brand .b-short { display: none; }
.top-nav { display: flex; gap: clamp(14px, 2.4vw, 30px); }
.top-nav a {
  font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  color: var(--muted); padding: 8px 0; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.top-nav a:hover { color: var(--ink); }
.top-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: none;
  background: transparent; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }
html:not([data-theme="light"]) .i-moon, html[data-theme="light"] .i-sun { display: none; }

/* ---- hero ------------------------------------------------------------- */
.hero { padding: clamp(48px, 7vw, 96px) 0 clamp(36px, 5vw, 64px); border-bottom: 1px solid var(--line); }
.hero h1 {
  font: 400 clamp(38px, 5.6vw, 76px)/1.04 var(--display); letter-spacing: -0.02em;
  margin: 18px 0 18px; text-wrap: balance; max-width: 20ch;
}
.hero .lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--muted); max-width: 62ch; }
.hero .lede a { color: var(--ink); text-underline-offset: 3px; }

/* ---- sections --------------------------------------------------------- */
.section { padding-top: clamp(44px, 5.5vw, 80px); }
.section:last-of-type { padding-bottom: clamp(56px, 7vw, 104px); }
.sec-head { padding-bottom: 18px; border-bottom: 2px solid var(--teal); }
.sec-head h2 { font: 400 clamp(26px, 3vw, 40px)/1.1 var(--display); letter-spacing: -0.015em; }
.sec-head p { margin-top: 8px; color: var(--muted); max-width: 60ch; }

.sub {
  margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line);
  font: 600 11.5px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.sub + .books, .sub + .podcasts, .sub + .posters, .sub + .f1 { margin-top: 22px; }

/* ---- rows: experience, education, writing, project materials ---------- */
.entry {
  display: grid; grid-template-columns: minmax(130px, 210px) minmax(0, 1fr); gap: 8px clamp(20px, 3vw, 48px);
  padding: clamp(24px, 3vw, 36px) 0; border-bottom: 1px solid var(--line);
}
.entry .when { font: 500 12.5px/1.5 var(--mono); color: var(--muted); padding-top: 6px; }
.entry-head { display: flex; align-items: center; gap: 18px; }
.logo { flex: none; width: 64px; height: 64px; }
.logo img { display: block; width: 64px; height: 64px; object-fit: contain; }
.entry h3 { font: 400 clamp(21px, 2.1vw, 27px)/1.2 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.entry .org { margin-top: 5px; font: 400 13px/1.4 var(--mono); color: var(--muted); }
.entry .body { margin-top: 14px; color: var(--ink-2); max-width: 70ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  font: 400 12.5px/1.25 var(--body); color: var(--ink-2);
}
.link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  font: 500 12.5px/1 var(--mono); letter-spacing: .04em; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--accent); padding-bottom: 4px;
}
.link:hover { color: var(--accent); }
.link .arr { transition: transform .15s; }
.link:hover .arr { transform: translateX(3px); }

/* ---- cards: projects -------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 2px;
  text-decoration: none; transition: border-color .2s, transform .2s;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-media { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); background: var(--raised); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media.empty { display: grid; place-items: center; font: 500 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.card h3 { font: 400 clamp(21px, 1.9vw, 25px)/1.15 var(--display); letter-spacing: -0.01em; }
.card .tags { flex: none; margin-top: 8px; font: 500 11px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card p { margin-top: 12px; color: var(--ink-2); font-size: 14.5px; flex: 1; }
.card .cta { margin-top: 18px; font: 500 12.5px/1 var(--mono); letter-spacing: .04em; color: var(--accent); }
.card.placeholder { background: transparent; border-style: dashed; }
.card.placeholder h3, .card.placeholder p { color: var(--muted); }

/* ---- reading: books, podcasts, posters -------------------------------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 22px; }
.book { text-decoration: none; display: block; }
.book .cover { aspect-ratio: 2 / 3; background: var(--raised); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; transition: border-color .2s; }
.book .cover img { width: 100%; height: 100%; object-fit: cover; }
.book:hover .cover { border-color: var(--accent); }
.book h4 { margin-top: 12px; font: 400 17px/1.25 var(--display); letter-spacing: -0.005em; }
.book .by { margin-top: 4px; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.book .blurb { margin-top: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }

.podcasts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 4vw, 56px); }
.podcast { display: flex; gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.podcast .art { flex: none; width: 84px; height: 84px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; background: var(--raised); }
.podcast .art img { width: 100%; height: 100%; object-fit: cover; }
.podcast h4 { font: 400 20px/1.2 var(--display); }
.podcast:hover h4 { color: var(--accent); }
.podcast .by { margin-top: 4px; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.podcast p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

.posters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 26px 20px; }
.poster .frame { aspect-ratio: 2 / 3; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; background: var(--raised); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster figcaption { margin-top: 10px; font: 400 12px/1.4 var(--mono); color: var(--muted); }

/* ---- Formula 1: four cards -------------------------------------------- */
.f1 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.f1-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.f1-media {
  aspect-ratio: 4 / 5; display: grid; place-items: end center; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--raised), var(--surface));
}
.f1-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.f1-media.logo-media { place-items: center; padding: 14%; background: var(--raised); }
.f1-media.logo-media img { width: 100%; height: auto; object-fit: contain; }
.f1-card .meta { padding: 16px 18px 18px; }
.f1-card .role { font: 600 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.f1-card h3 { margin-top: 8px; font: 400 21px/1.2 var(--display); }
.f1-card .detail { margin-top: 4px; font: 400 12.5px/1.45 var(--mono); color: var(--muted); }
/* the Mercedes wordmark ships in a dark-on-light and a light-on-dark variant */
.logo-light { display: block; } .logo-dark { display: none; }
html:not([data-theme="light"]) .logo-light { display: none; }
html:not([data-theme="light"]) .logo-dark { display: block; }

/* ---- footer ----------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-right: auto; }
.site-footer a { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .note { font: 400 12px/1.4 var(--mono); color: var(--muted); }

/* ---- responsive ------------------------------------------------------- */
@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .entry { grid-template-columns: 1fr; }
  .entry .when { padding-top: 0; }
  .podcasts { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brand .b-full { display: none; } .brand .b-short { display: inline; }
  .cards { grid-template-columns: 1fr; }
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.card:hover { transform: none; }
}

/* ---- breadcrumbs: first element on every sub page ---------------------- */
.crumbs { border-bottom: 1px solid var(--line); background: var(--bg); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; min-height: 40px; font: 500 11.5px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.crumbs li { display: flex; align-items: center; color: var(--muted); }
.crumbs li + li::before { content: "\203A"; margin: 0 10px; opacity: .6; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 6px 0; transition: color .15s; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--ink); }
.section[id] { scroll-margin-top: var(--bar); }
