/* ------------------------------------------------------------------
   Scroll-ruler navigation — ArtCraft-flavoured

   Nav bar  = articles
   The rail = sections *within* the article currently open. Ticks scroll
   with the page; section labels ride the rail, then fly to the top stack.
   ------------------------------------------------------------------ */

:root {
  /* ArtCraft palette */
  --bg: #f2f1ee;
  --bg-raised: #faf9f7;
  --bg-sunken: #e9e8e4;
  --ink: #101014;
  --ink-strong: #000;
  --ink-soft: #1010149e;
  --dim: #1010146b;
  --line: #10101429;
  --line-strong: #10101466;
  --accent: #2d81ff;
  --accent-ink: #1659c4;

  --font-display: Archivo, -apple-system, "Helvetica Neue", sans-serif;
  --font-body: Inter, -apple-system, "Helvetica Neue", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail-w: 60px;
  --nav-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

/* ---------- page chrome ---------- */

.topnav {
  position: fixed;
  top: 0; left: 0; right: var(--rail-w);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.topnav .brand {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--ink);
  text-decoration: none;
}

.topnav nav a {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--ink);
  text-decoration: none;
  margin-left: 20px;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}

.topnav nav a:hover { color: var(--ink); }
.topnav nav a.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- home ---------- */

.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: content-box;
  /* narrow enough that the name breaks over two lines */
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 6vw;
}

.hero-word {
  font-family: var(--font-display);
  font-size: clamp(26px, 5.76vw, 80px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .92;
  margin-bottom: 1.2rem;
}

.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-bottom: .4rem;
}

/* contact, merged onto the home page */
.home-contact {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.home-contact p {
  font-size: .95rem;
  color: var(--ink-soft);
  margin-bottom: .5rem;
}

.home-contact a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .15s, color .15s;
}

.home-contact a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

.home-contact .sep { color: var(--dim); margin: 0 .2rem; }

.home .dim { color: var(--dim); font-size: .85rem; font-family: var(--font-mono); letter-spacing: .04em; }

/* ---------- article body ---------- */

/* ---------- framed reading channel ----------
   The article sits inside a hairline-bounded column, the way ArtCraft
   frames its page: one 1px rule down each side and nothing else. */
.article {
  box-sizing: content-box;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 3.5rem;
  border-inline: 1px solid var(--line);
}

.sec {
  padding: 4.5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* The recipe viewer is a two-pane tool, not prose — it needs the room,
   so a section marked wide widens the whole channel it lives in. */
.article:has(.sec-wide) { max-width: 72rem; }
.sec-wide { max-width: none; }

@media (min-width: 900px) {
  .article:has(.sec-wide) { max-width: 78rem; }
}

/* ---------- reading measure ----------
   One column. The .cols wrapper is kept only as the section body
   container, so the markup doesn't need to change. */
.cols { columns: 1; }

@media (min-width: 900px) {
  .article { max-width: 46rem; }

  .sec { padding: 4rem 0; }

  /* first section tucks under the fixed nav */
  .sec:first-child { padding-top: calc(var(--nav-h) + 1.5rem); }

  .cols p,
  .cols li { max-width: none; }
}

.sec h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.6vw, 50px);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
  /* hairline rule above each section title */
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  margin-bottom: 1rem;
}

/* the first section already has the channel's own edge above it */
.sec:first-child h2 { border-top: 0; padding-top: 0; }

.sec h3 {
  font-family: var(--font-display);
  font-size: clamp(19px, 1.9vw, 26px);
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 2rem 0 .8rem;
}

.sec h4 {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--dim);
  margin: 1.4rem 0 .35rem;
}
.sec h4:first-child { margin-top: 0; }

.sec p {
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  max-width: 62ch;
}

.sec .meta {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--dim);
  margin: -.5rem 0 1.6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sec hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.sec a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .15s, color .15s;
}
.sec a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

.sec ul { margin: 0 0 1rem 1.1rem; }
.sec li { font-size: 1rem; color: var(--ink-soft); margin-bottom: .55rem; max-width: 62ch; }

.sec code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  padding: .12em .4em;
}

.sec img.hero-img {
  width: 100%;
  border-radius: 0;
  margin: 1rem 0 1.6rem;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  display: block;
}

.sec img.img {
  width: 100%;
  border-radius: 0;
  margin: 1.2rem 0;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  display: block;
}

/* two images side by side, with captions */
.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin: 1.4rem 0;
}
.two-up figure { margin: 0; }
.two-up img {
  width: 100%;
  border-radius: 0;
  display: block;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
}
.two-up figcaption {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--dim);
  text-align: center;
  margin-top: .4rem;
}

