/* portfolio.css — base tokens, home masthead + lead, controls.
   SSOT: STYLE.md (visual) + ARCHITECTURE.md (structure). */

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

/* Dark (default) — STYLE.md §Palette */
:root {
  --bg: #0a0f1c;
  --bg-elev: #111728;
  --bg-card: #161d31;
  --bg-glass: rgba(15, 21, 38, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --border-mid: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #e9ecf3;
  --text-mid: #a8b0c5;
  --text-mute: #6b7490;
  --text-faint: #475068;
  --accent: #ef4444;
  --accent-deep: #dc2626;
  --accent-soft: rgba(239, 68, 68, 0.12);
  --accent-glow: rgba(239, 68, 68, 0.35);

  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type & spacing — STYLE.md §Typography / §Spacing (theme-independent) */
  --hd-display: 88px;
  --pad-section: 88px;
  --pad-x: 56px;
  --gap: 48px;
  --rad-sm: 4px;
  --rad-md: 10px;
  --rad-lg: 18px;
}

/* Light — STYLE.md §Palette */
[data-theme="light"] {
  --bg: #f6f2eb;
  --bg-elev: #faf6ef;
  --bg-card: #ffffff;
  --bg-glass: rgba(246, 242, 235, 0.72);
  --border: rgba(20, 24, 36, 0.10);
  --border-mid: rgba(20, 24, 36, 0.18);
  --border-strong: rgba(20, 24, 36, 0.32);
  --text: #161d31;
  --text-mid: #4a5168;
  --text-mute: #6b7490;
  --text-faint: #9098ad;
  --accent: #b91c1c;
  --accent-deep: #991b1b;
  --accent-soft: rgba(185, 28, 28, 0.10);
  --accent-glow: rgba(185, 28, 28, 0.20);
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: 'ss01' 1, 'cv11' 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.18s ease, color 0.18s ease;
}

main {
  width: 100%;
}

/* ─── Masthead — STYLE.md §Layout (VOL/NO · title · dateline) ───────── */
.pf-mast {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  padding: 56px var(--pad-x) 28px;
}

.pf-mast-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.656rem; /* ~10.5px */
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.pf-mast-side.is-right {
  text-align: right;
}

.pf-mast-side strong {
  color: var(--text-mid);
  font-weight: 600;
}

.pf-mast-center {
  text-align: center;
}

.pf-mast-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic; /* newspaper-masthead slant (handoff style) */
  font-size: 2rem; /* 32px nameplate */
  letter-spacing: -0.01em;
  color: var(--text);
}

.pf-mast-sub {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.625rem; /* ~10px */
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ─── Lead headline — STYLE.md §Layout, §Motion (static glow) ───────── */
.pf-lead {
  position: relative;
  text-align: center;
  padding: 48px var(--pad-x) 40px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-soft), transparent 70%);
}

.pf-lead-eye {
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: 0.6875rem; /* 11px --hd-mono-sm */
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.pf-lead-title {
  max-width: 21ch;
  margin: 0 auto;
  font-family: var(--font-serif);
  font-weight: 500;
  /* 88px desktop, scales down on small screens — STYLE.md §Layout (responsive) */
  font-size: clamp(2.5rem, 9vw, var(--hd-display));
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--text);
}

.pf-lead-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.pf-lead-dek {
  max-width: 42ch;
  margin: 24px auto 0;
  font-family: var(--font-serif);
  font-size: 1.0625rem; /* 17px --hd-body */
  font-style: italic;
  line-height: 1.5;
  color: var(--text-mute); /* lighter gray — STYLE.md §Color */
}

.pf-lead-meta {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 0.6875rem; /* 11px */
  letter-spacing: 0.18em;
  color: var(--text-mute);
}

.pf-lead-meta span {
  color: var(--text-mid);
}

/* ─── Social links (carried from splash; footer/CV slice will rehome) ── */
.links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 16px var(--pad-x) 40px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.4s;
}

.links a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: color 0.18s ease;
}

.links a:hover {
  color: var(--accent);
}

.links a svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.links-sep {
  width: 1px;
  height: 16px;
  background: var(--border-mid);
}

footer {
  margin-top: auto;
  padding: 28px var(--pad-x);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* Top-right control cluster: theme toggle + language switcher */
.controls {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
}

/* Ghost pill — STYLE.md §Components (theme toggle, ghost buttons) */
.ghost-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.ghost-pill:hover,
.lang-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

/* Show moon in dark, sun in light */
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.lang-switcher {
  display: flex;
  gap: 0.4rem;
}

.lang-btn {
  border-radius: 999px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile: single-column masthead, hidden flanks, tighter padding — STYLE.md §Layout (390px ref) */
@media (max-width: 600px) {
  .pf-mast {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
    padding: 44px 24px 20px;
  }
  .pf-mast-side { display: none; }
  .pf-lead { padding: 32px 24px 56px; }
  .links {
    flex-direction: column;
    gap: 1.2rem;
    padding: 32px 24px;
  }
  .links-sep { display: none; }
}

/* Respect reduced motion — STYLE.md §Motion, ARCHITECTURE §5 */
@media (prefers-reduced-motion: reduce) {
  .links, .controls {
    animation: none;
    opacity: 1;
  }
  body, .links a, .ghost-pill {
    transition: none;
  }
}
