/* Limewash: the public site.
   Three colours come from Settings (--paper, --ink, --accent) and one number
   (--pace). Everything else is derived from them here.
   The idea of the layout: emptiness is part of the page. The text column
   sits left of centre, and the space beside and between things is kept. */

:root {
  --paper: #e9ebe4;
  --ink: #1e2b32;
  --accent: #5f7a52;
  --pace: 1;

  /* The colours actually painted. Daylight changes these, not the settings. */
  --p: var(--paper);
  --i: var(--ink);
  --a: var(--accent);
  --soft: color-mix(in oklab, var(--i) 66%, var(--p));
  --faint: color-mix(in oklab, var(--i) 14%, var(--p));

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", "Noto Sans", Roboto, sans-serif;
  --face: var(--serif);

  --measure: 33rem;
  --edge: clamp(1.4rem, 6vw, 5rem);
  --inset: clamp(0rem, 11vw, 13rem);          /* how far the column sits from the left edge */
  --ma: clamp(4.5rem, 16vh, 10rem);           /* the interval between things */
  --slow: calc(1.4s * var(--pace));
}
html[data-font="sans"] { --face: var(--sans); }

/* Daylight: the paper takes on the light of the visitor's own hour. */
html[data-light="dawn"]  { --p: color-mix(in oklab, var(--paper) 84%, #c3d3e6); }
html[data-light="dusk"]  { --p: color-mix(in oklab, var(--paper) 80%, #e6b184); }
html[data-light="night"] {
  --p: color-mix(in oklab, var(--ink) 86%, #04060b);
  --i: color-mix(in oklab, var(--paper) 84%, var(--ink));
  --a: color-mix(in oklab, var(--accent) 62%, var(--paper));
}
html[data-light="night"] img { filter: brightness(0.9); }

* { box-sizing: border-box; }
html { background: var(--p); color: var(--i); font-family: var(--face); font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem); line-height: 1.72; -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 0 var(--edge); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: color-mix(in oklab, var(--i) 35%, var(--p)); transition: text-decoration-color 0.3s; }
a:hover { text-decoration-color: var(--a); }
:focus-visible { outline: 2px solid var(--a); outline-offset: 4px; border-radius: 2px; }
::selection { background: color-mix(in oklab, var(--a) 30%, var(--p)); }
h1, h2, h3 { font-weight: 400; line-height: 1.18; margin: 0; text-wrap: balance; }
p { margin: 0 0 1.15em; text-wrap: pretty; }

/* Moving between pages is a slow dissolve, where the browser can do it. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: calc(0.7s * var(--pace)); }

.skip { position: absolute; left: var(--edge); top: -4rem; background: var(--p); padding: 0.4rem 0.8rem; z-index: 30; }
.skip:focus { top: 0.6rem; }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.masthead { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; align-items: baseline; justify-content: space-between; padding: clamp(1.3rem, 4vh, 2.4rem) var(--edge); font-size: 0.86rem; }
.masthead a { text-decoration: none; }
.home { display: inline-flex; align-items: center; gap: 0.6rem; letter-spacing: 0.04em; }
.mark { width: 1.35em; height: 1.35em; flex: none; }
.mark path { stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; fill: none; }
.mark circle { fill: var(--a); }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; color: var(--soft); }
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--i); }
.masthead nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--a); text-underline-offset: 0.45em; }

/* ── Headings and the column ──────────────────────────────────────────── */
.heading, .prose, .lines, .ending, .empty, .sit { max-width: var(--measure); margin-left: var(--inset); }
.heading { padding-top: var(--ma); margin-bottom: clamp(2.5rem, 8vh, 5rem); }
.heading h1 { font-size: clamp(1.9rem, 1.3rem + 3vw, 3.1rem); letter-spacing: -0.01em; }
.meta { color: var(--soft); font-size: 0.86rem; margin: 1.3rem 0 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.6rem; }
.draft { font-size: 0.72rem; font-style: italic; color: var(--a); border: 1px solid currentColor; border-radius: 99px; padding: 0.05em 0.6em; vertical-align: middle; letter-spacing: 0.02em; }
.empty { color: var(--soft); font-style: italic; }

/* ── Home ─────────────────────────────────────────────────────────────── */
.arrival { min-height: 62vh; min-height: 62svh; display: flex; align-items: flex-end; margin-left: var(--inset); padding-bottom: clamp(1rem, 4vh, 3rem); }
.arrival h1 { font-size: clamp(2.1rem, 1.2rem + 4.6vw, 4.3rem); line-height: 1.1; letter-spacing: -0.015em; max-width: 13em; }

.one-thing { margin: var(--ma) 0 0 auto; width: min(100%, 46rem); }
.one-thing img { width: 100%; }
.one-thing p { display: flex; flex-wrap: wrap; gap: 0.1rem 1.4rem; justify-content: space-between; font-size: 0.86rem; margin: 0.9rem 0 0; }
.one-thing p a { text-decoration: none; }
.one-thing p span { color: var(--soft); }

.lately { margin-top: var(--ma); }
.lately h2 { font-size: 0.86rem; color: var(--soft); margin: 0 0 2.6rem var(--inset); }

/* ── Lines: one piece per line, with air between ──────────────────────── */
.lines { list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; display: grid; gap: clamp(2.2rem, 6vh, 3.4rem); }
.lines li { display: grid; gap: 0.25rem; }
.lines time, .lines .kind { color: var(--soft); font-size: 0.8rem; }
.lines .title { font-size: 1.38rem; line-height: 1.25; text-decoration: none; }
.lines .title:hover { text-decoration: underline; text-decoration-color: var(--a); }
.lines p { margin: 0.35rem 0 0; color: var(--soft); font-size: 0.94rem; line-height: 1.55; }
.lines .kind { font-style: italic; }
/* On wider screens the dates hang in the left margin and titles keep the column. */
@media (min-width: 52rem) {
  :root { --inset: clamp(9rem, 13vw, 14rem); }
  .lines { max-width: calc(var(--measure) + 9rem); margin-left: calc(var(--inset) - 9rem); }
  .lines li { grid-template-columns: 9rem 1fr; gap: 0; align-items: baseline; }
}

/* ── Gallery: a walk, one work at a time ──────────────────────────────── */
.walk { display: grid; gap: var(--ma); }
.work { display: grid; justify-items: start; gap: 0.2rem; width: min(100%, 44rem); }
.work:nth-child(even) { margin-left: auto; justify-items: end; text-align: right; }
.work:nth-child(3n) { width: min(100%, 34rem); }
.work > a { display: block; margin-bottom: 0.9rem; }
.work img { width: auto; max-width: 100%; max-height: 82vh; }
.work h2 { font-size: 1.1rem; }
.work h2 a { text-decoration: none; }
.work p { color: var(--soft); font-size: 0.82rem; margin: 0; }

/* ── A piece ──────────────────────────────────────────────────────────── */
.hung { margin: clamp(1rem, 5vh, 3rem) 0 0; }
.hung img { max-height: 84vh; max-height: 84svh; width: auto; margin-inline: auto; }
.is-work .heading { padding-top: clamp(2rem, 6vh, 3.5rem); margin-bottom: 2rem; }
.is-work .heading h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
.cover { margin: 0 0 clamp(2.5rem, 8vh, 5rem); width: min(100%, 56rem); }

.prose > * { margin-top: 0; }
.prose h2 { font-size: 1.42rem; margin: 2.6em 0 0.7em; }
.prose h3 { font-size: 1.08rem; font-style: italic; margin: 2.2em 0 0.5em; }
.prose blockquote { margin: 2.2em 0; padding-left: 1.3rem; border-left: 1px solid var(--a); color: var(--soft); font-style: italic; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1.15em; }
.prose li { margin-bottom: 0.4em; }
.prose code { font-size: 0.86em; background: var(--faint); padding: 0.1em 0.35em; border-radius: 3px; }
.prose pre { overflow-x: auto; background: var(--faint); padding: 1rem 1.2rem; border-radius: 4px; font-size: 0.82rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; }
.prose figure { margin: clamp(3rem, 9vh, 5.5rem) 0; width: min(calc(100vw - 2 * var(--edge) - var(--inset)), 48rem); }
.prose figcaption { font-size: 0.82rem; color: var(--soft); margin-top: 0.8rem; font-style: italic; }

/* The writer's marks. A breath is empty space with one small sun in it. */
.breath { height: var(--ma); display: grid; place-items: center; }
.breath::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--a); opacity: 0.75; }
/* A pause is a whole quiet screen holding one line. */
.pause { min-height: 82vh; min-height: 82svh; display: grid; align-content: center; gap: 0.4rem; margin: var(--ma) 0; width: min(calc(100vw - 2 * var(--edge) - var(--inset)), 44rem); }
.pause p { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.3rem); line-height: 1.3; margin: 0; text-wrap: balance; }
.pause::before { content: ""; width: 1px; height: 4.5rem; background: var(--a); margin-bottom: 1.6rem; }

.ending { margin-bottom: var(--ma); }
.threads, .onward { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; align-items: baseline; font-size: 0.86rem; }
.threads span, .onward span { color: var(--soft); }
.onward { margin-top: 2.4rem; display: grid; gap: 0.3rem; }
.onward a { font-size: 1.38rem; line-height: 1.25; text-decoration: none; }
.onward a:hover { text-decoration: underline; text-decoration-color: var(--a); }

/* ── Sit for a minute ─────────────────────────────────────────────────── */
.sit { padding: clamp(3rem, 12vh, 7rem) 0 var(--ma); }
.sit h1 { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.3rem); line-height: 1.3; margin: clamp(3rem, 9vh, 5rem) 0 1.4rem; }
.sit p { color: var(--soft); font-size: 0.94rem; }
.gate { display: flex; align-items: center; justify-content: space-between; width: min(15rem, 62vw); height: min(15rem, 62vw); }
.gate i { width: 1px; height: 100%; background: var(--i); opacity: 0.55; }
.gate b { width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--a); animation: breathe 10s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.55); opacity: 0.55; } 50% { transform: scale(1.5); opacity: 1; } }

