/* antoniomonti.me
   Neutral paper and ink, Geist for reading, Instrument Serif italic for the one
   personal touch in each headline. The only color is red #ff2442, borrowed from Roger;
   Roger's own palette appears only inside its card. Follows the system theme,
   the toggle overrides it. */

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --panel2: #efefec;
  --line: #e3e3df;
  --fg: #111113;
  --muted: #6b6b70;
  --red: #ff2442;
  --red-ink: #e0173a;
  --ok: #16a34a;
  --shadow: 0 20px 44px -28px rgba(17, 17, 19, .35);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --column: 720px;
  --radius: 14px;
  /* Roger's palette, used only in the Roger card */
  --roger-bg: #0a0912;
  --roger-fg: #f0ebe4;
  --roger-muted: #a89fae;
  --roger-line: #2c2739;
  --roger-rainbow: linear-gradient(90deg, #ff2442, #f2582a, #e93cb0, #7a3bf5, #2e7cf6);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --panel: #18181b; --panel2: #202024; --line: #2b2b30;
    --fg: #ededee; --muted: #9b9ba3; --red-ink: #ff4a63; --ok: #22c55e;
    --shadow: 0 20px 44px -28px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --panel: #18181b; --panel2: #202024; --line: #2b2b30;
  --fg: #ededee; --muted: #9b9ba3; --red-ink: #ff4a63; --ok: #22c55e;
  --shadow: 0 20px 44px -28px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--red); color: #fff; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 14px; }
.dot {
  display: inline-block; width: .32em; height: .32em; border-radius: 50%;
  background: var(--red); margin-left: .12em; vertical-align: .05em;
}

/* Reading progress, only on chapter and post pages */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 30; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--red); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 14px;
  padding-inline: max(24px, calc((100% - var(--column)) / 2));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { font-weight: 600; font-size: 16px; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 2px; }
.top nav a { font-size: 14px; color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: 8px; }
.top nav a:hover { color: var(--fg); background: var(--panel2); }
.theme {
  display: grid; place-items: center; width: 32px; height: 32px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.theme:hover { color: var(--fg); border-color: var(--muted); }
.i-moon { display: none; }
:root[data-theme="light"] .i-moon { display: inline; }
:root[data-theme="light"] .i-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .i-moon { display: inline; }
  :root:not([data-theme="dark"]) .i-sun { display: none; }
}
@media (max-width: 480px) { .top nav a { padding: 7px 6px; font-size: 13px; } }

.wrap {
  max-width: calc(var(--column) + 48px);
  margin: 0 auto;
  padding-inline: 24px;
  padding-block: 40px 72px;
  display: grid;
  gap: 88px;
}

/* Shared labels */
.eyebrow, .label { font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.label { display: flex; align-items: center; gap: 12px; }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.block { display: grid; gap: 22px; }
.intro { color: var(--muted); max-width: 60ch; }

/* Buttons */
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 15px/1 var(--sans); text-decoration: none;
  padding: 12px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--fg); transform: translateY(-1px); }
