/* ════════════════════════════════════════════════════════════════════
   Constructor — coloring books

   Written from scratch 2026-08-05. The previous one worked and looked like
   a tax form: thirteen text cards for "what is the book about" and a
   percentage bar that stood for nothing.

   Everything here is the site's own brand — cream paper, gold, Cormorant —
   pulled from styles.css. The layout is the part that changed: every choice
   shows a real drawing from our own engine, and the page talks back.
   ════════════════════════════════════════════════════════════════════ */

.cc {
  --card-radius: 18px;
  --gap: clamp(12px, 1.6vw, 20px);
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 32px) 140px;
}

/* ── the track of steps ─────────────────────────────────────────────── */

.cc-track { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: clamp(22px, 3vw, 34px); flex-wrap: wrap; }
.cc-track__s {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  letter-spacing: .04em; color: var(--ink-mute);
  padding: 6px 12px 6px 7px; border-radius: 999px;
  border: 1.5px solid transparent; background: transparent;
  transition: background .25s, color .25s, border-color .25s;
}
.cc-track__n {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(44,44,42,.09); color: var(--ink-mute);
  font-size: 11.5px; line-height: 1;
}
.cc-track__s.is-done { color: var(--ink-soft); }
.cc-track__s.is-done .cc-track__n { background: var(--gold-bright); color: #4a3410; }
.cc-track__s.is-on {
  background: var(--paper-cream); border-color: var(--gold-bright); color: var(--ink);
  box-shadow: 0 3px 14px rgba(199,127,18,.13);
}
.cc-track__s.is-on .cc-track__n { background: var(--gold); color: #fff; }
/* A locked step is visibly not yours yet — the padlock says how far there is
   left to go, which a row of identical dots never did. */
.cc-track__s.is-locked { opacity: .5; }
@media (max-width: 700px) {
  .cc-track__s span:last-child { display: none; }
  .cc-track__s { padding: 5px; }
}

/* ── the head of each step ──────────────────────────────────────────── */

.cc-head { text-align: center; max-width: 640px; margin: 0 auto clamp(20px, 3vw, 30px); }
.cc-head h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(28px, 4.4vw, 44px); line-height: 1.08;
  letter-spacing: -.015em; color: var(--ink); margin: 8px 0 10px;
  text-wrap: balance;
}
.cc-head h2 em { font-style: italic; color: var(--rose); }
.cc-head p { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink-soft); margin: 0; text-wrap: pretty; }

/* The line that answers what was just chosen. It is the whole reason the page
   feels like a conversation rather than a form. */
.cc-echo {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold-deep);
  background: rgba(250,199,117,.22); border-radius: 999px; padding: 6px 14px;
}
.cc-echo b { font-weight: 700; color: var(--ink); }

/* ── pickable cards ─────────────────────────────────────────────────── */

.cc-grid { display: grid; gap: var(--gap); }
.cc-grid--themes { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cc-grid--3 { grid-template-columns: repeat(3, 1fr); }
.cc-grid--styles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* Group tabs above the style wall. Six groups is more than a row of pills can
   carry comfortably on a phone, so they wrap rather than scroll — a hidden tab
   is a tab nobody clicks. */
.cc-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: clamp(16px, 2.2vw, 24px); }
.cc-tab {
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--paper-cream); color: var(--ink-soft);
  transition: border-color .18s, color .18s, background .18s;
}
.cc-tab:hover { border-color: var(--gold-bright); }
.cc-tab.is-on { background: var(--gold); border-color: var(--gold); color: #fff; }

.cc-card {
  position: relative; display: flex; flex-direction: column;
  border: 1.5px solid var(--border); border-radius: var(--card-radius);
  background: var(--paper-cream); overflow: hidden;
  cursor: pointer; text-align: left; padding: 0;
  font: inherit; color: inherit;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.cc-card:hover { transform: translateY(-3px); border-color: var(--gold-bright); box-shadow: 0 10px 26px rgba(44,44,42,.10); }
.cc-card.is-on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250,199,117,.38); }
/* `cover` cropped the lion's mane off the top of every card. These are drawings,
   not photographs — a cropped drawing is a damaged one, and the whole point of
   the card is to show what the page will look like. `contain` letterboxes with
   white, which on line art is invisible. */
.cc-card__art { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; object-position: center; background: #fff; }
.cc-card--wide .cc-card__art { aspect-ratio: 3 / 4; }
/* Spans by necessity — the whole card is a <button>, and a button may not
   contain a <div>. So they are told to behave like blocks. */
.cc-card__b { display: block; padding: 12px 14px 14px; }
.cc-card__t { display: block; font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.2; color: var(--ink); }
.cc-card__d { display: block; font-family: var(--sans); font-size: 12.5px; line-height: 1.45; color: var(--ink-mute); margin-top: 5px; }
.cc-len__c { display: block; }
.cc-len__n, .cc-len__u, .cc-len__p, .cc-len__w { display: block; }
.cc-card__tag {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #4a3410;
  background: var(--gold-bright); border-radius: 999px; padding: 4px 9px;
}
/* The tick only appears on the chosen one, so the grid stays quiet. */
.cc-card__tick {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--gold); color: #fff;
  display: none; place-items: center; font-size: 15px; line-height: 1;
  box-shadow: 0 2px 8px rgba(199,127,18,.4);
}
.cc-card.is-on .cc-card__tick { display: grid; }

