/* ─────────────────────────────────────────────────────────
   tokens.css — Swiss editorial design system
   Light + dark tokens, typography, base resets, theme
   transition, and shared primitives used across every page.
   ───────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500&family=Inter:wght@400;500&display=swap');

/* ─── Tokens: light ──────────────────────────────────────── */
:root {
  --bg:           #FBFAF7;
  --bg-secondary: #F2EFE8;
  --text:         #121212;
  --text-muted:   #5E5E5E;
  --border:       #E5E3DC;
  --accent:       #5B8BC5;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  --tr: 200ms ease;
}

/* ─── Tokens: dark ───────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0E0E0E;
  --bg-secondary: #1A1A1A;
  --text:         #F2EFE8;
  --text-muted:   #9A9590;
  --border:       #2A2825;
  --accent:       #D94848;
}

/* ─── Base reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--tr), color var(--tr);
}

body,
html {
  min-height: 100%;
}

/* Apply transition to themed properties across the whole tree */
* {
  transition-property: background-color, color, border-color, fill, stroke;
  transition-duration: var(--tr);
  transition-timing-function: ease;
}

/* Don't blow up interaction or animation transitions */
a, button, input, textarea, select {
  transition-property: background-color, color, border-color, fill, stroke, opacity, transform;
}

/* ─── Typography primitives ──────────────────────────────── */
.serif,
.display {
  font-family: var(--font-display);
  font-weight: 400;
}

.mono-label,
.eyebrow,
.nav-link,
.section-label,
.footer-text {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tnum {
  font-variant-numeric: tabular-nums;
}

/* ─── Links ──────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

.link-accent {
  color: var(--accent);
  position: relative;
  display: inline-block;
  padding-bottom: 1px;
}

.link-accent::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: currentColor;
  transform-origin: left center;
  transform: scaleX(1);
}

.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 1px;
}

.link-underline::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: currentColor;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 200ms ease;
}

.link-underline:hover::after,
.link-underline:focus-visible::after {
  transform: scaleX(1);
}

/* ─── Layout containers ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
}

@media (max-width: 768px) {
  .container {
    padding: 0 24px;
  }
}

.section {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.section--first {
  border-top: none;
}

/* ─── Nav ────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--tr), background-color var(--tr);
}

.site-nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  max-width: 1280px;
  margin: 0 auto;
  gap: 24px;
}

.nav-brand {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  padding: 2px 0;
  transition: color 150ms ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text);
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 1px;
  width: 100%;
  background: currentColor;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 200ms ease;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

.theme-toggle {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--accent);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .sun {
  display: none;
}

.theme-toggle .moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

@media (max-width: 768px) {
  .nav-inner {
    padding: 16px 24px;
    gap: 14px;
  }
  .nav-links {
    gap: 16px;
  }
  .nav-link {
    font-size: 10px;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 560px) {
  .nav-brand {
    font-size: 10px;
  }
  .nav-links {
    gap: 12px;
  }
  .nav-link {
    font-size: 9px;
    letter-spacing: 0.06em;
  }
}

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  max-width: 1280px;
  margin: 0 auto;
  gap: 16px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  gap: 20px;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    padding: 24px 24px;
  }
  .footer-right {
    gap: 14px;
  }
}

/* ─── Section labels ─────────────────────────────────────── */
.section-label {
  display: block;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-header .section-label {
  margin-bottom: 0;
}

.section-header .view-all {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ─── Reveal primitives (for animation agent) ────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 400ms ease, transform 400ms ease;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ─── macOS window image wrapper ─────────────────────────── */
.mac-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
}

[data-theme="dark"] .mac-window {
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
}

.mac-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.mac-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mac-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.mac-dot--close { background: #FF5F57; }
.mac-dot--min   { background: #FEBC2E; }
.mac-dot--max   { background: #28C840; }

[data-theme="dark"] .mac-dot--close { background: #FF6058; }
[data-theme="dark"] .mac-dot--min   { background: #FEBD2F; }
[data-theme="dark"] .mac-dot--max   { background: #28C941; }

.mac-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  pointer-events: none;
}

.mac-body {
  display: block;
  background: var(--bg);
  line-height: 0;
  overflow: hidden;
}

.mac-body img {
  width: 100%;
  height: auto;
  display: block;
}

/* Thumbnail variant: capped width + fixed aspect ratio, image fills via cover */
.mac-window--thumb {
  max-width: 520px;
  margin: 24px 0;
}
.mac-window--thumb .mac-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mac-window--thumb[data-ratio="square"]    .mac-body { aspect-ratio: 1 / 1; }
.mac-window--thumb[data-ratio="wide"]      .mac-body { aspect-ratio: 16 / 10; }
.mac-window--thumb[data-ratio="landscape"] .mac-body { aspect-ratio: 3 / 2; }
.mac-window--thumb[data-ratio="portrait"]  .mac-body { aspect-ratio: 4 / 5; }

/* Detail variant: capped width, keeps natural aspect of the image */
.mac-window--detail {
  max-width: 560px;
  margin: 24px 0;
}

/* Hero variant: slightly larger, centered under a hero section */
.mac-window--hero {
  max-width: 720px;
  margin: 24px auto;
}

@media (max-width: 560px) {
  .mac-titlebar { height: 24px; padding: 0 10px; }
  .mac-dot { width: 10px; height: 10px; }
  .mac-title { font-size: 10px; }
}

/* ─── Split: text left, image right (detail pages) ───────── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}
.split .split-text h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 18px;
}
.split .split-text p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  margin-bottom: 14px;
}
.split .split-text p:last-child { margin-bottom: 0; }
.split .split-media { display: flex; flex-direction: column; gap: 16px; }
.split .split-media .mac-window { margin: 0; max-width: 100%; }
.split .caption {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: -6px;
}

@media (max-width: 768px) {
  .split { grid-template-columns: 1fr; gap: 20px; align-items: start; }
}

/* ─── Focus ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
