/* Storyfold: Puzzle Tales — marketing site. Palette mirrors assets/ui/tokens.json. */
:root {
  color-scheme: light;
  --paper: #f6eedd;
  --paper-deep: #efe3c9;
  --card: #fbf6ea;
  --ink: #192a35;
  --muted: #52616a;
  --brick: #b94d3c;
  --brick-deep: #9a3c2e;
  --gold: #cba358;
  --sage: #6f8050;
  --cardboard: #d8c7ac;
  --night: #16263a;
  --rule: #e2d4b8;
  --display: "Young Serif", Georgia, serif;
  --body: "Literata", Georgia, serif;
  --measure: 34rem;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--paper);
  /* soft paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
.tale img, .free-pages img, .pack-art img { width: 100%; }
a { color: var(--brick-deep); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.1rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }

.wrap { width: min(1160px, 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- header ---------- */
.site-header { padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 2px 6px rgb(25 42 53 / 0.25); }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name img { width: 128px; height: auto; border-radius: 0; box-shadow: none; }
.brand-name span { font-size: 0.72rem; letter-spacing: 0.32em; margin-top: 5px; padding-left: 2px; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 0.97rem; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: var(--brick); }
@media (max-width: 760px) { .site-nav .optional { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  border-radius: 14px;
  font: 600 1.05rem/1 var(--body);
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--brick);
  color: #fff8ec;
  box-shadow: inset 0 -3px 0 var(--brick-deep), 0 6px 14px rgb(154 60 46 / 0.28);
}
.btn-primary:hover { background: #c4573f; }
.btn-primary:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--brick-deep); }
.btn-quiet { color: var(--ink); background: var(--card); border: 1.5px solid var(--cardboard); }
.btn-quiet:hover { border-color: var(--gold); }
.btn svg { width: 20px; height: 20px; flex: none; }
.site-nav .btn { min-height: 42px; padding: 0 18px; font-size: 0.95rem; }
.site-nav .btn-primary, .site-nav .btn-primary:hover { color: #fff8ec; }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero-copy p.lede { font-size: 1.2rem; color: var(--muted); max-width: 31rem; margin: 22px 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero-note { margin-top: 18px; font-size: 0.95rem; color: var(--muted); }
.hero-note strong { color: var(--sage); font-weight: 600; }

.board {
  position: relative;
  padding: clamp(10px, 1.6vw, 16px);
  background: var(--cardboard);
  border-radius: 22px;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.5),
    0 1px 0 #bba98a,
    0 24px 50px -18px rgb(25 42 53 / 0.45);
}
.board svg { display: block; width: 100%; height: auto; border-radius: 12px; overflow: visible; }
.board .seams { fill: none; stroke: rgb(255 248 230 / 0.75); stroke-width: 3; }
.board .seams-shadow { fill: none; stroke: rgb(40 30 15 / 0.45); stroke-width: 3.5; transform: translate(0, 2.5px); }
.board .socket { fill: #c9b593; }
.board .piece-edge { fill: none; stroke: rgb(255 248 230 / 0.8); stroke-width: 2.5; }
.board .piece {
  transform-box: view-box;
  cursor: grab;
  touch-action: none;
  outline: none;
  filter: drop-shadow(0 10px 8px rgb(25 42 53 / 0.35));
  transition: transform 0.9s cubic-bezier(.3, .9, .3, 1.06), filter 0.3s;
}
.board .piece.lifted { cursor: grabbing; filter: drop-shadow(0 24px 16px rgb(25 42 53 / 0.42)); }
.board .piece.placed { cursor: default; filter: none; transition-duration: 0.22s; transition-delay: 0s; }
.board .piece:not(.placed) .piece-edge { stroke: #fff8e8; stroke-width: 6; transition: stroke 0.15s; }
.board .piece.near .piece-edge { stroke: var(--gold); stroke-width: 9; }
.board .piece.near { filter: drop-shadow(0 0 14px rgb(203 163 88 / 0.85)) drop-shadow(0 12px 10px rgb(25 42 53 / 0.3)); }
.board .piece:focus-visible .piece-edge { stroke: var(--gold); stroke-width: 7; }
@media (prefers-reduced-motion: reduce) { .board .piece { transition: none; } }
.board figcaption {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 24px);
  background: var(--card); border: 1px solid var(--rule);
  padding: 7px 16px; border-radius: 999px;
  font-size: 0.88rem; font-style: italic; color: var(--muted); white-space: nowrap;
  box-shadow: 0 4px 10px rgb(25 42 53 / 0.1);
}
.board figcaption .status { overflow: hidden; text-overflow: ellipsis; }
.board.restored figcaption { color: var(--sage); }
.board figcaption .again {
  font: 600 0.85rem var(--body); font-style: normal;
  color: var(--brick-deep); background: none; border: 0; padding: 4px 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 520px; width: 100%; margin-inline: auto; }
}