/* ── the "choose for me" line ───────────────────────────────────────── */

.cc-auto {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  flex-wrap: wrap; margin: 0 0 clamp(18px, 2.6vw, 26px);
  font-family: var(--serif); font-size: 16px; color: var(--ink-soft);
}

/* ── who is colouring: a row, not a screen ─────────────────────────── */

.cc-ages { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 0 0 clamp(16px, 2.2vw, 22px); }
.cc-ages__l { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-right: 4px; }
.cc-age {
  display: inline-flex; align-items: baseline; gap: 6px; cursor: pointer;
  font-family: var(--sans); font-size: 13px; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--paper-cream);
  transition: border-color .18s, background .18s, color .18s;
}
.cc-age b { font-weight: 700; color: var(--ink); }
.cc-age i { font-style: normal; font-size: 12px; color: var(--ink-mute); }
.cc-age:hover { border-color: var(--gold-bright); }
.cc-age.is-on { border-color: var(--gold); background: rgba(250,199,117,.24); }
.cc-age.is-on b, .cc-age.is-on i { color: var(--ink); }
@media (max-width: 560px) { .cc-age i { display: none; } }

/* ── page count ─────────────────────────────────────────────────────── */

.cc-len { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.cc-len__c { text-align: center; padding: 20px 14px 18px; }
.cc-len__n { font-family: var(--display); font-size: clamp(34px, 4.6vw, 50px); line-height: 1; color: var(--gold-deep); }
.cc-len__u { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); margin-top: 6px; }
.cc-len__p { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); margin-top: 12px; }
.cc-len__w {
  font-family: var(--sans); font-size: 12px; line-height: 1.4;
  margin-top: 10px; padding: 8px 10px; border-radius: 10px;
}
.cc-len__w--no { background: rgba(217,120,155,.14); color: #8d3a58; }
.cc-len__w--ok { background: rgba(122,168,116,.16); color: #3f6b3a; }

/* ── cover styles ───────────────────────────────────────────────────── */

.cc-coverstyles { margin-top: clamp(24px, 3vw, 34px); text-align: center; }
.cc-coverstyles .cc-ages__l { display: block; margin: 0 0 12px; }
.cc-grid--covers { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cc-cs {
  position: relative; display: block; text-align: left; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--paper-cream); padding: 14px 14px 13px;
  font: inherit; color: inherit;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.cc-cs:hover:not(.is-locked) { transform: translateY(-2px); border-color: var(--gold-bright); }
.cc-cs.is-on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250,199,117,.34); }
.cc-cs__swatch { display: block; width: 34px; height: 8px; border-radius: 999px; margin-bottom: 10px; }
.cc-cs__t { display: block; font-size: 17px; line-height: 1.15; color: var(--ink); }
.cc-cs__d { display: block; font-family: var(--sans); font-size: 12px; line-height: 1.4; color: var(--ink-mute); margin-top: 5px; }
/* Locked is dimmed but legible: the point is to be seen, not to tease. */
.cc-cs.is-locked { opacity: .55; cursor: default; }
.cc-cs__soon {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--purple);
  background: rgba(127,119,221,.14); border-radius: 999px; padding: 3px 8px;
}

/* ── title ──────────────────────────────────────────────────────────── */

.cc-field { max-width: 560px; margin: 0 auto; }
.cc-label { display: block; font-family: var(--sans); font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.cc-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--serif); font-size: 24px; color: var(--ink);
  padding: 15px 18px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--paper-cream);
  transition: border-color .18s, box-shadow .18s;
}
.cc-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250,199,117,.32); }
.cc-count { font-family: var(--sans); font-size: 12px; color: var(--ink-mute); text-align: right; margin-top: 6px; }
.cc-sug { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.cc-sug__l { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); width: 100%; }
.cc-chip {
  font-family: var(--serif); font-size: 16px; color: var(--ink);
  background: var(--paper-cream); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 8px 15px; cursor: pointer;
  transition: border-color .18s, transform .18s;
}
.cc-chip:hover { border-color: var(--gold-bright); transform: translateY(-1px); }
.cc-chip--ghost { color: var(--ink-mute); border-style: dashed; }

/* ── the wait, narrated ─────────────────────────────────────────────── */

