/* Cobalt — white type on electric blue, made of particles. Instrument Sans and DM Mono. */

:root {
  --bg: #1b2fe8;
  --bg-deep: #1426c9;
  --ink: #ffffff;
  --dim: rgba(255, 255, 255, 0.74);
  --mute: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.2);
  --accent: #ff7a3d;
  --g: clamp(16px, 4vw, 60px);
  --sans: "Instrument Sans", "Helvetica Neue", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: #fff; color: var(--bg); }
a { color: inherit; }
img, video, iframe, canvas { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.kicker, time, .len, .meta, figcaption, .colophon {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.01em; color: var(--mute);
}
.kicker { margin: 0; font-weight: 400; }

/* Text redrawn as particles: the real text stays for reading, selecting and searching. */
[data-dots] { position: relative; }
.dotted, .dotted * { color: transparent !important; }
canvas.dots { position: absolute; inset: -60px -40px; width: calc(100% + 80px); height: calc(100% + 120px); pointer-events: none; max-width: none; }

/* --- Masthead -------------------------------------------------------------------------- */

.masthead {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.1rem var(--g);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.name { display: flex; align-items: center; gap: 0.7rem; font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.mark { display: grid; grid-template-columns: repeat(2, 6px); gap: 3px; }
.mark i { width: 6px; height: 6px; border-radius: 50%; background: #fff; transition: transform 0.3s; }
.mark i:last-child { background: var(--accent); }
.name:hover .mark i:nth-child(1) { transform: translate(-2px, -2px); }
.name:hover .mark i:nth-child(4) { transform: translate(2px, 2px); }
nav { display: flex; gap: clamp(1rem, 2.5vw, 2.25rem); }
nav a { position: relative; font-weight: 500; text-decoration: none; color: var(--dim); }
nav a::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.25s;
}
nav a:hover, nav a[aria-current] { color: #fff; }
nav a[aria-current]::after, nav a:hover::after { transform: scale(1); }

main { min-height: 60vh; }

/* --- Home -------------------------------------------------------------------------------- */

.home {
  position: relative;
  display: grid;
  grid-template-columns: [full-start] var(--g) [a-start] minmax(0, 7fr) [a-end] clamp(2rem, 6vw, 7rem) [b-start] minmax(0, 4fr) [b-end] var(--g) [full-end];
}
.home > * { grid-column: a-start / b-end; }
.home canvas.field { position: absolute; top: 0; left: 0; width: 100%; height: 80vh; pointer-events: none; max-width: none; }
.home .prose { display: contents; }
.home .prose > * { grid-column: b-start / b-end; margin: 0 0 1.1rem; color: var(--dim); position: relative; }
.home .prose > h1 {
  grid-column: a-start / b-end;
  grid-row: 1;
  position: relative; z-index: 1;
  margin: clamp(15rem, 30vw, 28rem) 0 clamp(4rem, 9vw, 8rem);
  color: #fff;
  --glass-ink: #ffffff;
  font: 600 clamp(3.8rem, 13.6vw, 15rem)/0.86 var(--sans);
  letter-spacing: -0.055em;
}
.home .prose > h1 em { font-style: normal; color: var(--accent); --glass-ink: #ff7a3d; }

/* The glass: the hero and the footer are drawn by lens.js, type and portrait in dots. */
.glass-on [data-glass-text], .glass-on .prose > h1, .glass-on .prose > h1 em { color: transparent !important; }
canvas.glass { display: block; width: 100%; height: 100%; max-width: none; touch-action: pan-y; cursor: grab; }
canvas.glass:active { cursor: grabbing; }
.home > canvas.glass { grid-column: full-start / full-end; grid-row: 1; align-self: stretch; }
.hint {
  grid-column: a-start / b-end; grid-row: 1; align-self: end; z-index: 1;
  display: flex; justify-content: space-between; margin: 0 0 1.2rem;
  font: 0.72rem var(--mono); color: var(--mute); pointer-events: none;
  opacity: 0; transition: opacity 1s 1.5s;
}
.glass-on .hint { opacity: 1; }
.footer-glass { position: relative; display: grid; min-height: clamp(16rem, 32vw, 28rem); margin: 0 calc(-1 * var(--g)); --paper: #1426c9; }
.footer-glass > * { grid-area: 1 / 1; }
.footer-glass .footer-big { align-self: end; position: relative; padding: 0 var(--g); --glass-ink: #ffffff; }
[hidden] { display: none !important; }
.home .prose > h1 + p {
  grid-column: a-start / a-end;
  grid-row: 2 / span 8;
  margin: 0;
  color: #fff;
  font: 500 clamp(1.5rem, 2.9vw, 2.7rem)/1.12 var(--sans);
  letter-spacing: -0.03em;
}
.home .prose > h1 + p + p::before {
  content: "Now"; display: block; margin-bottom: 0.5rem;
  font: 0.75rem var(--mono); color: var(--accent);
}
.home .prose > ul { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.home .prose > ul li { position: relative; padding: 0.6rem 0 0.6rem 1.4rem; border-bottom: 1px solid var(--line); color: #fff; }
.home .prose > ul li::marker { content: none; }
.home .prose > ul li::before { content: ""; position: absolute; left: 0; top: calc(0.6rem + 0.8em - 3.5px); width: 7px; height: 7px; border-radius: 50%; background: #fff; transition: background 0.2s, transform 0.2s; }
.home .prose > ul li:hover::before { background: var(--accent); transform: scale(1.5); }
.home .prose a { color: #fff; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.home .prose a:hover { color: var(--accent); }

.recent { margin-top: clamp(5rem, 10vw, 9rem); }
.kicker.row { display: flex; justify-content: space-between; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.kicker.row a { color: #fff; text-decoration: none; }
.kicker.row a:hover { color: var(--accent); }

/* --- Post lists ---------------------------------------------------------------------------- */

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 6rem;
  column-gap: 2rem;
  padding: 1.6rem 1rem;
  margin: 0 -1rem;
  border-radius: 14px;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}
.post-list time, .post-list .len { padding-top: 0.55rem; }
.post-list .len { text-align: right; }
.post-list .title { font: 600 clamp(1.35rem, 2.3vw, 2rem)/1.1 var(--sans); letter-spacing: -0.03em; }
.post-list .summary { grid-column: 2; margin-top: 0.45rem; color: var(--dim); max-width: 44em; }
.post-list a:hover { background: #fff; color: var(--bg); }
.post-list a:hover .summary, .post-list a:hover time, .post-list a:hover .len { color: rgba(27, 47, 232, 0.7); }

/* --- Page headers --------------------------------------------------------------------------- */

.page-header, .post-header { padding: clamp(4rem, 10vw, 8rem) var(--g) clamp(3rem, 6vw, 5rem); }
.page-header h1 {
  margin: 0;
  font: 600 clamp(3.4rem, 11vw, 11rem)/0.88 var(--sans);
  letter-spacing: -0.055em;
}
.post-header .kicker { display: flex; gap: 1.5rem; margin-bottom: 1.6rem; }
.post-header h1 {
  margin: 0; max-width: 17ch;
  font: 600 clamp(2.4rem, 6vw, 5.8rem)/0.96 var(--sans);
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.standfirst { max-width: 32em; margin: 1.6rem 0 0; color: var(--dim); font-size: clamp(1.15rem, 1.8vw, 1.45rem); line-height: 1.4; }
.blog .intro { max-width: 32em; margin-top: 2rem; color: var(--dim); font-size: 1.2rem; }
.blog .intro p { margin: 0; }
.blog > .post-list { margin: 0 var(--g); border-top: 1px solid var(--line); }

.progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 11;
  display: flex; justify-content: space-between; padding: 0 var(--g);
  height: 4px; align-items: center;
  opacity: 0; transition: opacity 0.3s;
}
.progress.show { opacity: 1; }
.progress i { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); transition: background 0.2s; }
.progress i.on { background: var(--accent); }

/* --- Prose ------------------------------------------------------------------------------------ */

.page > .prose, .post > .prose {
  max-width: calc(40rem + 2 * var(--g));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) var(--g) 0;
  font-size: 1.15rem; line-height: 1.7;
}
.post > .prose { color: rgba(255, 255, 255, 0.92); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.3em; }
.prose a { color: #fff; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--accent); }
.prose a:hover { color: var(--accent); }
.prose h2 { margin: 2.4em 0 0.7em; color: #fff; font: 600 clamp(1.6rem, 2.8vw, 2.2rem)/1.12 var(--sans); letter-spacing: -0.035em; }
.prose h3 { margin: 2em 0 0.4em; color: #fff; font: 600 1.3rem/1.25 var(--sans); letter-spacing: -0.02em; }
.prose strong { font-weight: 650; color: #fff; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; padding-left: 0.3em; }
.prose ul > li::marker { content: "●  "; font-size: 0.55em; color: var(--accent); }
.prose ol > li::marker { font-family: var(--mono); font-size: 0.82em; color: var(--accent); }
.prose blockquote {
  margin: 2em 0; padding: 0.2em 0 0.2em 1.4em;
  border-left: 3px dotted var(--accent);
  color: #fff; font: 500 1.4rem/1.35 var(--sans); letter-spacing: -0.02em;
}
.prose blockquote p { margin: 0; }
.prose code { font: 0.85em var(--mono); background: rgba(0, 0, 40, 0.28); border-radius: 5px; padding: 0.12em 0.38em; }
.prose pre {
  margin: 2em calc(-1 * min(1.5rem, var(--g))); padding: 1.4em 1.6em; overflow-x: auto;
  background: #0f1d9e; border-radius: 16px;
  font-size: 0.86rem; line-height: 1.65;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose hr { border: 0; height: 6px; margin: 3.5em 0; background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 1.5px, transparent 2px) 0 50% / 14px 6px repeat-x; }
.prose figure { margin: 2.4em 0; }
.prose figure img, .prose figure video { width: 100%; height: auto; border-radius: 14px; }
.prose .embed-player iframe, .prose .embed-frame iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; }
.prose figcaption { margin-top: 0.7rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 2.4em 0; }
.gallery figure { margin: 0; }

.post-footer { max-width: calc(40rem + 2 * var(--g)); margin: 4rem auto 0; padding: 0 var(--g); }
.post-footer a { font-weight: 600; text-decoration: none; }
.post-footer a:hover { color: var(--accent); }

/* --- Projects ----------------------------------------------------------------------------------- */

.page-projects .prose > p:first-child { color: #fff; font: 500 1.45rem/1.35 var(--sans); letter-spacing: -0.02em; }
.page-projects .prose h2 { padding-top: 1.4rem; border-top: 1px solid var(--line); }
.page-projects .prose h3 { scroll-margin-top: 6rem; }
.page-projects .prose .meta { color: var(--accent); margin: 0 0 1rem; }

.timeline { margin: 0 var(--g) clamp(2rem, 5vw, 4rem); padding: 0; overflow-x: auto; }
.tl-row {
  display: grid; grid-template-columns: minmax(9rem, 16rem) minmax(20rem, 1fr);
  column-gap: 1.5rem; align-items: center;
  padding: 3px 0; text-decoration: none; color: var(--dim); font-size: 0.85rem;
}
.tl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-dots { display: grid; grid-template-columns: repeat(var(--years), 1fr); }
.tl-dots i { justify-self: center; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); transition: transform 0.2s; }
.tl-dots i.on { background: #fff; }
.tl-row.current .tl-dots i.on { background: var(--accent); }
.tl-row.current .tl-name { color: #fff; }
a.tl-row:hover { color: #fff; }
a.tl-row:hover .tl-dots i.on { transform: scale(1.5); }
.tl-axis { padding-bottom: 1.6rem; }
.tl-axis .tl-dots i { position: relative; width: 1px; height: 8px; border-radius: 0; background: transparent; }
.tl-axis .tl-dots i[data-year] { background: var(--mute); }
.tl-axis .tl-dots i[data-year]::after {
  content: attr(data-year); position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font: 0.7rem var(--mono); color: var(--mute);
}

/* --- Footer --------------------------------------------------------------------------------------- */

.site-footer {
  margin-top: clamp(6rem, 12vw, 10rem);
  padding: clamp(3rem, 7vw, 6rem) var(--g) 1.5rem;
  background: var(--bg-deep);
  overflow: hidden;
}
.footer-big {
  margin: 0 0 clamp(2rem, 5vw, 4rem);
  font: 600 clamp(3.4rem, 12.5vw, 13rem)/0.9 var(--sans);
  letter-spacing: -0.055em;
}
.footer-grid { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; margin-bottom: clamp(3rem, 6vw, 5rem); }
.footer-mail { font: 500 clamp(1.3rem, 3vw, 2.4rem)/1.1 var(--sans); letter-spacing: -0.03em; text-decoration: none; overflow-wrap: anywhere; }
.footer-mail span { display: inline-block; color: var(--accent); transition: transform 0.25s; }
.footer-mail:hover span { transform: translateX(6px); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-weight: 500; text-decoration: none; color: var(--dim); }
.footer-links a:hover { color: #fff; }
.colophon { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }

/* --- Small screens ---------------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .name { font-size: 0.92rem; }
  nav { gap: 1.1rem; }
  nav a { font-size: 0.92rem; }
  .home { grid-template-columns: [full-start] var(--g) [a-start b-start] minmax(0, 1fr) [a-end b-end] var(--g) [full-end]; }
  .home .prose > h1 { font-size: clamp(3.8rem, 21vw, 7rem); margin-top: 17rem; }
  .hint span:last-child { display: none; }
  .home .prose > h1 + p { grid-row: auto; margin-bottom: 2.5rem; font-size: 1.55rem; }
  .post-list a { grid-template-columns: 1fr auto; row-gap: 0.45rem; padding: 1.3rem 0.75rem; margin: 0 -0.75rem; }
  .post-list time, .post-list .len { padding: 0; }
  .post-list .title { grid-column: 1 / -1; grid-row: 2; }
  .post-list .summary { grid-column: 1 / -1; grid-row: 3; margin: 0; }
  .tl-row { grid-template-columns: 7rem minmax(16rem, 1fr); column-gap: 0.75rem; font-size: 0.75rem; }
  .tl-dots i { width: 5px; height: 5px; }
  .colophon { flex-direction: column; gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- Look switcher: one swatch per look, no labels (build.js fills {{ looks }}) ------------ */
.masthead .name { margin-right: auto; }
.looks { display: flex; align-items: center; gap: 2px; }
.looks a {
  display: grid; place-items: center; padding: 4px; border-radius: 50%; color: inherit; opacity: 0.55;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(.5, 1.8, .4, 1);
}
.looks a::before, .looks a::after { content: none; }
.looks a:hover { opacity: 1; transform: scale(1.15); }
.looks a[aria-current] { opacity: 1; box-shadow: inset 0 0 0 1.5px currentColor; }
.looks i { display: grid; place-items: center; width: 14px; height: 14px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.35); }
.looks [data-look="riso"] i { background: radial-gradient(circle at 34% 36%, #ff4a1c 0 28%, transparent 30%), radial-gradient(circle at 66% 64%, #1e1d20 0 24%, transparent 26%), #f1ece1; }
.looks [data-look="cobalt"] i { background: radial-gradient(circle at 34% 36%, #fff 0 26%, transparent 28%), radial-gradient(circle at 66% 64%, #ff7a3d 0 22%, transparent 24%), #1b2fe8; }
.looks [data-look="ascii"] i { background: #0b0b0a; }
.looks [data-look="ascii"] i::after { content: "@"; font: 500 9px/1 "Martian Mono", ui-monospace, monospace; color: #ff5a1f; }
@media (max-width: 560px) {
  /* Room for the swatches: the name gives way to its mark. */
  .name { font-size: 0; gap: 0; }
  .masthead { gap: 0.5rem; }
  .looks a { padding: 3px; }
  .looks i { width: 12px; height: 12px; }
}

/* --- Phones: portrait up top, the dotted name big beneath it ----------------------------- */
@media (max-width: 760px) {
  .home .prose > h1 {
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: calc(100svh - 4rem - 3.4rem); margin: 0 0 3.4rem;
    font-size: clamp(3.8rem, 22vw, 7rem);
  }
  .page-header h1 { font-size: clamp(3.4rem, 20vw, 7rem); }
  .footer-glass { min-height: 27rem; }
  .footer-big { font-size: clamp(3.4rem, 22vw, 7rem); }
  .tl-row { grid-template-columns: 6.5rem minmax(0, 1fr); column-gap: 0.6rem; }
}