/* ---------- section scaffolding ---------- */
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section-head { max-width: 40rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head p { color: var(--muted); font-size: 1.12rem; margin-top: 16px; }
.center { text-align: center; margin-inline: auto; }

/* ---------- how a tale unfolds ---------- */
.phone {
  border-radius: 38px;
  border: 8px solid var(--ink);
  background: var(--ink);
  overflow: hidden;
  box-shadow: 0 28px 50px -26px rgb(25 42 53 / 0.6);
  aspect-ratio: 540 / 1174;
}
.unfold {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}
.unfold-phone { grid-column: 2; grid-row: 1; width: 100%; justify-self: center; }
.unfold-phone video { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--paper); }
.unfold-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-column: 1; grid-row: 1; }
.unfold-steps li { position: relative; border-radius: 14px; transition: background-color 0.3s; }
.unfold-steps li.active { background: var(--card); box-shadow: 0 10px 24px -18px rgb(25 42 53 / 0.5); }
.unfold-steps button {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: grid; grid-template-columns: 36px 1fr; gap: 14px;
  width: 100%; padding: 16px 18px 18px;
  border-radius: 14px;
}
.unfold-steps button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.unfold-steps .num {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 1rem;
  background: var(--paper-deep); color: var(--muted);
  transition: background-color 0.3s, color 0.3s;
}
.unfold-steps .txt { display: block; }
.unfold-steps strong { display: block; font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.2; margin-top: 3px; color: var(--muted); transition: color 0.3s; }
.unfold-steps .txt > span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.98rem; opacity: 0.75; transition: opacity 0.3s; }
.unfold-steps li.active .num { background: var(--gold); color: var(--ink); }
.unfold-steps li.active strong { color: var(--ink); }
.unfold-steps li.active .txt > span { opacity: 1; }
.unfold-steps .bar {
  position: absolute; left: 68px; right: 18px; bottom: 8px; height: 3px; border-radius: 3px;
  background: var(--rule); transform-origin: left; opacity: 0;
}
.unfold-steps .bar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--brick); transform-origin: left; transform: scaleX(var(--p, 0));
}
.unfold-steps li.active .bar { opacity: 1; }
@media (max-width: 760px) {
  .unfold { grid-template-columns: 1fr; gap: 28px; }
  .unfold-phone { grid-column: 1; max-width: 250px; }
  .unfold-steps { grid-column: 1; grid-row: 2; }
  .unfold-steps button { padding: 12px 14px 16px; grid-template-columns: 30px 1fr; gap: 12px; }
  .unfold-steps .num { width: 30px; height: 30px; }
  .unfold-steps strong { font-size: 1.12rem; }
  .unfold-steps .txt > span { font-size: 0.92rem; }
  .unfold-steps .bar { left: 56px; right: 14px; }
}

