/* ==========================================================================
   dharun.dev — editorial systems
   Dark-first. Display serif, hairline rules, mono labels, one hot accent.
   Motion is layered on top and always optional (prefers-reduced-motion).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg:         #08080a;
  --bg-elev:    #0e0e11;
  --bg-sunk:    #050506;
  --fg:         #f4f1eb;
  --fg-muted:   #98948d;
  --fg-faint:   #57544f;
  --rule:       #222226;
  --rule-soft:  #151518;
  --accent:     #ff4f18;
  --accent-dim: #c33c10;
  --accent-ink: #08080a;
  --selection:  rgba(255, 79, 24, 0.3);
  --glass:      rgba(8, 8, 10, 0.66);
  --shade:      rgba(255, 255, 255, 0.045);
  --grain-op:   0.055;
  --canvas-op:  0.85;

  --font-display: "Instrument Serif", "Iowan Old Style", Palatino, "Times New Roman", serif;
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --t-xs:   0.6875rem;
  --t-sm:   0.8125rem;
  --t-base: clamp(1rem, 0.97rem + 0.16vw, 1.0625rem);
  --t-lg:   clamp(1.125rem, 1.04rem + 0.4vw, 1.35rem);
  --t-xl:   clamp(1.5rem, 1.28rem + 1.05vw, 2.05rem);
  --t-2xl:  clamp(2rem, 1.45rem + 2.4vw, 3.4rem);
  --t-3xl:  clamp(2.6rem, 1.5rem + 4.6vw, 5.4rem);
  --t-mega: clamp(3.2rem, 0.2rem + 12.4vw, 11.5rem);

  --gutter:    clamp(1.15rem, 4vw, 4.5rem);
  --page-max:  1440px;
  --measure:   36rem;
  --section-y: clamp(4.5rem, 10vw, 10.5rem);

  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.66, 0, 0.34, 1);
  --head-h:  70px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:         #f4f1ea;
    --bg-elev:    #fffdf8;
    --bg-sunk:    #e7e3d9;
    --fg:         #121214;
    --fg-muted:   #605d57;
    --fg-faint:   #a39f96;
    --rule:       #d6d1c5;
    --rule-soft:  #e5e0d5;
    --accent:     #d43a08;
    --accent-dim: #a32d06;
    --accent-ink: #fffdf8;
    --selection:  rgba(212, 58, 8, 0.22);
    --glass:      rgba(244, 241, 234, 0.7);
    --shade:      rgba(0, 0, 0, 0.04);
    --grain-op:   0.04;
    --canvas-op:  0.62;
  }
}

:root[data-theme="light"] {
  --bg:         #f4f1ea;
  --bg-elev:    #fffdf8;
  --bg-sunk:    #e7e3d9;
  --fg:         #121214;
  --fg-muted:   #605d57;
  --fg-faint:   #a39f96;
  --rule:       #d6d1c5;
  --rule-soft:  #e5e0d5;
  --accent:     #d43a08;
  --accent-dim: #a32d06;
  --accent-ink: #fffdf8;
  --selection:  rgba(212, 58, 8, 0.22);
  --glass:      rgba(244, 241, 234, 0.7);
  --shade:      rgba(0, 0, 0, 0.04);
  --grain-op:   0.04;
  --canvas-op:  0.62;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 28px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.62;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.6s var(--ease), color 0.6s var(--ease);
}

body.is-locked { overflow: hidden; }

::selection { background: var(--selection); color: var(--fg); }

img, svg, video, canvas, object { max-width: 100%; display: block; }
img { height: auto; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--section-y) 0;
}

.skip {
  position: fixed;
  top: 0; left: 0;
  z-index: 400;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 var(--t-sm)/1 var(--font-sans);
  text-decoration: none;
  transform: translateY(-110%);
  transition: transform 0.2s var(--ease);
}
.skip:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   3. Atmosphere — canvas, grain, vignette
   -------------------------------------------------------------------------- */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
}
#bg.is-live { opacity: var(--canvas-op); }

