/*
 * Paper Deck — design system for trillionwishes.com
 * Aesthetic: kraft/linen paper, cards as index-card-stack,
 * wax-seal stamps, postmark detail, cork pinboard, typewriter generator,
 * envelope 404.
 *
 * Mirrors the Claude Design handoff in trillionwishes-2/.
 * Loaded standalone; no Bootstrap.
 */

:root {
  --kraft: #e8dfcc;
  --kraft-deep: #d8cdb4;
  --linen: #f1e9d6;
  --paper: #f6efe1;
  --paper-warm: #f4ecdb;
  --ink: #1c1610;       /* near-black with warm undertone — was #2a2520 */
  --ink-soft: #3d3226;   /* darker secondary — was #5a5045, washed out */
  --ink-faint: #685a48;  /* darker tertiary — was #8a7e6e, hard to read */
  --rule: #d8cebb;
  --stamp-red: #b5392b;
  --stamp-red-deep: #8d2b20;
  --wax: #a8302a;
  --gold: #b08c3a;

  /* category card tints — low chroma, paper-like */
  --c-anniv: #f3e3dc;
  --c-anniv-edge: #d8b9a8;
  --c-bday: #f0c9b6;
  --c-bday-edge: #c98b6e;
  --c-wedding: #f6ecd1;
  --c-wedding-edge: #b08c3a;
  --c-xmas: #efe6d5;
  --c-xmas-edge: #2f4a3a;
  --c-symp: #d7dccb;
  --c-symp-edge: #8b9a7a;
  --c-recov: #f4e6b8;
  --c-recov-edge: #c9a94a;
  --c-easter: #e0d6e4;
  --c-easter-edge: #9b8aa6;
}

/* ---------- global box model + overflow safety ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  overflow-x: clip;
  max-width: 100%;
}
img, video, iframe, embed, object { max-width: 100%; height: auto; }

/* ---------- paper background ---------- */
html, body { background: var(--kraft); color: var(--ink); font-family: 'Inter', sans-serif; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 800px at 20% 0%, #efe6d2 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 100%, #ddd2b8 0%, transparent 55%),
    linear-gradient(180deg, #ece3cd 0%, #e2d8be 100%);
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    repeating-linear-gradient(0deg,   rgba(60,45,30,.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,  rgba(60,45,30,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--stamp-red); }

.content-wrapper { position: relative; z-index: 1; }

/* ---------- chrome header ---------- */
.tw-chrome {
  max-width: 1180px; margin: 0 auto; padding: 28px 28px 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: end;
}
.tw-wordmark { font-family: 'Caveat', cursive; font-weight: 600; font-size: 44px; line-height: .9; color: var(--ink); letter-spacing: .5px; }
.tw-wordmark a { color: inherit; }
.tw-wordmark .small { display: block; font-family: 'Inter', sans-serif; font-weight: 500; font-size: 10px; letter-spacing: 3.5px; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }

/* card-index search */
.tw-drawer {
  border: 1px solid var(--ink); background: var(--paper);
  box-shadow: 0 1px 0 #fff inset, 0 6px 0 -2px #c9bca0, 0 8px 16px rgba(60,40,20,.18);
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px;
  border-radius: 2px; position: relative;
}
.tw-drawer::before {
  content: ""; width: 22px; height: 10px; border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #c7b48a 0%, #8a7144 70%, #4b3a1a 100%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.4), 0 1px 1px rgba(0,0,0,.25);
  margin-right: 6px;
}
.tw-drawer .tag { font: 500 9px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); border-right: 1px solid var(--rule); padding-right: 10px; }
.tw-drawer input {
  border: 0; background: transparent; font: italic 500 18px/1.2 'Cormorant Garamond', serif;
  color: var(--ink); width: 100%; outline: none;
}
.tw-drawer input::placeholder { color: var(--ink-faint); font-style: italic; }

.tw-tools { display: flex; gap: 14px; align-items: center; }
.tw-tool {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; border: 0; cursor: pointer; position: relative; color: var(--ink);
}
.tw-tool svg { display: block; }
.tw-tool .lbl { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font: 500 9px/1 'Inter'; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }

.tw-hamburger {
  display: none; background: transparent; border: 0; padding: 8px; cursor: pointer; color: var(--ink);
}
.tw-hamburger svg { display: block; }

/* lang dropdown */
.tw-lang { position: relative; }
.tw-lang summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--rule); background: var(--paper); font: 500 10px/1 'Inter'; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-soft); border-radius: 2px; }
.tw-lang summary::-webkit-details-marker { display: none; }
.tw-lang summary::after { content: " ▾"; opacity: .55; }
.tw-lang[open] summary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tw-lang .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; z-index: 50;
  background: var(--paper); border: 1px solid var(--ink); box-shadow: 0 8px 20px rgba(60,40,20,.25);
}
.tw-lang .menu a { display: block; padding: 8px 12px; font: 500 12px/1.2 'Inter'; color: var(--ink); }
.tw-lang .menu a:hover { background: var(--linen); }
.tw-lang .menu a.active { background: var(--ink); color: var(--paper); }

