/* alxjrvs — design E.
   One scrolling page: an oversized wordmark that recedes into a floating
   header, then projects, writing and about, each at least a screen tall.
   Warm dark by default, with a light theme. Colour beyond ink comes from
   each project's own accent. */

/* ── tokens ─────────────────────────────────────────── */
:root {
  --sans: 'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --gutter: clamp(16px, 5vw, 64px);
  --bar-h: 60px;
  --measure: 40rem;
  color-scheme: dark;

  --bg: #121110;
  --ink: #f2eee8;
  --sub: #8f877c;
  --muted: #b3aca1;
  --body: #d2ccc2;
  --rule: #2a2724;
  --frame: #2f2b27;
  --hl: #ffc93c;
  --bar-bg: rgba(24, 22, 20, .72);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f2ec;
  --ink: #171512;
  --sub: #776f64;
  --muted: #5d564d;
  --body: #3a352f;
  --rule: #e2dcd2;
  --frame: #ddd6cb;
  --hl: #9a6b00;
  --bar-bg: rgba(250, 248, 244, .78);
  --shadow: 0 30px 60px -36px rgba(60, 45, 20, .35);
}

/* ── base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* Every home-page section is one screen tall. With a mouse or trackpad the
   home-page script springs to sections once a scroll settles; on touch,
   the browser's own proximity snapping does it. */
html { scroll-behavior: smooth; scroll-snap-type: y proximity; }
html.glide { scroll-snap-type: none; }
/* no hover effects flickering under the cursor while the page springs */
html.moving main { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.125rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1; letter-spacing: -.04em; }
h3 { font-size: clamp(1.75rem, 3.6vw, 2.25rem); line-height: 1.05; letter-spacing: -.04em; }
.alx { color: var(--sub); }
.label { font: 500 .75rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--sub); }
.wrap { padding-left: var(--gutter); padding-right: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--hl); outline-offset: 3px; border-radius: 2px; }

/* ── floating header ────────────────────────────────── */
/* --p runs 0 → 1 as the header slides in (set by the home-page script).
   Without JS, and on every other page, it stays at 1. */
.bar {
  --p: 1;
  position: fixed;
  top: 12px;
  left: var(--gutter);
  right: var(--gutter);
  z-index: 50;
  height: var(--bar-h);
  padding: 0 14px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bar-bg);
  border: 1px solid var(--rule);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  transform: translateY(calc((1 - var(--p)) * -150%));
  opacity: calc(var(--p) * 1.4);
}
.bar.off { visibility: hidden; }
.brand {
  font-weight: 700;
  font-size: 28px;
  line-height: .8;
  letter-spacing: -.065em;
  margin-left: -.045em;
  text-decoration: none;
}
.js .home .brand { opacity: 0; }
.js .home.docked .brand { opacity: 1; }
.nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); font-size: 1rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.theme {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
}
.theme:hover { color: var(--ink); border-color: var(--sub); }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .theme .moon, [data-theme="light"] .theme .sun { display: none; }