.grain {
  position: fixed;
  inset: -110%;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 7s steps(6) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  16%  { transform: translate(-4%, -3%); }
  33%  { transform: translate(3%, -5%); }
  50%  { transform: translate(-2%, 4%); }
  66%  { transform: translate(4%, 2%); }
  83%  { transform: translate(-3%, 3%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(125% 95% at 50% 42%, transparent 38%, var(--bg) 100%);
  opacity: 0.9;
}

/* Everything sits above the atmosphere. */
.site-head, .site-foot, .page, .menu, .curtain, .cursor { position: relative; z-index: 2; }

/* --------------------------------------------------------------------------
   4. Typography primitives
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.03em; }

p { margin: 0 0 1.15em; }
a { color: inherit; }
strong, b { font-weight: 600; }
em, i { font-style: italic; }
small { font-size: var(--t-sm); }

blockquote {
  margin: 2.2rem 0;
  padding: 0 0 0 clamp(1.1rem, 3vw, 2rem);
  border-left: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: var(--t-xl);
  line-height: 1.32;
  letter-spacing: -0.02em;
  color: var(--fg);
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--shade);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.12em 0.4em;
}

pre {
  overflow-x: auto;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  line-height: 1.65;
}
pre code { background: none; border: 0; padding: 0; }

.label {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  line-height: 1;
}
.label::before {
  content: "";
  width: 1.8em;
  height: 1px;
  background: var(--accent);
  flex: none;
}
.label--bare::before { display: none; }

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  letter-spacing: 0.02em;
}

.muted { color: var(--fg-muted); }
.accent { color: var(--accent); }

/* Wiping underline link */
.prose a, .link {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent)),
                    linear-gradient(var(--rule), var(--rule));
  background-size: 0% 1px, 100% 1px;
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 0.09em;
  transition: background-size 0.42s var(--ease), color 0.3s var(--ease);
}
.prose a:hover, .prose a:focus-visible,
.link:hover, .link:focus-visible {
  background-size: 100% 1px, 100% 1px;
  color: var(--accent);
}

.arrow {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
  transition: color 0.3s var(--ease);
}
.arrow::after { content: "\2192"; transition: transform 0.4s var(--ease); }
.arrow:hover, .arrow:focus-visible { color: var(--accent); }
.arrow:hover::after, .arrow:focus-visible::after { transform: translateX(0.4em); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.6em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 500 var(--t-sm)/1 var(--font-sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform 0.48s var(--ease);
}
.btn:hover, .btn:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }

.btn--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--solid::before { background: var(--fg); }
.btn--solid:hover, .btn--solid:focus-visible { color: var(--bg); border-color: var(--fg); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.9rem 0 0; }
.btn + .btn { margin-left: 12px; }
.btn-row .btn + .btn { margin-left: 0; }

.pill {
  display: inline-block;
  padding: 0.42em 0.9em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
a.pill:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   5. Header, nav, overlay menu
   -------------------------------------------------------------------------- */

.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 120;
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 var(--gutter);
  background: var(--glass);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: transform 0.5s var(--ease), border-color 0.4s var(--ease),
              background-color 0.4s var(--ease);
}
.site-head.is-stuck { border-bottom-color: var(--rule); }
.site-head.is-hidden { transform: translateY(-101%); }

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  margin-right: auto;
}
.brand .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  align-self: center;
  animation: pulse 3.2s var(--ease-io) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.7); }
}
.brand small {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.nav { display: flex; align-items: center; gap: clamp(0.6rem, 1.6vw, 1.6rem); }
.nav a {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);
  padding: 0.4em 0;
  transition: color 0.3s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.42s var(--ease);
}
.nav a:hover, .nav a:focus-visible { color: var(--fg); }
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }

.head-tools { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease),
              transform 0.3s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(18deg); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: block; }
:root[data-theme="light"] .icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .i-sun { display: block; }
  :root:not([data-theme="dark"]) .icon-btn .i-moon { display: none; }
}

