:root {
  --bg: #141413;
  --bg-2: #1C1B19;
  --ink: #FAF9F5;
  --muted: #A6A39A;
  --line: rgba(250, 249, 245, .12);
  --clay: #D97757;
  --gutter: clamp(20px, 5vw, 80px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Manrope', system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--clay); color: var(--bg); }
.wrap { padding-inline: var(--gutter); max-width: 1440px; margin-inline: auto; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); font-weight: 300; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--clay); }

/* Progress */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--clay); transform-origin: left; transform: scaleX(0); z-index: 60; }

/* Nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; justify-content: space-between; align-items: center; padding: 18px var(--gutter); font-size: 14px; }
.nav::before { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--bg), transparent); pointer-events: none; z-index: -1; }
.mark { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.mark svg { color: var(--clay); animation: spin 18s linear infinite; }
.nav-links { display: flex; gap: clamp(16px, 3vw, 36px); }
.nav-links a { min-height: 44px; display: flex; align-items: center; color: var(--muted); transition: color .3s; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 640px) { .nav-links a:not(:last-child) { display: none; } }

/* Hero */
.hero { position: relative; height: 100svh; min-height: 640px; overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cert { position: absolute; margin: 0; font-family: var(--mono); font-size: clamp(10px, 1.1vw, 14px); letter-spacing: .14em; text-transform: uppercase; color: var(--clay); white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(8px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }
.cert.is-in { opacity: 1; transform: none; }
.hero-copy { position: absolute; left: 0; right: 0; bottom: clamp(40px, 8vh, 96px); display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; pointer-events: none; }
.stream { max-width: 640px; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.3; min-height: 3.9em; margin: 0; }
.caret { display: inline-block; width: .5em; height: 1em; background: var(--clay); vertical-align: -0.12em; margin-left: 2px; animation: blink 1s steps(1) infinite; }

/* Sections */
section { padding-block: clamp(96px, 14vw, 180px); border-top: 1px solid var(--line); }
.h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(34px, 4.2vw, 60px); line-height: 1.02; letter-spacing: -.02em; margin: 24px 0 0; max-width: 20ch; }
.h2 em { color: var(--clay); font-style: italic; }

/* Facts */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 72px; }
.fact { background: var(--bg); padding: 32px 28px 36px; display: flex; flex-direction: column; gap: 56px; min-height: 280px; transition: background .5s var(--ease); }
.fact:hover { background: var(--bg-2); }
.fact .k { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fact .v { font-family: var(--serif); font-size: clamp(30px, 3vw, 44px); line-height: 1.05; letter-spacing: -.01em; margin-top: auto; }
.fact p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
@media (max-width: 960px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }

/* Skills */
.skills { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); margin-top: 72px; align-items: start; }
.tabs { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.tab { display: flex; align-items: baseline; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); text-align: left; min-height: 44px; position: relative; color: var(--muted); transition: color .4s; }
.tab .n { font-family: var(--mono); font-size: 12px; }
.tab .t { font-family: var(--serif); font-size: clamp(34px, 4vw, 56px); line-height: 1; letter-spacing: -.02em; }
.tab::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%; background: var(--clay); transform: scaleX(0); transform-origin: left; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { animation: fill 12s linear forwards; }
.tab[aria-selected="true"] .n { color: var(--clay); }
.term { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; position: sticky; top: 96px; }
.term-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.term-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--clay); display: inline-block; margin-right: 10px; animation: pulse 1.6s ease-in-out infinite; }
.term-prompt { padding: 24px 24px 0; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.term-prompt b { color: var(--clay); font-weight: 500; }
.term-out { padding: 16px 24px 32px; min-height: 360px; font-size: 17px; line-height: 1.65; white-space: pre-wrap; }
.term-out.code { font-family: var(--mono); font-size: 14px; line-height: 1.7; }
.term-out .kw { color: var(--clay); }
.term-out .cm { color: var(--muted); }
.term-out p { margin: 0 0 1.4em; }
.term-out b { display: block; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--clay); }
.term-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 24px 20px; font-family: var(--mono); font-size: 12px; color: var(--muted); transition: color .3s; }
.term-link:hover { color: var(--ink); }
.term-link[hidden] { display: none; }
@media (max-width: 860px) { .skills { grid-template-columns: 1fr; } .term { position: relative; top: 0; } }

