/* ============ LONESOME GOAT — field notebook system ============ */

:root {
  /* Palette aligned to Lonesome Goat Brand World v2 (Apr 2026 guide pack).
     Parchment / Sand / Dark Navy / Stone / Ochre Gold are authoritative. */
  --paper: #F3EAD7;       /* Parchment */
  --paper-deep: #E0D3B0;  /* Sand */
  --paper-edge: #d4c69e;  /* deeper sand edge — kept for layered shadow stitching */
  --ink: #1F2937;         /* Dark Navy / Charcoal Ink */
  --ink-soft: #2d3c4f;    /* softened navy for body type */
  --ink-faint: #6f7a85;
  --stone: #BDBDB3;       /* Stone Gray (signage / weathered metal accents) */
  --gold: #C89A4E;        /* Ochre Gold — signal, never decoration */
  --gold-deep: #a87a3d;
  --clay: #8a5a3b;
  --rule: rgba(31, 41, 55, 0.18);
  --rule-soft: rgba(31, 41, 55, 0.10);
  --tape: rgba(220, 200, 140, 0.55);
  --shadow: 0 12px 40px -18px rgba(31, 41, 55, 0.35), 0 2px 6px -2px rgba(31, 41, 55, 0.15);

  /* Field Desk category colors */
  --cat-gold: #C89A4E;
  --cat-sage: #7d8b6a;
  --cat-clay: #a8602f;
  --cat-wax:  #8c2f2a;

  --f-display: "Oswald", "Brothers OT", "Rockwell", sans-serif;
  --f-serif: "Fraunces", "Freight Text Pro", "Old Standard TT", "Times New Roman", serif;
  --f-sans: "Libre Franklin", "Neue Haas Grotesk", "Helvetica Neue", "Inter", sans-serif;
  --f-type: "Special Elite", "Courier New", monospace;
  --f-mono: "Cutive Mono", "Courier New", monospace;
  --f-hand: "Caveat", "Marker Felt", cursive;
  --f-script: "Homemade Apple", "Caveat", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-type);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Paper texture ===== */
.paper {
  position: relative;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(168, 122, 61, 0.08), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(31, 41, 55, 0.05), transparent 60%),
    radial-gradient(ellipse at 50% 50%, transparent 0%, rgba(168, 122, 61, 0.04) 100%);
}
.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.42  0 0 0 0 0.22  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: multiply;
  opacity: 0.35;
  z-index: 0;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at top left, rgba(31, 41, 55,0.18), transparent 35%),
    radial-gradient(ellipse at bottom right, rgba(31, 41, 55,0.18), transparent 35%);
  opacity: 0.4;
  z-index: 0;
}
.paper > * { position: relative; z-index: 1; }

/* Ledger lines variant */
.paper--ruled {
  background-image:
    linear-gradient(to bottom, transparent 31px, var(--rule) 31px, var(--rule) 32px, transparent 32px);
  background-size: 100% 32px;
  background-position: 0 8px;
}

/* ===== Type ===== */
.display {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 0.95;
  color: var(--ink);
  text-transform: uppercase;
}
.serif { font-family: var(--f-serif); }
.type  { font-family: var(--f-type);  }
.mono  { font-family: var(--f-mono);  }
.hand  { font-family: var(--f-hand); font-weight: 500; }
.script { font-family: var(--f-script); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
}
.rule--double {
  height: 5px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: transparent;
}

/* ===== Nav ===== */
.lg-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(239, 230, 207, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.lg-nav__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 36px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.lg-nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.lg-nav__brand img {
  height: 56px;
  width: auto;
  display: block;
}
.lg-nav__links {
  display: flex;
  gap: 28px;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.lg-nav__link {
  color: var(--ink-soft);
  cursor: pointer;
  position: relative;
  padding: 6px 0;
  transition: color 0.2s;
}
.lg-nav__link:hover, .lg-nav__link--active {
  color: var(--ink);
}
.lg-nav__link--active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  background: var(--gold);
}
.lg-nav__cta {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ===== Hamburger button (mobile only) ===== */
.lg-nav__hamburger {
  display: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  width: 40px;
  height: 40px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  transition: border-color 0.18s, background 0.18s;
}
.lg-nav__hamburger:hover { border-color: var(--ink); }
.lg-nav__hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.22s ease, opacity 0.18s;
  transform-origin: center;
}
/* Animate to an X when open */
.lg-nav__hamburger--open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.lg-nav__hamburger--open span:nth-child(2) { opacity: 0; }
.lg-nav__hamburger--open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
body[data-mode="moonlight"] .lg-nav__hamburger { border-color: rgba(232,217,180,0.25); }
body[data-mode="moonlight"] .lg-nav__hamburger:hover { border-color: var(--gold); }
body[data-mode="moonlight"] .lg-nav__hamburger span { background: var(--ink); /* in moonlight --ink is already cream */ }

/* ===== Mobile drawer (slides down from under the nav) ===== */
.lg-nav__drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 49;
  background: var(--paper);
  padding: 92px 0 16px; /* clears the nav row */
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 12px 24px -12px rgba(31, 41, 55, 0.35);
  transform: translateY(-110%);
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
  visibility: hidden;
  display: none; /* hidden entirely on desktop */
}
.lg-nav__drawer--open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}
.lg-nav__drawer-link {
  display: block;
  padding: 16px 24px;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  border-top: 1px solid var(--rule);
  transition: background 0.15s, color 0.15s;
}
.lg-nav__drawer-link:first-child { border-top: 0; }
.lg-nav__drawer-link:hover { background: var(--paper-deep); color: var(--ink); }
.lg-nav__drawer-link--active {
  color: var(--ink);
  background: var(--paper-deep);
  position: relative;
}
.lg-nav__drawer-link--active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--gold);
}

/* Scrim behind the drawer when open (mobile only) */
.lg-nav__scrim {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 55, 0.35);
  z-index: 48;
  display: none;
  animation: lg-fade-in 220ms ease;
}

body[data-mode="moonlight"] .lg-nav__drawer {
  background: var(--paper); /* in moonlight, --paper is dark */
  border-bottom-color: rgba(232, 217, 180, 0.25);
}
body[data-mode="moonlight"] .lg-nav__drawer-link { border-top-color: rgba(232, 217, 180, 0.12); }
body[data-mode="moonlight"] .lg-nav__drawer-link:hover { background: rgba(232, 217, 180, 0.08); }
body[data-mode="moonlight"] .lg-nav__drawer-link--active { background: rgba(232, 217, 180, 0.12); }
body[data-mode="moonlight"] .lg-nav__drawer-link--active::before { background: var(--gold); }

/* ===== Sun / Moon toggle — landscape scene ===== */
.sunmoon {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  border-radius: 0;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.sunmoon:hover { border-color: var(--ink); }
.sunmoon__scene {
  display: block;
  line-height: 0;
  border: none !important;
  border: 1px solid var(--rule);
}
.sunmoon__scene svg { display: block; }
.sunmoon__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
body[data-mode="moonlight"] .sunmoon { border-color: rgba(232,217,180,0.22); }

/* ===== Buttons ===== */
.btn {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--gold { border-color: var(--gold-deep); color: var(--ink); }
.btn--gold:hover { background: var(--gold); color: var(--ink); border-color: var(--ink); }
.btn--ghost { border-color: var(--rule); color: var(--ink-soft); }
/* Ghost CTA — quiet at rest, fills with the dominant signal on hover.
   Day mode = navy fill (matches primary .btn).  Night mode = gold fill. */
.btn--ghost:hover { border-color: var(--ink); color: var(--paper); background: var(--ink); }

/* Night mode (moonlight) flips primary fill to gold so the CTA reads as a glow,
   not a dark shape on a dark page. */
body[data-mode="moonlight"] .btn:hover,
body[data-mode="moonlight"] .btn--ghost:hover {
  background: var(--gold);
  color: #1a1c1f;
  border-color: var(--gold);
}
body[data-mode="moonlight"] .btn--gold:hover {
  background: var(--gold);
  color: #1a1c1f;
  border-color: var(--gold);
}

.btn-seal {
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.btn-seal__coin {
  position: relative;
  width: 200px;
  height: 200px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.35));
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.btn-seal__coin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  clip-path: circle(46% at 50% 50%);
  -webkit-clip-path: circle(46% at 50% 50%);
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}
.btn-seal__coin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 230, 180, 0.45), transparent 55%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.7;
  transition: opacity 0.4s ease;
}
.btn-seal__coin::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(168, 122, 61, 0.4);
  animation: rotate-slow 60s linear infinite;
  pointer-events: none;
}
.btn-seal:hover .btn-seal__coin { transform: scale(1.04); }
.btn-seal:hover .btn-seal__coin img { transform: rotate(-6deg); }
.btn-seal:hover .btn-seal__coin::before { opacity: 1; }
.btn-seal:active .btn-seal__coin { transform: scale(0.98); }
@keyframes rotate-slow { to { transform: rotate(360deg); } }

/* ===== Stamps + tags ===== */
.stamp {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  border: 2px solid var(--clay);
  color: var(--clay);
  padding: 5px 10px;
  transform: rotate(-2deg);
  background: rgba(239, 230, 207, 0.6);
}
.stamp--ink { border-color: var(--ink); color: var(--ink); }
.stamp--gold { border-color: var(--gold-deep); color: var(--gold-deep); }

.tag {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}

.field-line {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.field-line__label {
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  align-self: center;
}
.field-line__val { color: var(--ink); }

/* ===== Taped photo ===== */
.taped {
  position: relative;
  display: inline-block;
  background: #fff;
  padding: 10px 10px 36px 10px;
  box-shadow: 0 18px 30px -16px rgba(31, 41, 55,0.45), 0 2px 6px -2px rgba(31, 41, 55,0.2);
}
.taped::before, .taped::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 22px;
  background: var(--tape);
  border-left: 1px dashed rgba(168, 122, 61, 0.5);
  border-right: 1px dashed rgba(168, 122, 61, 0.5);
  top: -10px;
  box-shadow: 0 1px 3px rgba(31, 41, 55,0.12);
}
.taped::before { left: 14px; transform: rotate(-6deg); }
.taped::after  { right: 14px; transform: rotate(5deg); }
.taped__caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  font-family: var(--f-hand);
  font-size: 18px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.1;
}

/* placeholder photo */
.photo-ph {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(135deg, rgba(31, 41, 55,0.04) 0 8px, rgba(31, 41, 55,0.08) 8px 16px),
    linear-gradient(180deg, #cfc1a0, #b8a479);
  position: relative;
  overflow: hidden;
}
.photo-ph::after {
  content: attr(data-caption);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(31, 41, 55,0.7);
  text-align: center;
  padding: 0 16px;
}

/* sketch placeholder */
.sketch {
  width: 100%;
  display: block;
  color: var(--ink);
}

/* ===== Note article body ===== */
.prose {
  font-family: var(--f-type);
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink);
}
.prose p { margin: 0 0 1.4em 0; }
.prose p:first-child::first-letter {
  font-family: var(--f-display);
  font-size: 3.2em;
  float: left;
  line-height: 0.85;
  padding: 6px 10px 0 0;
  color: var(--ink);
}
.prose h2, .prose h3 {
  font-family: var(--f-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2em 0 0.6em;
}
.prose blockquote {
  border-left: 2px solid var(--gold);
  margin: 1.4em 0;
  padding: 0.4em 0 0.4em 1.4em;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
}

/* ===== Coordinate / corner marks ===== */
.corner-marks {
  position: relative;
}
.corner-marks::before, .corner-marks::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
}
.corner-marks::before {
  top: 0; left: 0;
  border-right: 0; border-bottom: 0;
}
.corner-marks::after {
  bottom: 0; right: 0;
  border-left: 0; border-top: 0;
}