.burger {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.burger span {
  position: absolute;
  left: 11px;
  width: 16px; height: 1.5px;
  background: var(--fg);
  transition: transform 0.4s var(--ease), opacity 0.25s var(--ease);
}
.burger span:nth-child(1) { top: 16px; }
.burger span:nth-child(2) { top: 21px; }
body.menu-open .burger span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
body.menu-open .burger span:nth-child(2) { transform: translateY(-4.5px) rotate(-45deg); }

.menu {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--head-h) + 2rem) var(--gutter) 2rem;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.72s var(--ease);
  visibility: hidden;
}
body.menu-open .menu { clip-path: inset(0 0 0 0); visibility: visible; }

.menu ol { list-style: none; margin: 0; padding: 0; }
.menu li { overflow: hidden; border-bottom: 1px solid var(--rule-soft); }
.menu li a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.42em 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 11vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--fg);
  transform: translateY(105%);
  transition: transform 0.7s var(--ease), color 0.3s var(--ease);
}
body.menu-open .menu li a { transform: translateY(0); }
.menu li:nth-child(1) a { transition-delay: 0.06s; }
.menu li:nth-child(2) a { transition-delay: 0.11s; }
.menu li:nth-child(3) a { transition-delay: 0.16s; }
.menu li:nth-child(4) a { transition-delay: 0.21s; }
.menu li:nth-child(5) a { transition-delay: 0.26s; }
.menu li:nth-child(6) a { transition-delay: 0.31s; }
.menu li:nth-child(7) a { transition-delay: 0.36s; }
.menu li a:hover { color: var(--accent); }
.menu li a i {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
}
.menu-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   6. Page shell
   -------------------------------------------------------------------------- */

.page { padding-top: var(--head-h); }

.shell {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.shell--narrow { max-width: 900px; }

.section { padding: var(--section-y) 0; }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.6rem;
  margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--rule);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--t-2xl);
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */

.hero {
  min-height: calc(100svh - var(--head-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(3rem, 9vh, 7rem) clamp(2rem, 5vh, 4rem);
  position: relative;
}

.hero-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.4rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--t-mega);
  line-height: 0.85;
  letter-spacing: -0.045em;
  margin: 0;
}
.hero-title .ln { display: block; overflow: hidden; }
.hero-title .ln > span { display: block; }
.hero-title .ital { font-style: italic; color: var(--accent); }
.hero-title .out {
  -webkit-text-stroke: 1px var(--fg-faint);
  color: transparent;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2.2rem, 6vw, 4rem);
  align-items: end;
}
@media (min-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

.hero-lede {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: var(--measure);
  margin: 0;
}
.hero-lede strong { color: var(--fg); font-weight: 500; }

.hero-facts {
  display: grid;
  margin: 1px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
}
.hero-facts div {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--rule);
  padding: 1.05rem 1.15rem;
}
.hero-facts dt {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.5rem;
}
.hero-facts dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: clamp(2.4rem, 6vw, 4rem);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-decoration: none;
}
.scroll-cue i {
  display: block;
  width: 1px; height: 34px;
  background: linear-gradient(var(--accent), transparent);
  animation: cue 2.2s var(--ease-io) infinite;
  transform-origin: top;
}
@keyframes cue {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(34px); opacity: 0; }
}

/* --------------------------------------------------------------------------
   8. Marquee
   -------------------------------------------------------------------------- */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.05rem 0;
  white-space: nowrap;
  user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: inline-flex;
  gap: 3rem;
  animation: slide 38s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 3rem;
}
.marquee span::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}
@keyframes slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* --------------------------------------------------------------------------
   9. Index rows (projects / reflections / any list)
   -------------------------------------------------------------------------- */

.entry-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }

.entry-list > li {
  position: relative;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.4s var(--ease);
}
.entry-list > li:hover { background: var(--shade); }

.entry-list > li > a.row-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem 1.6rem;
  padding: clamp(1.3rem, 3vw, 2.1rem) clamp(0.5rem, 2vw, 1.5rem);
  text-decoration: none;
  color: inherit;
}

.entry-idx {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  transition: color 0.35s var(--ease);
}
.entry-list > li:hover .entry-idx { color: var(--accent); }

.entry-body { min-width: 0; }

.entry-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  transition: transform 0.5s var(--ease), color 0.35s var(--ease);
  display: block;
}
@media (hover: hover) and (pointer: fine) {
  .entry-list > li:hover .entry-title { transform: translateX(14px); color: var(--accent); }
}