/* Source copy of the projects: readable without JS and by crawlers; visually hidden once JS animates it */
.projects { padding: 0 24px 24px; }
.projects h3 { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--muted); margin: 24px 0 8px; }
.projects pre { white-space: pre-wrap; font-size: 14px; }
.js .projects { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Principles editor */
.editor { position: relative; top: 0; margin-top: 72px; max-width: 920px; }
.editor .diff { color: var(--clay); }
.editor-body { padding: 20px 0 28px; min-height: calc(6 * 1.8em + 48px); font-family: var(--mono); font-size: clamp(14px, 1.6vw, 19px); line-height: 1.8; counter-reset: ln; }
.editor-body .ln { display: block; padding: 0 24px 0 8.5ch; text-indent: -8.5ch; background: rgba(217, 119, 87, .07); white-space: pre-wrap; counter-increment: ln; }
.editor-body .ln::before { content: counter(ln) "  +"; display: inline-block; width: 6.5ch; margin-right: 2ch; text-align: right; color: var(--muted); opacity: .7; }
.editor-body .tg { color: var(--clay); }
.editor-body .nb { color: var(--muted); }

/* Values */
.values { margin-top: 72px; border-top: 1px solid var(--line); }
.value { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 36px 0; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.value::before { content: ""; position: absolute; inset: 0; background: var(--clay); transform: translateY(101%); transition: transform .7s var(--ease); z-index: -1; }
.value:hover::before { transform: translateY(0); }
.value:hover, .value:hover .value-n, .value:hover p { color: var(--bg); }
.value-n { font-family: var(--mono); font-size: 12px; color: var(--muted); transition: color .4s; padding-left: 8px; }
.value h3 { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(48px, 8vw, 120px); line-height: .95; letter-spacing: -.03em; font-style: italic; transition: transform .7s var(--ease); }
.value:hover h3 { transform: translateX(16px); }
.value p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 44ch; transition: color .4s; padding-right: 8px; }
.values { isolation: isolate; }
@media (max-width: 760px) { .value { grid-template-columns: 1fr; gap: 12px; } }

/* Quote */
.quote { margin: 96px 0 0; max-width: 900px; }
.quote blockquote { margin: 0; font-size: clamp(26px, 3vw, 40px); line-height: 1.25; letter-spacing: -.01em; }
.quote figcaption { margin-top: 24px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Close */
.close { text-align: center; padding-block: clamp(120px, 18vw, 240px); }
.close .h2 { margin-inline: auto; max-width: none; font-size: clamp(64px, 13vw, 200px); }
.close p { color: var(--muted); font-size: 18px; margin: 28px auto 48px; max-width: 44ch; line-height: 1.55; }
.cta { display: inline-flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 30px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 17px; position: relative; overflow: hidden; transition: transform .5s var(--ease); }
.cta::before { content: ""; position: absolute; inset: 0; background: var(--clay); transform: scale(0); border-radius: 50%; transition: transform .7s var(--ease); }
.cta:hover::before { transform: scale(2); }
.cta > * { position: relative; }
.cta svg { transition: transform .5s var(--ease); }
.cta:hover svg { transform: translateX(4px); }

footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 28px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.social { display: flex; gap: 24px; }
.social a { transition: color .3s; }
.social a:hover { color: var(--ink); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.h2 .word { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .12em .08em; margin: 0 -.12em; }
.h2 .word > span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease); }
.h2.is-in .word > span { transform: none; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes fill { to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal, .h2 .word > span { opacity: 1; transform: none; }
}
