@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Parisienne&family=Pinyon+Script&family=Allura&family=Alex+Brush&family=Tangerine:wght@400;700&family=Sacramento&family=Petit+Formal+Script&family=Italianno&family=Mr+Dafoe&family=Mrs+Saint+Delafield&family=Herr+Von+Muellerhoff&family=Rouge+Script&family=Style+Script&family=Ms+Madi&family=Birthstone&family=Monsieur+La+Doulaise&family=League+Script&family=Lovers+Quarrel&family=Niconne&family=Clicker+Script&family=Yellowtail&family=Norican&family=WindSong&family=Caveat:wght@400;500;600;700&family=Dancing+Script:wght@400;500;600;700&family=Satisfy&family=Pacifico&family=Cookie&family=Courgette&family=Grand+Hotel&family=Kaushan+Script&family=Marck+Script&family=Damion&family=Shadows+Into+Light&family=Indie+Flower&family=Gloria+Hallelujah&family=Architects+Daughter&family=Patrick+Hand&family=Kalam&family=Gochi+Hand&family=Homemade+Apple&family=Reenie+Beanie&family=Nothing+You+Could+Do&family=La+Belle+Aurore&family=Comforter&family=Bilbo&family=Lobster&family=Lobster+Two&family=Permanent+Marker&family=Pattaya&family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400&family=EB+Garamond:ital@0;1&family=Libre+Baskerville&family=Poppins:wght@400;500&family=Montserrat:wght@400;500&family=Work+Sans:wght@400;500&family=Inter:wght@400;500;600&display=swap');