.entry-desc {
  display: block;
  margin: 0.6rem 0 0;
  color: var(--fg-muted);
  max-width: 52ch;
  font-size: var(--t-base);
}

.entry-tech {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.entry-tech a { color: inherit; }

.entry-date {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
}

.entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Floating image preview on row hover (desktop only) */
.row-peek {
  position: fixed;
  top: 0; left: 0;
  width: 300px;
  height: 210px;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.35s var(--ease), transform 0.5s var(--ease);
}
.row-peek img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.15); }
.row-peek.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* --------------------------------------------------------------------------
   10. Cards / grids
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.card {
  position: relative;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  border: 1px solid var(--rule);
  background: var(--bg-elev);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.4s var(--ease), transform 0.5s var(--ease);
}
.card::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.55s var(--ease);
}
.card:hover { border-color: var(--fg-faint); transform: translateY(-3px); }
.card:hover::after { transform: scaleX(1); }

.card h3 {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  margin-bottom: 0.55rem;
}
.card p { color: var(--fg-muted); margin-bottom: 0; }
.card .label { margin-bottom: 1.1rem; }

.stat-grid {
  display: grid;
  margin: 1px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.stat-grid > li {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--rule);
  padding: clamp(1.2rem, 3vw, 1.9rem);
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-lbl {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* --------------------------------------------------------------------------
   11. Prose — the content pages
   -------------------------------------------------------------------------- */

.prose {
  max-width: 720px;
  padding-top: clamp(3rem, 9vw, 6.5rem);
  padding-bottom: var(--section-y);
}
.prose--wide { max-width: 940px; }

.prose > h1 {
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}

.prose > h2 {
  font-family: var(--font-display);
  font-size: var(--t-2xl);
  margin: 3.2rem 0 1.1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}
.prose > h2:first-of-type { margin-top: 2.8rem; }

.prose > h3 {
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.2rem 0 0.7rem;
}

.prose p, .prose li { font-size: var(--t-base); }

.prose .meta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 2.4rem;
}
.prose .meta a { background-image: none; color: var(--fg-muted); }
.prose .meta a:hover { color: var(--accent); }

.prose .lead {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  line-height: 1.32;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 1.6rem;
}

.prose ul, .prose ol { padding-left: 1.15rem; margin: 0 0 1.4rem; }
.prose li { margin-bottom: 0.55rem; }
.prose ul { list-style: none; padding-left: 0; }
.prose ul > li {
  position: relative;
  padding-left: 1.5rem;
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 8px; height: 1px;
  background: var(--accent);
}
.prose ol { list-style: decimal; padding-left: 1.4rem; }
.prose ol::marker { color: var(--fg-faint); }

.prose .entry-list { margin: 2rem 0 0; padding-left: 0; }
/* index rows are not prose bullets — drop the dash and the hanging indent */
.prose .entry-list > li { padding-left: 0; }
.prose .entry-list > li::before { display: none; }
.prose .entry-list > li { border-bottom: 1px solid var(--rule); padding: 1.5rem 0; }
.prose .entry-list > li:hover { background: transparent; }
.prose .entry-list .entry-head a {
  background-image: none;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  transition: color 0.3s var(--ease);
}
.prose .entry-list .entry-head a:hover { color: var(--accent); }
.prose .entry-list .entry-desc { margin-top: 0.55rem; color: var(--fg-muted); max-width: none; }

.prose .note {
  font-size: var(--t-sm);
  color: var(--fg-muted);
  padding: 1rem 1.2rem;
  border-left: 2px solid var(--rule);
  background: var(--shade);
}

.prose .back, .prose .byline {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.prose .back { margin-bottom: 2rem; }
.prose .byline {
  margin-top: 3.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}

.prose object { border: 1px solid var(--rule); margin: 1.5rem 0; }

/* Resume-style rows */
.row {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.row:last-of-type { border-bottom: 0; }
.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.row h3 {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
}
.row-org,
.prose p.row-org {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.45rem 0 0.8rem;
}
.row ul { margin-bottom: 0; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1.8rem 0;
  border: 1px solid var(--rule);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rule-soft);
}
thead th {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--rule);
}
tbody th, tr > th:first-child {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
  width: 1%;
}
tr:last-child th, tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 0.3s var(--ease); }
tbody tr:hover { background: var(--shade); }

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--rule);
  padding: clamp(3rem, 7vw, 5.5rem) 0 2rem;
  background: var(--bg);
}