/* ---------- generic page chrome ---------- */
main, .tw-main { max-width: 1180px; margin: 0 auto; padding: 36px 28px 80px; position: relative; z-index: 1; }

.tw-eyebrow { font: 500 11px/1 'Inter'; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 10px; }
.tw-eyebrow::before, .tw-eyebrow::after { content: ""; height: 1px; width: 32px; background: var(--ink-faint); opacity: .5; }
.tw-eyebrow.no-rules::before, .tw-eyebrow.no-rules::after { display: none; }

.tw-title { font-family: 'Caveat', cursive; font-size: 78px; line-height: 1.02; color: var(--ink); margin: 14px 0 10px; font-weight: 600; text-wrap: balance; }
.tw-title .for { display: block; font-style: italic; font-size: .55em; line-height: 1; color: var(--ink-soft); margin-top: 2px; font-family: 'Cormorant Garamond', serif; font-weight: 400; }

/* Lead paragraph under H1 — italic Garamond at editorial-lead size, with
   balanced wrap so short copy doesn't end on a widow word. Max-width 62ch
   keeps lines in the readable 45-75ch range typography literature recommends. */
.tw-sub {
  font: italic 400 22px/1.55 'Cormorant Garamond', serif;
  color: var(--ink-soft);
  max-width: 62ch;
  text-wrap: balance;
  margin: 12px 0 8px;
}

/* breadcrumbs */
.tw-crumbs { font: 500 10px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 18px; }
.tw-crumbs a { color: var(--ink-soft); }
.tw-crumbs a:hover { color: var(--stamp-red); }
.tw-crumbs .sep { margin: 0 8px; opacity: .55; }