/* ── Colophon ─────────────────────────────────────────────────────────── */
.colophon { padding: var(--ma) var(--edge) clamp(2rem, 6vh, 3.5rem); font-size: 0.82rem; color: var(--soft); display: grid; gap: 0.5rem; }
.colophon p { margin: 0; }
.daylight { font-style: italic; min-height: 1.72em; }
.ways { display: flex; gap: 1.5rem; }

/* ── The threshold: two paper doors that slide apart, once per visit ──── */
.threshold { display: none; }
.arriving .threshold { display: grid; place-items: center; position: fixed; inset: 0; z-index: 20; }
.arriving body { overflow: hidden; }
.door { position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--p); transition: transform calc(2.6s * var(--pace)) cubic-bezier(0.65, 0, 0.2, 1); }
.door-left { left: 0; }
.door-right { right: 0; }
.crossing .door-left { border-right: 1px solid var(--faint); }
.crossing .door-right { border-left: 1px solid var(--faint); }
.threshold-line { position: relative; margin: 0; padding: 0 var(--edge); font-size: clamp(1.4rem, 1rem + 2vw, 2.2rem); line-height: 1.3; text-align: center; max-width: 22em; text-wrap: balance; opacity: 0; animation: settle calc(1.6s * var(--pace)) 0.3s ease-out forwards; transition: opacity calc(0.9s * var(--pace)); }
.threshold-cross { position: absolute; bottom: clamp(2rem, 8vh, 4rem); font: inherit; font-size: 0.82rem; color: var(--soft); background: none; border: 0; padding: 0.8rem 1.2rem; cursor: pointer; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 0.3em; opacity: 0; animation: settle 1s calc(1.8s * var(--pace)) forwards; transition: opacity 0.4s; }
.crossing .door-left { transform: translateX(-101%); }
.crossing .door-right { transform: translateX(101%); }
.crossing .threshold-line, .crossing .threshold-cross { opacity: 0 !important; animation: none; }
@keyframes settle { to { opacity: 1; } }

