/* ─── tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #f4f1ea;
  --bg-surface:    #ece7dc;
  --bg-card:       #fbf8f1;
  --bg-inverse:    #0e0e0c;

  --text-primary:   #0e0e0c;
  --text-secondary: #4a4a44;
  --text-muted:     #7a7a72;
  --text-inverse:   #f4f1ea;

  --accent:        #ff5b1f;
  --accent-soft:   rgba(255, 91, 31, .12);
  --accent-strong: #e34a10;
  --accent-ink:    #1a0f08;

  --status-online: #2bb673;

  --line:          rgba(14, 14, 12, .12);
  --line-strong:   rgba(14, 14, 12, .28);

  --grain-opacity: .07;
  --grain-blend:   multiply;

  --shadow-soft: 0 1px 0 rgba(14,14,12,.04), 0 24px 48px -28px rgba(14,14,12,.18);
  --shadow-lift: 0 30px 80px -40px rgba(14,14,12,.4);

  --font-display: "Fraunces", "Times New Roman", serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "Courier New", monospace;

  --ease-out:    cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, .05, .36, 1);

  --shell-pad-x:    clamp(1.25rem, 5vw, 4rem);
  --section-pad-y:  clamp(5rem, 10vw, 9rem);
}

/* ─── base ────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; background: var(--bg-base); }
body {
  margin: 0; background: var(--bg-base); color: var(--text-primary);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}
main { position: relative; z-index: 2; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 80;
  transition: width .1s linear;
}

/* ─── shell + section ─────────────────────────────────────────────────── */
.shell {
  width: 100%; max-width: 1440px; margin: 0 auto;
  padding-inline: var(--shell-pad-x); position: relative;
}
.section { padding-block: var(--section-pad-y); position: relative; border-top: 1px solid var(--line); scroll-margin-top: 5rem; }
.section:first-of-type { border-top: 0; }
.section--hero { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; padding-top: 8rem; }
.section--invert { background: var(--bg-inverse); color: var(--text-inverse); }
.section--invert .lede { color: rgba(244,241,234,.72); }
.section--invert .eyebrow,
.section--invert .kicker { color: rgba(244,241,234,.65); }
.section--invert .display-xl,
.section--invert .display-lg,
.section--invert .display-md { color: var(--text-inverse); }

.section-header {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 3.5rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted);
}
.section-header .sh-sym  { color: var(--accent); font-weight: 600; }
.section-header .sh-num  { color: var(--accent); font-weight: 600; }
.section-header .sh-name { color: var(--text-primary); font-weight: 500; }
.section-header .sh-rule { flex: 1; height: 1px; background: var(--line); }
.section-header .sh-tail { color: var(--text-muted); font-size: .68rem; }
@media (max-width: 640px) { .section-header { gap: .75rem; font-size: .65rem; } }

/* ─── typography ──────────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-secondary);
}
.eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: currentColor; opacity: .5; }

.kicker {
  font-family: var(--font-mono); font-size: .78rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted);
}

.display-xl, .display-lg, .display-md {
  font-family: var(--font-display); font-weight: 350; font-style: normal;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  letter-spacing: -.04em; line-height: .92; color: var(--text-primary); margin: 0;
}
.display-xl { font-size: clamp(3rem, 9.5vw, 8.5rem); }
.display-lg { font-size: clamp(2.25rem, 6vw, 5rem); }
.display-md { font-size: clamp(1.85rem, 4.4vw, 3.5rem); line-height: .98; }

.italic-accent {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 90, "WONK" 1;
  color: var(--accent);
}

.lede {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  color: var(--text-secondary); line-height: 1.65; max-width: 38ch;
}

/* ─── components ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.4rem; font-size: .88rem; font-weight: 500;
  letter-spacing: .01em; border-radius: 999px; border: 1px solid transparent;
  transition: background .25s var(--ease-out), color .25s var(--ease-out),
              border-color .25s var(--ease-out), transform .25s var(--ease-out);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost { background: transparent; color: var(--text-primary); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--text-primary); }
.btn--ink { background: var(--bg-inverse); color: var(--text-inverse); border-color: var(--bg-inverse); }
.btn--ink:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.chip {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .02em;
  padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-secondary);
  background: transparent; white-space: nowrap;
  transition: border-color .25s var(--ease-out), color .25s var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.status-pill {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem .85rem .4rem .55rem;
  border-radius: 999px; border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-secondary);
  background: var(--bg-card); backdrop-filter: blur(8px);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-online); position: relative; }
.status-pill .dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--status-online); opacity: .5;
  animation: pulseRing 2s var(--ease-out) infinite;
}

.hairline {
  display: flex; align-items: center; gap: 1rem;
  padding-block: 1rem; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted);
}

.link-line { position: relative; display: inline-block; padding-bottom: 2px; }
.link-line::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease-out);
}
.link-line:hover::after { transform: scaleX(1); }

.nav-link {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-muted);
  transition: color .25s var(--ease-out);
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link.active::before { content: "· "; color: var(--accent); }

/* terminal cursor */
.term-cursor {
  display: inline-block; width: .55em; height: .9em;
  margin-left: .15em; background: var(--accent);
  vertical-align: -.05em;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* inline code-style chip */
.code-mark {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .82em;
  padding: .1em .4em; border-radius: .25rem;
  background: var(--accent-soft); color: var(--accent-strong);
  letter-spacing: 0;
}

/* command-prompt style line */
.cmd-line {
  font-family: var(--font-mono); font-size: .78rem;
  color: var(--text-muted); letter-spacing: .04em;
}
.cmd-line .prompt { color: var(--accent); margin-right: .5rem; }
.cmd-line .path   { color: var(--text-secondary); }

/* loader */
.loader {
  position: fixed; inset: 0; background: var(--bg-base); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s var(--ease-out), visibility .6s;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-bar { width: 200px; height: 1px; background: var(--line); position: relative; overflow: hidden; }
.loader-bar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.2s infinite;
}

/* timeline */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: .6rem; bottom: 0;
  width: 1px; background: var(--line);
}
.timeline-item { position: relative; padding-left: 1.75rem; padding-bottom: 3rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -4px; top: .55rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-base); border: 2px solid var(--accent);
}