.cc-feed { max-width: 460px; margin: 0 auto; display: grid; gap: 2px; }
.cc-feed__i {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif); font-size: 17px; color: var(--ink-mute);
  padding: 11px 4px; opacity: .45;
  transition: opacity .3s, color .3s;
}
.cc-feed__i.is-on, .cc-feed__i.is-done { opacity: 1; color: var(--ink); }
.cc-feed__m {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: grid; place-items: center;
  font-size: 13px; line-height: 1; color: transparent;
  transition: background .3s, border-color .3s, color .3s;
}
.cc-feed__i.is-done .cc-feed__m { background: var(--gold); border-color: var(--gold); color: #fff; }
.cc-feed__i.is-on .cc-feed__m { border-color: var(--gold); border-right-color: transparent; animation: cc-spin 1s linear infinite; }
@keyframes cc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .cc-feed__i.is-on .cc-feed__m { animation: none; border-right-color: var(--gold); }
  .cc-card:hover { transform: none; }
}

/* ── the spread ─────────────────────────────────────────────────────── */

.cc-spread {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  max-width: 760px; margin: 0 auto;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 44px rgba(44,44,42,.18);
  background: #e8e2d6;
}
.cc-spread img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #fff; }

/* The cover, with the buyer's own title on it.
   The printed cover is built by routes/coloring-cover.js; this is the same
   layout in the same fonts and the theme's own ink, so what is promised here is
   what arrives. Kept deliberately close to that file — if one changes, so does
   the other.

   There USED to be a cream veil top and bottom, copied from the print file, so
   the title would read over whatever the model painted. The owner saw it as a
   golden blur and asked twice for it to go. It is gone from both — and the
   cover prompt now asks for a calm upper strip instead, which is the honest way
   to make a title readable. */
.cc-cover { position: relative; overflow: hidden; }
.cc-cover__t {
  position: absolute; left: 8%; right: 8%; top: 7%; z-index: 2; text-align: center;
}
.cc-cover__k {
  display: block; font-family: var(--sans); font-weight: 600;
  font-size: clamp(9px, 1.1vw, 12px); letter-spacing: .22em; text-transform: uppercase;
}
.cc-cover__h {
  display: block; font-family: 'Berkshire Swash', var(--serif); font-weight: 400;
  /* A third bigger than it was, with an outline under the fill — the two things
     that separate a cover title from a caption. */
  font-size: clamp(26px, 4.2vw, 46px); line-height: 1.02; margin-top: 8px;
  text-wrap: balance;
  -webkit-text-stroke: 0.055em #fffdf8;
  paint-order: stroke fill;
}
.cc-cover__f {
  position: absolute; left: 8%; right: 8%; bottom: 5%; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(8px, 1vw, 11px); letter-spacing: .06em;
}
.cc-cover__b { border-radius: 999px; padding: 4px 10px; color: #fff; }
.cc-cover__m { color: var(--ink-soft); letter-spacing: .16em; font-family: var(--serif); font-weight: 600; }
.cc-spread__cap { text-align: center; font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-top: 12px; }

/* ── what you get ───────────────────────────────────────────────────── */

.cc-get { max-width: 560px; margin: clamp(22px, 3vw, 32px) auto 0; }
.cc-get li { font-family: var(--serif); font-size: 16.5px; line-height: 1.5; color: var(--ink-soft); padding: 9px 0 9px 28px; position: relative; list-style: none; }
.cc-get li::before { content: "✦"; position: absolute; left: 0; top: 9px; color: var(--gold); font-size: 14px; }
.cc-get ul { margin: 0; padding: 0; }
.cc-fine { font-family: var(--serif); font-style: italic; font-size: 14.5px; line-height: 1.5; color: var(--ink-mute); margin-top: 14px; }

/* ── the bar that follows you ───────────────────────────────────────── */

.cc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(253,246,236,.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 12px clamp(14px, 4vw, 28px);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.cc-bar__in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.cc-bar__price { margin-left: auto; text-align: right; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.cc-bar__price small { display: block; font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--ink-mute); margin-top: 3px; }
.cc-bar .btn { white-space: nowrap; }
.cc-bar .btn[disabled] { opacity: .45; pointer-events: none; }
/* The browser's own rule for [hidden] is display:none, and any explicit display
   in a stylesheet beats it — .btn is inline-flex, so the Back button stayed on
   screen at step one however faithfully the script hid it. */
[hidden] { display: none !important; }

/* ── steps ──────────────────────────────────────────────────────────── */

.cc-step { display: none; }
.cc-step.is-on { display: block; animation: cc-in .32s ease both; }
@keyframes cc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cc-step.is-on { animation: none; } }

.cc-err {
  max-width: 560px; margin: 0 auto 18px; display: none;
  font-family: var(--serif); font-size: 16px; line-height: 1.5;
  background: rgba(217,120,155,.13); color: #8d3a58;
  border-radius: 12px; padding: 13px 16px;
}
.cc-err.is-on { display: block; }
.cc-note { text-align: center; font-family: var(--sans); font-size: 12.5px; color: var(--ink-mute); margin-top: 14px; }

@media (max-width: 640px) {
  .cc-grid--themes { grid-template-columns: repeat(2, 1fr); }
  .cc-grid--3, .cc-len { grid-template-columns: 1fr; }
  .cc-spread { grid-template-columns: 1fr; max-width: 340px; }
  .cc-spread img:last-child { display: none; }
  .cc-input { font-size: 20px; }
}