:root {
  --font-display: 'Dancing Script', cursive;
  --font-body: 'Caveat', cursive;
  --font-letter: 'Cormorant Garamond', serif;   /* same hand as the envelope */

  --paper: #ffffff;
  --paper-deep: #f3f3f4;
  --card: #ffffff;
  --ink: #1b1b1d;
  --ink-soft: #4d4d50;
  --ink-faint: #8b8b90;
  --rule: #e4e4e7;
  --envelope: #ffffff;
  --envelope-deep: #eef0f1;
  --env-fold: #e3e3e7;
  --env-crease: rgba(40, 40, 45, 0.16);
  --accent: #1b1b1d;
  --accent-soft: #6a6a70;
  --shadow: rgba(0, 0, 0, 0.12);

  /* base colour for the metallic button — set live by the Button colour panel */
  --btn: #F7CAD8;

  /* soft grey page background — lets the glass button & shadows read */
  --bg-grad: #f1f1f3;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

/* freeze background scrolling while a modal (reading popup / add panel) is open.
   Applied to both <html> and <body> since the document scrolls on <html>. */
.scroll-locked { overflow: hidden !important; }

body {
  margin: 0;
  overflow-x: hidden;     /* no sideways scroll from off-canvas panels / wide bits */
  background-color: #f1f1f3;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 23px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* soft circular gradient wash */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-grad);
  pointer-events: none;
}

.wrap { max-width: 1340px; margin: 0 auto; padding: 0 28px; }

/* ---------- Masthead ---------- */
.masthead {
  text-align: center;
  padding: 76px 28px 40px;
  position: relative;
}

.masthead .kicker {
  /* inline-flex so the label text and the odometer sit on one vertically
     centred line (vertical-align on the inline box was unreliable) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(56px, 11vw, 124px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  margin: 0;
}

/* stitched / embroidered masthead title */
.masthead-title { margin: 0; }
.stitched {
  display: block;
  width: 100%;            /* fit the padded masthead — 96vw overflowed on mobile */
  max-width: 940px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}
.stitched text {
  /* a THIN monoline script so each stroke is one row of crosses (not a thick block) */
  font-family: var(--font-stitch, 'Pinyon Script', cursive);
  font-weight: 400;
  font-size: 168px;
  text-anchor: middle;
  fill: url(#xstitch);               /* letters filled with little cross-stitches */
  /* a soft thread-on-fabric lift */
  filter: drop-shadow(0.5px 1px 0.5px rgba(0, 0, 0, 0.18));
}
/* the two crossing strands of each stitch */
.stitched .xs {
  fill: none;
  stroke-linecap: round;
  stroke-width: var(--stitch-weight, 1.5);
}
.stitched .xs-back  { stroke: var(--stitch-back, var(--accent-soft)); }   /* under strand, lighter */
.stitched .xs-front { stroke: var(--stitch-front, var(--accent)); }       /* over strand, darker */

.masthead .tagline {
  font-family: 'Inter', sans-serif;
  font-size: clamp(13px, 1.5vw, 15.5px);
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: none;
  white-space: nowrap;        /* keep the whole subheadline on one line */
  margin: 22px auto 0;
}
/* on narrow screens, let it wrap rather than overflow */
@media (max-width: 700px) {
  .masthead .tagline { white-space: normal; max-width: 360px; }
}

/* inline with the kicker, so it reads "A Collection Of 15" */
.masthead .meta {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 5px;
}
.counter {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
/* analogue odometer — rolling digit reels */
.odometer {
  display: inline-flex;
  gap: 2px;
}
.odo-digit {
  position: relative;
  /* content-box so the inner window equals the cell height exactly — with the
     global border-box, the 1px borders would shrink the window and push the
     digit off-centre / clip it against the 22px roll step */
  box-sizing: content-box;
  width: 15px;
  height: 22px;          /* must equal .odo-cell height (and JS ODO_CELL) */
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffffff 0%, #eeeef0 100%);
  border: 1px solid var(--rule);
}
/* the split-flap centre seam — the analogue tell */
.odo-digit::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.12);
  z-index: 2;
}
.odo-reel {
  display: flex;
  flex-direction: column;
  width: 100%;            /* fill the digit box so cells centre across full width */
  transition: transform 1.05s cubic-bezier(0.16, 0.84, 0.24, 1);
  will-change: transform;
}
.odo-cell {
  height: 22px;          /* must equal .odo-digit height (and JS ODO_CELL) */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;        /* flex centres the compact line box in the cell */
  letter-spacing: 0;     /* kill the kicker's 0.32em tracking — it shoved each digit left */
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.counter-label {
  display: none;            /* inline number only — no "love letters collected" */
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  line-height: 1.25;
}

/* ---------- Controls ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(7px);
  padding: 18px 0;
}

.controls .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 10px;
  justify-content: center;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.chip {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent-soft); color: var(--accent); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.search {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 16px;
  width: 230px;
  outline: none;
  transition: border-color 0.18s ease;
}
.search:focus { border-color: var(--accent-soft); }
.search::placeholder { color: var(--ink-faint); }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 68px 60px;            /* room for the outside scallop frames */
  padding: 54px 4px 44px;
  align-items: start;
}

/* ---------- Envelope ---------- */
.env { position: relative; }
/* an opened letter rises above its neighbours */
.env.open { z-index: 50; }

.env-card {
  position: relative;
  height: 188px;             /* wide, landscape envelope */
  cursor: pointer;
  /* pre-promote each card to its own layer so the ::after cross-stitch frame
     paints on first render; `border-image … round` can otherwise drop on a
     fractionally-sized grid column until a repaint (e.g. hover) forces it */
  will-change: transform;
  /* a whisper-thin envelope flap: two creases meeting in a V */
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20200%20100'%20preserveAspectRatio='none'%3E%3Cpath%20d='M0%200%20L100%2058%20L200%200'%20fill='none'%20stroke='%231b1b1d'%20stroke-opacity='0.06'%20stroke-width='0.6'%20vector-effect='non-scaling-stroke'/%3E%3C/svg%3E")
      top center / 100% 100% no-repeat,
    var(--envelope);
  border: none;
  border-radius: 0;
  transition: transform 0.2s ease;
}
/* scalloped cross-stitch lace frame, sitting OUTSIDE the envelope */
.env-card::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 12px solid transparent;
  border-image: url("stitch-border.svg") 10 round;
  pointer-events: none;
}
.env:not(.open) .env-card:hover { transform: translateY(-3px); }
.env-card:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

/* centred address block: To: … / from: … */
.env-address {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 7px;
  padding: 20px 26px;
  transition: opacity 0.3s ease;
}
.env-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
}
.env-lbl {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.env-place {
  font-family: 'Cormorant Garamond', serif;
  font-size: 25px;
  line-height: 1.18;
  color: var(--ink-soft);
  overflow-wrap: anywhere;   /* wrap long names instead of clipping */
}
.env-author {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  line-height: 1.18;
  color: var(--ink-faint);
  overflow-wrap: anywhere;   /* wrap instead of cutting off */
}
.env-where {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: -2px;
}
.env.open .env-address { opacity: 0; pointer-events: none; }

/* the letter — hidden popover that fades up over the envelope, growing to fit */
.letter {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 100%;
  z-index: 9;
  background: var(--envelope);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(6px) scale(0.99);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.env.open .letter {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* link letter: full title (never clipped) + the link */
.letter--link { text-align: center; }
.letter .l-title {
  font-family: var(--font-letter);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
  color: var(--ink);
}
.letter .read {
  align-self: center;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}
.letter .read:hover { opacity: 0.6; }

/* "Share with a friend" — quiet pill that echoes the .read link */
.l-share {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--btn);                  /* same pink as the "Add a love letter" button */
  background: none;
  border: 1px solid var(--btn);       /* pink outline */
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.l-share:hover { background: var(--btn); color: color-mix(in srgb, var(--btn) 42%, #190610); }
.l-share .share-ico { width: 12px; height: 12px; }
/* the popup variant sits under a long letter, centred */
.read-share { margin: 18px auto 4px; }

/* transient confirmation toast (e.g. "link copied") */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  background: var(--ink, #1b1b1d);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* written letter: the whole thing, scroll if it's long */
.letter--written {
  justify-content: flex-start;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.letter .l-head {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.letter .l-lbl {
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 4px;
}
.letter .l-letter {
  font-family: var(--font-letter);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;        /* keep the writer's line breaks */
}
.letter .l-sign {
  font-family: var(--font-letter);
  font-size: 16px;
  color: var(--ink-soft);
  align-self: flex-end;
}

.empty {
  text-align: center;
  font-style: italic;
  color: var(--ink-faint);
  padding: 80px 0;
  font-size: 26px;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 56px 28px 70px;
  border-top: 1px solid var(--rule);
  margin-top: 30px;
}
footer .ornament { color: var(--accent-soft); font-size: 22px; margin-bottom: 18px; }
footer p {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin: 6px 0;
}

/* ---------- Font panel ---------- */
.font-toggle {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 60;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.18s ease, background 0.18s ease;
}
.font-toggle:hover { transform: translateY(-2px); background: var(--accent-soft); }
.font-toggle .glyph { font-size: 15px; }

.font-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.30);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
}
.font-overlay.open { opacity: 1; pointer-events: auto; }

.font-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 360px;
  max-width: 90vw;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 80;
  display: flex;
  flex-direction: column;
}
.font-panel.open { transform: translateX(0); }

.fp-head {
  padding: 26px 26px 18px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.fp-head .fp-title {
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 1;
  margin: 0;
}
.fp-head .fp-sub {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-top: 6px;
}
.fp-close {
  position: absolute;
  top: 22px;
  right: 22px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.18s ease;
}
.fp-close:hover { color: var(--accent); }

.fp-targets {
  display: flex;
  gap: 6px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.fp-target {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 9px 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fp-target small {
  display: block;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin-top: 2px;
}
.fp-target.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.fp-target.active small { color: rgba(255,255,255,0.7); }

.fp-list { overflow-y: auto; padding: 12px 16px 90px; flex: 1; }
.fp-group {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 18px 12px 8px;
}
.fp-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.25;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.fp-item:hover { background: var(--paper-deep); }
.fp-item.active { border-color: var(--accent-soft); background: var(--paper-deep); }
.fp-item .fp-name-label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-top: -2px;
}

.fp-foot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 26px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fp-reset {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fp-reset:hover { color: var(--accent); }
.fp-count {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---------- Gradient settings panel ---------- */
.grad-toggle {
  position: fixed;
  bottom: 26px;
  left: 26px;
  z-index: 60;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.grad-toggle:hover { transform: translateY(-2px); border-color: var(--accent-soft); }
.grad-toggle .gswatch {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-grad);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.grad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.30);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
}
.grad-overlay.open { opacity: 1; pointer-events: auto; }

.grad-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 340px;
  max-width: 90vw;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.grad-panel.open { transform: translateX(0); }

.gp-head {
  padding: 26px 26px 18px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.gp-head .gp-title { font-family: var(--font-display); font-size: 38px; line-height: 1; margin: 0; }
.gp-head .gp-sub {
  font-family: 'Inter', sans-serif; font-size: 11.5px; letter-spacing: 0.04em;
  color: var(--ink-faint); margin-top: 6px;
}
.gp-close {
  position: absolute; top: 22px; right: 22px;
  background: none; border: none; font-size: 26px; line-height: 1;
  color: var(--ink-faint); cursor: pointer; transition: color 0.18s ease;
}
.gp-close:hover { color: var(--accent); }

.gp-body { padding: 20px 26px 30px; }

.gp-preview {
  height: 70px; border-radius: 12px; border: 1px solid var(--rule);
  background: var(--bg-grad); margin-bottom: 22px;
}

.gp-section {
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
  margin: 22px 0 12px;
}

.gp-types { display: flex; gap: 6px; }
.gp-type {
  flex: 1; font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; padding: 9px 10px; cursor: pointer; transition: all 0.18s ease;
}
.gp-type.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.gp-stop {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.gp-stop input[type="color"] {
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--rule);
  border-radius: 10px; background: none; cursor: pointer; flex-shrink: 0;
}
.gp-stop input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.gp-stop input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
.gp-stop .gp-stop-body { flex: 1; }
.gp-stop .gp-stop-label {
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.03em; color: var(--ink-soft); display: flex; justify-content: space-between;
}
.gp-stop .gp-stop-label span { color: var(--ink-faint); font-weight: 400; }

input[type="range"].gp-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  border-radius: 999px; background: var(--rule); outline: none; margin-top: 8px;
}
input[type="range"].gp-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 1px 4px var(--shadow);
}
input[type="range"].gp-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  cursor: pointer; border: 2px solid #fff;
}

.gp-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.gp-row .gp-row-label {
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; color: var(--ink-soft);
}
.gp-row .gp-row-val { font-family: 'Inter', sans-serif; font-size: 11px; color: var(--ink-faint); }

.gp-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gp-preset {
  height: 46px; border-radius: 10px; border: 1px solid var(--rule); cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.gp-preset:hover { transform: translateY(-2px); border-color: var(--accent-soft); }

.gp-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule);
}
.gp-reset {
  font-family: 'Inter', sans-serif; font-size: 12px; color: var(--ink-soft);
  background: none; border: none; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.gp-reset:hover { color: var(--accent); }
.gp-copy {
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 600; color: var(--paper);
  background: var(--accent); border: none; border-radius: 999px; padding: 9px 16px; cursor: pointer;
}
.gp-copy:hover { background: var(--accent-soft); }

/* ---------- Stitching panel (reuses .grad-panel / .gp-* styles) ---------- */
.stitch-toggle {
  position: fixed;
  bottom: 78px;
  right: 26px;
  left: auto;
  z-index: 60;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.stitch-toggle:hover { transform: translateY(-2px); border-color: var(--accent-soft); }
.stitch-toggle .st-icon { color: var(--accent); font-size: 14px; }

/* slide in from the right instead of the left */
.stitch-panel {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
}
.stitch-panel.open { transform: translateX(0); }

.st-preview {
  display: block;
  width: 100%;
  height: 70px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-deep);
  margin-bottom: 22px;
}
.st-select {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  outline: none;
}
.st-select:focus { border-color: var(--accent-soft); }

/* ---------- Add a love letter ---------- */
/* REAL liquid glass: a silvery gradient lives UNDER the button, and the button
   refracts + frosts it (SVG displacement + backdrop blur) so it bends like glass */
.add-stage {
  position: relative;
  display: inline-block;
  margin-top: 34px;
  border-radius: 999px;
  box-shadow: 0 12px 26px -8px rgba(110,114,140,0.40), 0 3px 8px rgba(110,114,140,0.22);
}
.add-trigger {
  position: relative;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--btn) 42%, #190610);
  /* metallic CSS: gloss + reflection over a body derived from --btn */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.5) 16%, rgba(255,255,255,0) 44%),  /* gloss */
    radial-gradient(120% 70% at 50% -8%, rgba(255,255,255,0.9), rgba(255,255,255,0) 44%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--btn) 28%, white) 0%,
      color-mix(in srgb, var(--btn) 82%, white) 38%,
      color-mix(in srgb, var(--btn) 78%, #2a1018) 74%,
      color-mix(in srgb, var(--btn) 48%, white) 100%);
  border: 1px solid color-mix(in srgb, var(--btn) 70%, #3a1622);
  border-radius: 999px;
  padding: 17px 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),             /* lit top edge */
    inset 0 -3px 6px rgba(140,70,52,0.32),            /* warm base shade */
    0 9px 20px -3px rgba(165,100,84,0.38),            /* drop */
    0 2px 5px rgba(90,45,32,0.14);
  transition: transform 0.18s ease, box-shadow 0.22s ease;
}
/* soft specular rim — the lit top edge of the metal */
.add-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow:
    inset 0 2px 1px rgba(255,255,255,1),
    inset 0 0 6px rgba(255,255,255,0.55),
    inset 0 -2px 2px rgba(165,100,84,0.4);
  pointer-events: none;
}
/* press down on hover (no lift, so the warm drop-shadow never peeks out);
   the drop shadow tightens to sell the "pushed in" feel */
.add-trigger:hover {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -3px 6px rgba(140,70,52,0.32),
    0 4px 10px -3px rgba(165,100,84,0.34),
    0 1px 3px rgba(90,45,32,0.14);
}
.add-trigger:active { transform: translateY(3px); }
.add-trigger span { font-size: 13px; }
/* inline SVG heart — same flat shape + colour on every browser/OS (no emoji) */
.heart-ico { width: 1.1em; height: 1.1em; flex: 0 0 auto; vertical-align: -0.15em; }

.add-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.34);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}
.add-overlay.open { opacity: 1; pointer-events: auto; }