.btn--primary { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn--primary:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Hero */
.hero { display: grid; gap: 22px; padding-top: 40px; }
.hello { font-size: clamp(52px, 11.5vw, 104px); font-weight: 700; letter-spacing: -.05em; line-height: .95; }
.hello em { font-size: 1.08em; letter-spacing: -.02em; padding-right: .02em; }
.hello .dot { width: .15em; height: .15em; margin-left: .04em; vertical-align: 0; }
.headline { font-size: clamp(19px, 2.6vw, 22px); line-height: 1.5; max-width: 36ch; }
.headline strong { font-weight: 600; }
.now { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; color: var(--muted); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.clock:not(:empty)::before, .days:not(:empty)::before { content: "·"; margin-right: 8px; }
.now-note { flex-basis: 100%; padding-left: 16px; }
.now-note a { color: var(--fg); }
@media (max-width: 520px) {
  .clock, .days { flex-basis: 100%; padding-left: 16px; }
  .clock:not(:empty)::before, .days:not(:empty)::before { content: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .live { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 0%, transparent); } }
}

/* Numbers strip */
.numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); margin-top: -40px; }
.numbers div { padding: 22px 14px 22px 0; display: grid; gap: 6px; align-content: start; }
.numbers div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.numbers b { font-size: clamp(28px, 4.6vw, 38px); font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.numbers span { font-size: 13px; line-height: 1.4; color: var(--muted); }
@media (max-width: 600px) {
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .numbers div:nth-child(3) { padding-left: 0; border-left: 0; }
  .numbers div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* About */
.bio { display: grid; gap: 14px; font-size: clamp(19px, 2.4vw, 21px); line-height: 1.55; max-width: 58ch; }
.bio a, .prose a, .intro a, .lede a, .headline a {
  text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.bio a:hover, .prose a:hover, .lede a:hover { color: var(--red-ink); }

/* Roger card: the only place with Roger's own colors */
.roger {
  display: grid; gap: 24px; padding: 30px; border-radius: 18px; position: relative; overflow: hidden;
  background: var(--roger-bg); color: var(--roger-fg); border: 1px solid var(--roger-line);
}
.roger::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--roger-rainbow); }
.roger::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -160px; top: -200px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(122, 59, 245, .35), transparent);
}
.roger-copy { display: grid; gap: 10px; position: relative; z-index: 1; }
.roger-eyebrow { font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--roger-muted); }
.roger h2 { font-size: clamp(34px, 6vw, 48px); font-weight: 700; letter-spacing: -.045em; }
.roger h2::after { content: "."; color: #ff2442; }
.roger-copy p { color: var(--roger-muted); max-width: 52ch; }
.roger-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--roger-line); position: relative; z-index: 1; }
.roger-stats div { padding: 16px 12px 16px 0; display: grid; gap: 4px; }
.roger-stats div + div { padding-left: 16px; border-left: 1px solid var(--roger-line); }
.roger-stats b { font-size: 24px; font-weight: 600; letter-spacing: -.03em; }
.roger-stats span { font-size: 13px; color: var(--roger-muted); }
.roger .cta { position: relative; z-index: 1; }
.btn--roger { background: #ff2442; border-color: #ff2442; color: #fff; }
.btn--roger:hover { background: #ff4a63; border-color: #ff4a63; }
.btn--ghost { background: transparent; border-color: var(--roger-line); color: var(--roger-fg); }
.btn--ghost:hover { border-color: var(--roger-fg); }

/* Story timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; display: grid; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 20px; bottom: 20px; width: 1px; background: var(--line); }
.tl {
  position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 16px 14px 16px 30px; margin-left: -4px; border-radius: 12px; text-decoration: none; transition: background .2s;
}
.tl::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px;
  border-radius: 50%; background: var(--bg); border: 1.5px solid var(--muted); transition: all .2s;
}
.tl:hover, .tl:focus-visible { background: var(--panel); box-shadow: var(--shadow); }
.tl:hover::before, .tl:focus-visible::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 22%, transparent); }
.tl-year { font: 13px/1.3 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-main { display: grid; gap: 2px; min-width: 0; }
.tl-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.tl-sum { color: var(--muted); font-size: 15px; }
.tl-thumb { display: none; }
.tl-go { color: var(--muted); transition: transform .2s, color .2s; }
.tl:hover .tl-go { transform: translateX(4px); color: var(--red); }
@media (max-width: 560px) {
  .tl { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .tl-go { grid-column: 2; grid-row: 1 / 3; }
  .tl-thumb { display: block; grid-column: 2; grid-row: 1 / 3; width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
  .tl-thumb + .tl-go { display: none; }
}

/* Floating photo that follows the cursor on the timeline (desktop only) */
.peek {
  position: fixed; left: 0; top: 0; z-index: 25; width: 260px; aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden; pointer-events: none; opacity: 0;
  box-shadow: var(--shadow); background: var(--panel2);
  transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(-2deg) scale(.92);
  transition: opacity .2s, transform .12s ease-out;
}
.peek.on { opacity: 1; transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(-2deg) scale(1); }
.peek img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none), (max-width: 760px) { .peek { display: none; } }

/* Lists (journal, links) */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.rows li:first-child .row { border-top: 1px solid var(--line); }
.row-title { font-weight: 500; transition: color .15s; }
.row:hover .row-title { color: var(--red-ink); }
.row-meta { font: 13px/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.more { font-size: 14px; color: var(--muted); text-decoration: none; justify-self: start; }
.more:hover { color: var(--red-ink); }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; gap: 4px; } }

/* Chapter / post */
.back { font-size: 14px; color: var(--muted); text-decoration: none; justify-self: start; margin-bottom: -56px; }
.back:hover { color: var(--red-ink); }
.chapter { display: grid; gap: 40px; }
.chapter-head { display: grid; gap: 16px; }
.chapter-head h1 { font-size: clamp(36px, 6.6vw, 60px); font-weight: 700; letter-spacing: -.045em; line-height: 1.02; }
.lede { font-size: clamp(19px, 2.4vw, 21px); line-height: 1.55; color: var(--muted); max-width: 56ch; }