/* skill bar */
.bar { position: relative; overflow: hidden; background: var(--line); height: 2px; border-radius: 2px; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent);
  transition: width 1.6s var(--ease-out); }

/* marquee */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
           mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%); }
.marquee-track { display: flex; gap: 3rem; white-space: nowrap; animation: marqueeLeft 40s linear infinite;
                 font-family: var(--font-display); font-style: italic; color: var(--text-muted);
                 font-size: clamp(2.5rem, 6vw, 5rem); letter-spacing: -.02em; }
.marquee-track > span { display: inline-flex; align-items: center; gap: 2rem; }
.marquee-dot { color: var(--accent); font-style: normal; }

/* writing list rows */
.writing-row {
  display: grid; grid-template-columns: 7rem 1fr auto; gap: 1.5rem;
  align-items: baseline; padding: 1.75rem 0; border-top: 1px solid var(--line);
}
.writing-row:last-child { border-bottom: 1px solid var(--line); }
.writing-row .title { transition: transform .4s var(--ease-out), color .25s var(--ease-out); }
.writing-row .excerpt {
  grid-column: 2 / 3; max-height: 0; overflow: hidden;
  transition: max-height .5s var(--ease-out), opacity .5s, margin-top .5s;
  opacity: 0; margin-top: 0; color: var(--text-muted);
}
.writing-row:hover .title { transform: translateX(10px); color: var(--accent); }
.writing-row:hover .excerpt { max-height: 80px; opacity: 1; margin-top: .5rem; }
.writing-row .arrow { transition: transform .4s var(--ease-out), color .25s var(--ease-out); color: var(--text-muted); }
.writing-row:hover .arrow { transform: translateX(8px) rotate(-45deg); color: var(--accent); }

/* card */
.card {
  border: 1px solid var(--line); border-radius: 1.25rem; padding: 1.75rem;
  background: var(--bg-card);
  transition: border-color .3s var(--ease-out), transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow-soft); }

/* social card */
.social-card {
  display: flex; flex-direction: column; gap: 1.5rem;
  border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem;
  background: var(--bg-card);
  transition: background .3s var(--ease-out), border-color .3s var(--ease-out), transform .3s var(--ease-out);
}
.social-card:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }

/* stat */
.stat-value {
  font-family: var(--font-display); font-weight: 350;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  font-size: clamp(2rem, 4vw, 3rem); line-height: 1; color: var(--text-primary);
}
.stat-label {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-muted); margin-top: .5rem;
}

/* reveal */
.reveal {
  opacity: 0; transform: translateY(28px); filter: blur(6px);
  transition: opacity .9s var(--ease-out) var(--reveal-delay, 0ms),
              transform .9s var(--ease-out) var(--reveal-delay, 0ms),
              filter .9s var(--ease-out) var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}
.reveal.in { opacity: 1; transform: none; filter: blur(0); }

/* keyframes */
@keyframes marqueeLeft  { 0% { transform: translate(0); }   to { transform: translate(-50%); } }
@keyframes pulseRing    { 0% { transform: scale(.6); opacity: .7; } to { transform: scale(1.6); opacity: 0; } }
@keyframes sweep        { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
}