/* the composer reads like an envelope: same paper + scalloped stitch frame */
.add-panel {
  position: fixed;
  top: 50%; left: 50%;
  width: min(680px, calc(100vw - 64px));
  /* landscape, envelope-ish, but tall enough to hold the form without
     scrolling — only scrolls if the form is taller than the viewport */
  height: min(720px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--envelope);
  border: none;
  border-radius: 0;
  z-index: 105;
  transform: translate(-50%, -48%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1, 0.4, 1);
}
.add-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.add-panel::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 12px solid transparent;
  border-image: url("stitch-border.svg") 10 round;
  pointer-events: none;
}
/* the interior fills the envelope; scrolls if content outgrows the panel */
.add-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px 40px 30px;
}

.add-close {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 2;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.18s ease;
}
.add-close:hover { color: var(--accent); }

.add-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 38px;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.add-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-faint);
  margin: 6px 0 18px;
}

/* two-way mode toggle */
.add-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}
.add-mode {
  flex: 1;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.add-mode .am-icon { font-size: 14px; margin-right: 5px; }
.add-mode small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 3px;
}
.add-mode:hover { border-color: var(--accent-soft); }
.add-mode.active {
  border-color: var(--accent);
  background: #efeff1;
  color: var(--accent);
}
.add-mode.active small { color: var(--accent-soft); }

