:root {
  --bg: oklch(97.5% .008 85);
  --surface: oklch(99% .006 85);
  --ink: oklch(24% .015 85);
  --muted: oklch(48% .015 85);
  --accent: oklch(52% .11 165);
  --line: rgb(0 0 0 / .12);
  --edge: oklch(60% .015 85);
  --serif: "Spectral", Georgia, serif;
  --display: "Lora", Georgia, serif;
  --mono: "Roboto Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(19% .01 85);
    --surface: oklch(23% .01 85);
    --ink: oklch(92% .01 85);
    --muted: oklch(70% .012 85);
    --accent: oklch(76% .11 165);
    --line: rgb(255 255 255 / .12);
    --edge: oklch(55% .012 85);
  }
}

/* Page-to-page: quick crossfade, and the nav marker slides to the new page */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
::view-transition-group(nav-marker) { animation-duration: .45s; animation-timing-function: var(--ease); }

* { box-sizing: border-box; }
html { scrollbar-color: var(--edge) transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.125rem/1.65 var(--serif); caret-color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 72rem; }
main.wrap { padding-top: clamp(2.5rem, 7vw, 4.5rem); }

/* Links. Prose links keep a real underline; UI links draw one under their own text on hover. */
a { color: var(--accent); }
.prose a, .post-body a {
  text-decoration: underline 1px;
  text-underline-offset: .22em;
  text-decoration-color: color-mix(in oklch, var(--accent) 45%, transparent);
  transition: text-decoration-color .2s, text-decoration-thickness .2s;
}
.prose a:hover, .post-body a:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.sweep {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size .35s var(--ease);
}
.sweep:hover { background-size: 100% 1px; }

