/* Tokens mirror Kamsi's portfolio (Portfolio/styles/globals.css). */

@font-face {
  font-family: 'Aspekta';
  src: url('fonts/AspektaVF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --gray-0: #ffffff;
  --gray-10: #f9f9fa;
  --gray-20: #f1f1f1;
  --gray-30: #d3d5d9;
  --gray-50: #b2b6bd;
  --gray-60: #9fa4ac;
  --gray-70: #6d737e;
  --gray-80: #555961;
  --gray-90: #41444a;
  --gray-100: #242529;
  --gray-110: #191a1c;
  --gray-120: #141517;
  --gray-130: #010102;

  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 96px;
  --space-section-2: 120px;
  --space-frame: 160px;

  --font-display: 'Aspekta', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --col: 600px;
  --wide: min(1024px, 100vw - 2 * var(--space-xl));

  --canvas: var(--gray-130);
  --surface-1: var(--gray-120);
  --surface-2: var(--gray-110);
  --surface-3: var(--gray-100);
  --hairline: var(--gray-100);
  --hairline-strong: var(--gray-90);
  --ink: var(--gray-10);
  --ink-muted: var(--gray-30);
  --ink-subtle: var(--gray-60);
  --ink-tertiary: var(--gray-70);
  --accent: #2dd4bf;
  --card-edge: 0 0 0 1px rgb(255 255 255 / 0.08);
  --card-depth: inset 0 1px 0 rgb(255 255 255 / 0.04);
  color-scheme: dark;
}

[data-theme='light'] {
  --canvas: var(--gray-0);
  --surface-1: var(--gray-0);
  --surface-2: var(--gray-10);
  --surface-3: var(--gray-20);
  --hairline: var(--gray-20);
  --hairline-strong: var(--gray-50);
  --ink: var(--gray-120);
  --ink-muted: var(--gray-80);
  --ink-subtle: var(--gray-70);
  --ink-tertiary: var(--gray-60);
  --accent: #0d9488;
  --card-edge: 0 0 0 1px rgb(0 0 0 / 0.08);
  --card-depth: 0 2px 4px rgb(0 0 0 / 0.04);
  color-scheme: light;
}

/* The rail needs its own lane, so wide blocks narrow while it is visible. */
@media (min-width: 1360px) {
  :root { --wide: min(1024px, 100vw - 2 * 272px); }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
code { font-family: var(--font-mono); font-size: 0.875em; color: var(--ink); }

/* ---------- Type ---------- */

.display {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.headline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.021em;
  text-wrap: balance;
}
.subhead { font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; color: var(--ink); }
.eyebrow { font-size: 12px; font-weight: 500; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-subtle); }
.body { color: var(--ink-subtle); }
.caption { font-size: 12px; line-height: 1.4; color: var(--ink-subtle); }

@media (max-width: 767px) {
  .display { font-size: 40px; line-height: 1.15; letter-spacing: -0.025em; }
  .headline { font-size: 24px; }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--canvas) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-name { font-size: 16px; font-weight: 500; color: var(--ink); }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--ink-subtle);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface-3); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .icon-sun { display: none; }
[data-theme='light'] .theme-toggle .icon-sun { display: block; }
[data-theme='light'] .theme-toggle .icon-moon { display: none; }

/* ---------- Layout ---------- */

.page {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-xxl) var(--space-xl) var(--space-section-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.col { width: 100%; max-width: var(--col); margin-inline: auto; }
.wide { width: var(--wide); max-width: none; margin-inline: calc(50% - var(--wide) / 2); }
.bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

.stack { display: flex; flex-direction: column; gap: var(--space-lg); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-sm); }
.stack-xs { display: flex; flex-direction: column; gap: var(--space-xs); }
.stack-xl { display: flex; flex-direction: column; gap: var(--space-xl); }

/* ---------- Header / summary ---------- */

.intro { max-width: min(960px, var(--wide)); width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-xl); }
.intro-title { display: flex; align-items: center; gap: var(--space-frame); }
.intro-title h1 { max-width: 640px; }
.intro-title .eyebrow-plain { color: var(--ink-subtle); flex-shrink: 0; }
.rule { border: 0; border-top: 1px solid var(--hairline); }
.intro-summary { width: 100%; max-width: min(960px, var(--wide)); margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-sm); }
.lede { font-size: 18px; line-height: 1.6; color: var(--ink-muted); }