/* ---------- THE WISH CARD ---------- */
.tw-card {
  --tint: var(--paper);
  --edge: var(--ink-faint);
  --rot: 0deg;
  position: relative;
  background: var(--tint);
  border: 1px solid rgba(0,0,0,.06);
  padding: 26px 24px 22px;
  width: 100%;
  min-height: 240px;
  transform: rotate(var(--rot));
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease;
  box-shadow:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 1px 2px rgba(60,40,20,.06),
    0 8px 14px -8px rgba(60,40,20,.35),
    0 14px 30px -20px rgba(60,40,20,.45);
  display: flex; flex-direction: column;
  isolation: isolate;
}
.tw-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35; z-index: 0;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0 0.08 0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
.tw-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  box-shadow: inset 0 0 0 1px rgba(60,40,20,.05), inset 0 0 24px rgba(60,40,20,.06);
}
.tw-card:hover {
  transform: rotate(0deg) translateY(-5px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 2px 3px rgba(60,40,20,.08),
    0 16px 22px -10px rgba(60,40,20,.4),
    0 28px 50px -24px rgba(60,40,20,.5);
}
.tw-card > * { position: relative; z-index: 1; }

.tw-card .cat {
  font: 500 9px/1 'Inter'; letter-spacing: 2.5px; text-transform: uppercase; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.tw-card .cat::before { content: ""; width: 14px; height: 1px; background: var(--edge); }
.tw-card .body { font: 600 22px/1.5 'Cormorant Garamond', serif; color: var(--ink); flex: 1; text-wrap: pretty; margin: 0; }
.tw-card .sig { font: italic 400 16px/1.3 'Cormorant Garamond', serif; color: var(--ink-soft); margin-top: 14px; }
.tw-card .sig a { color: var(--ink-soft); border-bottom: 1px dotted var(--ink-faint); }
.tw-card .sig a:hover { color: var(--stamp-red); border-color: var(--stamp-red); }

/* action sticker row */
.tw-acts { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.tw-act {
  border: 0; background: transparent; cursor: pointer; padding: 0;
  width: 36px; height: 36px; display: grid; place-items: center;
  position: relative; color: var(--ink-soft);
}
.tw-act svg { display: block; transition: transform .2s ease; pointer-events: none; }
.tw-act:hover svg { transform: scale(1.06) rotate(-2deg); }
.tw-act[data-action="favorite"].is-favorited .wax-fill { fill: var(--stamp-red); stroke: var(--stamp-red-deep); }
.tw-act[data-action="favorite"].is-favorited .wax-heart { fill: #f9e9c8; opacity: .95; }
.tw-act[data-action="favorite"].is-favorited { animation: tw-stamp .35s ease; }
@keyframes tw-stamp { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-4deg); } 100% { transform: scale(1) rotate(0deg); } }

/* "got it" copy sticker */
.tw-gotit {
  position: absolute; top: -10px; right: -10px; z-index: 5;
  background: #fff7d8; color: var(--ink); padding: 6px 10px 6px 8px;
  font: 500 11px/1 'Inter'; letter-spacing: 1px; text-transform: uppercase;
  border: 1px solid #d9c682; transform: rotate(8deg);
  box-shadow: 0 4px 8px rgba(60,40,20,.18);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.tw-gotit.show { opacity: 1; transform: rotate(8deg) translateY(2px); }
.tw-gotit::before { content: "✓"; color: var(--stamp-red); font-weight: 700; }

/* Lift the whole card above siblings while the sticker is showing —
   .tw-card has `isolation: isolate` which traps the sticker's z-index
   inside the card. The next card in the grid otherwise paints over the
   overflowing sticker. */
.tw-card:has(.tw-gotit) { z-index: 10; }

/* category tint classes (assigned by helper) */
.tw-card.t-anniv     { --tint: var(--c-anniv);   --edge: var(--c-anniv-edge); }
.tw-card.t-bday      { --tint: var(--c-bday);    --edge: var(--c-bday-edge); }
.tw-card.t-wedding   { --tint: var(--c-wedding); --edge: var(--c-wedding-edge); }
.tw-card.t-xmas      { --tint: var(--c-xmas);    --edge: var(--c-xmas-edge); }
.tw-card.t-symp      { --tint: var(--c-symp);    --edge: var(--c-symp-edge); }
.tw-card.t-recov     { --tint: var(--c-recov);   --edge: var(--c-recov-edge); }
.tw-card.t-easter    { --tint: var(--c-easter);  --edge: var(--c-easter-edge); }

/* ---------- VIEW 1: HOME / SCATTER DECK ---------- */
.tw-home-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.tw-home-head .meta { text-align: right; font: 400 14px/1.4 'Cormorant Garamond', serif; font-style: italic; color: var(--ink-soft); }
.tw-home-head .meta .d { font: 500 10px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); }
.tw-home-head .meta b { font-style: normal; color: var(--ink); font-family: 'Caveat'; font-size: 26px; line-height: 1; font-weight: 600; }

.tw-scatter { position: relative; height: 580px; margin-top: 36px; }
.tw-scatter .tw-card { position: absolute; width: 280px; min-height: 220px; }
.tw-deck-label {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  font-family: 'Caveat', cursive; font-size: 22px; color: var(--ink-faint);
}
@media (max-width: 980px) {
  .tw-scatter { height: auto; display: flex; flex-direction: column; gap: 18px; margin-top: 24px; }
  .tw-scatter .tw-card { position: static; width: 100%; }
  .tw-deck-label { display: none; }
}

.tw-home-side {
  display: grid; grid-template-columns: 1fr 320px; gap: 40px; margin-top: 60px;
}
@media (max-width: 880px) { .tw-home-side { grid-template-columns: 1fr; } }
.tw-featured {
  background: var(--paper); padding: 22px;
  border: 1px solid var(--rule);
  box-shadow: 0 14px 28px -16px rgba(60,40,20,.4);
  position: relative;
}
.tw-featured::before {
  content: ""; position: absolute; top: -10px; left: 24px; width: 90px; height: 22px;
  background: rgba(180,140,90,.45);
  transform: rotate(-3deg);
  box-shadow: 0 1px 2px rgba(60,40,20,.18);
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.5) 0%, transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.15) 0 4px, transparent 4px 8px);
}
.tw-featured h3 { font-family: 'Caveat', cursive; font-size: 30px; margin: 6px 0 14px; font-weight: 600; }
.tw-featured ul { list-style: none; padding: 0; margin: 0; }
.tw-featured li { font: 400 16px/1.3 'Cormorant Garamond', serif; padding: 10px 0; border-bottom: 1px dashed var(--rule); display: flex; justify-content: space-between; gap: 12px; }
.tw-featured li:last-child { border-bottom: 0; }
.tw-featured li a { color: var(--ink); }
.tw-featured li a:hover { color: var(--stamp-red); }
.tw-featured li .n { font: 500 11px/1 'Inter'; color: var(--ink-faint); letter-spacing: 1px; }
.tw-featured-eyebrow { font: 500 10px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); }