/* show only the fields for the chosen mode (ids to beat #addForm label specificity) */
#addForm .f-link, #addForm .f-write { display: none; }
.add-panel.mode-link #addForm .f-link { display: block; }
.add-panel.mode-write #addForm .f-write { display: block; }
/* review fields appear only after a link has been read */
.add-panel.mode-link:not(.found) #addForm .f-found { display: none; }
.f-hint { display: block; margin-top: 6px; color: var(--ink-soft, #8a8278); font-size: 12px; font-style: italic; }
.add-panel.found #addForm .f-hint { display: none; }
/* optional auto-fill button under the link field */
.link-read-row { margin: -4px 0 4px; }
.link-read-btn {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.link-read-btn:hover { border-color: var(--accent-soft); color: var(--accent); }
.link-read-btn:disabled { opacity: 0.6; cursor: default; }
.link-read-btn span { margin-right: 4px; }

#addForm label {
  display: block;
  position: relative;          /* anchor for the char counter */
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
#addForm label i { color: var(--accent); font-style: normal; }
#addForm label small {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 14px;
}
#addForm input,
#addForm textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-family: 'Cormorant Garamond', serif;   /* match the envelope's hand */
  font-size: 19px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 13px;
  outline: none;
  transition: border-color 0.18s ease;
}
#addForm textarea { resize: vertical; line-height: 1.45; }
/* the link field is a URL — keep it legible in plain type */
#addForm input[name="url"] { font-family: 'Inter', sans-serif; font-size: 14px; }

/* live character countdown — top-right, on the label's text line */
#addForm .char-count {
  position: absolute;
  right: 0; top: 0;
  height: 23px;                 /* ≈ the 19px label's first line box */
  display: inline-flex;
  align-items: center;          /* centre the small text on the label line */
  font-family: 'Inter', sans-serif;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}