.foot-cta {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-decoration: none;
  color: var(--fg);
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  transition: color 0.4s var(--ease);
}
.foot-cta span { display: inline-block; transition: transform 0.5s var(--ease); }
.foot-cta:hover { color: var(--accent); }
.foot-cta:hover span { transform: translateX(0.16em); }

.foot-cols {
  display: grid;
  gap: 2.2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}
.foot-cols h4 {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 1.1rem;
}
.foot-cols ul { list-style: none; margin: 0; padding: 0; }
.foot-cols li { margin-bottom: 0.55rem; }
.foot-cols a {
  text-decoration: none;
  color: var(--fg-muted);
  font-size: var(--t-sm);
  transition: color 0.3s var(--ease), padding-left 0.3s var(--ease);
}
.foot-cols a:hover { color: var(--accent); padding-left: 5px; }

.foot-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.8rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.foot-base a { text-decoration: none; }
.foot-base a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   13. Cursor & curtain
   -------------------------------------------------------------------------- */

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 26px;
  border: 1px solid var(--fg-faint);
  border-radius: 50%;
  pointer-events: none;
  z-index: 300;
  transform: translate(-50%, -50%);
  transition: width 0.32s var(--ease), height 0.32s var(--ease),
              background-color 0.32s var(--ease), border-color 0.32s var(--ease),
              opacity 0.3s var(--ease);
  opacity: 0;
  mix-blend-mode: difference;
}
.cursor.is-on { opacity: 1; }
.cursor.is-hot {
  width: 58px; height: 58px;
  background: var(--fg);
  border-color: transparent;
}
@media (hover: none), (pointer: coarse) { .cursor, .row-peek { display: none; } }

.curtain {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  pointer-events: none;
  transform: translateY(0);
  transition: transform 0.85s var(--ease);
}
body.is-ready .curtain { transform: translateY(-100%); }
body.is-leaving .curtain { transform: translateY(0); transition-duration: 0.5s; }

/* --------------------------------------------------------------------------
   14. Scroll reveal
   -------------------------------------------------------------------------- */

/* Scoped to .js so a no-script visitor gets the full document, not blank space. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
  transition-delay: var(--d, 0s);
}
[data-reveal] { transition: opacity 0.85s var(--ease), transform 0.85s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

.js .ln > span {
  transform: translateY(105%);
  transition: transform 0.95s var(--ease);
  transition-delay: var(--d, 0s);
}
body.is-ready .ln > span, .ln.is-in > span { transform: translateY(0); }

.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--accent);
  z-index: 130;
}

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .nav { display: none; }
  .burger { display: block; }
}

@media (max-width: 560px) {
  .timeline > li { grid-template-columns: 1fr; gap: 0.5rem; }
  .timeline > li::before, .timeline > li::after { display: none; }
  .tl-year { text-align: left; color: var(--accent); }

  .brand small { display: none; }
  .hero-title { line-height: 0.9; }
  .entry-list > li > a.row-link { grid-template-columns: 1fr; padding-left: 0; padding-right: 0; }
  .entry-idx { order: -1; }
  .entry-date { order: 3; }
}

/* --------------------------------------------------------------------------
   16. Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .grain { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .ln > span { transform: none; }
  .curtain { display: none; }
  .cursor { display: none; }
}

@media print {
  #bg, .grain, .vignette, .cursor, .curtain, .site-head, .menu, .marquee, .progress { display: none !important; }
  body { background: #fff; color: #000; }
  .page { padding-top: 0; }
  a { color: #000; text-decoration: underline; }
}

/* --------------------------------------------------------------------------
   17. Static glow — the floor under the WebGL layer, and its fallback
   -------------------------------------------------------------------------- */