/* "What are we writing today?" — h2 cursive header for the home-side block */
.tw-h2-cursive { font-family: 'Caveat', cursive; font-size: 48px; font-weight: 600; margin: 8px 0 18px; line-height: 1; color: var(--ink); }

/* Browse-by-occasion category pills on the home page */
.tw-cat-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tw-cat-pill {
  display: inline-block; padding: 8px 14px;
  background: var(--tint, var(--paper));
  border: 1px solid rgba(60,40,20,.18);
  font: 500 12px/1.1 'Inter'; letter-spacing: .5px; color: var(--ink);
  text-decoration: none;
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 4px -2px rgba(60,40,20,.25);
  transition: transform .2s ease, box-shadow .2s ease;
}
.tw-cat-pill:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 10px -4px rgba(60,40,20,.35); color: var(--ink); }
.tw-cat-pill.t-anniv     { --tint: var(--c-anniv); }
.tw-cat-pill.t-bday      { --tint: var(--c-bday); }
.tw-cat-pill.t-wedding   { --tint: var(--c-wedding); }
.tw-cat-pill.t-xmas      { --tint: var(--c-xmas); }
.tw-cat-pill.t-symp      { --tint: var(--c-symp); }
.tw-cat-pill.t-recov     { --tint: var(--c-recov); }
.tw-cat-pill.t-easter    { --tint: var(--c-easter); }

/* Editorial prose block for page-level content (intro paragraphs etc.) */
.tw-prose { font: 400 17px/1.55 'Cormorant Garamond', serif; color: var(--ink-soft); max-width: 70ch; margin: 24px 0 32px; }
.tw-prose p { margin: 0 0 14px; }
.tw-prose a { color: var(--stamp-red); border-bottom: 1px dotted; }
.tw-prose h2, .tw-prose h3 { font-family: 'Caveat', cursive; color: var(--ink); font-weight: 600; margin: 28px 0 10px; }
.tw-prose h2 { font-size: 36px; }
.tw-prose h3 { font-size: 28px; }
.tw-prose ul, .tw-prose ol { padding-left: 22px; }
.tw-prose li { margin-bottom: 6px; }

/* Soft info notice (legal english-only banner, etc.) */
.tw-notice {
  background: var(--paper);
  border-left: 3px solid var(--gold);
  padding: 14px 18px; margin: 18px 0 28px;
  font: italic 400 15px/1.4 'Cormorant Garamond', serif;
  color: var(--ink-soft);
  box-shadow: 0 8px 18px -14px rgba(60,40,20,.35);
}

