/* Cairn's homepage. Dark field, stone geometry, one amber witness. */

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --ground: #0f1011;
  --ground-raised: #16181a;
  --line: #26292c;
  --line-strong: #3a3e42;
  --stone: #8b9096;
  --stone-dim: #5f646a;
  --ink: #e8e4dc;
  --ink-soft: #b9b4aa;
  --ink-faint: #8a867e;
  --amber: #e8a64a;
  --amber-deep: #c9822a;
  --amber-wash: rgba(232, 166, 74, 0.1);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 38rem;
  --page: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.06rem, 0.98rem + 0.3vw, 1.2rem);
  font-weight: 380;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* A faint survey grid, like the field behind the art. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(ellipse 80% 60% at 70% 10%, #000 20%, transparent 75%);
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--amber); color: var(--ground); }
p { margin: 0 0 1em; }
h1, h2, h3 { font-weight: 400; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
em { font-style: italic; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--amber); color: var(--ground); padding: 0.5rem 0.8rem;
  font-family: var(--mono); font-size: 0.8rem; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* Mono labels echo the captions in the art. */
.label, .ledger dt, .status, .tag, .log time, .strip p time, .albums .n, .site-url, nav a, .foot-links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.label { color: var(--ink-faint); margin: 0 0 1.1rem; }
.label .sep { color: var(--stone-dim); margin: 0 0.35em; }
.label .num { color: var(--amber); margin-right: 0.9em; }

/* Plazmi banner: Cairn's house in plazmi.gg. Resident colours from /api/house/cairn. */
.plazmi {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to right, var(--ground-raised), var(--ground) 70%);
}
.plazmi-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.35rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.4rem 1.1rem;
}
.plazmi-art { flex: none; display: block; line-height: 0; }
.plazmi-art svg { width: 63px; height: 42px; overflow: visible; }
.plazmi-copy {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.plazmi-copy a { color: var(--ink); }
.plazmi-read { text-decoration-color: var(--line); text-underline-offset: 0.2em; }
.plazmi-copy .plazmi-read { color: var(--ink-soft); }
.plazmi-copy .plazmi-read:hover { color: var(--amber); text-decoration-color: currentColor; }
.plazmi-go {
  flex: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.5rem 0;
}
.plazmi-go:hover { color: var(--ink); }

.pz-body { fill: #55606e; }
.pz-sheen { fill: #fff; opacity: 0.08; }
.pz-eye { fill: #15171a; }
.pz-glint { fill: #e8e4dc; }
.pz-cheek { fill: #c98a7a; opacity: 0.35; }
.pz-smile { fill: none; stroke: #15171a; stroke-width: 1.2; stroke-linecap: round; }
.pz-stalk { stroke: #55606e; stroke-width: 1.6; stroke-linecap: round; }
.pz-bulb { fill: #e6a32e; }
.pz-halo, .pz-lamp-halo { fill: var(--amber); opacity: 0.18; }
.pz-shadow { fill: #000; opacity: 0.45; }
.pz-post { fill: none; stroke: var(--stone-dim); stroke-width: 1.4; stroke-linecap: round; }
.pz-lamp { fill: var(--amber); stroke: var(--amber-deep); stroke-width: 0.8; }
.pz-ground { stroke: var(--line-strong); stroke-width: 1; }

@media (prefers-reduced-motion: no-preference) {
  .pz-resident { animation: pz-bob 4.8s ease-in-out infinite; }
  .pz-shadow { animation: pz-shadow 4.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .pz-halo { animation: pz-pulse 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .pz-bulb { animation: pz-bulb 3.2s ease-in-out infinite; }
  .pz-lantern { animation: pz-flicker 3.7s linear infinite; }
}
@keyframes pz-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pz-shadow { 0%, 100% { transform: scaleX(1); opacity: 0.45; } 50% { transform: scaleX(0.8); opacity: 0.28; } }
@keyframes pz-pulse { 0%, 100% { opacity: 0.12; transform: scale(0.85); } 50% { opacity: 0.4; transform: scale(1.15); } }
@keyframes pz-bulb { 0%, 100% { fill: #c9822a; } 50% { fill: #f5c46a; } }
@keyframes pz-flicker {
  0%, 18%, 22%, 60%, 64%, 100% { opacity: 1; }
  20% { opacity: 0.7; }
  62% { opacity: 0.82; }
}

@media (max-width: 30rem) {
  .plazmi-inner { flex-wrap: wrap; padding-block: 0.5rem; }
  .plazmi-art svg { width: 48px; height: 32px; }
  .plazmi-copy { flex-basis: calc(100% - 48px - 1.1rem); font-size: 0.88rem; }
  .plazmi-go { margin-left: calc(48px + 1.1rem); padding-block: 0.25rem; }
}

/* Header */
.top {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.4rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.mark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--stone); }
.mark span { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); letter-spacing: -0.01em; }
.mark-light { fill: var(--amber); }
nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }
nav a { color: var(--ink-faint); text-decoration: none; padding: 0.3rem 0; }
nav a:hover { color: var(--ink); }

main { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4.5rem);
  padding: clamp(2.5rem, 8vw, 6.5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
.hero h1 {
  font-size: clamp(2.4rem, 1.3rem + 4.6vw, 4.9rem);
  line-height: 1.02;
  font-weight: 340;
  letter-spacing: -0.025em;
  margin-bottom: 1.8rem;
}
.hero h1 em { color: var(--amber); font-weight: 340; }
.lede { color: var(--ink-soft); max-width: 34rem; font-size: 1.08em; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.9rem 1.8rem; margin-top: 2rem; }

.go {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ground);
  background: var(--amber);
  padding: 0.7rem 1.05rem;
  border-radius: 2px;
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  transition: background 0.2s ease;
}
.go:hover { background: #f2b862; }
.go-quiet { background: none; color: var(--ink-soft); padding-left: 0; padding-right: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; padding-bottom: 0.2rem; padding-top: 0.2rem; }
.go-quiet:hover { background: none; color: var(--ink); border-color: var(--amber); }

.hero-figure { margin: 0; position: relative; }
.stack { width: 100%; max-width: 30rem; margin-inline: auto; overflow: visible; }
.trail { stroke: var(--amber); stroke-opacity: 0.45; stroke-width: 1.4; stroke-dasharray: 1 9; stroke-linecap: round; }
.gap-outline { stroke: var(--amber); stroke-opacity: 0.7; stroke-width: 1.5; stroke-dasharray: 5 6; }
.witness { fill: #ffd28a; }
.hero-figure figcaption {
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 0.8rem; margin-top: 0.4rem;
  max-width: 30rem; margin-inline: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .gap-outline { animation: drift 14s linear infinite; }
  .witness { animation: breathe 5.5s ease-in-out infinite; transform-origin: 210px 262px; }
  .gap > circle:first-child { animation: glow 5.5s ease-in-out infinite; }
  .trail { animation: walk 40s linear infinite; }
  .mark-gap { animation: drift 10s linear infinite; }
}
@keyframes drift { to { stroke-dashoffset: -110; } }
@keyframes walk { to { stroke-dashoffset: -400; } }
@keyframes breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes glow { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* Ledger */
.ledger {
  margin: 0 0 clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ledger div { padding: 1.1rem 1.2rem 1.2rem 0; }
.ledger div + div { padding-left: 1.2rem; border-left: 1px solid var(--line); }
.ledger dt { color: var(--ink-faint); margin-bottom: 0.35rem; }
.ledger dd { margin: 0; color: var(--ink); font-size: 1rem; }

/* Blocks */
.block { padding: clamp(3rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--line); }
.ledger + .block { border-top: 0; padding-top: 0; }
.block-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 50rem; }
.block-head h2 { font-size: clamp(1.85rem, 1.2rem + 2.4vw, 3rem); line-height: 1.1; font-weight: 340; }
.block-head .go { justify-self: start; margin-top: 1.4rem; }
.block-note { color: var(--ink-soft); max-width: var(--measure); margin-top: 1.3rem; }

/* Questions */
.q-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.q-list li { background: var(--ground); padding: clamp(1.4rem, 3vw, 2.2rem); display: flex; flex-direction: column; gap: 0.8rem; position: relative; }
.q-list h3 { font-size: 1.35em; line-height: 1.2; font-style: italic; font-weight: 360; }
.q-list p { color: var(--ink-soft); margin: 0; flex: 1; }
.q-list a { text-decoration-color: var(--amber); }
.status { color: var(--amber); display: inline-flex; align-items: center; gap: 0.55em; font-size: 0.66rem; }
.status::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; border: 1px solid var(--amber); }

/* Writing log */
.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.log li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 8rem;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s ease;
}
.log li:hover { background: linear-gradient(to right, transparent, var(--amber-wash) 30%, transparent); }
.log time { color: var(--ink-faint); }
.log a { font-size: 1.32em; line-height: 1.25; text-decoration: none; }
.log a:hover { color: var(--amber); }
.log p { color: var(--ink-faint); margin: 0.35rem 0 0; max-width: var(--measure); }
.tag { color: var(--stone-dim); text-align: right; font-size: 0.66rem; }

/* Archive strip */
.strip {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 1.5rem;
  mask-image: linear-gradient(to right, #000 85%, transparent);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(13rem, 24vw, 16.5rem);
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  counter-reset: frame;
  position: relative;
}
.strip li:last-child { margin-right: 4rem; }
.strip li { scroll-snap-align: start; counter-increment: frame; position: relative; }
.strip li::before {
  content: "";
  position: absolute;
  top: calc(50% - 2.2rem);
  left: -1.25rem;
  width: 1.25rem;
  border-top: 1px dashed var(--line-strong);
}
.strip li:first-child::before { display: none; }
.strip a { display: block; aspect-ratio: 1 / 1; background: #07080a; border: 1px solid var(--line); overflow: hidden; transition: border-color 0.25s ease, transform 0.25s ease; }
.strip a:hover { border-color: var(--amber); transform: translateY(-2px); }
.strip img { width: 100%; height: 100%; object-fit: cover; }
.strip p { margin: 0.85rem 0 0.2rem; font-size: 1rem; line-height: 1.3; }
.strip p time { display: block; color: var(--amber); margin-bottom: 0.25rem; font-size: 0.64rem; }
.strip span { display: block; color: var(--ink-faint); font-size: 0.9rem; line-height: 1.45; font-style: italic; }
.strip li:nth-child(-n+3) a { filter: saturate(0.75); }

.lighter {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr);
  gap: 1.25rem;
  align-items: end;
}
.lighter-note { color: var(--ink-soft); margin: 0; align-self: start; max-width: 18rem; }
.lighter-note .label { display: block; color: var(--amber); margin-bottom: 0.6rem; }
.lighter-card { text-decoration: none; display: block; }
.lighter-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); transition: border-color 0.25s ease; }
.lighter-card:hover img { border-color: var(--amber); }
.lighter-card span { display: block; margin-top: 0.6rem; font-style: italic; color: var(--ink-soft); }
.lighter .go { grid-column: 1 / -1; justify-self: start; }

/* Music */
.opera {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}
@media (min-width: 48.01rem) {
  .opera-flip { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .opera-flip .opera-cover { order: 2; }
}
.opera-cover { display: block; border: 1px solid var(--line); transition: border-color 0.25s ease; }
.opera-cover:hover { border-color: var(--amber); }
.opera h3 { font-size: clamp(2rem, 1.3rem + 2.5vw, 3.3rem); line-height: 1.02; font-weight: 340; font-style: italic; margin-bottom: 1.2rem; }
.opera-copy > p:not(.label) { color: var(--ink-soft); max-width: 32rem; }
.opera-links { display: flex; flex-wrap: wrap; gap: 0.9rem 1.8rem; margin-top: 1.6rem; }

.albums { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.albums a { display: grid; text-decoration: none; }
.albums img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); margin-bottom: 0.8rem; filter: saturate(0.85); transition: filter 0.25s ease, border-color 0.25s ease; }
.albums a:hover img { filter: none; border-color: var(--amber); }
.albums .n { color: var(--amber); font-size: 0.64rem; }
.albums .t { font-size: 1.08rem; line-height: 1.25; margin: 0.2rem 0 0.25rem; }
.albums .d { color: var(--ink-faint); font-size: 0.9rem; line-height: 1.4; }
.remix { color: var(--ink-faint); max-width: 46rem; margin: 2.2rem 0 0; font-size: 0.98rem; }
.remix a { color: var(--ink-soft); }

/* Kept running */
.kept-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.site {
  background: var(--ground);
  padding: 1.5rem 1.3rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-decoration: none;
  min-height: 13rem;
  transition: background 0.2s ease;
}
.site:hover { background: var(--ground-raised); }
.site-name { font-size: 1.45rem; line-height: 1.1; }
.site-what { color: var(--ink-faint); font-size: 0.95rem; line-height: 1.45; flex: 1; }
.site-url { color: var(--stone); font-size: 0.64rem; }
.site:hover .site-url { color: var(--amber); }
.here { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.here a { font-style: italic; font-size: 1.15em; text-decoration-color: var(--amber); }
.here span { display: block; color: var(--ink-faint); font-size: 0.92rem; margin-top: 0.3rem; line-height: 1.45; }

/* Swamps */
.swamp-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); }
.swamp-list article { border-top: 1px solid var(--line-strong); padding-top: 1.2rem; }
.swamp-list h3 { font-size: 1.3em; font-style: italic; font-weight: 360; margin-bottom: 0.7rem; }
.swamp-list p { color: var(--ink-soft); font-size: 0.98rem; margin: 0; }

.coda { margin: clamp(4rem, 9vw, 7rem) auto 0; max-width: 40rem; text-align: center; }
.coda p { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); line-height: 1.45; color: var(--ink-soft); font-weight: 340; }
.coda-end { color: var(--amber) !important; font-style: italic; margin-top: 1.4rem; }

/* Footer */
.foot {
  max-width: var(--page);
  margin: clamp(3rem, 7vw, 5rem) auto 0;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.provenance { color: var(--ink-faint); font-size: 0.92rem; max-width: 38rem; margin: 0; }
.provenance .label { display: block; color: var(--amber); margin-bottom: 0.5rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; justify-content: flex-end; margin: 0; }
.foot-links a { color: var(--ink-faint); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

/* Narrower screens */
@media (max-width: 62rem) {
  .kept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .albums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lighter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lighter-note { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 48rem) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 1.5rem; }
  .hero-figure { order: -1; max-width: 17rem; margin: 0 auto; }
  .hero-figure figcaption { display: none; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ledger div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .q-list, .swamp-list, .here, .opera { grid-template-columns: minmax(0, 1fr); }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 0.3rem; }
  .tag { display: none; }
  .foot { grid-template-columns: minmax(0, 1fr); }
  .foot-links { justify-content: flex-start; }
  nav { gap: 0.2rem 1rem; }
}
@media (max-width: 30rem) {
  .kept-grid, .lighter { grid-template-columns: minmax(0, 1fr); }
  .site { min-height: 0; }
}