/* Header: the brand reads like a shell prompt showing where you are */
header.site { border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: baseline; padding-block: 1.25rem; max-width: 72rem; }
.brand { font: 600 .95rem var(--mono); color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.brand::before { content: "~/"; color: var(--accent); }
.brand .path { color: var(--muted); font-weight: 400; }
nav { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; font: .85rem var(--mono); }
nav a { position: relative; color: var(--muted); text-decoration: none; padding-block: .2rem; transition: color .2s; }
nav a:hover, nav a[aria-current] { color: var(--ink); }
/* Marker sits under the link's own text only */
nav a::after, nav .marker {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
nav a::after { transform: scaleX(0); transform-origin: left; opacity: .5; transition: transform .3s var(--ease); }
nav a:hover::after { transform: scaleX(1); }
nav a[aria-current]::after { display: none; }
nav .marker { view-transition-name: nav-marker; }

/* Headings */
h1 { font: 600 clamp(2rem, 5vw, 2.75rem)/1.15 var(--display); margin: 0 0 .75rem; text-wrap: balance; }
.lede { color: var(--muted); font-size: 1.2rem; margin: 0 0 2.5rem; text-wrap: pretty; }
.caret {
  display: inline-block; width: .5em; height: .95em; margin-left: .12em;
  background: var(--accent); vertical-align: -.1em; border-radius: 1px;
}
.typed .ch { animation: ch-in .01s step-end both; animation-delay: calc(var(--i) * var(--step)); }
.typed .caret { animation: blink 1.1s step-end calc(var(--n) * var(--step)) infinite; }
@keyframes ch-in { from { opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }

/* Posts */
.post { border-top: 1px solid var(--line); padding-block: 3rem; }
.post.in { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } }
.post h2 { font: 600 1.9rem/1.2 var(--display); margin: 0 0 .35rem; text-wrap: balance; }
.post h2 a { color: inherit; text-decoration: none; transition: color .2s; }
.post h2 a:hover { color: var(--accent); }
.post-body { overflow-wrap: break-word; }
.post-body h1, .post-body h2, .post-body h3 { font-family: var(--display); line-height: 1.25; margin: 2.2em 0 .6em; }
.post .meta { font: .8rem var(--mono); color: var(--muted); margin-bottom: 1.5rem; font-variant-numeric: tabular-nums; }
.post .sub { color: var(--muted); font-size: 1.2rem; margin: 0 0 .5rem; }
.post-body figure { margin: 2rem 0; }
.post-body img { border-radius: 6px; }
.post-body figcaption { font-size: .9rem; color: var(--muted); text-align: center; }
.post-body pre, .post-body code { font-family: var(--mono); font-size: .85em; }
.post-body :not(pre) > code { background: color-mix(in oklch, var(--accent) 10%, transparent); padding: .1em .35em; border-radius: 4px; }
.post-body pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-x: auto; }
.post-body blockquote { border-left: 1px solid var(--accent); margin: 1.5rem 0; padding-left: 1.25rem; color: var(--muted); font-style: italic; }
.post-body iframe { max-width: 100%; }
/* Substack widgets that do nothing off-platform */
.post-body .subscription-widget-wrap, .post-body .subscription-widget-wrap-editor,
.post-body .button-wrapper, .post-body .image-link-expand, .post-body .footnote-anchor-wrap { display: none; }
.more { font: .85rem var(--mono); }
.more.all { border-top: 1px solid var(--line); padding-top: 2rem; }
.status { font: .9rem var(--mono); color: var(--muted); padding-block: 2rem; }
.spin::before { content: "⠋"; display: inline-block; width: 1.2em; color: var(--accent); animation: spin .8s step-end infinite; }
@keyframes spin {
  0% { content: "⠋"; } 12.5% { content: "⠙"; } 25% { content: "⠹"; } 37.5% { content: "⠸"; }
  50% { content: "⠼"; } 62.5% { content: "⠴"; } 75% { content: "⠦"; } 87.5% { content: "⠧"; }
}

/* Photos */
.grid { columns: 3 18rem; column-gap: 12px; }
.grid a { display: block; margin-bottom: 12px; break-inside: avoid; border-radius: 8px; overflow: hidden; background: var(--surface); }
.grid img { display: block; width: 100%; transition: scale .8s var(--ease), filter .8s var(--ease); }
.grid a:hover img { scale: 1.035; }
.grid a.in { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
dialog { border: 0; padding: 0; background: none; max-width: 95vw; max-height: 95vh; opacity: 1; scale: 1; transition: opacity .3s var(--ease), scale .3s var(--ease), overlay .3s allow-discrete, display .3s allow-discrete; }
@starting-style { dialog[open] { opacity: 0; scale: .96; } }
dialog::backdrop { background: rgb(0 0 0 / .85); }
dialog img { max-height: 92vh; border-radius: 6px; display: block; }

/* About */
.prose p { margin: 0 0 1.1em; }
.now { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.5rem; }
.now h2 { font: 600 1.3rem var(--display); margin: 0 0 .75rem; }
.now ul { margin: 0; padding: 0; list-style: none; }
.now li { padding-block: .35rem; }
.now li::before { content: "→ "; color: var(--accent); font-family: var(--mono); }

/* Contact */
.links { list-style: none; padding: 0; margin: 0; font-family: var(--mono); font-size: .95rem; }
.links li { border-top: 1px solid var(--line); padding-block: .9rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.links span { color: var(--muted); }
.contact { display: grid; gap: 1rem; margin-top: 3rem; }
.contact label { display: grid; gap: .35rem; font: .8rem var(--mono); color: var(--muted); }
.contact input, .contact textarea {
  font: 1rem var(--serif); color: var(--ink); background: var(--surface);
  border: 1px solid var(--edge); border-radius: 8px; padding: .65rem .8rem;
  transition: border-color .2s, box-shadow .2s;
}
.contact input:focus-visible, .contact textarea:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent);
}
.contact button {
  justify-self: start; font: 600 .9rem var(--mono); color: var(--bg); background: var(--ink);
  border: 0; border-radius: 8px; padding: .75rem 1.4rem; cursor: pointer;
  transition: background .2s, transform .15s var(--ease);
}
.contact button:hover { background: var(--accent); }
.contact button:active { transform: scale(.97); }
.contact button:disabled { opacity: .6; cursor: wait; }
.contact .status { padding: 0; min-height: 1.5em; }
.hp { position: absolute; left: -9999px; }

footer { border-top: 1px solid var(--line); margin-top: 5rem; padding-block: 2rem; font: .8rem var(--mono); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  .post.in, .grid a.in { animation: none; }
  .typed .ch { animation: none; }
  .grid a:hover img { scale: 1; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media (max-width: 480px) {
  nav { gap: .35rem .8rem; font-size: .8rem; }
  .post h2 { font-size: 1.5rem; }
  .post { padding-block: 2.25rem; }
}
