/* TheLangleyCraft Cards — mobile-first styles. Brand palette lives in :root. */
:root {
  --ivory: #fdf6f3;
  --paper: #fffaf8;
  --blush: #f6e3df;
  --blush-deep: #f3d9d4;
  --pink: #e7a2b2;
  --burgundy: #7d1f3a;
  --burgundy-dark: #5f1529;
  --gold: #d8b26a;
  --ink: #2b1a1f;
  --muted: #7c6a6e;
  --line: #ead8d4;
  --error: #b3261e;
  --radius: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  /* card theme (updated live by JS) */
  --card: #7d1f3a;
  --accent: #d8b26a;
  --card-ink: #fff6ef;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); line-height: 1.45;
  background: radial-gradient(120% 80% at 50% 0%, #fbefec 0%, #f4e2de 100%) fixed;
  min-height: 100vh;
}
a { color: var(--burgundy); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .82rem; }
.muted { color: var(--muted); }
mark.todo { background: #fff0b3; color: #6b4e00; padding: 0 .25em; border-radius: 4px; }

.shell { padding: 12px 10px 32px; display: flex; justify-content: center; }
.sheet {
  width: 100%; max-width: 600px; background: var(--ivory); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(125, 31, 58, .10), 0 2px 6px rgba(125, 31, 58, .05);
  padding: 18px 16px 0; overflow: hidden;
}
.hero { text-align: center; margin-bottom: 12px; }
.hero-heart { width: 34px; height: 34px; fill: none; stroke: var(--burgundy); stroke-width: 1.6; }
.hero h1 { margin: 2px 0 2px; font-size: 1.25rem; color: var(--burgundy); letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); font-size: .98rem; }

.product-picker { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; }
.product-picker button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.product-picker button[aria-pressed="true"] { background: var(--burgundy); color: #fff; border-color: var(--burgundy); }

/* ── Preview stage ───────────────────────────────────────────── */
.stage {
  position: relative; background: linear-gradient(180deg, #f8e4e0, var(--blush-deep));
  border-radius: 18px; padding: 26px 0 22px; overflow: hidden; min-height: 340px;
  display: flex; align-items: center; justify-content: center;
}
.view { width: 100%; display: flex; flex-direction: column; align-items: center; }
.float-heart { position: absolute; width: 18px; height: 16px; opacity: .75; animation: drift 7s ease-in-out infinite; }
.float-heart::before, .float-heart::after { content: ""; position: absolute; top: 0; width: 10px; height: 15px; background: var(--pink); border-radius: 10px 10px 0 0; }
.float-heart::before { left: 8px; transform: rotate(-45deg); transform-origin: 0 100%; }
.float-heart::after { left: 0; transform: rotate(45deg); transform-origin: 100% 100%; }
.float-heart.h1 { left: 7%; top: 18%; } .float-heart.h2 { left: 15%; top: 44%; animation-delay: -2s; }
.float-heart.h3 { left: 11%; top: 74%; animation-delay: -4s; } .float-heart.h4 { right: 10%; top: 25%; animation-delay: -1s; }
.float-heart.h5 { right: 12%; top: 78%; animation-delay: -3s; } .float-heart.h6 { right: 22%; top: 8%; animation-delay: -5s; }
@keyframes drift { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .float-heart, .demo-book * { animation: none !important; } }

.card {
  position: relative; width: min(58%, 300px); aspect-ratio: 307 / 443; background: var(--card);
  border-radius: 8px; padding: 4%; box-shadow: 0 10px 24px rgba(60, 10, 25, .25); transition: background .3s;
  z-index: 1;
}
.card-frame {
  height: 100%; border: 1.5px solid var(--accent); border-radius: 3px; padding: 4%;
  outline: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -6px;
  display: flex; flex-direction: column; align-items: center;
}
.card-title {
  margin: 6% 0 7%; font-family: var(--serif); color: var(--card-ink); text-align: center;
  font-size: clamp(.95rem, 4.6vw, 1.45rem); line-height: 1.15; min-height: 1.2em; overflow-wrap: anywhere;
}
.photo-frame {
  position: relative; width: 74%; aspect-ratio: 9 / 10; border: 2px solid var(--accent); border-radius: 2px;
  background: #e4c4c2; overflow: hidden;
}
.photo-placeholder { position: absolute; inset: 0; }
.sil { position: absolute; border-radius: 50%; width: 30%; aspect-ratio: 1; top: 18%; }
.sil-a { left: 18%; background: #f7e9df; } .sil-b { left: 50%; background: #f0d1c1; }
.sil-body { position: absolute; bottom: 18%; width: 42%; height: 34%; border-radius: 50% 50% 0 0; }
.sil-body-a { left: 6%; background: #f7e9df; } .sil-body-b { left: 44%; background: #f2dccf; }
.photo-hint { position: absolute; bottom: 4%; left: 0; right: 0; text-align: center; color: #8a5a5f; font-size: .72rem; }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.card-heart { width: 18%; margin-top: auto; margin-bottom: 4%; fill: var(--accent); }
.card-shadow { width: min(64%, 330px); height: 16px; margin-top: -6px; background: radial-gradient(closest-side, rgba(90, 30, 40, .18), transparent); }

.card.inside { background: #fffaf3; border: 1px solid #efdcc7; }
.inside-page {
  height: 100%; border: 1.5px solid var(--card); border-radius: 3px; padding: 9% 8%; display: flex; flex-direction: column;
  color: #3b2228; font-family: var(--serif); overflow: hidden;
}
.inside-occasion { margin: 0 0 8%; text-transform: uppercase; letter-spacing: .14em; font-family: var(--sans); font-size: .62rem; color: var(--card); text-align: center; }
.inside-dear { margin: 0 0 6%; font-size: clamp(.85rem, 3.8vw, 1.1rem); }
.inside-message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: clamp(.72rem, 3.2vw, .95rem); line-height: 1.45; }
.inside-sign { margin: auto 0 0; text-align: right; font-size: clamp(.78rem, 3.4vw, 1rem); }
.inside-heart { width: 14%; align-self: center; margin-top: 6%; fill: var(--card); }

.demo-wrap { position: relative; width: min(78%, 360px); }
.demo-video { width: 100%; border-radius: 12px; background: #000; display: block; }
.watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  color: rgba(255, 255, 255, .55); font-weight: 700; letter-spacing: .2em; font-size: .8rem; transform: rotate(-24deg); text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.demo-placeholder { text-align: center; color: var(--muted); font-size: .85rem; }
.demo-placeholder p { margin: 14px 8px 0; }
.demo-book { position: relative; width: 52%; margin: 0 auto; aspect-ratio: 307 / 443; perspective: 900px; }
.demo-cover, .demo-inner {
  position: absolute; inset: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--serif); padding: 10%;
}
.demo-inner { background: #fffaf3; color: #3b2228; border: 1px solid #efdcc7; }
.demo-cover { background: var(--card); color: var(--card-ink); border: 2px solid var(--accent); transform-origin: left center; animation: open 5s ease-in-out infinite; z-index: 1; backface-visibility: hidden; }
@keyframes open { 0%, 25% { transform: rotateY(0); } 55%, 80% { transform: rotateY(-160deg); } 100% { transform: rotateY(0); } }

.tabs { display: flex; gap: 2px; margin: 12px 0 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: transparent; padding: 7px 11px; font-size: .92rem; white-space: nowrap; border-radius: 999px; color: #9a8a8d; font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: #f0e6e6; color: var(--ink); }
.tab:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible, .crop-frame:focus-visible { outline: 3px solid color-mix(in srgb, var(--burgundy) 45%, transparent); outline-offset: 2px; }

.product-line { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 14px; }
.product-line h2 { margin: 0; font-size: 1.02rem; color: var(--burgundy); }
.price { font-weight: 700; color: var(--burgundy); font-size: 1.1rem; }

/* ── Form ────────────────────────────────────────────────────── */
.order-form { display: flex; flex-direction: column; gap: 14px; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.label { display: block; font-weight: 600; color: #8b7b7e; margin-bottom: 7px; font-size: .95rem; padding: 0; }
.label-note { font-weight: 400; }
.radios { display: flex; flex-direction: column; gap: 6px; }
.radio { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 30px; }
.radio input { appearance: none; width: 20px; height: 20px; border: 1.5px solid #e2d3d2; border-radius: 50%; margin: 0; display: grid; place-content: center; background: #fff; }
.radio input:checked { border-color: #111; background: #111; }
.radio input:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.radio input:focus-visible, .check input:focus-visible, .swatch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--burgundy) 45%, transparent); outline-offset: 2px; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--ivory); box-shadow: 0 0 0 1.5px transparent; }
.swatch input:checked + span { box-shadow: 0 0 0 2px #7a5b52; }
.input {
  width: 100%; border: 1px solid #e3d4d1; background: var(--paper); border-radius: 999px; padding: 11px 16px; font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(125, 31, 58, .12); }
.textarea { border-radius: 14px; resize: vertical; min-height: 84px; line-height: 1.4; }
.input[aria-invalid="true"] { border-color: var(--error); }
.field-foot { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-top: 4px; }
.counter { color: var(--muted); font-size: .82rem; white-space: nowrap; margin-left: auto; }
.counter.near { color: #a1561d; } .counter.over { color: var(--error); font-weight: 600; }
.field-error { color: var(--error); font-size: .85rem; margin: 4px 0 0; min-height: 0; }
.field-error:empty { display: none; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed #d9bfbd; border-radius: 14px; background: var(--paper); color: var(--muted);
}
.dropzone svg { width: 28px; height: 28px; fill: var(--burgundy); }
.dropzone strong { color: var(--ink); }
.dropzone.dragging { border-color: var(--burgundy); background: #fff3f1; }
input[type="file"]:focus-visible + .cropper, #photo-input:focus-visible ~ .dropzone { outline: 3px solid var(--burgundy); }
.cropper { display: grid; grid-template-columns: 42% 1fr; gap: 14px; align-items: start; margin-top: 10px; }
.crop-frame { position: relative; width: 100%; aspect-ratio: 9 / 10; overflow: hidden; border-radius: 6px; border: 2px solid var(--gold); background: #eee; cursor: grab; touch-action: none; }
.crop-frame:active { cursor: grabbing; }
.crop-controls input[type="range"] { width: 100%; accent-color: var(--burgundy); }
.crop-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.btn-ghost { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .88rem; }

.consents { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: #4a3a3e; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--burgundy); flex: none; }
.turnstile { min-height: 0; display: flex; justify-content: center; }
.form-error { background: #fdecea; color: var(--error); border-radius: 12px; padding: 10px 14px; font-size: .9rem; }

.btn-primary {
  width: 100%; border: 0; background: var(--burgundy); color: #fff; font-weight: 700; padding: 14px 18px; border-radius: 12px;
  font-size: 1.02rem; cursor: pointer; box-shadow: 0 6px 16px rgba(125, 31, 58, .22); transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--burgundy-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .65; cursor: progress; }
.secure-line { margin: -4px 0 0; text-align: center; color: var(--muted); font-size: .88rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.secure-line svg { width: 14px; height: 14px; fill: currentColor; }
.test-banner { margin: 0; text-align: center; font-size: .8rem; color: #6b4e00; background: #fff4cf; border-radius: 8px; padding: 6px; }
.notice { background: #fff4cf; padding: 10px; border-radius: 10px; }

.details { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; font-size: .95rem; }
.details h2 { font-size: 1.05rem; color: var(--burgundy); margin: 0 0 8px; }
.details h3 { font-size: .98rem; margin: 18px 0 6px; }
.facts, .steps { padding-left: 1.2em; margin: 8px 0; } .facts li, .steps li { margin: 4px 0; }
details { border-bottom: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 6px 0 0; color: #4a3a3e; }

.footer { margin: 24px -16px 0; padding: 16px; background: #f7ebe8; text-align: center; font-size: .82rem; color: var(--muted); }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-bottom: 6px; }
.footer a { color: var(--muted); }

/* ── Simple pages (legal, order status) ─────────────────────── */
.page { max-width: 760px; }
.page h1 { color: var(--burgundy); font-size: 1.5rem; margin: 8px 0 4px; }
.page h2 { font-size: 1.1rem; color: var(--burgundy); margin: 22px 0 6px; }
.page p, .page li { font-size: .96rem; }
.draft-banner { background: #fff4cf; color: #6b4e00; border-radius: 12px; padding: 10px 14px; font-size: .88rem; margin: 10px 0 16px; }
.status-box { text-align: center; padding: 26px 8px; }
.status-box .big { font-size: 2.2rem; }
.status-box .ref { font-weight: 700; color: var(--burgundy); font-size: 1.15rem; }
.back { display: inline-block; margin-top: 10px; }
.btn-link { display: inline-block; background: var(--burgundy); color: #fff; text-decoration: none; padding: 12px 20px; border-radius: 12px; font-weight: 700; }

/* ── Larger screens ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .shell { padding: 28px 20px 48px; }
  .sheet { padding: 26px 26px 0; }
  .footer { margin: 28px -26px 0; }
  .hero h1 { font-size: 1.4rem; }
  .stage { min-height: 460px; }
  .card-title { font-size: 1.5rem; }
  .tab { padding: 7px 14px; font-size: 1rem; }
}
@media (min-width: 1024px) {
  .sheet.page { max-width: 820px; }
}

/* ── Product tiers (free landing page, access page) ───────────── */
.tier-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.tier { display: grid; grid-template-columns: 38% 1fr; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.tier-media { background: linear-gradient(180deg, #f8e4e0, var(--blush-deep)); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 12px 8px; min-height: 150px; }
.tier-video { width: 100%; border-radius: 8px; display: block; background: #000; }
.mini-card { width: 74%; aspect-ratio: 307 / 443; border-radius: 6px; border: 2px solid; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 14% 8% 10%; text-align: center; box-shadow: 0 8px 18px rgba(60, 10, 25, .22); }
.mini-title { font-family: var(--serif); font-size: .92rem; line-height: 1.15; }
.mini-heart { font-size: 1.2rem; }
.tier-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tier-body p { margin: 0; }
.tier-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tier-head h3 { margin: 0; font-size: 1.05rem; color: var(--burgundy); font-family: var(--serif); }
.tier-price { font-weight: 700; color: var(--burgundy); white-space: nowrap; }
.badge { align-self: flex-start; background: var(--burgundy); color: #fff; font-size: .7rem; font-weight: 700; letter-spacing: .06em; border-radius: 999px; padding: 2px 9px; }
.tier-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 4px; }
.tier-actions .btn-primary { padding: 12px 14px; font-size: .95rem; }
.tier-note { margin: 0; }
.btn-link-block { display: block; text-align: center; text-decoration: none; }
.btn-ghost.wide { width: 100%; padding: 10px 12px; font-weight: 600; color: var(--burgundy); border-color: #e0c6c9; }
.upsell { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.upsell h2 { margin: 0 0 2px; font-size: 1.05rem; color: var(--burgundy); }
.inapp-hint { background: #fff4cf; color: #6b4e00; border-radius: 12px; padding: 8px 12px; font-size: .85rem; margin: 0 0 10px; }
.cross-sell { margin: 0 0 12px; text-align: center; font-size: .9rem; }
.cross-sell a { font-weight: 600; }
.pay-first { border: 1px dashed #e0c6c9; border-radius: 14px; padding: 12px; text-align: center; }
.pay-first p { margin: 6px 0 0; }

/* ── "My order" pages (/o#<id>.<token>) reuse the storefront ─── */
.access-mode .shop-only { display: none !important; }
.access-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; text-align: center; margin-bottom: 14px; }
.access-panel h2 { color: var(--burgundy); margin: 4px 0 8px; font-size: 1.2rem; }
.access-panel .btn-primary { max-width: 360px; margin: 10px auto 4px; display: block; text-decoration: none; }
.access-intro { background: #fff3f1; border-radius: 12px; padding: 10px 14px; font-size: .92rem; margin: 0 0 12px; }
@media (max-width: 380px) { .tier { grid-template-columns: 1fr; } .mini-card { width: 40%; } }
.access-done .stage, .access-done .tabs, .access-done .product-line, .access-done .order-form, .access-done .access-intro { display: none !important; }

/* ── Card design choice + words-only (monogram) design ───────── */
.layout-field { margin-bottom: 10px; }
.layout-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.layout-opt { position: relative; display: block; cursor: pointer; }
.layout-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.layout-opt > span { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid #e3d4d1; background: var(--paper); border-radius: 14px; padding: 10px 12px; height: 100%; }
.layout-opt strong { font-size: .95rem; }
.layout-opt small { color: var(--muted); font-size: .78rem; }
.layout-opt input:checked + span { border-color: var(--burgundy); box-shadow: 0 0 0 2px rgba(125, 31, 58, .12); }
.layout-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--burgundy) 45%, transparent); outline-offset: 2px; }
.layout-opt.disabled { opacity: .5; cursor: not-allowed; }
.aup-note { font-size: .82rem; color: #5b4a4e; background: #fbf0ee; border-radius: 10px; padding: 8px 10px; margin: 10px 0 8px; }
.photo-step-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.btn-link-plain { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .88rem; padding: 4px; }

.monogram { display: none; }
.card.layout-text .photo-frame { display: none; }
.card.layout-text .monogram {
  display: flex; flex: 1; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 8%;
  color: var(--accent); font-family: var(--serif); text-align: center;
}
.mono-line { display: block; width: 46%; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.mono-letters { display: flex; align-items: baseline; gap: .15em; font-size: clamp(2rem, 11vw, 3.4rem); line-height: 1; color: var(--card-ink); letter-spacing: .02em; }
.mono-letters .amp { font-style: italic; font-size: .55em; color: var(--accent); }
.mono-names { font-size: clamp(.7rem, 3vw, .9rem); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-family: var(--sans); min-height: 1em; overflow-wrap: anywhere; }
.card.layout-text .card-title { margin-bottom: 2%; }

/* Post-payment photo step: only the photo area is shown */
.photo-step-mode .order-form > .field:not(#photo-field),
.photo-step-mode .order-form > fieldset,
.photo-step-mode #layout-field,
.photo-step-mode .product-line { display: none !important; }