#addForm .char-count.warn { color: #b07a16; }   /* amber as you near the cap */
#addForm .char-count.over { color: #c0392b; font-weight: 600; }   /* over the cap */
#addForm input:focus,
#addForm textarea:focus { border-color: var(--accent-soft); }

.add-error {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 12px;
}
.add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.add-cancel, .add-submit {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.add-cancel { background: transparent; border: 1px solid var(--rule); color: var(--ink-soft); }
.add-cancel:hover { border-color: var(--accent-soft); color: var(--accent); }
.add-submit { background: var(--accent); border: 1px solid var(--accent); color: var(--paper); }
.add-submit:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* remove button on a visitor's own letter */
.env-del {
  position: absolute;
  top: 7px; left: 9px;
  z-index: 8;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-faint);
  font-size: 15px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.env-card:hover .env-del { opacity: 1; }
/* in admin mode keep the delete buttons visible (touch devices have no hover) */
body.admin-mode .env-del { opacity: 1; }
.env-del:hover { color: var(--accent); background: #fff; }
.env.open .env-del { opacity: 0; pointer-events: none; }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 56px 44px; }
}
@media (max-width: 600px) {
  body { font-size: 18px; }
  .masthead { padding: 52px 22px 32px; }
  /* one column; row gap must clear the scallop frames (15px outside each card) */
  .grid { grid-template-columns: 1fr; gap: 46px; padding: 36px 0 24px; }
  .env-card { height: 168px; }
  .search { width: 100%; }
  .font-toggle { bottom: 18px; right: 18px; }
  .add-panel { height: auto; min-height: 0; }
  .add-sheet { padding: 30px 24px 26px; }
}

