/* Chalk & Code · Name-it page */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.tool-hero { padding: 48px 0 40px; }
.tool-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 24px; padding: 8px 10px 8px 14px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 18px; line-height: 1.3; }
.tool-title strong { font-family: var(--f-head); font-weight: 600; font-size: 22px; margin-right: 4px; }
.tool-title__icon { font-size: 20px; }
.tool-title__free { padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; }
@media (max-width: 700px) { .tool-title { border-radius: 18px; } .tool-title__icon { display: none; } }
.tool-hero h1 { font-size: clamp(44px, 7vw, 104px); margin: 0 0 20px; }
.tool-hero .lede { max-width: 46ch; margin: 0; }
@media (max-width: 900px) { .tool-hero { padding-top: 32px; } }

/* ---------- Layout ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.t-tabs { order: 1; }
.stage { display: contents; }
.stage__frame { order: 2; }
.t-controls { order: 3; }
.t-actions { order: 4; }
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px 56px; align-items: start; }
  .t-tabs { grid-column: 1; grid-row: 1; }
  .t-controls { grid-column: 1; grid-row: 2; }
  .stage { display: block; grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 104px; }
  .stage__frame, .t-actions { order: initial; }
}

/* ---------- Postcard / tag switch ---------- */
.t-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); justify-self: start; width: fit-content; }
.seg { min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); cursor: pointer; transition: background var(--t) var(--ease), color var(--t) var(--ease); }
.seg:hover { background: var(--sun-pale); }
.seg[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Preview ---------- */
.stage__frame {
  position: relative; display: grid; place-items: center; min-height: 280px; padding: 28px;
  border-radius: var(--radius); background: var(--sun-pale); box-shadow: inset 0 0 0 1.5px var(--line);
}
#cv {
  display: block; width: auto; height: auto; max-width: 100%; max-height: min(52vh, 460px);
  filter: drop-shadow(0 10px 18px rgba(43, 29, 20, .22));
}
.stage__badge {
  position: absolute; left: 16px; top: 16px; max-width: calc(100% - 32px);
  padding: 6px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 700; line-height: 1.3;
}
.stage__badge[hidden] { display: none; }