/* back to top: only visible while scrolling */
.to-top {
  position: fixed;
  right: var(--gutter);
  bottom: 24px;
  z-index: 40;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s, visibility 0s .3s;
}
.to-top.show, .to-top:focus-visible { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
.to-top:hover { color: var(--ink); border-color: var(--sub); }
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── screens ────────────────────────────────────────── */
.screen {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: calc(var(--bar-h) + 40px);
  padding-bottom: 40px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.screen + .screen { border-top: 1px solid var(--rule); }

/* intro */
.intro {
  justify-content: center;
  gap: clamp(28px, 5vh, 48px);
  padding: 0 var(--gutter);
}
.mark {
  position: relative;
  z-index: 60;
  align-self: flex-start;
  margin-left: -.045em;
  font-size: clamp(96px, min(23vw, 36vh), 300px);
  line-height: .8;
  letter-spacing: -.065em;
  transform-origin: 0 0;
  will-change: transform;
}
.docked .mark { visibility: hidden; }
.tagline {
  margin: 0;
  font-weight: 500;
  font-size: clamp(30px, 4.7vw, 60px);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.tagline em { font-style: normal; color: var(--hl); }
.roll { display: inline-block; }
/* the die is the sentence's full stop: click it to roll */
.die-btn { font: inherit; line-height: 0; padding: 0 0 0 .06em; margin: 0; border: 0; background: none; cursor: pointer; vertical-align: baseline; color: var(--hl); }
.die { width: .36em; height: .36em; vertical-align: baseline; transition: transform .2s; }
.die-face { fill: currentColor; }
.die-pips { fill: var(--bg); }
.die-btn:hover .die { transform: rotate(-12deg); }
.die-btn.rolling .die { animation: tumble .5s linear infinite; }
@keyframes tumble { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .die-btn.rolling .die { animation: none; } }

/* projects */
#projects h2 { margin-bottom: clamp(24px, 4vh, 40px); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 28px; }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 28px; } }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; gap: 56px; } }
.card {
  --accent: var(--accent-dark);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
[data-theme="light"] .card { --accent: var(--accent-light); }
.shot { display: block; width: 100%; margin-bottom: 6px; }
.shot img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--frame);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform .25s;
}
.shot:hover img { transform: translateY(-4px); }
.kicker { margin: 0; font: 500 .75rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.summary { margin: 0; color: var(--muted); max-width: 34rem; font-size: 1rem; line-height: 1.5; }
.visit {
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}
.visit:hover { color: var(--accent); }

/* writing */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 28px; }
.section-head a { color: var(--muted); text-decoration: none; }
.section-head a:hover { color: var(--ink); }
.archive { list-style: none; margin: 0; padding: 0; }
.archive li { border-top: 1px solid var(--rule); }
.archive a { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 24px; padding: 20px 0; text-decoration: none; }
@media (max-width: 600px) { .archive a { grid-template-columns: 1fr; gap: 4px; } }
.archive .d { font: .8125rem/2 var(--mono); color: var(--sub); }
.archive .t { font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.02em; }
.archive .x { display: block; margin-top: 4px; font-weight: 400; font-size: 1.0625rem; letter-spacing: 0; color: var(--muted); }
.archive a:hover .t { text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 2px; }

/* about */
.about { justify-content: space-between; padding-bottom: 0; }
.about-body { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.about h2 { margin-bottom: 28px; }
.bio { max-width: 45rem; font-size: 1.1875rem; line-height: 1.6; color: var(--body); }
.bio p { margin: 0 0 18px; }
.bio a { color: var(--ink); text-underline-offset: .18em; }

/* footer */
.foot {
  margin-top: 64px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  font: .75rem var(--mono);
  color: var(--sub);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }
.inner .foot { margin-left: var(--gutter); margin-right: var(--gutter); padding: 0; }

/* ── inner pages: writing archive, posts, 404 ───────── */
.inner main { padding-top: calc(var(--bar-h) + 72px); min-height: calc(100svh - 88px); }
.pagehead { padding-bottom: 28px; border-bottom: 1px solid var(--rule); }
.pagehead h1, .notfound h1 { margin-top: 8px; font-size: clamp(3rem, 9vw, 6rem); line-height: .9; letter-spacing: -.055em; }
.year { margin: 48px 0 12px; }
.empty { margin: 32px 0 0; max-width: var(--measure); color: var(--muted); }
.empty a, .notfound a { color: var(--ink); text-underline-offset: .18em; }
.notfound p { color: var(--muted); max-width: var(--measure); }

.post-head { padding-bottom: 32px; border-bottom: 1px solid var(--rule); }
.post-head .crumb { text-decoration: none; }
.post-head .crumb:hover { color: var(--ink); }
.post-head h1 { margin-top: 12px; max-width: 18ch; font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: .95; letter-spacing: -.045em; }
.post-head .dek { margin: 16px 0 0; max-width: var(--measure); color: var(--muted); font-size: 1.25rem; }
.post-head .meta { margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.post-head .meta a { color: var(--accent-dark, var(--ink)); text-decoration: none; }
[data-theme="light"] .post-head .meta a { color: var(--accent-light, var(--ink)); }

.prose { max-width: var(--measure); margin-top: 40px; font-size: 1.1875rem; line-height: 1.65; color: var(--body); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 1.1em 0 0; }
.prose h2 { margin: 2em 0 0; font-size: 1.75rem; letter-spacing: -.03em; color: var(--ink); }
.prose h3 { margin: 1.75em 0 0; font-size: 1.25rem; letter-spacing: -.015em; color: var(--ink); }
.prose a { color: var(--ink); text-underline-offset: .18em; }
.prose blockquote { padding-left: 1.25rem; border-left: 2px solid var(--rule); color: var(--muted); font-style: italic; }
.prose code { font: .85em var(--mono); background: var(--rule); padding: .1em .35em; border-radius: 4px; }
.prose pre { background: var(--rule); padding: 1rem 1.125rem; overflow-x: auto; border-radius: 8px; font-size: .875rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; border-top: 1px solid var(--rule); }
.pager a { display: block; padding: 16px 0; text-decoration: none; }
.pager .next { grid-column: 2; text-align: right; }
.pager .t { display: block; margin-top: 4px; font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; }

@media (max-width: 600px) {
  .bar { top: 8px; padding: 0 8px 0 16px; }
  .brand { font-size: 24px; }
  .nav { font-size: .9375rem; }
}