/* ---------- VIEW 2: CATEGORIES / FOLDERS ---------- */
.tw-folders { margin-top: 36px; display: flex; flex-direction: column; gap: 0; perspective: 1200px; }
.tw-folder {
  position: relative;
  background: var(--paper-warm);
  border: 1px solid rgba(60,40,20,.18);
  padding: 22px 26px 22px 90px;
  box-shadow: 0 6px 10px -8px rgba(60,40,20,.35);
  margin-bottom: 14px;
  transition: transform .25s ease, box-shadow .25s ease;
  color: var(--ink);
  display: block; text-decoration: none;
}
.tw-folder:hover { transform: translateX(6px); box-shadow: 0 12px 22px -14px rgba(60,40,20,.5); color: var(--ink); }
.tw-folder .tab {
  position: absolute; left: -2px; top: -14px; width: 110px; height: 30px;
  background: var(--tab, var(--paper));
  border: 1px solid rgba(60,40,20,.2); border-bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font: 500 10px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.tw-folder .num {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 44px; color: var(--ink-faint);
}
.tw-folder h3 { font-family: 'Caveat', cursive; font-size: 36px; margin: 0; font-weight: 600; line-height: 1; }
.tw-folder p { font: italic 400 15px/1.4 'Cormorant Garamond', serif; color: var(--ink-soft); margin: 4px 0 0; max-width: 60ch; }
.tw-folder .count { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); font: 500 10px/1 'Inter'; letter-spacing: 2px; color: var(--ink-faint); }

.tw-folder.f-anniv     { --tab: var(--c-anniv); }
.tw-folder.f-bday      { --tab: var(--c-bday); }
.tw-folder.f-wedding   { --tab: var(--c-wedding); }
.tw-folder.f-xmas      { --tab: var(--c-xmas); }
.tw-folder.f-symp      { --tab: var(--c-symp); }
.tw-folder.f-recov     { --tab: var(--c-recov); }
.tw-folder.f-easter    { --tab: var(--c-easter); }

/* ---------- VIEW 3: LIST GRID ---------- */
.tw-listhead {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end;
  margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--rule);
}
@media (max-width: 720px) { .tw-listhead { grid-template-columns: 1fr; } }
.tw-filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tw-chip {
  font: 500 10px/1 'Inter'; letter-spacing: 1.5px; text-transform: uppercase;
  border: 1px solid var(--rule); padding: 8px 12px; background: var(--paper); cursor: pointer;
  color: var(--ink-soft); text-decoration: none; display: inline-block;
}
.tw-chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.tw-chip[aria-pressed="true"], .tw-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tw-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 22px;
}
@media (max-width: 980px) { .tw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tw-grid { grid-template-columns: 1fr; } }

/* ---------- VIEW 4: DETAIL POSTMARK ---------- */
.tw-detail-wrap { display: grid; grid-template-columns: 1fr; place-items: center; padding: 40px 0 0; }
.tw-detail { width: min(640px, 100%); }
.tw-detail .tw-card { min-height: 360px; padding: 44px 42px 36px; transform: none; }
.tw-detail .tw-card:hover { transform: translateY(-3px); }
.tw-detail .tw-card .body { font-size: 26px; line-height: 1.45; }

.tw-postmark {
  margin: 28px auto 0; text-align: center;
  font: 500 11px/1 'Inter'; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}
.tw-postmark .ring {
  width: 110px; height: 110px; border: 1.5px solid var(--stamp-red); border-radius: 50%;
  display: grid; place-items: center; transform: rotate(-8deg);
  color: var(--stamp-red); font: 500 10px/1.1 'Inter'; letter-spacing: 2px; text-transform: uppercase;
  text-align: center; padding: 8px;
  background: radial-gradient(circle, transparent 60%, rgba(181,57,43,.06) 100%);
  box-shadow: inset 0 0 0 6px rgba(181,57,43,.05);
  opacity: .85;
}
.tw-wax {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d24a3a 0%, #a8302a 50%, #6b1c14 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 -3px 6px rgba(0,0,0,.3), inset 0 2px 4px rgba(255,255,255,.18);
  display: grid; place-items: center; color: #f9e9c8;
  font-family: 'Caveat', cursive; font-size: 28px; font-weight: 600;
  transform: rotate(-6deg);
}
.tw-related { margin-top: 60px; padding-top: 30px; border-top: 1px dashed var(--rule); }
.tw-related h4 { font-family: 'Caveat', cursive; font-size: 28px; margin: 0 0 18px; font-weight: 600; }
.tw-related-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 880px) { .tw-related-row { grid-template-columns: 1fr; } }