/* ---------- Background-colour picker ---------- */
.bg-toggle {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 60;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
  transition: transform 0.18s ease;
}
.bg-toggle:hover { transform: translateY(-2px); }
.bg-dot {
  width: 14px; height: 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg-grad);
}

.bg-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,22,0.28);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
}
.bg-overlay.open { opacity: 1; pointer-events: auto; }

.bg-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: 300px; max-width: 88vw;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
}
.bg-panel.open { transform: translateX(0); }
.bg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--rule);
}
.bg-title { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; margin: 0; color: var(--ink); }
.bg-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--ink-faint); cursor: pointer; }
.bg-close:hover { color: var(--accent); }

.bg-swatches {
  overflow-y: auto;
  padding: 16px 16px 40px;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
}
.bg-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.bg-swatch:hover { background: var(--paper-deep); }
.bg-swatch.active { border-color: var(--accent); }
.bg-chip {
  width: 100%;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--rule);
}
.bg-name {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.bg-swatch.active .bg-name { color: var(--ink); font-weight: 600; }

/* ---------- Love letter chains ---------- */

/* small thread badge on the envelope of a letter that others have replied to */
.env-thread {
  position: absolute;
  top: -9px; right: -9px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px 2px 5px;
  background: var(--envelope);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--ink-soft);
  box-shadow: 0 2px 6px var(--shadow);
}
.env-thread i { font-style: normal; font-weight: 600; color: var(--ink); }