.stats { margin: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); border-top: 1px solid var(--line); }
.stats div { border-bottom: 1px solid var(--line); padding: 18px 14px 16px 0; display: flex; flex-direction: column-reverse; gap: 6px; }
.stats dd { margin: 0; font-size: clamp(28px, 4.6vw, 36px); font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats dt { font-size: 13px; color: var(--muted); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 200px minmax(0, 1fr) 56px; gap: 14px; align-items: center; font-size: 15px; color: var(--muted); }
.bar .track { height: 8px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); border-radius: 6px; background: var(--fg); }
.bar:first-of-type i { background: var(--red); }
.bar b { text-align: right; color: var(--fg); font: 500 14px var(--mono); }
.js .bar i { width: 0; transition: width 1.1s cubic-bezier(.2, .7, .2, 1); }
.js .bars.in .bar i { width: var(--w); }
@media (max-width: 520px) {
  .bar { grid-template-columns: minmax(0, 1fr) 56px; gap: 6px 12px; }
  .bar .track { grid-column: 1 / -1; grid-row: 2; }
}

.gallery { display: grid; gap: 12px; }
.gallery figure { margin: 0; display: grid; gap: 8px; }
.zoom { display: block; padding: 0; border: 0; background: var(--panel2); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; width: 100%; }
.zoom img { width: 100%; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.zoom:hover img { transform: scale(1.03); }
.g-main .zoom img { aspect-ratio: 16 / 10; object-fit: cover; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.g-item .zoom img { aspect-ratio: 1; object-fit: cover; }
figcaption { font-size: 13px; line-height: 1.5; color: var(--muted); }

.prose { display: grid; gap: 18px; max-width: 62ch; }
.prose h2 { font-size: 24px; font-weight: 600; letter-spacing: -.025em; margin-top: 18px; }
.prose h3 { font-size: 18px; font-weight: 600; margin-top: 8px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.prose li::marker { color: var(--red); }
.prose figure { margin: 8px 0; display: grid; gap: 8px; }
.prose img { border-radius: var(--radius); }
.prose blockquote { margin: 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--red); display: grid; gap: 12px; font: italic 24px/1.4 var(--serif); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 8px 0; width: 100%; }
.prose code { font: 14px var(--mono); background: var(--panel2); padding: 2px 6px; border-radius: 5px; }
.prose pre { margin: 0; background: var(--panel2); padding: 16px 18px; border-radius: var(--radius); overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.7; }

.resume .prose { max-width: none; }
.resume .prose h2 { font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 24px; display: flex; gap: 12px; align-items: center; }
.resume .prose h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.resume .prose h3 { margin-top: 6px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pcard {
  display: grid; gap: 4px; align-content: start; padding: 18px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.pcard:hover { border-color: var(--fg); transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard .mono { font-size: 12px; }
.pcard-t { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.pcard .muted:last-child { font-size: 14px; }
.pager .next { text-align: right; }
@media (max-width: 480px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; } }

/* Lightbox */
.lightbox { width: min(1100px, 94vw); max-height: 92vh; padding: 0; border: 0; background: transparent; color: #f2f2f2; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 10, 12, .9); backdrop-filter: blur(6px); }
.lightbox figure { margin: 0; display: grid; gap: 10px; }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: 10px; }
.lightbox figcaption { text-align: center; color: #a8a8ae; }
.lightbox button {
  position: fixed; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(24, 24, 27, .85); color: #f2f2f2; font-size: 18px; cursor: pointer;
}
.lightbox button:hover { border-color: #ff2442; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 16px; top: 50%; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

/* Footer */
.foot { border-top: 1px solid var(--line); }
.foot-in {
  max-width: calc(var(--column) + 48px); margin: 0 auto; padding: 28px 24px 48px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
}
.foot-name { font-weight: 600; font-size: 15px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot nav a { font-size: 14px; color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--red-ink); }

/* Entrance: content is visible at rest; this only adds a short rise on load */
@media (prefers-reduced-motion: no-preference) {
  .hero > *, .numbers, .chapter-head > * { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero > :nth-child(2) { animation-delay: .06s; }
  .hero > :nth-child(3) { animation-delay: .12s; }
  .hero > :nth-child(4) { animation-delay: .18s; }
  .hero > :nth-child(5), .numbers { animation-delay: .24s; }
  @keyframes rise { from { transform: translateY(10px); opacity: .001; } }
}