/* ===== Ritual modal ===== */
.ritual-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at center, rgba(40, 30, 18, 0.6), rgba(15, 10, 5, 0.94));
  display: grid;
  place-items: center;
  animation: dim-in 600ms ease;
}
@keyframes dim-in { from { opacity: 0; } to { opacity: 1; } }

.ritual-page {
  width: min(720px, 92vw);
  max-height: 88vh;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 50px 120px -30px rgba(0,0,0,0.7), 0 4px 12px rgba(0,0,0,0.4);
  position: relative;
  transform-origin: bottom center;
  animation: page-rise 900ms cubic-bezier(.2,.7,.2,1) both;
  display: flex;
  flex-direction: column;
}
@keyframes page-rise {
  from { transform: translateY(60px) rotateX(8deg) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
}

.ritual-page__inner {
  position: relative; /* anchor the date stamp inside this region (not the modal root, which overlapped the esc button) */
  padding: 48px 56px 32px;
  overflow-y: auto;
  flex: 1;
  background-image:
    linear-gradient(to bottom, transparent 31px, var(--rule) 31px, var(--rule) 32px, transparent 32px);
  background-size: 100% 32px;
  background-position: 0 16px;
}
.ritual-page__bar {
  border-top: 1px solid var(--rule);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.02);
}

.ritual-stamp {
  position: absolute;
  top: 18px;
  right: 28px;
  transform: rotate(8deg);
  opacity: 0;
  animation: stamp-in 600ms 1100ms ease both;
}
@keyframes stamp-in {
  0%   { opacity: 0; transform: rotate(8deg) scale(2.5); }
  60%  { opacity: 1; transform: rotate(8deg) scale(0.95); }
  100% { opacity: 1; transform: rotate(8deg) scale(1); }
}

.lamplight {
  position: fixed;
  inset: 0;
  z-index: 199;
  pointer-events: none;
  background: radial-gradient(circle at 50% 35%, rgba(255, 220, 150, 0.18), transparent 40%);
}

/* typewriter caret */
.caret::after {
  content: "▌";
  display: inline-block;
  margin-left: 2px;
  color: var(--ink);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

textarea.ritual-input {
  width: 100%;
  min-height: 280px;
  background: transparent;
  border: 0;
  resize: none;
  font-family: var(--f-type);
  font-size: 18px;
  line-height: 32px;
  color: var(--ink);
  outline: none;
  padding: 0;
}
input.ritual-line, .ritual-line {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  font-family: var(--f-type);
  font-size: 16px;
  color: var(--ink);
  padding: 4px 0;
  outline: none;
  width: 100%;
}
input.ritual-line:focus { border-bottom-color: var(--ink); }

/* ===== Card stack (writing desk) ===== */
.desk {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 220, 150, 0.10), transparent 65%),
    linear-gradient(180deg, var(--paper-deep), var(--paper));
  padding: 56px 32px;
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 60px rgba(31, 41, 55,0.06);
  overflow: hidden;
}
.desk::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='w'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.34  0 0 0 0 0.24  0 0 0 0 0.12  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23w)' opacity='0.5'/></svg>");
  background-size: 480px 480px;
  mix-blend-mode: multiply;
  opacity: 0.4;
}
.desk__paperclip {
  position: absolute;
  top: 18px;
  left: 22px;
  font-family: var(--f-hand);
  color: var(--ink-soft);
  font-size: 22px;
  transform: rotate(-4deg);
  z-index: 6;
}
.desk__hint {
  position: absolute;
  bottom: 14px;
  right: 22px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  z-index: 6;
}

/* ===== Card stack — physical card flip ===== */
.stack-wrap {
  position: relative;
  width: min(580px, 100%);
  height: 640px;
  perspective: 2400px;
  margin: 0 auto;
  touch-action: pan-y;
  cursor: grab;
}
.stack-wrap:active { cursor: grabbing; }
.stack-card {
  position: absolute;
  inset: 0;
  background: var(--paper);
  box-shadow:
    0 22px 40px -22px rgba(31, 41, 55, 0.45),
    0 4px 10px -4px rgba(31, 41, 55, 0.20),
    inset 0 0 0 1px rgba(31, 41, 55, 0.06);
  padding: 38px;
  transform-origin: left center;
  border: 1px solid var(--rule);
  will-change: transform, opacity;
}
.stack-card.is-static {
  transition:
    transform 600ms cubic-bezier(.2,.7,.2,1),
    opacity 400ms ease,
    box-shadow 400ms ease;
}
.stack-card--ruled {
  background-image:
    linear-gradient(to bottom, transparent 31px, var(--rule) 31px, var(--rule) 32px, transparent 32px);
  background-size: 100% 32px;
  background-position: 0 64px;
}
/* tonal variants — rotated through the stack so cards feel like different days */
.stack-card.tone-1 { background-color: #F3EAD7; }
.stack-card.tone-2 { background-color: #ece1c4; }
.stack-card.tone-3 { background-color: #e8dcb9; }
.stack-card.tone-4 { background-color: #f0e8d2; }
.stack-card.tone-5 { background-color: #e3d6b3; }
.stack-card.tone-6 { background-color: #ede2c8; }

.stack-card--top    { z-index: 5; transform: translate(0,0) rotate(-0.6deg); }
.stack-card--mid    { z-index: 4; transform: translate(10px, 14px) rotate(2.2deg); opacity: 0.92; }
.stack-card--back   { z-index: 3; transform: translate(-12px, 24px) rotate(-3.4deg); opacity: 0.78; }
.stack-card--bottom { z-index: 2; transform: translate(6px, 34px) rotate(1.4deg); opacity: 0.6; filter: brightness(0.97); }

/* file index tabs (desk) */
.file-tabs {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  z-index: 7;
}
.file-tab {
  width: 28px;
  height: 18px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, background 0.2s ease;
}
.file-tab--active {
  background: var(--gold);
  border-color: var(--gold-deep);
  height: 22px;
  margin-top: -4px;
}
.file-tab:hover { transform: translateY(-2px); }

/* corner clip */
.stack-card__clip {
  position: absolute;
  top: -8px;
  right: 32px;
  width: 14px;
  height: 56px;
  background: linear-gradient(180deg, #b8a884, #8a795a);
  border-radius: 2px 2px 6px 6px;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.25);
  z-index: 6;
  transform: rotate(2deg);
}
.stack-card__clip::after {
  content: "";
  position: absolute;
  top: 6px; left: 4px; right: 4px; bottom: 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 2px;
}

/* handwritten annotation utility */
.annot {
  position: absolute;
  font-family: var(--f-hand);
  color: var(--ink);
  pointer-events: none;
  line-height: 1.1;
}
.annot--gold { color: var(--gold-deep); }
.annot--clay { color: var(--clay); }
.annot--arrow svg { display: block; }

/* ===== Manifesto — typewriter line-by-line ===== */
.mf-line {
  font-family: var(--f-script);
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  min-height: 1.2em;
  white-space: pre-wrap;
}
.mf-line.is-pending { opacity: 0; }
.mf-line .mf-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--ink);
  margin-left: 2px;
  vertical-align: -0.15em;
  animation: mf-blink 0.9s steps(2) infinite;
}
@keyframes mf-blink { 50% { opacity: 0; } }
.mf-line--em {
  font-family: var(--f-hand);
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 38px);
  color: var(--ink);
}

/* keep the legacy class as a no-op fallback */
.manifesto-line {
  font-family: var(--f-script);
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.manifesto-line.visible {
  opacity: 1;
  transform: translateY(0);
}
.manifesto-line--em {
  font-family: var(--f-hand);
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 38px);
  color: var(--ink);
}
.manifesto-line--quiet {
  color: var(--ink-soft);
  font-size: clamp(20px, 2.2vw, 26px);
}

/* ===== Home — horizon hero + doors ===== */
.home-hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}
.horizon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* --- About hero: 3-beat headline with campfire between firelight and the call --- */
.lg-about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}
.lg-hero-line { display: block; }
.lg-hero-line--accent { display: block; margin-top: 8px; }

/* Stamp picker — centered modal so every plate is clearly visible. */
.lg-stamp-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 41, 55, 0.55);
  display: grid; place-items: center;
  z-index: 9999;
  padding: 24px;
  animation: lg-fade-in 200ms ease;
}
@keyframes lg-fade-in { from { opacity: 0; } to { opacity: 1; } }
.lg-stamp-modal {
  width: min(960px, 96vw);
  max-height: 86vh;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: lg-modal-in 240ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes lg-modal-in {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.lg-stamp-modal__head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
}
.lg-stamp-modal__grid {
  padding: 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 760px) { .lg-stamp-modal__grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .lg-stamp-modal__grid { grid-template-columns: repeat(2, 1fr); } }
body[data-mode="moonlight"] .lg-stamp-modal {
  background: #1c1e21;
  border-color: rgba(232, 217, 180, 0.18);
}

/* User-uploaded hero photo on Goat Notes — disposable-camera vibe.
   Slight desat + warm tone + subtle contrast lift, soft drop shadow,
   gentle rotation, two strips of "tape" along the top. */
/* Inline variant for the home page Latest Dispatch column — constrained
   to the column width instead of the full 920px hero size. */
.lg-hero-photo--inline { max-width: 100%; }
.lg-hero-photo--inline::before { left: 18px; }
.lg-hero-photo--inline::after  { right: 18px; }

.lg-hero-photo {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 38px -16px rgba(31, 41, 55, 0.45),
              0 4px 12px -2px rgba(31, 41, 55, 0.18);
  transform: rotate(-1deg);
}
.lg-hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.82) contrast(1.05) brightness(0.96) sepia(0.06);
}
.lg-hero-photo::before,
.lg-hero-photo::after {
  content: '';
  position: absolute;
  width: 92px;
  height: 22px;
  background: var(--tape);
  top: -10px;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.18);
}
.lg-hero-photo::before { left: 24px; transform: rotate(-7deg); }
.lg-hero-photo::after  { right: 24px; transform: rotate(6deg); }
.lg-hero-photo figcaption {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--ink-soft);
  text-align: right;
  padding: 8px 14px 10px;
  background: var(--paper);
}

/* Brand-aligned campfire — same paths as the existing `fire` Sketch plate.
   Gold wash plume + three ink flame strokes + ink-line logs + ink-tick sparks.
   Flames + wash + sparks animate subtly; logs are completely static.
   Drag transforms the flames group only. */
.lg-hero-fire {
  display: inline-block;
  margin: 14px auto 8px;
  width: clamp(180px, 24vw, 320px);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  line-height: 0;
}
.lg-hero-fire.lg-hero-fire--dragging { cursor: grabbing; }
.lg-hero-fire svg { display: block; }
.lg-fire-flames { will-change: transform, opacity; }