/* ---------- VIEW 5: PINBOARD ---------- */
.tw-pinboard {
  margin-top: 30px;
  background:
    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='2.2' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.22 0 0 0 0 0.10 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23c)'/></svg>"),
    linear-gradient(180deg, #8a5a30, #6b4220);
  padding: 50px 40px;
  border: 10px solid;
  border-image: linear-gradient(180deg, #3a2814, #1f1408) 1;
  box-shadow: inset 0 0 60px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.3);
  min-height: 540px; position: relative;
}
.tw-pinwrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px; }
@media (max-width: 980px) { .tw-pinwrap { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tw-pinwrap { grid-template-columns: 1fr; } }
.tw-pinned { position: relative; }
.tw-pinned .tw-card { transform: rotate(var(--rot, -1.5deg)); }
.tw-pinned .tack {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 6;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8b78 0%, #c8311e 55%, #6e1a10 100%);
  box-shadow: 0 3px 4px rgba(0,0,0,.45), inset 0 1px 1px rgba(255,255,255,.5);
}
.tw-pinned .tack.blue  { background: radial-gradient(circle at 35% 30%, #88b3ff 0%, #2a5cb5 55%, #122a5a 100%); }
.tw-pinned .tack.amber { background: radial-gradient(circle at 35% 30%, #ffd07a 0%, #b07a14 55%, #5a3a06 100%); }
.tw-empty-fav { text-align: center; padding: 40px; color: #f6efe1; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 22px; }

/* ---------- CALENDAR / UPCOMING OCCASIONS ---------- */
.tw-cal { margin-top: 30px; display: flex; flex-direction: column; gap: 14px; }
.tw-cal-row {
  --tint: var(--paper-warm);
  display: grid; grid-template-columns: 84px 1fr auto; gap: 22px; align-items: center;
  background: var(--paper-warm);
  border: 1px solid rgba(60,40,20,.18);
  padding: 18px 22px;
  box-shadow: 0 6px 10px -8px rgba(60,40,20,.35);
  transition: transform .25s ease, box-shadow .25s ease;
}
.tw-cal-row:hover { transform: translateX(4px); box-shadow: 0 12px 22px -14px rgba(60,40,20,.5); }

.tw-cal-row .stamp {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tint);
  border: 2px solid rgba(60,40,20,.3);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.4), 0 2px 4px rgba(60,40,20,.15);
  transform: rotate(-6deg);
  text-align: center; line-height: 1; color: var(--ink);
}
.tw-cal-row .stamp .m { display: block; font: 500 9px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft); }
.tw-cal-row .stamp .d { display: block; font-family: 'Caveat', cursive; font-weight: 600; font-size: 32px; margin-top: 2px; }

.tw-cal-row .body h3 { font-family: 'Caveat', cursive; font-size: 32px; font-weight: 600; margin: 0; line-height: 1; }
.tw-cal-row .body .when { font: italic 400 15px/1.3 'Cormorant Garamond', serif; color: var(--ink-soft); margin: 6px 0 0; }
.tw-cal-row .body .when strong { font-style: normal; color: var(--ink); }

.tw-cal-row.t-anniv   { --tint: var(--c-anniv); }
.tw-cal-row.t-bday    { --tint: var(--c-bday); }
.tw-cal-row.t-wedding { --tint: var(--c-wedding); }
.tw-cal-row.t-xmas    { --tint: var(--c-xmas); }
.tw-cal-row.t-symp    { --tint: var(--c-symp); }
.tw-cal-row.t-recov   { --tint: var(--c-recov); }
.tw-cal-row.t-easter  { --tint: var(--c-easter); }

@media (max-width: 640px) {
  .tw-cal-row { grid-template-columns: 64px 1fr; gap: 14px; padding: 14px 16px; }
  .tw-cal-row .stamp { width: 60px; height: 60px; }
  .tw-cal-row .stamp .d { font-size: 26px; }
  .tw-cal-row .body h3 { font-size: 26px; }
  .tw-cal-row .tw-chip { grid-column: 1 / -1; justify-self: start; }
}

/* ---------- VIEW 7: 404 ENVELOPE ---------- */
.tw-four { margin: 60px auto 0; max-width: 680px; text-align: center; padding: 50px 20px; }
.tw-envelope {
  width: 360px; max-width: 100%; height: 230px; margin: 0 auto 30px; position: relative;
  background: var(--paper); border: 1px solid var(--rule);
  box-shadow: 0 30px 40px -20px rgba(60,40,20,.45);
  transform: rotate(-2deg);
}
.tw-envelope::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 145px;
  background: linear-gradient(180deg, #f0e7d2 0%, #e6dcc2 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-bottom: 1px solid rgba(60,40,20,.18);
  box-shadow: 0 2px 6px rgba(60,40,20,.12);
}
.tw-envelope .addr {
  position: absolute; left: 28px; bottom: 28px; right: 28px;
  font: 400 14px/1.5 'Special Elite', monospace; color: var(--ink-soft); text-align: left;
}
.tw-envelope .addr b { color: var(--ink); font-weight: 400; }
.tw-envelope .stamp-rts {
  position: absolute; right: 16px; top: 16px; transform: rotate(-12deg);
  border: 2.5px solid var(--stamp-red); color: var(--stamp-red);
  padding: 6px 10px; font: 700 12px/1.1 'Inter'; letter-spacing: 2px; text-transform: uppercase;
  opacity: .85;
}
.tw-four h2 { font-family: 'Caveat', cursive; font-size: 60px; margin: 8px 0 6px; font-weight: 600; }
.tw-four p { font: italic 400 18px/1.5 'Cormorant Garamond', serif; color: var(--ink-soft); max-width: 50ch; margin: 0 auto; }

/* ---------- FOOTER COLOPHON ---------- */
.tw-footer {
  max-width: 1180px; margin: 80px auto 0; padding: 50px 28px 80px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 30px; align-items: center;
  border-top: 1px solid var(--rule);
  font: 400 13px/1.4 'Cormorant Garamond', serif; color: var(--ink-soft); font-style: italic;
}
.tw-footer .mark { font-family: 'Caveat', cursive; font-size: 30px; color: var(--ink); font-style: normal; text-align: center; }
.tw-footer a { color: var(--ink-soft); border-bottom: 1px dotted var(--ink-faint); }
.tw-footer a:hover { color: var(--stamp-red); border-color: var(--stamp-red); }
@media (max-width: 720px) {
  .tw-footer { grid-template-columns: 1fr; text-align: center; }
}

/* ---------- pagination ---------- */
.tw-pager { margin: 28px 0 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tw-pager a, .tw-pager .here, .tw-pager .dots {
  font: 500 11px/1 'Inter'; letter-spacing: 1.5px; text-transform: uppercase;
  border: 1px solid var(--rule); padding: 8px 12px; background: var(--paper); color: var(--ink-soft);
}
.tw-pager .here { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tw-pager .dots { border-color: transparent; background: transparent; }

/* ---------- share popup ---------- */
.tw-share-popup {
  background: var(--paper); border: 1px solid var(--ink); border-radius: 2px;
  box-shadow: 0 6px 0 -2px #c9bca0, 0 8px 16px rgba(60,40,20,.25);
  padding: .5rem; z-index: 2000;
  display: flex; flex-direction: column; min-width: 180px;
}
.tw-share-popup a { display: block; padding: 8px 12px; color: var(--ink); font: 500 12px/1 'Inter'; letter-spacing: 1px; text-decoration: none; }
.tw-share-popup a:hover { background: var(--linen); }
.tw-share-close { position: absolute; top: 4px; right: 4px; border: 0; background: transparent; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--ink-faint); }

/* ---------- generator typewriter ---------- */
.tw-typewriter {
  margin-top: 30px;
  background: #d8cdb4;
  padding: 36px;
  border: 1px solid rgba(60,40,20,.3);
  box-shadow: 0 20px 40px -20px rgba(60,40,20,.5), inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
}
.tw-typewriter::before {
  content: ""; position: absolute; left: 20px; right: 20px; top: 8px; height: 6px;
  background: #3a2814; border-radius: 3px;
  box-shadow: 0 2px 0 rgba(255,255,255,.2) inset, 0 4px 6px rgba(0,0,0,.3);
}
.tw-typewriter .sheet {
  background: var(--paper); padding: 32px 36px; max-width: 640px; margin: 24px auto 0;
  border: 1px solid var(--rule);
  box-shadow: 0 4px 0 -2px #c9bca0, 0 18px 26px -14px rgba(60,40,20,.5);
  position: relative;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0 0.08 0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    repeating-linear-gradient(180deg, transparent 0 30px, rgba(60,40,20,.08) 30px 31px);
  background-blend-mode: multiply, normal;
}
.tw-typewriter .sheet h3 { font-family: 'Caveat', cursive; font-size: 38px; margin: 0 0 4px; font-weight: 600; }
.tw-typewriter .sheet .sub { font: italic 400 15px/1.3 'Cormorant Garamond', serif; color: var(--ink-soft); margin-bottom: 22px; }
.tw-field { margin-bottom: 22px; }
.tw-field label { display: block; font: 500 10px/1 'Inter'; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.tw-field input, .tw-field select, .tw-field textarea {
  width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px dashed var(--ink-faint);
  background: transparent; font: 400 18px/1.4 'Special Elite', 'Courier New', monospace; color: var(--ink);
  padding: 4px 0 6px; outline: none;
}
.tw-field input:focus, .tw-field select:focus, .tw-field textarea:focus { border-bottom-color: var(--ink); }
.tw-field textarea { min-height: 90px; resize: vertical; }
.tw-lever {
  margin-top: 12px; padding: 14px 18px;
  background: linear-gradient(180deg, #b53a2c, #7a2418);
  color: #fff7d8; font: 500 11px/1 'Inter'; letter-spacing: 3px; text-transform: uppercase;
  box-shadow: 0 6px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25);
  text-align: center; border: 0; cursor: pointer; border-radius: 16px; width: 100%;
}
.tw-lever:hover { transform: translateY(-1px); box-shadow: 0 8px 14px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.25); }

/* ---------- mobile responsive overrides ---------- */
@media (max-width: 720px) {
  .tw-chrome { grid-template-columns: auto auto; gap: 14px; padding: 18px 18px 10px; }
  .tw-drawer { grid-column: 1 / -1; order: 3; }
  .tw-tools { gap: 8px; }
  .tw-tool { width: 36px; height: 36px; }
  .tw-tool .lbl { display: none; }
  .tw-wordmark { font-size: 32px; }
  .tw-title { font-size: 54px; }
  .tw-hamburger { display: inline-grid; place-items: center; }
  .tw-tools .desktop-only { display: none; }
  .tw-main { padding: 24px 18px 60px; }
}

/* ---------- mobile menu offcanvas ---------- */
.tw-menu-backdrop {
  position: fixed; inset: 0; background: rgba(20,15,10,.45); z-index: 1050; opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.tw-menu-backdrop.open { opacity: 1; pointer-events: auto; }
.tw-menu {
  position: fixed; top: 0; right: 0; bottom: 0; width: 320px; max-width: 90vw;
  background: var(--paper); z-index: 1060;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.7,.2,1);
  box-shadow: -20px 0 30px rgba(60,40,20,.3);
  display: flex; flex-direction: column;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.25 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.tw-menu.open { transform: translateX(0); }
.tw-menu .head { padding: 22px 22px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); }
.tw-menu .head .ttl { font-family: 'Caveat', cursive; font-size: 28px; font-weight: 600; }
.tw-menu .close { background: transparent; border: 0; font-size: 28px; line-height: 1; color: var(--ink); cursor: pointer; }
.tw-menu .body { overflow-y: auto; padding: 18px 22px 30px; flex: 1; }
.tw-menu form { margin-bottom: 18px; }
.tw-menu input[type="search"] {
  width: 100%; box-sizing: border-box; border: 1px solid var(--rule);
  background: var(--paper); padding: 10px 12px;
  font: italic 500 16px/1 'Cormorant Garamond', serif; color: var(--ink);
}
.tw-menu .links { list-style: none; padding: 0; margin: 0 0 22px; }
.tw-menu .links li { margin: 0 0 6px; }
.tw-menu .links a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--ink); font: 500 14px/1 'Inter'; border-radius: 2px; }
.tw-menu .links a:hover { background: var(--linen); }
.tw-menu .section-ttl { font: 500 9px/1 'Inter'; letter-spacing: 2.5px; text-transform: uppercase; color: var(--ink-faint); margin: 10px 0 8px; }
.tw-menu .cats { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow-y: auto; }
.tw-menu .cats li { margin: 0; }
.tw-menu .cats a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: var(--ink-soft); font: 400 14px/1.2 'Cormorant Garamond', serif; }
.tw-menu .cats a:hover, .tw-menu .cats a.active { color: var(--ink); background: var(--linen); }