/* the chain footer inside an opened letter */
.l-chain {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.l-chain button {
  font-family: 'Inter', sans-serif;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

/* "Inspired by …" — the parent of this letter */
.chain-up {
  font-size: 12px;
  color: var(--ink-soft);
  align-self: flex-start;
  transition: color 0.18s ease;
}
.chain-up em { font-style: normal; font-weight: 600; color: var(--ink); }
.chain-up:hover { color: var(--ink); }

/* "N letters were sewn to this" — the children */
.chain-kids { display: flex; flex-direction: column; gap: 5px; }
.chain-kids-lbl {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.chain-goto {
  font-size: 13px;
  color: var(--ink-soft);
  padding-left: 14px !important;
  position: relative;
  transition: color 0.18s ease;
}
.chain-goto::before {
  content: "";
  position: absolute;
  left: 3px; top: 0.7em;
  width: 7px; height: 1px;
  background: var(--rule);
}
.chain-goto em { font-style: normal; color: var(--ink); }
.chain-goto:hover { color: var(--ink); }

/* "Add to this chain" — the call to write a reply */
.chain-add {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent) !important;
  border-bottom: 1px solid var(--accent-soft) !important;
  padding-bottom: 2px !important;
  transition: opacity 0.18s ease;
}
.chain-add:hover { opacity: 0.6; }

/* banner at the top of the composer when sewing a reply onto another letter */
.chain-banner { display: none; }
.add-panel.replying .chain-banner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.chain-banner .cb-knot { color: var(--ink-soft); flex-shrink: 0; }
.chain-banner .cb-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.chain-banner .cb-place { color: var(--ink); }
.chain-banner .cb-from { color: var(--ink-faint); }

/* a reply is always written in your own words — hide the mode toggle */
.add-panel.replying .add-modes { display: none; }

/* ---------- Reading popup (long written letters) ---------- */
.read-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.34);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}
.read-overlay.open { opacity: 1; pointer-events: auto; }

/* styled to read like a scaled-up envelope: same paper, same scalloped
   cross-stitch frame, same To/from address treatment */
.read-modal {
  position: fixed;
  top: 50%; left: 50%;
  width: min(540px, calc(100vw - 64px));
  background: var(--envelope);
  border: none;
  border-radius: 0;
  z-index: 105;
  transform: translate(-50%, -48%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1, 0.4, 1);
}
.read-modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
/* the same scalloped lace frame that sits outside the envelopes */
.read-modal::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 12px solid transparent;
  border-image: url("stitch-border.svg") 10 round;
  pointer-events: none;
}

.read-close {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 2;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.18s ease;
}
.read-close:hover { color: var(--accent); }