/* Per-flame subtle flicker — small scaleY + tiny skewX so it feels alive
   without becoming animated cartoon fire. transform-box: fill-box anchors
   the transform-origin to each path's own bounding box. */
.lg-flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

@keyframes lg-flame-flicker-1 {
  0%, 100% { transform: scaleY(1) skewX(0deg); }
  35%      { transform: scaleY(1.04) skewX(-1deg); }
  70%      { transform: scaleY(0.97) skewX(0.6deg); }
}
@keyframes lg-flame-flicker-2 {
  0%, 100% { transform: scaleY(1) skewX(0deg); }
  40%      { transform: scaleY(0.96) skewX(1.4deg); }
  75%      { transform: scaleY(1.05) skewX(-0.9deg); }
}
@keyframes lg-flame-flicker-3 {
  0%, 100% { transform: scaleY(1); opacity: 0.85; }
  50%      { transform: scaleY(1.07); opacity: 1; }
}
.lg-flame-1 { animation: lg-flame-flicker-1 1.7s ease-in-out infinite; }
.lg-flame-2 { animation: lg-flame-flicker-2 1.3s ease-in-out infinite; animation-delay: -0.4s; }
.lg-flame-3 { animation: lg-flame-flicker-3 1.0s ease-in-out infinite; animation-delay: -0.2s; }

/* Soft warm wash that breathes */
@keyframes lg-flame-wash-pulse {
  0%, 100% { fill-opacity: 0.16; }
  50%      { fill-opacity: 0.26; }
}
.lg-flame-wash {
  fill-opacity: 0.18;
  animation: lg-flame-wash-pulse 2.4s ease-in-out infinite;
}

/* Sparks — small ink ticks rising and fading */
@keyframes lg-spark-rise {
  0%   { transform: translateY(0); opacity: 0; }
  18%  { opacity: 1; }
  100% { transform: translateY(-22px); opacity: 0; }
}
.lg-spark {
  transform-box: fill-box;
  animation: lg-spark-rise 2.6s ease-out infinite;
}
.lg-spark-1 { animation-delay: 0s; }
.lg-spark-2 { animation-delay: 0.7s; animation-duration: 3.0s; }
.lg-spark-3 { animation-delay: 1.4s; animation-duration: 2.4s; }
.lg-spark-4 { animation-delay: 2.0s; animation-duration: 2.8s; }

@media (prefers-reduced-motion: reduce) {
  .lg-flame, .lg-flame-wash, .lg-spark { animation: none !important; }
}

/* --- Night sky animations --- */

/* Subtle twinkle on a subset of brighter stars. Durations & delays are
   set per-star inline so the field doesn't pulse in unison. */