/* ---------- the free tale ---------- */
.free { background: var(--paper-deep); border-block: 1px solid var(--rule); }
.free .wrap { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.free-pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.free-pages figure { margin: 0; background: var(--card); padding: 8px 8px 10px; border-radius: 6px; box-shadow: 0 8px 18px -10px rgb(25 42 53 / 0.45); }
.free-pages figure:nth-child(1) { transform: rotate(-2.5deg); }
.free-pages figure:nth-child(3) { transform: rotate(2deg); }
.free-pages figure:nth-child(4) { transform: rotate(1.5deg); }
.free-pages figure:nth-child(6) { transform: rotate(-1.5deg); }
.free-pages img { border-radius: 3px; aspect-ratio: 1; object-fit: cover; }
.free-pages figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 6px; text-align: center; line-height: 1.3; }
.free-pages .more { display: grid; place-items: center; text-align: center; background: var(--brick); color: #fff8ec; font-family: var(--display); font-size: 1.15rem; line-height: 1.25; padding: 16px; border-radius: 6px; }
.promises { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.promises li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.promises svg { width: 24px; height: 24px; color: var(--sage); margin-top: 3px; }
.promises strong { display: block; font-weight: 600; }
.promises span { color: var(--muted); font-size: 0.98rem; }
@media (max-width: 860px) { .free .wrap { grid-template-columns: 1fr; } }

/* ---------- the shelf ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: clamp(18px, 2.4vw, 28px); }
.tale { display: flex; flex-direction: column; }
.tale img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; box-shadow: 0 12px 24px -16px rgb(25 42 53 / 0.6); }
.tale h3 { margin-top: 14px; font-size: 1.2rem; }
.tale p { color: var(--muted); font-size: 0.95rem; margin: 6px 0 10px; flex: 1; }
.tale .price { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.tale .price small { font-weight: 400; color: var(--sage); }

.pack {
  margin-top: clamp(40px, 6vw, 64px);
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center;
  background: var(--card); border: 1px solid var(--rule); border-radius: 20px;
  padding: clamp(18px, 3vw, 32px);
}
.pack-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pack-art img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.pack h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.pack p { color: var(--muted); margin: 12px 0 16px; }
.pack .price { font-size: 1.1rem; font-weight: 600; }
.pack .price small { font-weight: 400; color: var(--muted); }
@media (max-width: 760px) { .pack { grid-template-columns: 1fr; } }
.fineprint { margin-top: 28px; font-size: 0.9rem; color: var(--muted); }

/* ---------- keepsakes (night band) ---------- */
.night {
  position: relative;
  background: var(--night);
  color: #f3ead6;
  --deckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V9l40 4 55-7 48 6 60-5 52 8 45-6 70 5 38-7 66 6 50-4 58 7 46-8 62 6 40-5 70 7 52-6 44 5 60-6 48 7 56-4 50 5 46-7 44 4v15z' fill='%2316263a'/%3E%3C/svg%3E");
}
.night::before, .night::after {
  content: ""; position: absolute; left: 0; right: 0; height: 24px;
  background: var(--deckle) center / 100% 100% no-repeat;
}
.night::before { top: -23px; }
.night::after { bottom: -23px; transform: scaleY(-1); }
.night .stars { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.night .stars i { position: absolute; width: 14px; height: 14px; background: var(--gold); clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%); opacity: 0.8; }
.night h2 { color: #fbf3e2; }
.night .section-head p { color: #c7c3b4; }
.keepsakes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(12px, 2.4vw, 28px); }
.keepsakes figure { margin: 0; text-align: center; }
.keepsakes .medal {
  aspect-ratio: 1; border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--cardboard);
  overflow: hidden;
  box-shadow: 0 0 0 6px rgb(203 163 88 / 0.18);
}
.keepsakes .medal.gilded { border-color: var(--gold); box-shadow: 0 0 0 6px rgb(203 163 88 / 0.35), 0 0 30px rgb(203 163 88 / 0.35); }
.keepsakes img { width: 100%; height: 100%; object-fit: cover; }
.keepsakes figcaption { margin-top: 12px; font-size: 0.92rem; color: #e7dfcb; line-height: 1.35; }
.keepsakes figcaption small { display: block; color: #a9a796; font-size: 0.8rem; }
.night-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: clamp(40px, 6vw, 64px); padding-top: 32px; border-top: 1px solid rgb(203 163 88 / 0.3); }
.night-points h3 { color: var(--gold); font-size: 1.15rem; margin-bottom: 6px; }
.night-points p { color: #c7c3b4; font-size: 0.97rem; margin: 0; }
@media (max-width: 760px) {
  .keepsakes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .keepsakes figure:nth-child(n+4) { display: none; }
  .night-points { grid-template-columns: 1fr; }
}

/* ---------- comfort ---------- */
.comfort .wrap { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 80px); }
.comfort dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 36px; }
.comfort dt { font-family: var(--display); font-size: 1.15rem; margin-bottom: 4px; }
.comfort dd { margin: 0; color: var(--muted); font-size: 0.97rem; }
@media (max-width: 860px) { .comfort .wrap { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .comfort dl { grid-template-columns: 1fr; } }

/* ---------- closing ---------- */
.closing { text-align: center; padding-bottom: clamp(72px, 10vw, 128px); }
.closing img.icon { width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 28px; box-shadow: 0 16px 30px -12px rgb(25 42 53 / 0.5); }
.closing p { color: var(--muted); max-width: 32rem; margin: 18px auto 30px; font-size: 1.12rem; }
.steam { margin-top: 44px; font-size: 0.95rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 32px 0 44px; font-size: 0.93rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a { color: var(--ink); }

/* ---------- information pages (privacy, terms, support) ---------- */
.info { width: min(760px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: clamp(24px, 5vw, 56px) 0 64px; }
.info .kicker { color: var(--sage); font-style: italic; font-size: 1.05rem; margin-bottom: 10px; }
.info h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 14px; }
.info .updated { color: var(--muted); font-size: 0.93rem; }
.info .summary {
  background: var(--card); border: 1px solid var(--rule); border-radius: 16px;
  padding: 20px 24px; margin: 28px 0 8px;
}
.info .summary ul { margin: 0; padding-left: 1.2em; }
.info .summary li { margin: 4px 0; }
.info h2 { font-size: 1.5rem; margin: 40px 0 10px; }
.info p, .info li { color: #3b4a52; }
.info details { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.info details:first-of-type { border-top: 1px solid var(--rule); }
.info summary { cursor: pointer; font-family: var(--display); font-size: 1.15rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.info summary::-webkit-details-marker { display: none; }
.info summary::after { content: "+"; color: var(--brick); font-size: 1.4rem; line-height: 1; }
.info details[open] summary::after { content: "–"; }
.info details p { margin: 12px 0 0; }
.info .contact {
  margin-top: 40px; padding: 24px; border-radius: 16px;
  background: var(--night); color: #f3ead6;
}
.info .contact h2 { color: #fbf3e2; margin-top: 0; }
.info .contact p { color: #c7c3b4; }
.info .contact a { color: var(--gold); font-weight: 600; }