/* clickable image row (opens the lightbox) */
.images-row {
  display: flex;
  gap: 1rem;
  margin: 1.4rem 0;
  justify-content: center;
  flex-wrap: wrap;
}
.images-row .lightbox-link { border-bottom: none; flex: 1; min-width: 0; display: block; }
.images-row .photo {
  width: 100%;
  height: auto;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  cursor: zoom-in;
  transition: opacity .2s;
  display: block;
}
.images-row .photo:hover { opacity: .88; transform: translateY(-1px); }

/* collapsible spec blocks */
.sec details { margin: 1.2rem 0 1.8rem; }
.sec summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .45rem .9rem;
  list-style: none;
  background: var(--bg-raised);
  border-radius: 0;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  margin-bottom: .5rem;
  transition: border-color .15s, color .15s;
}
.sec summary:hover { border-color: var(--line-strong); color: var(--ink); }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::before { content: '▸ '; color: var(--dim); margin-right: .35rem; }
.sec details[open] summary::before { content: '▾ '; }

.note {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.1rem 1.3rem;
  margin-top: .6rem;
  font-size: .92rem;
  line-height: 1.7;
}
.note p { font-size: .92rem; margin-bottom: .4rem; }
.note table { width: 100%; border-collapse: collapse; margin: .6rem 0; font-size: .88rem; }
.note table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.note table td:first-child {
  white-space: nowrap;
  width: 1%;
  font-family: var(--font-mono);
  font-size: .78rem;
}

/* video */
.video-wrap { margin: 1.2rem 0 .5rem; text-align: center; }
.video {
  display: block;
  max-width: 100%;
  width: 640px;
  height: auto;
  margin: 0 auto;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #000;
}
.video-caption {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--dim);
  margin: .5rem 0 0;
}

/* lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,16,20,.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

/* contact */
.sec .links { font-size: .95rem; }
.sec .sep { color: var(--dim); margin: 0 .2rem; }

@media (max-width: 600px) {
  .two-up { grid-template-columns: 1fr; }
  .images-row { flex-direction: column; align-items: center; }

  /* claw back horizontal room for content on a phone (56px each side is
     a lot of a 393px screen) */
  .article { padding: 0 1rem; }
}

/* the recipe viewer is a full-screen tool on mobile: sit it tight under
   the nav and let it own the viewport rather than scroll as a page */
@media (max-width: 899px) {
  .sec-wide { padding: 0; }
  .sec-wide:first-child { padding-top: calc(var(--nav-h) + .5rem); }
}

/* ---------- the rail ---------- */

.ruler {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: var(--rail-w);
  overflow: hidden;
  z-index: 40;
  cursor: crosshair;
}

.rail-frost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(9px);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  /* solid at the outer edge, feathering toward the page */
  mask-image: linear-gradient(to left,
      black 40%,
      rgba(0,0,0,.745) 47.5%,
      rgba(0,0,0,.53) 55%,
      rgba(0,0,0,.357) 62.5%,
      rgba(0,0,0,.22) 70%,
      rgba(0,0,0,.118) 77.5%,
      rgba(0,0,0,.047) 85%,
      rgba(0,0,0,.01) 92.5%,
      transparent 100%);
}

.rail-ticks {
  position: absolute;
  left: 0; right: 0; top: 0;
  will-change: transform;
}

.tick { position: absolute; left: 0; right: 0; height: 0; }

.tick-bar {
  position: absolute;
  right: 0; top: 0;
  height: 1px;
  background: var(--ink);
  transform-origin: right center;
}

.tick-num {
  position: absolute;
  right: 24px; top: 0;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--ink);
  opacity: .5;
}

/* needle + percent readout */
.rail-needle {
  position: absolute;
  left: 0; right: 0; top: 0;
  will-change: transform, opacity;
}

.needle-line {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.readout {
  position: absolute;
  right: 2px; top: 4px;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--accent-ink);
}
.readout.aboveline { top: -14px; }

.digits { display: flex; }
.dcol {
  display: block;
  height: 1em;
  overflow: hidden;
  line-height: 1em;
}
.dcol span { display: block; height: 1em; line-height: 1em; }

/* ---------- section labels ---------- */

.ruler-labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 41;
  overflow: hidden;
}

.rlabel {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
}

.rl {
  position: absolute;
  left: 0; top: 0;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: 14px;          /* must match CFG.headingPx */
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  will-change: transform, color;
  transform-origin: center center;
}

.rhit {
  position: absolute;
  pointer-events: none;
  cursor: pointer;
  border-radius: 2px;
  transition: background-color .15s;
}
.rhit:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

@media (max-width: 720px) {
  :root { --rail-w: 34px; --nav-h: 48px; }
  .ruler-labels { display: none; }
  .rail-frost { backdrop-filter: blur(6px); }
  .topnav { padding: 0 14px; }
  .topnav nav a { margin-left: 12px; font-size: 9.5px; }
}