@media (max-width: 767px) {
  .intro-title { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
}

/* ---------- Article + rail ---------- */

.article { position: relative; }
/* The rail starts level with the summary, just below the title rule. */
.intro + .article { margin-top: calc(var(--space-xl) - var(--space-section)); }
.summary { display: flex; flex-direction: column; gap: var(--space-section); }
.sections { display: flex; flex-direction: column; gap: var(--space-section-2); }

.rail {
  display: none;
  position: absolute;
  top: 0;
  height: 100%;
  width: 160px;
  left: calc(50% - 50vw + var(--space-section));
}
.rail ul {
  position: sticky;
  top: 96px;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.rail a {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-subtle);
  text-decoration: none;
  transition: color 150ms ease;
}
.rail a:hover { color: var(--ink-muted); }
.rail a[aria-current='true'] { color: var(--ink); }
@media (min-width: 1360px) { .rail { display: block; } }

.section-head { display: flex; flex-direction: column; gap: var(--space-xs); }

/* ---------- Lists ---------- */

.list { padding-left: var(--space-lg); color: var(--ink-subtle); display: flex; flex-direction: column; gap: var(--space-xs); }
.list li::marker { color: var(--ink-tertiary); }
ol.list li { padding-left: var(--space-xxs); }

/* ---------- Status note and placeholders ---------- */

.status {
  display: flex;
  gap: var(--space-sm);
  align-items: baseline;
  padding: var(--space-sm) var(--space-md);
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--ink-muted);
}
.status .eyebrow { flex-shrink: 0; }

.ph {
  border: 1px dashed var(--hairline-strong);
  border-radius: 12px;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  color: var(--ink-tertiary);
}
.ph-tag,
.ph-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ph-tag { color: var(--accent); }
.ph p, .ph li { color: var(--ink-tertiary); }
.ph .list { gap: var(--space-xxs); }

/* ---------- Media ---------- */

.media { display: flex; flex-direction: column; gap: var(--space-sm); }
.frame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface-2);
  outline: 1px solid rgb(0 0 0 / 0.06);
  outline-offset: -1px;
}
.bleed .frame { border-radius: 0; outline: 0; }
.frame img, .frame video { display: block; width: 100%; height: auto; }
.ph-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  padding: 5px 9px;
  border-radius: 6px;
  background: rgb(1 1 2 / 0.78);
  color: #f9f9fa;
}
.bleed .ph-badge { right: var(--space-xl); }

.play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.play span {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: rgb(249 249 250 / 0.9);
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.35);
}
.play svg { margin-left: 4px; }
.duration {
  position: absolute;
  left: var(--space-md);
  bottom: var(--space-md);
  padding: 5px 9px;
  border-radius: 6px;
  background: rgb(1 1 2 / 0.78);
  color: #f9f9fa;
  font-family: var(--font-mono);
  font-size: 12px;
}
.bleed .duration { left: var(--space-xl); }
.bleed figcaption { width: 100%; max-width: 1024px; margin: 0 auto; padding-inline: var(--space-xl); }

.media-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 639px) { .media-pair { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  background: var(--surface-1);
  box-shadow: var(--card-edge), var(--card-depth);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
th, td { padding: var(--space-sm); border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
th {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
}
td { color: var(--ink-muted); }
tr > :first-child { padding-left: var(--space-md); }
tr > :last-child { padding-right: var(--space-md); }
tbody tr:last-child > td { border-bottom: 0; }
td:first-child { color: var(--ink); }
td.nowrap, th.nowrap { white-space: nowrap; }
td.pending { white-space: nowrap; color: var(--ink-tertiary); font-style: italic; }





/* ---------- Reflection ---------- */

.thoughts { display: flex; flex-direction: column; gap: var(--space-xl); }

/* ---------- Footer ---------- */

.footer {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-xxl) var(--space-xl);
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  font-size: 14px;
  color: var(--ink-subtle);
}

@media (max-width: 639px) {
  .play span { width: 52px; height: 52px; }
  .play svg { width: 18px; height: 18px; }
  .ph-badge, .duration { top: auto; font-size: 10px; padding: 3px 6px; }
  .ph-badge { top: var(--space-xs); right: var(--space-xs); }
  .duration { left: var(--space-xs); bottom: var(--space-xs); }
}
.frame a { display: block; }

/* ---------- Lightbox ---------- */

.zoom { cursor: zoom-in; }
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: transparent; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.85); }
.lightbox-scroll { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; padding: 64px 24px 24px; cursor: zoom-out; }
.lightbox img { width: min(1600px, 92vw); height: auto; border-radius: 8px; cursor: default; }
.lightbox-close { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.25); background: rgb(20 21 23 / 0.8); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.lightbox-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html:has(.lightbox[open]) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lb-in 160ms ease-out; }
  @keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
}

.wide p.body, .wide .caption { max-width: var(--col); }

/* ---------- Front page ---------- */

a.topbar-name { text-decoration: none; }
.projects { width: 100%; max-width: min(960px, var(--wide)); margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-lg); }
.project-card { display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: var(--space-xl); padding: var(--space-lg); border-radius: 16px; background: var(--surface-2); box-shadow: var(--card-edge), var(--card-depth); color: inherit; text-decoration: none; transition: background-color 150ms ease; }
.project-card:hover { background: var(--surface-3); }
.project-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-card img { width: 100%; height: auto; border-radius: 10px; }
.project-card .more { color: var(--accent); font-size: 14px; font-weight: 500; }
@media (max-width: 767px) { .project-card { grid-template-columns: 1fr; } }