.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(48rem 34rem at 78% 12%, rgba(255, 79, 24, 0.11), transparent 68%),
    radial-gradient(40rem 30rem at 12% 84%, rgba(120, 140, 200, 0.07), transparent 70%);
}
:root[data-theme="light"] .glow {
  background:
    radial-gradient(48rem 34rem at 78% 12%, rgba(212, 58, 8, 0.09), transparent 68%),
    radial-gradient(40rem 30rem at 12% 84%, rgba(70, 90, 160, 0.06), transparent 70%);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .glow {
    background:
      radial-gradient(48rem 34rem at 78% 12%, rgba(212, 58, 8, 0.09), transparent 68%),
      radial-gradient(40rem 30rem at 12% 84%, rgba(70, 90, 160, 0.06), transparent 70%);
  }
}

/* --------------------------------------------------------------------------
   18. Index page mastheads
   -------------------------------------------------------------------------- */

.page-head {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(4rem, 12vw, 9rem) var(--gutter) clamp(2.5rem, 6vw, 4.5rem);
}

.page-head .label { margin-bottom: 1.6rem; }

.page-title {
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
}
.page-title em { font-style: italic; color: var(--accent); }

.page-lede {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: var(--measure);
  margin: 0;
}
.page-lede + .page-lede { margin-top: 1rem; }
.page-lede a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .3s var(--ease), border-color .3s var(--ease); }
.page-lede a:hover { color: var(--accent); border-color: var(--accent); }

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

/* --------------------------------------------------------------------------
   19. About — portrait, facts, timeline, skills, pull quote
   -------------------------------------------------------------------------- */

.about-hero {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(4rem, 12vw, 9rem) var(--gutter) clamp(2.5rem, 6vw, 4rem);
}
@media (min-width: 880px) {
  .about-hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.85fr); }
}

.about-hero .page-title { font-size: var(--t-mega); line-height: 0.84; }

.portrait {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
  aspect-ratio: 4 / 5;
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transform: scale(1.04);
  transition: filter 0.8s var(--ease), transform 1.1s var(--ease);
}
.portrait:hover img { filter: grayscale(0) contrast(1); transform: scale(1); }
.portrait figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.9rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #f4f1eb;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fact-grid {
  display: grid;
  margin: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 1px;
  margin: 0;
}
.fact-grid > div {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--rule);
  padding: 1.25rem 1.35rem;
}
.fact-grid dt {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.6rem;
}
.fact-grid dd {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--fg);
}
.fact-grid dd a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.fact-grid dd a:hover { color: var(--accent); border-color: var(--accent); }

.pull {
  border-left: 0;
  padding-left: 0;
  padding-right: 0;
  margin: clamp(3rem, 8vw, 6rem) 0;
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.pull p {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.4vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 0;
  max-width: 22ch;
}
.pull em { font-style: italic; color: var(--accent); }
.pull cite {
  display: block;
  margin-top: 1.6rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-style: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 2.4rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.timeline > li::before {
  content: "";
  position: absolute;
  left: 5.7rem;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--rule);
}
.timeline > li::after {
  content: "";
  position: absolute;
  left: calc(5.7rem - 3px);
  top: 2.15rem;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--fg-faint);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.timeline > li:hover::after { background: var(--accent); border-color: var(--accent); }
.timeline > li:first-child::before { top: 2.15rem; }
.timeline > li:last-child::before { bottom: calc(100% - 2.15rem); }

.tl-year {
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding-top: 0.15rem;
}
.tl-body h3 {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.tl-body p { margin: 0; color: var(--fg-muted); font-size: var(--t-sm); }

.skill-cols {
  display: grid;
  margin: 1px;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.skill-cols > div {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--rule);
  padding: 1.5rem 1.4rem;
}
.skill-cols h4 {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}
.skill-cols ul { list-style: none; margin: 0; padding: 0; }
.skill-cols li {
  font-size: var(--t-sm);
  color: var(--fg-muted);
  padding: 0.32rem 0;
  border-bottom: 1px dashed var(--rule-soft);
  transition: color 0.3s var(--ease), padding-left 0.3s var(--ease);
}
.skill-cols li:last-child { border-bottom: 0; }
.skill-cols li:hover { color: var(--fg); padding-left: 6px; }