/* ---------- Actions ---------- */
.t-actions { display: grid; gap: 14px; margin-top: 4px; }
@media (min-width: 960px) { .t-actions { margin-top: 20px; } }
.t-actions__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.t-actions .btn svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; background: var(--bbg); }
.btn[disabled]:hover { transform: none; box-shadow: none; background: var(--bbg); }
.btn--ghost[disabled]:hover { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.sheet { display: inline-flex; gap: 8px; align-items: center; }
.paper-select {
  min-height: 56px; padding: 0 40px 0 16px; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%232B1D14' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 2px solid var(--line); border-radius: 999px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.paper-select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.t-help { margin: 0; font-weight: 700; color: var(--accent-deep); min-height: 1.6em; }
.t-help:empty { display: none; }
.t-note { margin: 0; font-size: 16px; color: var(--soft); }
.t-done { margin: 0; font-weight: 500; }
.t-done:empty { display: none; }

/* ---------- Controls ---------- */
.t-controls { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
@media (max-width: 700px) { .t-controls { padding: 22px 18px; } }
.group { border: 0; margin: 0 0 28px; padding: 0; min-width: 0; }
.group > legend { padding: 0; margin-bottom: 12px; font-family: var(--f-head); font-weight: 600; font-size: 24px; letter-spacing: -.01em; }
.chips, .looks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .look { position: relative; }
.chip input, .look input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip label {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--line); font-weight: 500; cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.chip label:hover { background: var(--sun-pale); }
.chip input:checked + label { background: var(--ink); color: #fff; box-shadow: none; }
.chip input:focus-visible + label, .look input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.look label { display: grid; justify-items: center; gap: 6px; width: 98px; padding: 8px 4px; border-radius: 14px; font-size: 15px; font-weight: 500; line-height: 1.2; text-align: center; cursor: pointer; box-shadow: inset 0 0 0 2px transparent; }
.look label:hover { background: var(--sun-pale); }
.look .sw { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%); box-shadow: inset 0 0 0 2px rgba(43, 29, 20, .18); }
.look input:checked + label { box-shadow: inset 0 0 0 3px var(--ink); }

.t-controls .field { margin-bottom: 18px; }
.field .opt { font-weight: 500; color: var(--soft); }
.field textarea, .more-names textarea {
  width: 100%; min-height: 96px; padding: 14px 16px; font: inherit; font-size: 18px; line-height: 1.45; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px; resize: vertical;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field textarea:hover, .more-names textarea:hover { border-color: #D6C2AC; }
.field textarea:focus, .more-names textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(244, 194, 122, .6); }
.field__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.count { font-size: 15px; color: var(--soft); }
.linkbtn {
  background: none; border: 0; padding: 0; min-height: 44px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--accent);
}
.linkbtn:hover { text-decoration-color: var(--ink); }
.linkbtn:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.more-names { margin: -4px 0 18px; }
.more-names summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.more-names textarea { margin-top: 8px; }
.hint { margin: 6px 0 0; font-size: 15px; color: var(--soft); min-height: 1.4em; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; line-height: 1.4; cursor: pointer; margin-top: 4px; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.noscript { background: var(--sun-pale); padding: 20px 24px; border-radius: var(--radius); font-weight: 700; }

/* ---------- More from the shop ---------- */
.more { padding-top: 24px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .more-grid { grid-template-columns: 1fr; } }
.more-card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.more-card__art { aspect-ratio: 4 / 3; overflow: hidden; background: var(--sun-pale); }
.more-card__art img { width: 100%; height: 100%; object-fit: cover; }
.more-card__body { padding: 22px 24px 26px; display: grid; gap: 6px; flex: 1; align-content: start; }
.more-card__body h3 { margin: 0; font-size: 26px; }
.more-card__body p { margin: 0 0 12px; color: var(--soft); font-size: 17px; line-height: 1.5; }
.more-card__body .btn { justify-self: start; margin-top: auto; }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; }
.faq details { border-top: 1.5px solid var(--line); }
.faq details:last-child { border-bottom: 1.5px solid var(--line); }
.faq summary { cursor: pointer; font-family: var(--f-head); font-weight: 600; font-size: 24px; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-body); font-size: 28px; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 22px; color: var(--soft); }

.ecard-actions { display: inline-flex; flex-wrap: wrap; gap: 12px; }
.ecard-actions[hidden], .sheet[hidden], .more-names[hidden] { display: none; }

/* ---------- E-card viewer (card.html) ---------- */
.cardview { padding: 40px 0 var(--section); text-align: center; }
.cardview .eyebrow { justify-content: center; }
.cardview__title { font-size: clamp(38px, 5.6vw, 76px); margin: 0 auto 32px; max-width: 16ch; }
.cardview__stage { position: relative; display: grid; justify-items: center; min-height: 340px; }
.envelope {
  position: relative; width: min(440px, 86vw); aspect-ratio: 1.45; border: 0; padding: 0; cursor: pointer;
  background: none; font: inherit; color: var(--ink); transition: transform var(--t) var(--ease), opacity 400ms var(--ease);
}
.envelope:hover { transform: translateY(-4px) rotate(-1deg); }
.envelope:focus-visible { outline: 3px solid var(--accent); outline-offset: 8px; border-radius: 12px; }
.envelope__back { position: absolute; inset: 0; border-radius: 14px; background: var(--sun-pale); box-shadow: inset 0 0 0 2px var(--line), var(--shadow-lift); }
.envelope__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 58%; border-radius: 14px 14px 0 0;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform 400ms var(--ease);
}
.envelope__seal {
  position: absolute; left: 50%; top: 58%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--sun);
  font-family: var(--f-head); font-weight: 600; font-size: 18px; box-shadow: 0 4px 10px rgba(43, 29, 20, .3);
}
.envelope__to { position: absolute; left: 0; right: 0; bottom: 14%; font-family: var(--f-head); font-style: italic; font-weight: 600; font-size: clamp(22px, 3vw, 30px); }
.cardview__tap { margin: 20px 0 0; font-weight: 700; color: var(--accent-deep); }
.is-open .envelope { opacity: 0; transform: translateY(40px) scale(.96); pointer-events: none; }
.is-open .envelope__flap { transform: scaleY(-1); }
.cardview__card { position: relative; animation: cardPop 650ms var(--ease) both; }
.cardview__card canvas {
  display: block; width: min(440px, 86vw); height: auto; border-radius: 18px; box-shadow: var(--shadow-lift);
}
.cardview__card canvas:focus { outline: none; }
.cardview__card canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }
@keyframes cardPop { from { opacity: 0; transform: translateY(40px) scale(.86) rotate(-3deg); } to { opacity: 1; transform: none; } }
.confetti span {
  position: absolute; left: 50%; top: 40%; width: 12px; height: 12px; border-radius: 3px; opacity: 0;
  background: var(--c); animation: pop 1100ms var(--ease) both; animation-delay: var(--dl, 0ms);
}
@keyframes pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r)) scale(1); }
}
.cardview__after { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.cardview__after[hidden], .cardview__card[hidden], .envelope[hidden], .cardview__tap[hidden], .cardview__error[hidden], .cardview__stage[hidden] { display: none; }
.cardview__small { margin: 24px 0 0; color: var(--soft); font-size: 16px; }
.cardview__error { max-width: 40ch; margin: 0 auto; color: var(--soft); }
@media (prefers-reduced-motion: reduce) {
  .cardview__card, .confetti span { animation: none; }
  .confetti { display: none; }
  .envelope, .envelope__flap { transition: none; }
}

.linkbox { display: grid; gap: 6px; }
.linkbox[hidden] { display: none; }
.linkbox label { font-weight: 700; font-size: 16px; }
.linkbox input { width: 100%; min-height: 48px; padding: 0 14px; font: inherit; font-size: 15px; color: var(--soft); background: var(--card); border: 2px solid var(--line); border-radius: 12px; }
.linkbox input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(244, 194, 122, .6); }

/* e-card extras + effects */
#extras[hidden] { display: none; }
.sublabel { font-weight: 700; font-size: 17px; margin: 14px 0 8px; }
.stage__frame { overflow: hidden; }
.fx-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.fx-layer--page { position: fixed; z-index: 80; }

/* seasonal looks */
.look__new { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--orange, #E2683C); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