/* the interior scrolls; the frame stays put around it */
.read-sheet {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 40px 44px 38px;
}

/* centred To / from, mirroring the envelope front */
.read-address {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.read-line { display: flex; align-items: baseline; gap: 8px; max-width: 100%; }
.read-lbl {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.read-place {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  line-height: 1.18;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.read-author {
  font-family: 'Cormorant Garamond', serif;
  font-size: 21px;
  line-height: 1.18;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
.read-body {
  font-family: var(--font-letter);
  font-size: 22px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;        /* keep the writer's line breaks */
}

/* ---------- Solo page: one shared letter on its own ---------- */
.solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  width: 100%;
  max-width: 560px;
  margin: 8px auto 64px;
  padding: 0 18px;
}
/* in solo mode, the collection grid and the masthead's add/counter step aside */
body.solo-mode .grid,
body.solo-mode .add-stage,
body.solo-mode .kicker { display: none; }

.solo-sheet {
  position: relative;
  width: 100%;
  background: var(--envelope);
  padding: 44px 44px 38px;
}
/* the same scalloped lace frame the envelopes and reading popup use */
.solo-sheet::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 12px solid transparent;
  border-image: url("stitch-border.svg") 10 round;
  pointer-events: none;
}
.solo-title {
  font-family: var(--font-letter);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  text-align: center;
  margin: 0 0 18px;
  color: var(--ink);
}
.solo-read { display: block; text-align: center; margin: 0 auto; width: fit-content; }
.solo-note {
  font-family: var(--font-letter);
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 22px 0 0;
  text-align: center;
}
.solo-actions { display: flex; justify-content: center; margin-top: 30px; }
.solo-all {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}
.solo-all:hover { opacity: 0.6; }

/* ---------- Button-colour panel ---------- */
.bc-toggle {
  position: fixed;
  bottom: 22px; right: 152px;
  z-index: 60;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--ink);
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
  transition: transform 0.18s ease;
}
.bc-toggle:hover { transform: translateY(-2px); }
.bc-dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--btn) 40%, white), color-mix(in srgb, var(--btn) 80%, #2a1018));
  border: 1px solid color-mix(in srgb, var(--btn) 70%, #3a1622);
}
.bc-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,22,0.28);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
}
.bc-overlay.open { opacity: 1; pointer-events: auto; }
.bc-panel {
  position: fixed; top: 0; right: 0;
  height: 100%; width: 320px; max-width: 88vw;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
}
.bc-panel.open { transform: translateX(0); }
.bc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 22px 16px; border-bottom: 1px solid var(--rule);
}
.bc-title { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; margin: 0; color: var(--ink); }
.bc-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--ink-faint); cursor: pointer; }
.bc-close:hover { color: var(--accent); }
.bc-body { padding: 18px 22px 40px; overflow-y: auto; }
.bc-sub { font-family: 'Inter', sans-serif; font-size: 12px; color: var(--ink-faint); margin: 0 0 18px; line-height: 1.5; }
.bc-pick {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Inter', sans-serif; font-size: 13px; color: var(--ink-soft);
  margin-bottom: 8px;
}
.bc-pick input[type="color"] {
  width: 46px; height: 36px; padding: 0;
  border: 1px solid var(--rule); border-radius: 8px;
  background: none; cursor: pointer;
}
.bc-pick small { display: block; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.bc-section {
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint);
  padding: 22px 0 10px;
}
.bc-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.bc-swatch {
  aspect-ratio: 1; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.7), 0 2px 5px rgba(0,0,0,0.14);
  transition: transform 0.15s ease;
}
.bc-swatch:hover { transform: scale(1.1); }
.bc-swatch.active { border-color: var(--ink); }
.bc-reset {
  margin-top: 26px;
  font-family: 'Inter', sans-serif; font-size: 12px; letter-spacing: 0.03em;
  color: var(--ink-soft); background: none; border: none;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.bc-reset:hover { color: var(--accent); }