@keyframes lg-twinkle {
  0%, 100% { opacity: var(--lg-base-op, 0.9); }
  50%      { opacity: calc(var(--lg-base-op, 0.9) * 0.22); }
}
.lg-star-twinkle {
  animation-name: lg-twinkle;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

/* Shooting stars — long cycles with a short visible streak.
   Each streak has different timing so they don't fire at once. */
.lg-shoot {
  opacity: 0;
  transform-box: fill-box;
  will-change: transform, opacity;
}
@keyframes lg-shoot-1 {
  0%, 96.5% { transform: translate(0,0); opacity: 0; }
  97%       { transform: translate(0,0); opacity: 1; }
  100%      { transform: translate(380px, 130px); opacity: 0; }
}
@keyframes lg-shoot-2 {
  0%, 96%   { transform: translate(0,0); opacity: 0; }
  96.5%     { transform: translate(0,0); opacity: 1; }
  100%      { transform: translate(-340px, 150px); opacity: 0; }
}
@keyframes lg-shoot-3 {
  0%, 97%   { transform: translate(0,0); opacity: 0; }
  97.3%     { transform: translate(0,0); opacity: 1; }
  100%      { transform: translate(420px, 110px); opacity: 0; }
}
.lg-shoot-1 { animation: lg-shoot-1 75s linear infinite; }
.lg-shoot-2 { animation: lg-shoot-2 92s linear infinite; animation-delay: 28s; }
.lg-shoot-3 { animation: lg-shoot-3 110s linear infinite; animation-delay: 60s; }

@media (prefers-reduced-motion: reduce) {
  .lg-star-twinkle,
  .lg-shoot,
  .lg-shoot-1, .lg-shoot-2, .lg-shoot-3 { animation: none !important; opacity: 0.95; }
}
.home-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-top: 64px;
  padding-bottom: 96px;
  width: 100%;
}
.home-hero__eyebrow {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--rule);
  background: rgba(239, 230, 207, 0.6);
  backdrop-filter: blur(4px);
}
body[data-mode="moonlight"] .home-hero__eyebrow {
  background: rgba(14, 20, 25, 0.6);
  border-color: rgba(232,217,180,0.18);
}
.home-hero__lockup {
  margin: 32px auto 28px;
  display: flex;
  justify-content: center;
  max-width: 100%;
}
.home-hero__lockup img,
.home-hero__lockup svg {
  max-width: min(860px, 100%);
  height: auto;
}
.home-hero__mark {
  display: inline-block;
  margin: 32px 0 28px;
}
.home-hero__line {
  font-size: clamp(56px, 9vw, 132px);
  line-height: 0.95;
  margin: 0 0 28px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
body[data-mode="moonlight"] .home-hero__line { text-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.home-hero__sub {
  font-style: italic;
  font-size: clamp(18px, 1.6vw, 22px);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
}
.home-hero__cta {
  margin-top: 40px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
/* Hero CTAs sit over the horizon scene — give them a tinted backing
   so they read in both daylight (over dark ridges) and moonlight. */
.home-hero__cta .btn {
  background: rgba(239, 230, 207, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px -10px rgba(31, 41, 55, 0.35);
}
.home-hero__cta .btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.home-hero__cta .btn--ghost {
  background: rgba(239, 230, 207, 0.55);
  border-color: var(--ink-soft);
  color: var(--ink);
}
.home-hero__cta .btn--ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
body[data-mode="moonlight"] .home-hero__cta .btn {
  background: rgba(14, 20, 25, 0.62);
  border-color: rgba(232, 217, 180, 0.55);
  color: #f0e4c2;
  box-shadow: 0 1px 0 rgba(232, 217, 180, 0.08), 0 6px 18px -10px rgba(0, 0, 0, 0.6);
}
body[data-mode="moonlight"] .home-hero__cta .btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #15171a;
}
body[data-mode="moonlight"] .home-hero__cta .btn--ghost {
  background: rgba(14, 20, 25, 0.42);
  border-color: rgba(232, 217, 180, 0.32);
  color: rgba(240, 228, 194, 0.88);
}
body[data-mode="moonlight"] .home-hero__cta .btn--ghost:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #15171a;
}

/* Latest dispatch on home */
.home-latest {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
.home-latest__art { transform: rotate(-1.5deg); }

/* Three doors */
.home-doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.door {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  padding: 56px 36px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: background 0.3s ease;
  color: inherit;
}
.door:last-child { border-right: 0; }
.door:hover { background: rgba(168, 122, 61, 0.08); }
body[data-mode="moonlight"] .door:hover { background: rgba(232,217,180,0.05); }
.door__num {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--gold-deep);
}
.door__sketch { display: block; max-width: 220px; }
.door__label {
  font-size: 32px;
  margin-top: 10px;
}
.door__sub {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
  margin: 0;
}
.door__chev {
  font-size: 22px;
  color: var(--gold-deep);
  transition: transform 0.3s ease;
  margin-top: 6px;
}
.door:hover .door__chev { transform: translateX(8px); }

@media (max-width: 900px) {
  .home-latest { grid-template-columns: 1fr; gap: 36px; }
  .home-doors { grid-template-columns: 1fr; }
  .door { border-right: 0; border-bottom: 1px solid var(--rule); }
  .door:last-child { border-bottom: 0; }
}

/* ===== Field Desk page ===== */
.desk-room {
  background: linear-gradient(180deg, #2a2118 0%, #1d1612 100%);
  min-height: calc(100vh - 89px);
  position: relative;
  overflow: hidden;
}
.desk-room::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='wood'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.04' numOctaves='3' seed='5'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.10  0 0 0 0 0.06  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23wood)' opacity='0.85'/></svg>");
  background-size: 800px 800px;
  mix-blend-mode: multiply;
  opacity: 0.5;
}
body[data-mode="moonlight"] .desk-room {
  background: linear-gradient(180deg, #0e0a07 0%, #060403 100%);
}
.desk-room__inner {
  position: relative;
  z-index: 2;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 36px 48px;
}
.desk-room--dim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  pointer-events: none;
  z-index: 5;
  transition: background 0.5s ease;
}

/* Head */
.desk-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: #d6c89a;
  margin-bottom: 24px;
}
.desk-head .display { color: #F3EAD7; }
.desk-head__title {
  font-size: clamp(36px, 4.5vw, 64px);
  margin: 6px 0 0;
  line-height: 1;
}
.desk-head .eyebrow { color: #b09e6c; }
.desk-head__tools { display: flex; gap: 10px; }
.toolbtn {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(214, 200, 154, 0.35);
  color: #d6c89a;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.toolbtn:hover { border-color: var(--gold); color: var(--gold); }
.toolbtn--static { cursor: default; }
.toolbtn--static:hover { border-color: rgba(214, 200, 154, 0.35); color: #d6c89a; }
.toolbtn__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4a4030; transition: all 0.3s ease;
}
.toolbtn--on .toolbtn__dot {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* Corkboard */
.cork {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,220,150,0.07), transparent 60%),
    linear-gradient(180deg, #6b4a2c, #5a3e26);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.32  0 0 0 0 0.20  0 0 0 0 0.10  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23c)' opacity='0.8'/></svg>"),
    linear-gradient(180deg, #6b4a2c, #5a3e26);
  background-size: 200px 200px, 100% 100%;
  border: 6px solid #2a1d0f;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.4),
    0 12px 30px rgba(0,0,0,0.4);
  padding: 26px 30px 22px;
  margin-bottom: 24px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
}
.cork .hand { color: #d6c89a; }
.cork__pin {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold), var(--gold-deep));
  box-shadow: 0 2px 4px rgba(0,0,0,0.6), inset 0 -1px 1px rgba(0,0,0,0.3);
  flex: 0 0 auto;
}
.cork__items {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
}
.cork__card {
  background: var(--paper);
  padding: 12px 16px;
  min-width: 220px;
  max-width: 320px;
  flex: 1;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  position: relative;
}
.cork__card::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #c34, #6a1c20);
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Desk surface */
.desk-surface {
  position: relative;
  background:
    linear-gradient(135deg, #6b4a2c 0%, #4a311c 100%);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='lt'><feTurbulence type='fractalNoise' baseFrequency='0.02 0.005' numOctaves='3' seed='9'/><feColorMatrix values='0 0 0 0 0.20  0 0 0 0 0.12  0 0 0 0 0.05  0 0 0 0.8 0'/></filter><rect width='100%' height='100%' filter='url(%23lt)' opacity='0.85'/></svg>"),
    linear-gradient(135deg, #6b4a2c 0%, #4a311c 100%);
  background-size: 600px 600px, 100% 100%;
  border: 1px solid #1a1208;
  border-radius: 4px;
  box-shadow:
    inset 0 0 80px rgba(0,0,0,0.6),
    inset 0 0 0 12px #2a1d0f,
    0 30px 60px rgba(0,0,0,0.5);
  padding: 80px 320px 80px 80px;
  min-height: 720px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}
.desk-surface__pool {
  position: absolute;
  top: -40px; left: -40px;
  width: 65%;
  height: 70%;
  background: radial-gradient(ellipse at 25% 20%, rgba(255, 210, 130, 0.35) 0%, rgba(255, 210, 130, 0.12) 35%, transparent 65%);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
}

/* Single-page variant — drop the desk props, center the notebook, leave room for tray */
.desk-surface--single {
  padding: 56px 56px 56px 56px;
  min-height: 720px;
  display: block;
}
@media (min-width: 1100px) {
  .desk-surface--single { padding: 64px 360px 64px 64px; }
}
.desk-surface__notebook {
  position: relative;
  z-index: 3;
}
.desk-surface--single .coffee-ring,
.desk-surface--single .pen,
.desk-surface--single .desk-photo,
.desk-surface--single .desk-mark { display: none !important; }

/* Sketch view (read mode for sketches) */
.sketch-view {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--rule);
  background:
    linear-gradient(to bottom, transparent 23px, var(--rule-soft) 23px, var(--rule-soft) 24px, transparent 24px),
    var(--paper);
  background-size: 100% 24px;
  padding: 16px;
  min-height: 320px;
}
.sketch-view img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

/* Button color variants */
.btn--clay {
  background: var(--cat-clay);
  color: var(--paper);
  border-color: var(--cat-clay);
}
.btn--clay:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--wax {
  background: var(--cat-wax);
  color: var(--paper);
  border-color: var(--cat-wax);
}
.btn--wax:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--wax:disabled, .btn--clay:disabled { opacity: 0.4; cursor: not-allowed; }

.coffee-ring {
  position: absolute;
  top: 36px; right: 360px;
  width: 80px; height: 80px;
  border: 3px solid rgba(80, 40, 18, 0.6);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(80,40,18,0.15), transparent 60%);
  transform: rotate(-12deg) scale(1, 0.95);
  z-index: 1;
  box-shadow: inset 0 -4px 6px rgba(0,0,0,0.2);
}
.pen {
  position: absolute;
  bottom: 80px;
  left: 60px;
  width: 220px;
  height: 14px;
  transform: rotate(-22deg);
  z-index: 6;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}
.pen__nib {
  position: absolute; left: 0; top: 4px;
  width: 18px; height: 6px;
  background: linear-gradient(180deg, #b8b8b8, #6a6a6a);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.pen__body {
  position: absolute; left: 18px; top: 0;
  width: 170px; height: 14px;
  background: linear-gradient(180deg, #1a1208 0%, #4a311c 50%, #1a1208 100%);
  border-radius: 4px;
}
.pen__cap {
  position: absolute; right: 0; top: 2px;
  width: 32px; height: 10px;
  background: linear-gradient(180deg, #C89A4E, #8e6730);
  border-radius: 2px;
}
.desk-photo {
  position: absolute;
  top: 50px;
  right: 80px;
  width: 200px;
  z-index: 3;
  transform: rotate(4deg);
  display: none; /* hidden by default — reveal on wider screens via media query */
}
.desk-mark {
  position: absolute;
  bottom: 60px;
  right: 100px;
  z-index: 3;
  opacity: 0.8;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
  display: none;
}
@media (min-width: 1280px) {
  .desk-photo { display: block; }
  .desk-mark { display: block; }
  .desk-surface { padding: 80px 360px 80px 320px; }
}

.desk-surface__journal {
  position: relative;
  z-index: 4;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* Drawer rail */
.desk-surface__rail {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 64px;
  z-index: 7;
  display: flex;
  flex-direction: column;
}
.drawers {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
  padding: 24px 0;
}
.drawer {
  flex: 1;
  appearance: none;
  background:
    linear-gradient(180deg, #5a3e26 0%, #3a2818 100%);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'><filter id='dr'><feTurbulence type='fractalNoise' baseFrequency='0.04 0.01' numOctaves='3' seed='2'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.10  0 0 0 0 0.05  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23dr)'/></svg>"),
    linear-gradient(180deg, #5a3e26 0%, #3a2818 100%);
  background-size: 200px 100px, 100% 100%;
  border: 1px solid #1a1208;
  border-right: 0;
  color: #d6c89a;
  padding: 0;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow:
    inset 1px 0 2px rgba(255, 200, 130, 0.12),
    inset 0 0 30px rgba(0,0,0,0.4),
    -2px 0 6px rgba(0,0,0,0.4);
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), background 0.3s ease;
}
.drawer:hover { transform: translateX(-6px); }
.drawer--open { transform: translateX(-12px); }
.drawer__pull {
  width: 22px; height: 8px;
  background: linear-gradient(180deg, #C89A4E, #8e6730);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.drawer__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* Drawer tray */
.tray {
  position: absolute;
  top: 12px;
  bottom: 12px;
  right: 80px;
  width: 360px;
  z-index: 8;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow:
    -20px 0 40px rgba(0,0,0,0.4),
    inset 0 0 0 1px rgba(31, 41, 55,0.06);
  display: flex;
  flex-direction: column;
  animation: tray-slide 0.4s cubic-bezier(.2,.7,.2,1);
}
@keyframes tray-slide {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.tray__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tray__close {
  appearance: none; background: transparent; border: 0;
  font-size: 22px; cursor: pointer; color: var(--ink-soft);
  padding: 0 6px; line-height: 1;
}
.tray__body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tray__body--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tray__sketch-frame {
  border: 1px solid var(--rule);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 110px;
  overflow: hidden;
  margin-bottom: 6px;
}
.tray__sketch-frame img,
.tray__sketch-frame svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.tray__item--sketch {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tray__item--sketch .tray__item-title {
  font-size: 14px;
  line-height: 1.2;
}
.tray__sketch {
  border: 1px solid var(--rule);
  padding: 8px;
  background: var(--paper);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tray__item {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  text-align: left;
  padding: 12px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.2s ease;
  color: inherit;
}
.tray__item:hover { background: rgba(168,122,61,0.08); }
.tray__item-title {
  font-size: 18px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.tray__item-meta {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tray__empty {
  text-align: center;
  padding: 40px 20px;
}

/* Journal book — DEPRECATED two-page spread (kept for any legacy refs).
   Replaced by .notebook (single page) below. */

/* ===== Notebook — single-page journal ===== */
.notebook {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  z-index: 4;
}
.notebook__page {
  position: relative;
  background: var(--paper);
  padding: 28px 36px 36px;
  min-height: 540px;
  box-shadow:
    0 30px 60px -10px rgba(0,0,0,0.7),
    0 8px 20px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(31, 41, 55,0.06);
  background-image:
    radial-gradient(ellipse at 50% 50%, rgba(168, 122, 61, 0.05), transparent 70%),
    var(--paper);
}
.notebook__page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.42  0 0 0 0 0.22  0 0 0 0.16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: multiply;
  opacity: 0.22;
}
.notebook__body { position: relative; z-index: 1; }

/* Letterhead — top of every page, changes per mode */
.letterhead {
  position: relative;
  z-index: 1;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 16px;
  margin-bottom: 18px;
}
.letterhead__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Inline mode tabs that live in the letterhead top — Write/Read/Sketch/Letter.
   Replaced the bottom menu drawer so modes are visible without scrolling. */
.letterhead__modes {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  border-radius: 2px;
}
.letterhead__mode {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.letterhead__mode:hover { color: var(--ink); background: rgba(31, 41, 55,0.05); }
.letterhead__mode--on,
.letterhead__mode--on:hover {
  background: var(--ink);
  color: var(--paper);
}
body[data-mode="moonlight"] .letterhead__modes { background: rgba(232,217,180,0.06); border-color: rgba(232,217,180,0.18); }
body[data-mode="moonlight"] .letterhead__mode--on,
body[data-mode="moonlight"] .letterhead__mode--on:hover {
  background: var(--gold);
  color: #15171a;
}
.letterhead__stamp {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  background: rgba(168,122,61,0.06);
  transform: rotate(-1.5deg);
}
.letterhead__kind {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}
.letterhead__date {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1;
}
.letterhead__mark {
  opacity: 0.75;
  flex-shrink: 0;
}
.letterhead__title,
.letterhead__title-static {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 6px 0 8px;
  margin: 0 0 10px;
  outline: none;
}
.letterhead__title:focus { border-bottom-color: var(--ink); }
.letterhead__title::placeholder { color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; font-style: italic; font-family: var(--f-serif); font-size: 22px; }
.letterhead__title-static { border-bottom: 0; }
.letterhead__metarow { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; padding-bottom: 4px; }
.letterhead__lines { display: flex; flex-direction: column; gap: 6px; }
.letterhead__line {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  border-bottom: 1px dashed var(--rule);
  padding: 4px 0;
}
.letterhead__line label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.letterhead__line input {
  appearance: none;
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--ink);
  padding: 4px 0;
}
.letterhead--read { padding-bottom: 14px; }
.letterhead--write .letterhead__stamp { border-color: var(--cat-gold); color: var(--cat-gold); background: rgba(200,155,90,0.08); }
.letterhead--write .letterhead__kind { color: var(--cat-gold); }
.letterhead--sketch .letterhead__stamp { border-color: var(--cat-clay); background: rgba(168,96,47,0.08); }
.letterhead--sketch .letterhead__kind { color: var(--cat-clay); }
.letterhead--letter .letterhead__stamp { border-color: var(--cat-wax); background: rgba(140,47,42,0.08); }
.letterhead--letter .letterhead__kind { color: var(--cat-wax); }

/* Notebook write/read */
.notebook__write {
  width: 100%;
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--f-type);
  font-size: 17px;
  line-height: 32px;
  color: var(--ink);
  min-height: 360px;
  padding: 4px 0;
  background-image:
    linear-gradient(to bottom, transparent 31px, var(--rule-soft) 31px, var(--rule-soft) 32px, transparent 32px);
  background-size: 100% 32px;
}
.notebook__write::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}
.notebook__write--letter {
  font-family: var(--f-script);
  font-size: 22px;
  line-height: 32px;
}
.notebook__read { padding: 8px 0 24px; }
.notebook__prose {
  font-family: var(--f-serif);
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 0;
}
.notebook__empty {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 320px;
  padding: 40px 20px;
}
.notebook__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.notebook__count {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Bottom menu bar */
.menubar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-top: 0;
  box-shadow:
    0 18px 40px -12px rgba(0,0,0,0.55),
    0 4px 10px rgba(0,0,0,0.35);
}
.menubar__btn {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(232,217,180,0.10);
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: rgba(232,217,180,0.55);
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.menubar__btn:last-child { border-right: 0; }
.menubar__btn:hover {
  color: var(--paper);
  background: rgba(232,217,180,0.06);
}
.menubar__btn--on {
  background: var(--paper);
  color: var(--ink);
}
.menubar__btn--on:hover {
  background: var(--paper);
  color: var(--ink);
}
.menubar__label {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.menubar__hint {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* Mode chips (legacy chips, unchanged) */
.chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip--on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Sketch pad */
.sketchpad-wrap {
  margin-top: 24px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(to bottom, transparent 23px, var(--rule-soft) 23px, var(--rule-soft) 24px, transparent 24px);
  background-size: 100% 24px;
}
.sketchpad {
  display: block;
  width: 100%;
  height: 320px;
  cursor: crosshair;
  /* Crucial for mobile: stop the browser from treating drags as scrolls/zooms
     and stop the OS from selecting nothing-in-particular. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
@media (max-width: 760px) {
  .sketchpad { height: 280px; }
}

/* Filed stamp animation */
.filed-stamp {
  position: absolute;
  top: 30%;
  left: 30%;
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.filed-stamp--show {
  opacity: 1;
  animation: filed-pop 1.6s ease-out;
}
@keyframes filed-pop {
  0% { transform: scale(2); opacity: 0; }
  20% { transform: scale(0.9); opacity: 1; }
  60% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* Desk foot */
.desk-foot {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #d6c89a;
  padding: 12px 4px;
}
.desk-foot .hand { color: #d6c89a; }
.desk-foot .script { color: #F3EAD7; }

@media (max-width: 1100px) {
  .desk-surface { padding: 60px 96px 60px 24px; min-height: 600px; }
  .desk-surface--single { padding: 56px 24px; }
  .desk-surface__rail { width: 56px; }
  .tray { right: 24px; width: 320px; }
  .coffee-ring { display: none; }
  .pen { display: none; }
  .cork__items { display: none; }
}
@media (max-width: 760px) {
  .desk-surface { padding: 24px 16px; }
  .desk-surface--single { padding: 24px 12px; }
  .desk-surface__rail { position: static; width: 100%; height: 56px; flex-direction: row; }
  .drawers { flex-direction: row; padding: 4px 0; gap: 4px; }
  .drawer { flex: 1; flex-direction: row; gap: 6px; height: 56px; padding: 0 8px; }
  .drawer__label { writing-mode: horizontal-tb; transform: none; }
  .tray { position: fixed; top: 60px; bottom: 60px; right: 8px; left: 8px; width: auto; }
  .journal { grid-template-columns: 1fr; }
  .journal__page { min-height: 400px; }
  .journal__spine { display: none; }
  .notebook__page { padding: 22px 18px 28px; }
  .menubar__hint { display: none; }
  .menubar__btn { padding: 12px 6px; }
  .letterhead__top { flex-direction: column; align-items: flex-start; }
}

/* ===== Manifesto — letter format ===== */
.mf-room {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(168,122,61,0.10), transparent 50%),
    var(--paper-deep);
  min-height: 100vh;
}
.mf-hero {
  min-height: 80vh;
  display: grid;
  place-items: center;
  padding: 80px 32px;
}
.mf-hero__envelope {
  background: var(--paper);
  max-width: 720px;
  padding: 60px 56px;
  text-align: center;
  position: relative;
  box-shadow:
    0 40px 80px -30px rgba(0,0,0,0.45),
    0 8px 20px -8px rgba(0,0,0,0.25),
    inset 0 0 0 1px rgba(31, 41, 55,0.08);
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(168,122,61,0.06), transparent 60%),
    var(--paper);
  animation: env-rise 1s cubic-bezier(.2,.7,.2,1);
}
@keyframes env-rise {
  from { transform: translateY(40px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.mf-hero__eyebrow { display: block; margin-bottom: 24px; }
.mf-hero__sender { margin: 8px 0 24px; }
.mf-hero__title {
  font-size: clamp(48px, 8vw, 110px);
  line-height: 0.95;
  margin: 0 0 24px;
}
.mf-hero__sub {
  font-style: italic;
  font-size: 20px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 auto 32px;
  max-width: 540px;
}
.mf-hero__divider {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}
.mf-hero__divider span {
  flex: 0 0 80px;
  height: 1px;
  background: var(--rule);
}

.mf-letter {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}
.mf-letter__head {
  margin-bottom: 60px;
  padding-bottom: 32px;
  border-bottom: 1px dashed var(--rule);
}
.mf-section {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
  margin-bottom: 80px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.mf-section.is-seen { opacity: 1; transform: translateY(0); }
.mf-section--flip { grid-template-columns: 1fr 1.4fr; }
.mf-section--flip .mf-section__body { order: 2; }
.mf-section--flip .mf-section__aside { order: 1; }
.mf-section__head {
  font-size: clamp(28px, 3.4vw, 44px);
  margin: 0 0 18px;
  letter-spacing: 0.02em;
}
.mf-section__p {
  font-size: 19px;
  line-height: 1.7;
  font-style: italic;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: pretty;
}
.mf-section__pull {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.3;
  margin: 24px 0 0;
  color: var(--ink);
  position: relative;
  display: inline-block;
}
.mf-section__sketch { position: relative; }
.mf-caption {
  display: block;
  text-align: center;
  font-size: 18px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.mf-section__photo { transform: rotate(-2.5deg); }
.mf-section--flip .mf-section__photo { transform: rotate(2deg); }

.mf-margin { display: inline-block; margin-left: 12px; }
.mf-margin--scribble {
  font-family: var(--f-hand);
  font-size: 22px;
  color: var(--ink);
}
.mf-margin--gold { color: var(--gold-deep); }
.mf-margin--arrow .hand {
  font-size: 22px;
  color: var(--ink);
  margin-left: 6px;
}

.wax-seal {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35));
  transform: rotate(-6deg);
}

.mf-section--close {
  grid-template-columns: 2fr 1fr;
  align-items: center;
  border-top: 1px dashed var(--rule);
  padding-top: 60px;
}

@media (max-width: 800px) {
  .mf-section, .mf-section--flip { grid-template-columns: 1fr; gap: 24px; }
  .mf-section--flip .mf-section__body, .mf-section--flip .mf-section__aside { order: 0; }
  .mf-hero__envelope { padding: 36px 24px; }
}

/* ===== Footer ===== */
.lg-foot {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 48px 32px 56px;
  background: var(--paper-deep);
  position: relative;
}
.lg-foot__inner {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 48px;
}
.lg-foot h4 {
  font-family: var(--f-display);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 14px 0;
}
.lg-foot p, .lg-foot a {
  font-family: var(--f-type);
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  display: block;
  margin: 4px 0;
}
.lg-foot a:hover { color: var(--ink); }

/* ===== utility ===== */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}
.container--narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 32px;
}
.container--read {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
}
.spacer-xl { height: 96px; }
.spacer-lg { height: 64px; }
.spacer-md { height: 40px; }
.spacer-sm { height: 24px; }

a { color: inherit; }
a.link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: color 0.2s;
}
a.link:hover { color: var(--gold-deep); }

/* ===== Moonlight (dark mode) ===== */
body[data-mode="moonlight"] .paper::before { opacity: 0.55 !important; }
body[data-mode="moonlight"] .paper::after {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 220, 150, 0.10), transparent 50%),
    radial-gradient(ellipse at top left, rgba(0,0,0,0.35), transparent 40%),
    radial-gradient(ellipse at bottom right, rgba(0,0,0,0.35), transparent 40%);
  opacity: 0.9;
}
body[data-mode="moonlight"] .lg-nav {
  background: rgba(26, 28, 31, 0.85);
}
body[data-mode="moonlight"] .desk {
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 220, 150, 0.12), transparent 60%),
    linear-gradient(180deg, #15171a, #1a1c1f);
}
body[data-mode="moonlight"] .stack-card {
  box-shadow:
    0 26px 50px -22px rgba(0,0,0,0.7),
    0 4px 14px -4px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(232, 217, 180, 0.06);
}
body[data-mode="moonlight"] .stack-card.tone-1 { background-color: #1a1c1f; }
body[data-mode="moonlight"] .stack-card.tone-2 { background-color: #1c1e21; }
body[data-mode="moonlight"] .stack-card.tone-3 { background-color: #1d1f23; }
body[data-mode="moonlight"] .stack-card.tone-4 { background-color: #1e2024; }
body[data-mode="moonlight"] .stack-card.tone-5 { background-color: #161819; }
body[data-mode="moonlight"] .stack-card.tone-6 { background-color: #1b1d20; }
body[data-mode="moonlight"] .photo-ph {
  background:
    repeating-linear-gradient(135deg, rgba(232,217,180,0.04) 0 8px, rgba(232,217,180,0.08) 8px 16px),
    linear-gradient(180deg, #2a2c2e, #1d1f22);
}
body[data-mode="moonlight"] .taped { background: #2a2c2e; }
body[data-mode="moonlight"] .stamp { background: rgba(26, 28, 31, 0.6); }
body[data-mode="moonlight"] .lg-foot { background: #15171a; }
body[data-mode="moonlight"] .btn:hover { color: var(--paper); }
body[data-mode="moonlight"] .btn-seal__mark { color: #15171a; }

/* ===== Field Desk — folders, pinned, save-as, notebook tabs ===== */

/* Pinned slot */
.pinned {
  --cat-color: var(--gold);
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px 18px 56px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--cat-color);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.pinned--empty {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 12px,
    rgba(168, 122, 61, 0.06) 12px 14px
  );
  border-left-color: var(--rule);
}
.pinned__pin {
  position: absolute;
  top: -10px;
  left: 22px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cat-color);
  color: var(--paper);
  border-radius: 50%;
  box-shadow: 0 4px 8px -2px rgba(31, 41, 55,0.4);
}
.pinned--empty .pinned__pin {
  background: var(--ink-faint);
}
.pinned__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--cat-color);
  border: 0;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--paper);
  white-space: nowrap;
}
.pinned__chip svg { color: var(--paper); }
.pinned__placeholder {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pinned__hint {
  font-style: italic;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.5;
}
.pinned__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pinned__title {
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
}
.pinned__preview {
  margin: 4px 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pinned__meta {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 4px;
}
.pinned__thumb {
  width: 80px;
  height: 60px;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pinned__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pinned__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  align-self: start;
}
.pinned__close:hover { color: var(--ink); }

/* Folder tabs — colored top nub + body card */
.folders {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.folder {
  --cat-color: var(--gold);
  position: relative;
  appearance: none;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: transform 0.18s, background 0.18s, box-shadow 0.18s;
  overflow: hidden;
}
.folder__nub {
  display: block;
  height: 8px;
  background: var(--cat-color);
}
.folder__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 14px 14px;
}
.folder::before { display: none; }
.folder__tab { display: none; }
.folder:hover {
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -10px rgba(31, 41, 55,0.35);
}
.folder--open {
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow:
    0 12px 28px -10px rgba(31, 41, 55,0.45),
    inset 0 -3px 0 var(--cat-color);
}
.folder--open .folder__nub { height: 14px; }
.folder__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: rgba(168,122,61,0.08);
  border: 1px solid var(--rule);
}
.folder__label {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--ink);
}
.folder__count {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 2px 8px;
  min-width: 28px;
  text-align: center;
}
.folder--open .folder__count {
  background: var(--cat-color);
  color: var(--paper);
  border-color: var(--cat-color);
}

/* Tray hint (added under tray header) */
.tray__hint {
  padding: 10px 20px 14px;
  border-bottom: 1px solid var(--rule-soft);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
}
.tray__actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* Notebook tabs (Write / Read / Sketch / Letter) */
.ntabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--rule);
}
.ntab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  padding: 10px 18px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, background 0.15s;
}
.ntab:hover { color: var(--ink-soft); background: rgba(168,122,61,0.06); }
.ntab--on {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--rule);
  border-bottom-color: var(--paper);
}

/* Save-as picker */
.saveas {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
}
.saveas .eyebrow {
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.saveas__btn {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-faint);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-rows: auto;
  column-gap: 10px;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  transition: transform 0.15s, background 0.15s;
}
.saveas__btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--paper-deep);
}
.saveas__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.saveas__btn > span:nth-of-type(1) {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.saveas__hint {
  grid-column: 2;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.saveas__btn--gold { border-left-color: var(--cat-gold); }
.saveas__btn--sage { border-left-color: var(--cat-sage); }
.saveas__btn--wax  { border-left-color: var(--cat-wax); }
.saveas__btn--gold:hover:not(:disabled) { background: rgba(200,155,90,0.12); }
.saveas__btn--sage:hover:not(:disabled) { background: rgba(125,139,106,0.12); }
.saveas__btn--wax:hover:not(:disabled)  { background: rgba(140,47,42,0.10); }

/* ===== Stamp picker (sketch-into-note) ===== */
.stamp-picker { position: relative; display: inline-block; }
.stamp-picker__trigger {
  display: inline-flex; align-items: center;
  border: 1px dashed var(--rule);
  background: var(--paper);
}
.stamp-picker__tray {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: min(640px, 92vw);
  max-height: 460px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 40px rgba(31, 41, 55,0.18), 0 4px 12px rgba(31, 41, 55,0.10);
  padding: 18px 20px 22px;
  z-index: 30;
  border-radius: 2px;
}
.stamp-picker__head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.stamp-picker__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stamp-picker__plate {
  appearance: none;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: 10px 8px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.stamp-picker__plate:hover {
  transform: translateY(-2px);
  background: var(--paper);
  border-color: var(--ink-soft);
}
.stamp-picker__plate-art {
  display: block; line-height: 0;
}
.stamp-picker__plate-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
body[data-mode="moonlight"] .stamp-picker__tray {
  background: #1c1e21;
  border-color: rgba(232,217,180,0.18);
}
body[data-mode="moonlight"] .stamp-picker__plate {
  background: #15171a;
  border-color: rgba(232,217,180,0.14);
}
body[data-mode="moonlight"] .stamp-picker__plate-label {
  color: rgba(232,217,180,0.7);
}
.inline-stamp {
  display: inline-block;
  vertical-align: middle;
  margin: 0 6px;
}

/* nudge published-entry article on Goat Notes — fresh saved entries glow */
.entry--saved .entry__num::after {
  content: "NEW";
  display: inline-block;
  margin-left: 8px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  background: var(--gold);
  color: var(--paper);
  padding: 2px 5px;
  vertical-align: middle;
  border-radius: 1px;
}

/* Location bar */
.locbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 8px 10px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
}
.locbar__geo {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.locbar__geo:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.locbar__in {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 6px 4px;
  font-family: var(--f-type);
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.locbar__in:focus {
  border-bottom-color: var(--ink);
}
.locbar__in--mono {
  font-family: var(--f-mono);
  font-size: 11px;
  width: 140px;
  color: var(--ink-soft);
}

/* Small button variant */
.btn--sm {
  padding: 6px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

body[data-mode="moonlight"] .pinned,
body[data-mode="moonlight"] .folder--open,
body[data-mode="moonlight"] .saveas__btn,
body[data-mode="moonlight"] .ntab--on {
  background: #1c1e21;
}
body[data-mode="moonlight"] .folder { background: #16181b; }
body[data-mode="moonlight"] .folder:hover { background: #1c1e21; }
body[data-mode="moonlight"] .locbar { background: #16181b; }
body[data-mode="moonlight"] .locbar__in { color: var(--paper); }

/* Moonlight — notebook contrast */
body[data-mode="moonlight"] .notebook__page {
  background: #1c1e21;
  background-image: radial-gradient(ellipse at 50% 50%, rgba(168,122,61,0.04), transparent 70%), #1c1e21;
}
body[data-mode="moonlight"] .notebook__write,
body[data-mode="moonlight"] .notebook__prose,
body[data-mode="moonlight"] .letterhead__title,
body[data-mode="moonlight"] .letterhead__title-static,
body[data-mode="moonlight"] .letterhead__line input {
  color: #e8d9b4;
  caret-color: #e8d9b4;
}
body[data-mode="moonlight"] .notebook__write::placeholder,
body[data-mode="moonlight"] .letterhead__title::placeholder,
body[data-mode="moonlight"] .letterhead__line input::placeholder {
  color: rgba(232,217,180,0.45);
}
body[data-mode="moonlight"] .letterhead { border-bottom-color: rgba(232,217,180,0.18); }
body[data-mode="moonlight"] .letterhead__line { border-bottom-color: rgba(232,217,180,0.12); }
body[data-mode="moonlight"] .letterhead__stamp { background: rgba(232,217,180,0.04); }
body[data-mode="moonlight"] .menubar { background: #0e1013; border-color: #0e1013; }
body[data-mode="moonlight"] .menubar__btn--on { background: #e8d9b4; color: #0e1013; }
body[data-mode="moonlight"] .pinned__title,
body[data-mode="moonlight"] .pinned__preview { color: #e8d9b4; }
body[data-mode="moonlight"] .pinned__hint { color: rgba(232,217,180,0.5); }
body[data-mode="moonlight"] .folder__label { color: #e8d9b4; }
body[data-mode="moonlight"] .folder__count { background: #0e1013; color: rgba(232,217,180,0.7); border-color: rgba(232,217,180,0.15); }
body[data-mode="moonlight"] .saveas__btn > span:nth-of-type(1) { color: #e8d9b4; }
body[data-mode="moonlight"] .tray { background: #1c1e21; }
body[data-mode="moonlight"] .tray__item-title { color: #e8d9b4; }
body[data-mode="moonlight"] .tray__item-preview { color: rgba(232,217,180,0.7); }
body[data-mode="moonlight"] .tray__hint { color: rgba(232,217,180,0.6); }
body[data-mode="moonlight"] .letterhead__kind { color: #e8d9b4; }
body[data-mode="moonlight"] .letterhead--write .letterhead__kind { color: var(--cat-gold); }
body[data-mode="moonlight"] .letterhead--sketch .letterhead__kind { color: var(--cat-clay); }
body[data-mode="moonlight"] .letterhead--letter .letterhead__kind { color: var(--cat-wax); }

/* ===== Desk top — pinned + daily prompt side by side ===== */
.desk-top {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}
.desk-top > .pinned { margin-bottom: 0; }

/* Daily prompt card — index card pinned to the desk */
.prompt-card {
  position: relative;
  background:
    repeating-linear-gradient(to bottom,
      transparent 0 23px,
      var(--rule-soft) 23px,
      var(--rule-soft) 24px),
    var(--paper);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--cat-clay);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow:
    0 14px 28px -16px rgba(31, 41, 55,0.45),
    inset 0 0 0 1px rgba(31, 41, 55,0.04);
  transform: rotate(0.4deg);
}
.prompt-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.prompt-card__date {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.prompt-card__text {
  margin: 0;
  font-family: var(--f-script);
  font-size: 22px;
  line-height: 1.35;
  color: var(--ink);
  flex: 1;
}
.prompt-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px dashed var(--rule);
  padding-top: 10px;
}
.prompt-card__corner {
  position: absolute;
  top: -4px; right: 14px;
  width: 14px; height: 18px;
  background:
    radial-gradient(circle at 50% 70%, rgba(31, 41, 55,0.55), rgba(31, 41, 55,0.2) 60%, transparent 70%),
    linear-gradient(180deg, #7a3a2a, #5a2a1f);
  clip-path: polygon(50% 0, 100% 50%, 100% 100%, 50% 90%, 0 100%, 0 50%);
}

body[data-mode="moonlight"] .prompt-card {
  background:
    repeating-linear-gradient(to bottom,
      transparent 0 23px,
      rgba(232,217,180,0.08) 23px,
      rgba(232,217,180,0.08) 24px),
    #1c1e21;
}
body[data-mode="moonlight"] .prompt-card__text { color: #e8d9b4; }
body[data-mode="moonlight"] .prompt-card__date { color: rgba(232,217,180,0.55); }

/* ===== Tag system ===== */
.tagpick {
  position: relative;
  margin: 10px 0 4px;
}
.tagpick__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
}
.tagpick__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tagpick__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
}
.tagpick__empty {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
}
.tagpick__add {
  appearance: none;
  background: transparent;
  border: 1px dashed var(--rule);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
}
.tagpick__add:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}
.tagpick__add:disabled { opacity: 0.4; cursor: not-allowed; }
.tagpick__pop {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 40px -12px rgba(31, 41, 55,0.45);
  padding: 12px 14px 14px;
}
.tagpick__search {
  width: 100%;
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  outline: none;
  padding: 6px 2px;
  margin-bottom: 10px;
  font-family: var(--f-serif);
  font-size: 14px;
  color: var(--ink);
}
.tagpick__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.tagpick__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}

.tagchip {
  --leather: #5a4128;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--leather);
  color: var(--leather);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tagchip:hover {
  background: rgba(90, 65, 40, 0.08);
}
.tagchip--on {
  background: var(--leather);
  color: var(--paper);
}
.tagchip--on:hover { background: var(--leather); }
.tagchip--read {
  cursor: default;
  font-size: 10px;
  letter-spacing: 0.18em;
}
.tagchip--tiny {
  font-size: 9px;
  padding: 3px 7px;
  letter-spacing: 0.14em;
}
.read-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tray__item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

/* Edit-after-publish */
.edit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(168, 96, 47, 0.10);
  border: 1px solid var(--cat-clay);
  border-left-width: 4px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cat-clay);
}
.edit-banner__cancel {
  margin-left: auto;
  appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.edit-banner__cancel:hover { color: var(--ink); }

/* Force readable input colors regardless of mode/edit state.
 * Spec says we want black-ink on paper in light, bone on dark in moonlight.
 * These rules win over the edit-banner orange tinting + any inherited weirdness.
 */
.notebook input,
.notebook textarea,
.notebook__write,
.letterhead__title,
.letterhead__line input,
.locbar__in,
.tagpick__search { color: var(--ink); }
.notebook input::placeholder,
.notebook textarea::placeholder,
.letterhead__title::placeholder,
.letterhead__line input::placeholder,
.tagpick__search::placeholder { color: var(--ink-faint); }
body[data-mode="moonlight"] .notebook input,
body[data-mode="moonlight"] .notebook textarea,
body[data-mode="moonlight"] .notebook__write,
body[data-mode="moonlight"] .letterhead__title,
body[data-mode="moonlight"] .letterhead__line input,
body[data-mode="moonlight"] .locbar__in,
body[data-mode="moonlight"] .tagpick__search { color: #e8d9b4; caret-color: #e8d9b4; }
body[data-mode="moonlight"] .notebook input::placeholder,
body[data-mode="moonlight"] .notebook textarea::placeholder,
body[data-mode="moonlight"] .letterhead__title::placeholder,
body[data-mode="moonlight"] .letterhead__line input::placeholder,
body[data-mode="moonlight"] .tagpick__search::placeholder { color: rgba(232,217,180,0.45); }

.reader-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
  flex-wrap: wrap;
}

/* =============================================================
 * PRIVACY NOTICE — Field Desk
 * Small stamped strip that lives between desk-head and content.
 * Always visible so visitors trust the writing surface.
 * ============================================================= */
.desk-privacy {
  margin: 8px 0 18px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, transparent, rgba(168, 122, 61, 0.04));
}
.desk-privacy__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.desk-privacy__stamp {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 4px 10px;
  background: var(--paper-deep);
  /* Tiny stamped feel — slightly off-true so it reads as inked-on, not pixel-perfect. */
  transform: rotate(-0.4deg);
}
.desk-privacy__line {
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  flex: 1;
}
.desk-privacy__how {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 8px;
  border-bottom: 1px dashed var(--ink-faint);
  transition: color 0.15s, border-color 0.15s;
}
.desk-privacy__how:hover { color: var(--ink); border-bottom-color: var(--ink); }
.desk-privacy__expand {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--paper-deep);
  border-left: 3px solid var(--gold);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.desk-privacy__expand p { margin: 0 0 10px; }
.desk-privacy__expand p:last-child { margin-bottom: 0; }
.desk-privacy__expand strong { color: var(--ink); }

body[data-mode="moonlight"] .desk-privacy {
  border-color: rgba(232, 217, 180, 0.18);
  background: linear-gradient(180deg, transparent, rgba(232, 217, 180, 0.04));
}
body[data-mode="moonlight"] .desk-privacy__stamp {
  color: var(--ink);
  background: rgba(232, 217, 180, 0.08);
  border-color: rgba(232, 217, 180, 0.45);
}
body[data-mode="moonlight"] .desk-privacy__expand {
  background: rgba(232, 217, 180, 0.06);
  border-left-color: var(--gold);
}

@media (max-width: 760px) {
  .desk-privacy__row { gap: 8px; }
  .desk-privacy__line { font-size: 13px; flex-basis: 100%; order: 3; }
  .desk-privacy__stamp { font-size: 9px; padding: 3px 8px; }
}

/* =============================================================
 * EXPORT MENU — "Take it with you"
 * Inline trigger button + portal-ish modal sheet. Used in the
 * desk header (bulk) and reader-actions (single entry).
 * ============================================================= */
.export-menu {
  position: relative;
  display: inline-flex;
}
.export-menu__trigger {
  /* inherits .btn--ghost styling */
}
.export-menu__scrim {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 55, 0.45);
  z-index: 998;
  animation: lg-fade-in 180ms ease;
}
.export-menu__sheet {
  position: fixed;
  z-index: 999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 0 22px 60px -20px rgba(31, 41, 55, 0.5),
              0 6px 18px -8px rgba(31, 41, 55, 0.25);
  animation: lg-fade-in 180ms ease;
}
.export-menu__head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--rule);
}
.export-menu__head .eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
}
.export-menu__hint {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}
.export-menu__list {
  padding: 8px 0;
}
.export-menu__item {
  appearance: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  padding: 14px 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s;
}
.export-menu__item:last-child { border-bottom: 0; }
.export-menu__item:hover { background: var(--paper-deep); }
.export-menu__item-label {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.export-menu__item-hint {
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--f-serif);
  font-style: italic;
}
.export-menu__item--power {
  background: linear-gradient(90deg, transparent, rgba(200, 154, 78, 0.06));
}
.export-menu__item--power .export-menu__item-label {
  color: var(--gold-deep);
}
.export-menu__foot {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
}

body[data-mode="moonlight"] .export-menu__sheet {
  background: var(--paper);
  border-color: rgba(232, 217, 180, 0.45);
}
body[data-mode="moonlight"] .export-menu__item:hover {
  background: rgba(232, 217, 180, 0.06);
}

@media (max-width: 760px) {
  .export-menu__sheet { width: 96vw; }
  .export-menu__head { padding: 18px 18px 14px; }
  .export-menu__item { padding: 14px 18px; }
}

body[data-mode="moonlight"] .tagpick__pop { background: #1c1e21; border-color: rgba(232,217,180,0.18); }
body[data-mode="moonlight"] .tagpick__search { color: #e8d9b4; border-bottom-color: rgba(232,217,180,0.18); }
body[data-mode="moonlight"] .tagchip { color: #e8d9b4; border-color: rgba(232,217,180,0.4); }
body[data-mode="moonlight"] .tagchip--on { color: #1c1e21; background: var(--leather); border-color: var(--leather); }
body[data-mode="moonlight"] .edit-banner { background: rgba(168, 96, 47, 0.16); }

/* =============================================================
 * READ SHELF — card list shown in the read pane
 * ============================================================= */
.readshelf {
  padding: 12px 0 16px;
}
.readshelf__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.readshelf__head-line { flex: 1; height: 1px; background: var(--rule); }
.readshelf__count {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.readshelf__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.readshelf__empty {
  padding: 60px 20px;
  text-align: center;
}
.readshelf__empty .hand {
  font-size: 24px;
  color: var(--ink-soft);
}

/* Card itself — looks like an index card with a colored top edge */
.readcard {
  --card-color: var(--cat-gold);
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--card-color);
  padding: 12px 14px 14px;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 0 rgba(31, 41, 55,0.06), 0 8px 18px -12px rgba(31, 41, 55,0.25);
  min-height: 130px;
}
.readcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 rgba(31, 41, 55,0.08), 0 14px 28px -14px rgba(31, 41, 55,0.35);
}
.readcard__nub {
  position: absolute;
  top: -3px; right: 16px;
  width: 22px; height: 8px;
  background: var(--card-color);
  opacity: 0.85;
}
.readcard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.readcard__kind {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--card-color);
  font-weight: 600;
}
.readcard__date {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}
.readcard__title {
  font-family: var(--f-display);
  font-size: 18px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
}
.readcard__preview {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.readcard__loc {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 6px;
  border-top: 1px dashed var(--rule);
}
.readcard__thumb {
  display: block;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  height: 72px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.readcard__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: contrast(1.1);
}

/* Folders for many entries */
.readshelf__folders {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.readshelf__group {
  border: 1px solid var(--rule);
  background: var(--paper);
}
.readshelf__folder {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.readshelf__folder:hover { background: var(--paper-deep); }
.readshelf__folder-tab {
  width: 6px; height: 22px;
  background: var(--cat-gold);
}
.readshelf__folder-month { flex: 1; }
.readshelf__folder-count {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}
.readshelf__group--open { border-color: var(--ink); }
.readshelf__group--open .readshelf__cards {
  padding: 4px 14px 14px;
}

/* Branded "esc" button on the Ritual modal — small dashed chip paired
   with the crumpled-paper icon. Replaces the generic ghost button. */
.lg-esc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--paper-deep);
  border: 1px dashed var(--rule);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lg-esc-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
body[data-mode="moonlight"] .lg-esc-btn {
  background: rgba(232, 217, 180, 0.06);
  color: rgba(232, 217, 180, 0.75);
  border-color: rgba(232, 217, 180, 0.28);
}
body[data-mode="moonlight"] .lg-esc-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #15171a;
}
.lg-discard-btn { display: inline-flex; align-items: center; }

/* Folder tray item header — flex layout so the trash icon never
   overlaps the title, and the title can wrap cleanly. */
.tray__item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.tray__item-head .tray__item-title {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.tray__icon-btn {
  appearance: none;
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px;
  line-height: 0;
  cursor: pointer;
  color: var(--ink-faint);
  border-radius: 2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tray__icon-btn:hover {
  color: var(--ink);
  background: var(--paper-deep);
  border-color: var(--rule);
}
body[data-mode="moonlight"] .tray__icon-btn { color: rgba(232, 217, 180, 0.55); }
body[data-mode="moonlight"] .tray__icon-btn:hover {
  color: #e8d9b4;
  background: rgba(232, 217, 180, 0.06);
  border-color: rgba(232, 217, 180, 0.18);
}

/* Welcome letter on the Field Desk — first-visit, dismissible.
   Styled like a real piece of paper laid on the desk: tape strips at
   the top, slight rotation, drop shadow, "from Lonesome Goat" sign-off. */
.desk-letter {
  position: relative;
  max-width: 740px;
  margin: 0 auto 36px;
  padding: 26px 38px 24px;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 36px -16px rgba(31, 41, 55, 0.32),
              0 4px 10px -2px rgba(31, 41, 55, 0.12);
  transform: rotate(-0.4deg);
}
.desk-letter::before,
.desk-letter::after {
  content: '';
  position: absolute;
  width: 86px;
  height: 18px;
  background: var(--tape);
  top: -8px;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.15);
}
.desk-letter::before { left: 36px; transform: rotate(-4deg); }
.desk-letter::after  { right: 36px; transform: rotate(3deg); }
.desk-letter__close {
  position: absolute;
  top: 10px;
  right: 12px;
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  color: var(--ink-faint);
  transition: color 0.15s;
}
.desk-letter__close:hover { color: var(--ink); }
.desk-letter__head { margin-bottom: 14px; }
.desk-letter__body {
  font-family: var(--f-serif);
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 16px;
  font-style: italic;
}
.desk-letter__body p { margin: 0 0 12px; }
.desk-letter__body strong {
  color: var(--ink);
  font-weight: 600;
  font-style: normal;
}
.desk-letter__sign {
  margin-top: 18px;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.desk-letter__hand {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--ink-soft);
  margin-right: 28px;
}
.desk-letter__sig {
  font-family: 'Homemade Apple', 'Caveat', cursive;
  font-size: 30px;
  color: var(--ink);
  display: inline-block;
  transform: rotate(-2deg);
  transform-origin: right center;
  line-height: 1;
}
body[data-mode="moonlight"] .desk-letter {
  background: #1a1c1f;
  border-color: rgba(232, 217, 180, 0.2);
}
body[data-mode="moonlight"] .desk-letter__body { color: rgba(232, 217, 180, 0.78); }
body[data-mode="moonlight"] .desk-letter__body strong { color: #e8d9b4; }
body[data-mode="moonlight"] .desk-letter__hand { color: rgba(232, 217, 180, 0.7); }
body[data-mode="moonlight"] .desk-letter__sig  { color: #e8d9b4; }

/* Back-to-shelf button on the reader — promoted to a real, tappable
   chip so it doesn't get lost in the surrounding paper. */
.reader-back {
  appearance: none;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 18px;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.reader-back:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
body[data-mode="moonlight"] .reader-back {
  background: rgba(232, 217, 180, 0.08);
  border-color: rgba(232, 217, 180, 0.3);
  color: #e8d9b4;
}
body[data-mode="moonlight"] .reader-back:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #15171a;
}

body[data-mode="moonlight"] .readcard { background: #1c1e21; border-color: rgba(232,217,180,0.16); }
body[data-mode="moonlight"] .readcard__title { color: #e8d9b4; }
body[data-mode="moonlight"] .readcard__thumb { background: #16181b; border-color: rgba(232,217,180,0.16); }
body[data-mode="moonlight"] .readshelf__group { background: #1c1e21; border-color: rgba(232,217,180,0.16); }
body[data-mode="moonlight"] .readshelf__folder { color: #e8d9b4; }
body[data-mode="moonlight"] .readshelf__folder:hover { background: #16181b; }

/* =============================================================
 * GOAT NOTES — archive page
 * ============================================================= */
.archive { background: var(--paper); }
.archive__head { padding: 64px 0 24px; }
.archive__rule {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 24px;
}
.archive__rule-line { flex: 1; height: 1px; background: var(--rule); }
.archive__title {
  font-size: clamp(56px, 10vw, 140px);
  margin: 0;
  line-height: 0.95;
}
.archive__lede {
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
  max-width: 640px;
  margin-top: 28px;
  text-wrap: pretty;
}

/* =============================================================
 * FOLDER RACK — Goat Notes tag filter
 * Each tag is a manila folder tab. Click to pull the folder forward
 * (toggle the tag). Multi-select fans multiple folders out. The "All
 * Notes" tab is the dark-stamped master at the left of the rack.
 * Replaces the previous Stripe-Press-style leather bookshelf, which
 * forced a tag→book mental model that never quite mapped.
 * ============================================================= */
.archive__rack { padding: 8px 0 28px; }
.archive__rack-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.archive__rack-hint {
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
}

.folder-rack {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 18px 0 0;
  border-bottom: 2px solid var(--ink);
}
.folder-rack::after {
  /* subtle desk-shadow under the rack edge */
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 6px;
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.18), transparent);
  pointer-events: none;
}

.folder-tab {
  appearance: none;
  position: relative;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--paper-deep);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  padding: 11px 14px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s, color 0.18s, box-shadow 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 1px 0 rgba(31, 41, 55, 0.06);
}
.folder-tab:hover {
  transform: translateY(-3px);
  background: var(--paper);
  color: var(--ink);
}
.folder-tab--active {
  transform: translateY(-8px);
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 -2px 0 var(--ink),
    0 4px 14px -6px rgba(31, 41, 55, 0.35);
}

/* Stamped colored swatch — preserves the leather color identity per tag */
.folder-tab__swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--leather, var(--gold));
  display: inline-block;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.folder-tab__count {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.folder-tab--active .folder-tab__count { color: var(--ink-soft); }

/* "All Notes" master tab — dark-stamped, sits at the left of the rack */
.folder-tab--all {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  letter-spacing: 0.22em;
  margin-right: 6px;
}
.folder-tab--all:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-3px);
}
.folder-tab--all .folder-tab__count { color: rgba(243, 234, 215, 0.65); }
.folder-tab--all .folder-tab__swatch { display: none; }
.folder-tab--all.folder-tab--active {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-8px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 -2px 0 var(--gold),
    0 4px 14px -6px rgba(31, 41, 55, 0.45);
}

/* Moonlight: tabs invert tonally, gold becomes the active-stamp color */
body[data-mode="moonlight"] .folder-tab {
  background: rgba(232, 217, 180, 0.06);
  color: rgba(232, 217, 180, 0.78);
  border-color: rgba(232, 217, 180, 0.18);
  box-shadow: none;
}
body[data-mode="moonlight"] .folder-tab:hover {
  background: rgba(232, 217, 180, 0.12);
  color: #f0e4c2;
}
body[data-mode="moonlight"] .folder-tab--active {
  background: rgba(232, 217, 180, 0.14);
  color: #f0e4c2;
  border-color: var(--gold);
  box-shadow:
    0 -2px 0 var(--gold),
    0 4px 14px -6px rgba(0, 0, 0, 0.55);
}
body[data-mode="moonlight"] .folder-tab--all {
  background: rgba(232, 217, 180, 0.92);
  color: #15171a;
  border-color: rgba(232, 217, 180, 0.92);
}
body[data-mode="moonlight"] .folder-tab--all:hover {
  background: rgba(232, 217, 180, 1);
  color: #15171a;
}
body[data-mode="moonlight"] .folder-tab--all .folder-tab__count {
  color: rgba(21, 23, 26, 0.55);
}
body[data-mode="moonlight"] .folder-rack { border-bottom-color: rgba(232, 217, 180, 0.45); }
body[data-mode="moonlight"] .folder-rack::after {
  background: linear-gradient(180deg, rgba(232, 217, 180, 0.18), transparent);
}

@media (max-width: 760px) {
  .folder-rack {
    gap: 4px;
    padding: 14px 0 0;
  }
  .folder-tab {
    font-size: 10px;
    padding: 10px 12px 12px;
    letter-spacing: 0.14em;
  }
  .folder-tab--all { letter-spacing: 0.18em; }
}
/* Multi-select chip rail — wraps when there are many tags */
.archive__active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.archive__active-chip {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--f-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f8de9e;
  background: var(--leather);
  padding: 6px 10px 6px 14px;
  box-shadow: inset 0 0 0 1px rgba(248,222,158,0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.15s;
}
.archive__active-chip:hover { opacity: 0.78; transform: translateY(-1px); }
.archive__active-clear {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-left: auto;
}
.archive__active-clear:hover { color: var(--ink); }


/* Search bar — typewriter rail */
.archive__search { padding: 18px 0 32px; }
.searchbar {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 4px;
  background:
    repeating-linear-gradient(to bottom,
      transparent 0 22px,
      rgba(31, 41, 55,0.04) 22px,
      rgba(31, 41, 55,0.04) 23px);
}
.searchbar__lead {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.searchbar__in {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  outline: none;
  padding: 4px 0;
  font-family: var(--f-script);
  font-size: 22px;
  color: var(--ink);
  caret-color: var(--ink);
}
.searchbar__in::placeholder {
  color: var(--ink-faint);
  font-style: italic;
  opacity: 0.7;
}
.searchbar__clear {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
}
.searchbar__clear:hover { color: var(--ink); }

/* Entry list */
.archive__list {
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
}
.entry {
  display: grid;
  grid-template-columns: 110px 1.4fr 1fr auto;
  gap: 32px;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  align-items: start;
  transition: background 0.2s;
}
.entry:hover { background: rgba(31, 41, 55,0.02); }
.entry--saved { cursor: default; }
.entry--saved:hover { background: transparent; }
.entry__num { font-size: 36px; line-height: 1; }
.entry__date { margin-top: 8px; }
.entry__cat { color: var(--clay); }
.entry__title {
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  margin: 8px 0 12px;
}
.entry__excerpt {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 18px;
  margin: 0;
  max-width: 600px;
  text-wrap: pretty;
}
.entry__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.entry__meta { padding-top: 8px; }
.entry__sketch { padding-top: 8px; }

.archive__empty {
  padding: 80px 0;
  text-align: center;
}
.archive__empty .hand {
  font-size: 28px;
  color: var(--ink-soft);
}

/* Moonlight overrides for archive */
body[data-mode="moonlight"] .archive { background: var(--paper); }
body[data-mode="moonlight"] .searchbar__in { color: #e8d9b4; caret-color: #e8d9b4; }
body[data-mode="moonlight"] .entry:hover { background: rgba(232,217,180,0.04); }



/* ===== Mobile ===== */
@media (max-width: 760px) {
  .lg-nav__inner {
    grid-template-columns: 1fr auto;
    padding: 12px 18px;
  }
  .lg-nav__links { display: none; }
  /* Long horizontal logo gets squished on phone widths — cap it small
     so it stays in proportion within the 1fr brand column. */
  .lg-nav__brand img {
    height: 38px;
    max-width: 60vw;
    object-fit: contain;
    object-position: left center;
  }
  /* Reveal the hamburger + drawer + scrim on mobile */
  .lg-nav__hamburger { display: inline-flex; }
  .lg-nav__drawer { display: block; }
  .lg-nav__scrim { display: block; }
  .container, .container--narrow, .container--read { padding: 0 18px; }
  .lg-foot__inner { grid-template-columns: 1fr; gap: 24px; }
  .ritual-page { width: 96vw; }
  .ritual-page__inner { padding: 28px 22px 22px; }
  .stack-wrap { height: 520px; }
  .stack-card { padding: 22px; }
  .prose { font-size: 16px; }
  .folders { grid-template-columns: 1fr 1fr; }
  .saveas { grid-template-columns: 1fr; }
  .locbar { grid-template-columns: 1fr; }
  .locbar__in--mono { width: 100%; }
  .pinned { grid-template-columns: 1fr; padding: 22px 18px 16px; }
  .desk-top { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr; gap: 12px; padding: 24px 0; }
  .entry__no { display: flex; align-items: baseline; gap: 12px; }
  .entry__sketch { display: none; }
  .archive__title { font-size: clamp(48px, 14vw, 96px); }

  /* Goat Note page: drop the Field Card sidebar below the body. The
     grid columns are set inline (220px 1fr), so we override with
     !important to win against the JSX style attribute. */
  .article-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .article-grid > aside {
    border-right: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
  }

  /* About page: collapse all the 2-up grids (creed, pillars, why,
     simplest version) to single column. Inline style → !important. */
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
  /* The "What we believe" 5-card orphan span — let it use the full width */
  .about-grid .creed-card[style*="grid-column"] {
    max-width: none !important;
  }

  /* Welcome letter on the Field Desk — tighter padding + smaller margin */
  .desk-letter {
    padding: 22px 22px 20px;
    margin: 0 8px 24px;
    transform: rotate(-0.3deg);
  }
  .desk-letter::before { left: 18px; }
  .desk-letter::after  { right: 18px; }
  .desk-letter__body { font-size: 15px; line-height: 1.6; }
  .desk-letter__sig  { font-size: 26px; }

  /* In-letterhead mode tabs — wrap, shrink, no horizontal scroll */
  .letterhead__modes { flex-wrap: wrap; padding: 3px; }
  .letterhead__mode { padding: 6px 9px; font-size: 9px; letter-spacing: 0.18em; }
  .letterhead__mode span { display: inline; }

  /* Inline hero photo on the home Latest Dispatch — keep tape strips
     inside the (now single-column, narrower) frame */
  .lg-hero-photo--inline::before { left: 12px; }
  .lg-hero-photo--inline::after  { right: 12px; }

  /* Sign-off on the Goat Note page — the inline whiteSpace: nowrap
     can overflow on narrow screens. Allow wrapping. */
  .article-grid .prose > div:last-child {
    padding-right: 0 !important;
  }

  /* Latest Dispatch headline — give it room to breathe */
  .home-latest__body h2 { font-size: clamp(36px, 8vw, 56px) !important; }
}

/* Very narrow phones — extra tightening for clutter-prone areas. */
@media (max-width: 480px) {
  .desk-letter { padding: 18px 18px 16px; }
  .desk-letter__head .eyebrow { font-size: 10px; }
  .lg-stamp-modal__head { padding: 14px 18px; }
  .lg-stamp-modal__grid { padding: 16px; gap: 12px; }
  /* Stamp modal: smallest viewport — give plates more room */
  .stamp-picker__plate { padding: 8px 6px 6px; }
  /* Letterhead grid rows: shrink the label column */
  .letterhead [style*="90px 1fr"] { grid-template-columns: 70px 1fr !important; }
}