/* ── Preview bar ──────────────────────────────────────────────────────── */
.preview-bar { position: fixed; left: 50%; bottom: 0.9rem; transform: translateX(-50%); z-index: 25; display: flex; gap: 1rem; align-items: center; white-space: nowrap; max-width: calc(100vw - 1.5rem); font: 0.8rem/1.2 var(--sans); background: var(--i); color: var(--p); padding: 0.6rem 1rem; border-radius: 99px; box-shadow: 0 6px 24px color-mix(in oklab, var(--i) 25%, transparent); }
.preview-bar a { color: inherit; }
.embedded .preview-bar { display: none; }
@media (max-width: 30rem) { .preview-bar span { display: none; } .preview-bar::before { content: "Preview"; } }
/* On a draft's page the sentence saying so stays at every width, wrapping as it needs (record 0028). */
.preview-bar[data-draft] { white-space: normal; width: max-content; flex-wrap: wrap; row-gap: 0.45rem; border-radius: 1.4rem; }
.preview-bar[data-draft] span { flex: 1 1 14rem; }
.preview-bar[data-draft] a { white-space: nowrap; }
@media (max-width: 30rem) { .preview-bar[data-draft] span { display: block; } .preview-bar[data-draft]::before { content: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gate b { animation: none; transform: scale(1); }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
@media print {
  .masthead nav, .colophon, .preview-bar, .threshold { display: none !important; }
  html { --p: #fff; --i: #000; }
}
