/* CKL Foundation site. Colours come from the card itself: marble cream paper,
   the brown of the crest, the gold of the frame. scrollcraft.css supplies the
   scale; this file themes it and adds the site's own parts. */
:root {
  --sc-canvas: #1b120b;            /* walnut table, the hero ground */
  --sc-surface: #2a1c11;
  --sc-ink: #f8efd9;
  --sc-ink-soft: #cdbb98;
  --sc-accent: #d9a441;            /* frame gold */
  --sc-accent-ink: #24150a;
  --sc-font-display: "Frank Ruhl Libre", "Noto Serif", "Noto Serif SC", "Noto Serif Devanagari", Georgia, serif;
  --sc-font-text: "Heebo", "Noto Sans", "Noto Sans SC", "Noto Sans Devanagari", system-ui, sans-serif;
  --paper: #fbf4e0;
  --paper-2: #f3e6c2;
  --brown: #532f16;
  --brown-ink: #2b1a0e;
  --brown-soft: #6b5743;
  --line: #dcc99a;
  --bar-h: 64px;
}
html { scroll-padding-top: var(--bar-h); }
body { font-family: var(--sc-font-text); }
img { max-width: 100%; }

/* sections printed on paper use dark ink */
.on-paper { --sc-ink: var(--brown-ink); --sc-ink-soft: var(--brown-soft); --sc-hairline: #dcc99a; color: var(--sc-ink); }
body.paper { background: var(--paper); --sc-canvas: var(--paper); }

/* ---------- bar ---------- */
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: var(--sc-z-chrome, 60);
  background: color-mix(in oklab, var(--paper) 94%, transparent); border-bottom: 1px solid var(--line);
  color: var(--brown-ink); }
.bar__in { max-width: var(--sc-maxw); margin-inline: auto; padding-inline: var(--sc-gutter); height: 100%;
  display: flex; align-items: center; gap: var(--sc-5); }
.bar__logo img { height: 34px; width: auto; display: block; }
.bar nav { display: flex; gap: var(--sc-5); margin-inline-start: auto; }
.bar nav a { color: var(--brown-ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 6px 2px; border-bottom: 2px solid transparent; }
.bar nav a:hover, .bar nav a[aria-current="page"] { border-bottom-color: var(--sc-accent); }
.lang { font: inherit; font-size: 0.9rem; color: var(--brown-ink); background: #fff; border: 1px solid #c9b584; border-radius: 6px; padding: 7px 8px; max-width: 9.5rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--brown); color: #fff; border: 1px solid var(--brown); border-radius: 8px; padding: 11px 20px; text-decoration: none; min-height: 44px; }
.btn:hover { background: #3f2310; }
.btn--gold { background: var(--sc-accent); border-color: var(--sc-accent); color: var(--sc-accent-ink); }
.btn--gold:hover { background: #e6b65a; }
.btn--ghost { background: transparent; color: var(--brown); border-color: #c9b584; }
.btn--ghost:hover { background: #fbf1d4; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.bar .btn { padding: 9px 16px; min-height: 40px; white-space: nowrap; }
.menu-btn { display: none; margin-inline-start: auto; background: none; border: 1px solid #c9b584; border-radius: 8px; width: 44px; height: 40px; cursor: pointer; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--brown-ink); margin: 4px auto; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .bar nav { position: absolute; inset: var(--bar-h) 0 auto 0; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px var(--sc-gutter) 16px; display: none; }
  .bar nav.open { display: flex; }
  .bar nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .bar .btn { display: none; }
  .bar__logo img { height: 28px; }
}

/* ---------- the card, a real hinged object ---------- */
.cardstage { background: radial-gradient(120% 90% at 50% 38%, #3a2716 0%, #24170d 46%, #150d07 100%); overflow: hidden; }
.table-grain { position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: soft-light; pointer-events: none;
  background-image: repeating-linear-gradient(92deg, rgba(255,220,170,0.05) 0 2px, transparent 2px 9px), repeating-linear-gradient(88deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 23px); }
.card-scene { position: absolute; inset: 0; display: grid; place-items: center; perspective: 1900px; perspective-origin: 50% 40%;
  pointer-events: none; padding-inline-start: 38vw; padding-top: var(--bar-h); }
/* scroll position of the act (0..1) -> three moves, one after the other */
.card-rig { --w: min(25vw, 40vh, 400px); --s0: 0.9;
  --open: clamp(0, calc((var(--sc-p, 0) - 0.08) / 0.24), 1);
  --lift: clamp(0, calc((var(--sc-p, 0) - 0.38) / 0.22), 1);
  --flip: clamp(0, calc((var(--sc-p, 0) - 0.68) / 0.22), 1);
  position: relative; width: calc(var(--w) * 2); height: calc(var(--w) / 0.75); transform-style: preserve-3d; will-change: transform;
  transform: translateY(calc((1 - var(--lift)) * 5vh)) scale(calc(var(--s0) + var(--lift) * (1 - var(--s0))))
    rotateX(calc((1 - var(--lift)) * 52deg)) rotateZ(calc((1 - var(--lift)) * -9deg)); }
.card-shadow { position: absolute; top: 4%; bottom: -7%; inset-inline: calc((1 - var(--open)) * var(--w) / 2 - 3%);
  background: rgba(0,0,0,0.6); filter: blur(22px); opacity: calc(1 - var(--lift) * 0.85); transform: translateZ(-3px); }
.card3d { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform;
  transform: translateX(calc((1 - var(--open)) * var(--w) / 2)) rotateY(calc(var(--flip) * 180deg)); }
.leaf { position: absolute; top: 0; width: 50%; height: 100%; transform-style: preserve-3d; }
.leaf--base { left: 0; }
.leaf--cover { left: 50%; transform-origin: 0 50%; will-change: transform;
  transform: rotateY(calc(var(--open) * 180deg - 180deg)) translateZ(-0.6px); }
.leaf__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #f3e3b6; }
.leaf__face img, .leaf__face svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.leaf__face--back { transform: rotateY(180deg); }
/* the fold catches less light while the card is half open */
.leaf--cover .leaf__face:not(.leaf__face--back)::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(40,20,5,0.5), transparent 45%); opacity: calc((1 - var(--open)) * 0.9); }
.leaf--base .leaf__face:not(.leaf__face--back)::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(270deg, rgba(40,20,5,0.45), transparent 40%); opacity: calc((1 - var(--open)) * 0.9); }
.hero-copy { position: absolute; z-index: var(--sc-z-copy); inset-inline-start: var(--sc-gutter); top: 50%; translate: 0 -40%;
  width: min(34rem, 35vw); }
.hero-copy p { color: var(--sc-ink-soft); font-size: var(--sc-t-lg); line-height: 1.45; margin: 0; }
.hero-copy .btn { margin-top: var(--sc-5); }
.hero-h1 { font-family: var(--sc-font-display); font-weight: 700; font-size: clamp(2.2rem, 1.2rem + 3.1vw, 4.2rem); line-height: 1.04; letter-spacing: -0.015em; margin: 0 0 var(--sc-4); text-wrap: balance; }
.act-h { font-family: var(--sc-font-display); font-weight: 700; font-size: clamp(1.8rem, 1.2rem + 2.2vw, 3.2rem); line-height: 1.08; margin: 0 0 var(--sc-3); text-wrap: balance; }
:lang(he) .hero-h1, :lang(yi) .hero-h1, :lang(zh) .hero-h1, :lang(hi) .hero-h1 { letter-spacing: 0; line-height: 1.15; }
@media (max-width: 900px) {
  .card-scene { padding-inline-start: 0; padding-top: var(--bar-h); padding-bottom: 30vh; perspective: 1200px; }
  .card-rig { --w: min(44vw, 30vh); --s0: 0.82; }
  .hero-copy { inset-inline: var(--sc-gutter); width: auto; top: auto; bottom: 5vh; translate: none; }
  .hero-copy p { font-size: 1.05rem; }
  .hero-h1 { font-size: clamp(1.9rem, 7.4vw, 2.6rem); }
}
@media (prefers-reduced-motion: reduce) {
  .card-rig { --open: 1; --lift: 1; --flip: 0; }
}
html.i18n-wait body { visibility: hidden; }

/* ---------- what it is ---------- */
.what { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.what figure { margin: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 4px rgba(60,35,10,0.18), 0 18px 40px rgba(60,35,10,0.22); }
.what figure img { display: block; width: 100%; height: auto; }
.what blockquote { margin: var(--sc-6) 0 0; padding-inline-start: var(--sc-5); border-inline-start: 3px solid var(--sc-accent); font-family: var(--sc-font-display); font-size: var(--sc-t-xl); line-height: 1.2; color: var(--brown); }
.what blockquote cite { display: block; margin-top: var(--sc-2); font-family: var(--sc-font-text); font-size: var(--sc-t-sm); font-style: normal; color: var(--brown-soft); }
@media (max-width: 860px) { .what { grid-template-columns: 1fr; } }

/* ---------- formats rail ---------- */
.rail { direction: ltr; display: flex; align-items: center; gap: clamp(2rem, 5vw, 5rem); height: 100%; padding-inline: var(--sc-gutter); width: max-content; }
.rail__lead { width: min(26rem, 78vw); flex: none; }
.format { flex: none; width: min(64vw, 46rem); color: inherit; text-decoration: none; }
.format--narrow { width: min(48vw, 30rem); }
.format img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 4px rgba(60,35,10,0.2), 0 22px 44px rgba(60,35,10,0.24); }
.format h3 { font-family: var(--sc-font-display); font-size: var(--sc-t-xl); margin: var(--sc-5) 0 var(--sc-1); }
.format p { margin: 0; color: var(--brown-soft); }
.rail__end { flex: none; width: min(22rem, 70vw); }
@media (max-width: 760px) { .format { width: 86vw; } .format--narrow { width: 70vw; } }

/* ---------- how ---------- */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 4rem); margin-top: var(--sc-7); }
.how h3 { font-family: var(--sc-font-display); font-size: var(--sc-t-xl); margin: 0 0 var(--sc-2); color: var(--brown); }
.how p { margin: 0; color: var(--brown-soft); }
.how > div { border-top: 2px solid var(--sc-accent); padding-top: var(--sc-4); }
@media (max-width: 760px) { .how { grid-template-columns: 1fr; } }

/* ---------- close: the name goes on the card ---------- */
.close { display: grid; grid-template-rows: 1fr auto; background: radial-gradient(120% 90% at 50% 30%, #3a2716 0%, #1f140b 55%, #130b06 100%); }
.close__in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(2rem, 6vw, 6rem); align-items: center;
  max-width: var(--sc-maxw); margin-inline: auto; padding: calc(var(--bar-h) + 2vh) var(--sc-gutter) 2vh; width: 100%; }
.close__card { position: relative; width: min(100%, 46vh * 0.7308); margin-inline: auto; aspect-ratio: 342 / 468; border-radius: 3px; overflow: hidden; box-shadow: 0 3px 6px rgba(0,0,0,0.4), 0 30px 60px rgba(0,0,0,0.5); transform: rotate(-2.2deg); }
.close__card img, .close__card svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.name-field { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--sc-5); }
.name-field input { flex: 1 1 14rem; min-width: 0; font: inherit; font-size: 1.25rem; padding: 12px 14px; border-radius: 8px; border: 1px solid #7a5c3a; background: #fffaf0; color: var(--brown-ink); min-height: 48px; }
.name-field input:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .btn:focus-visible, .lang:focus-visible, a:focus-visible, .choice input:focus-visible + span { outline: 3px solid var(--sc-accent); outline-offset: 2px; }
.foot { border-top: 1px solid rgba(248,239,217,0.14); color: var(--sc-ink-soft); font-size: 0.92rem; }
.foot__in { max-width: var(--sc-maxw); margin-inline: auto; padding: 18px var(--sc-gutter); display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; }
.foot a { color: inherit; }
.foot--paper { border-top-color: var(--line); color: var(--brown-soft); background: var(--paper-2); margin-top: var(--sc-9); }
@media (max-width: 860px) {
  .close__in { grid-template-columns: 1fr; gap: 3vh; padding-top: calc(var(--bar-h) + 1vh); }
  .close__card { width: min(52vw, 30vh * 0.7308); order: -1; }
}

/* ---------- inner pages ---------- */
.page { padding-top: calc(var(--bar-h) + clamp(1.5rem, 4vw, 3.5rem)); }
.page h1 { font-family: var(--sc-font-display); font-weight: 700; font-size: clamp(2rem, 1.5rem + 2.4vw, 3.4rem); line-height: 1.05; margin: 0 0 var(--sc-3); color: var(--brown-ink); }
.page .lead { font-size: var(--sc-t-lg); color: var(--brown-soft); max-width: 46rem; margin: 0 0 var(--sc-7); }
.prose p { max-width: 44rem; font-size: 1.08rem; line-height: 1.7; color: var(--brown-ink); }
.card-box { background: #fffdf6; border: 1px solid var(--line); border-radius: 8px; padding: clamp(1rem, 3vw, 1.75rem); }

/* order */
.order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--sc-5); flex-wrap: wrap; }
.steps li { font-size: 0.9rem; font-weight: 600; color: var(--brown-soft); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fffdf6; }
.steps li[aria-current="step"] { background: var(--brown); color: #fff; border-color: var(--brown); }
.steps li.done { color: var(--brown); border-color: var(--brown); }
fieldset.step { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.step[hidden] { display: none; }
.field { margin: 0 0 18px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: 0.92rem; margin: 0 0 6px; color: var(--brown-ink); }
.field input[type=text], .field input[type=tel], .field input[type=email], .field input[type=date], .field select, .field textarea {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--brown-ink); background: #fff; border: 1px solid #c9b584; border-radius: 6px; min-height: 46px; }
.field textarea { min-height: 88px; resize: vertical; }
.hint { font-size: 0.86rem; color: var(--brown-soft); margin: 6px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choices--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: block; padding: 11px 12px; border: 1px solid #c9b584; border-radius: 6px; background: #fff; line-height: 1.3; min-height: 46px; }
.choice span b { display: block; font-weight: 700; }
.choice span i { font-style: normal; color: var(--brown-soft); font-size: 0.84rem; }
.choice input:checked + span { border-color: var(--brown); box-shadow: inset 0 0 0 1px var(--brown); background: #fbf1d4; }
.names .name { display: flex; gap: 8px; margin-bottom: 8px; }
.names .name[hidden] { display: none; }
.names input { flex: 1; font-size: 1.15rem !important; }
.icon-btn { background: #fff; border: 1px solid #c9b584; color: var(--brown-soft); width: 46px; min-height: 46px; flex: none; font-size: 1.2rem; line-height: 1; border-radius: 6px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.preview { position: sticky; top: calc(var(--bar-h) + 16px); }
.preview__tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.preview__tabs button { font: inherit; font-weight: 600; font-size: 0.9rem; padding: 8px 14px; border-radius: 6px; border: 1px solid #c9b584; background: #fff; color: var(--brown-soft); cursor: pointer; min-height: 40px; }
.preview__tabs button[aria-pressed="true"] { background: var(--brown); border-color: var(--brown); color: #fff; }
.preview__card { position: relative; aspect-ratio: 684 / 468; background: #efe2bd; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 4px rgba(60,35,10,0.2), 0 16px 34px rgba(60,35,10,0.22); }
.preview__card img { display: block; width: 100%; height: auto; }
.preview__card svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview__msg { margin: 12px 0 0; font-size: 0.9rem; color: var(--brown-soft); }
.preview__manual { padding: clamp(2rem, 8vw, 5rem) 1.25rem; text-align: center; color: var(--brown); font-weight: 600; }
.review { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0 0 18px; }
.review dt { color: var(--brown-soft); }
.review dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin: 14px 0; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.note { font-size: 0.9rem; color: var(--brown-soft); margin: 10px 0 0; }
.error { color: #a3261a; font-weight: 600; }
.hp { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  .order { grid-template-columns: 1fr; }
  .preview { position: sticky; top: var(--bar-h); z-index: 5; background: var(--paper); padding: 8px 0 10px; margin-inline: calc(var(--sc-gutter) * -1); padding-inline: var(--sc-gutter); border-bottom: 1px solid var(--line); order: -1; }
  .preview__card { max-width: min(100%, 30rem); margin-inline: auto; }
  .preview__msg { display: none; }
}
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; gap: 0; } .choices--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* stories */
.stories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); margin-top: var(--sc-7); }
.story { margin: 0; }
.story__photo { aspect-ratio: 4 / 5; border-radius: 6px; background: repeating-linear-gradient(135deg, #f1e3bb 0 14px, #ecdcae 14px 28px); border: 1px dashed #c9b584; display: grid; place-items: center; color: var(--brown-soft); font-size: 0.9rem; text-align: center; padding: 1rem; }
.story:nth-child(2) { margin-top: clamp(1rem, 5vw, 4rem); }
@media (max-width: 760px) { .stories { grid-template-columns: 1fr 1fr; } .story:nth-child(2) { margin-top: 0; } .story:nth-child(3) { display: none; } }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.founder__photo { aspect-ratio: 1; max-width: 18rem; border-radius: 6px; background: repeating-linear-gradient(135deg, #f1e3bb 0 14px, #ecdcae 14px 28px); border: 1px dashed #c9b584; }
[dir="rtl"] .close__card { transform: rotate(2.2deg); }

[dir="rtl"] .rail > * { direction: rtl; }
.table-grain { transform: translateY(calc(var(--sc-p, 0) * -5vh)) scale(1.12); }
.lamp { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 50% at calc(62% - var(--sc-p, 0) * 10%) 30%, rgba(255,214,150,0.16), transparent 70%); }
[dir="rtl"] .lamp { transform: scaleX(-1); }
@media (max-height: 700px) and (max-width: 860px) { .close__card { width: min(40vw, 24vh * 0.7308); } .close__in h2 { font-size: 1.6rem; } }
.paper-a { background: var(--paper); }
.paper-b, .formats { background: var(--paper-2); }
.formats { padding-top: var(--bar-h); direction: ltr; }
.format--wide { width: min(82vw, 58rem); }
.what [data-sc-stagger] > * + * { margin-top: var(--sc-4); }
.what .sc-body { color: var(--brown-ink); font-size: 1.1rem; line-height: 1.65; }
.close .sc-body { margin-top: 0; }
@media (max-width: 760px) { .format--wide { width: 92vw; } }
@media (max-width: 900px) { .preview__card { width: min(100%, calc(30vh * var(--ar, 1.46))); max-width: none; margin-inline: auto; } .preview__tabs { justify-content: center; margin-bottom: 8px; } .preview__tabs button { padding: 5px 12px; min-height: 34px; } }
[hidden] { display: none !important; }
.review { grid-template-columns: minmax(7rem, 38%) 1fr; }
/* order page, all four parts visible */
fieldset.step { margin: 0 0 clamp(1.5rem, 4vw, 2.5rem); padding: 0 0 clamp(1.25rem, 3vw, 2rem); border: 0; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 12px); }
fieldset.step:last-of-type { border-bottom: 0; }
.step-h { display: flex; align-items: center; gap: 10px; padding: 0; margin: 0 0 16px; font-family: var(--sc-font-display); font-weight: 700; font-size: 1.5rem; color: var(--brown-ink); }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--brown); color: #fff; font-family: var(--sc-font-text); font-size: 0.95rem; }
.steps li { padding: 0; }
.steps li a { display: block; padding: 8px 12px; color: var(--brown); text-decoration: none; }
.steps li a:hover { background: #fbf1d4; }
.field-error { color: #a3261a; font-weight: 600; font-size: 0.92rem; margin: 6px 0 0; }
.field.has-error .choice span, .field.has-error input, .field.has-error select { border-color: #a3261a; }
.review dd.missing { color: #a3261a; }
@media (max-width: 900px) { .steps { display: none; } }
/* what is missing is marked clearly */
.field.has-error { background: #fdecea; border-inline-start: 4px solid #b3261e; padding: 10px 12px; border-radius: 6px; }
.field.has-error > label, .field.has-error > .label, .field.has-error .check span { color: #8c1d18; }
.field-error { color: #8c1d18; font-weight: 700; font-size: 0.95rem; margin: 8px 0 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .choice span { border-color: #b3261e; box-shadow: inset 0 0 0 1px #b3261e; }
.missing-box { background: #fdecea; border: 2px solid #b3261e; border-radius: 8px; padding: 12px 16px; margin: 0 0 14px; color: #8c1d18; }
.missing-box ul { margin: 6px 0 0; padding-inline-start: 20px; }
.missing-box a { color: #8c1d18; font-weight: 600; }
.steps li.bad a { color: #8c1d18; background: #fdecea; }
.steps li.bad { border-color: #b3261e; }
.preview__msg.error { color: #8c1d18; font-weight: 700; display: block; }
.hebdate { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 6px; }
.hebdate select, .hebdate input { width: 100%; min-width: 0; padding: 11px 8px; font: inherit; color: var(--brown-ink); background: #fff; border: 1px solid #c9b584; border-radius: 6px; min-height: 46px; }
.field .hint[for], .field span.hint { display: block; margin: 0 0 4px; }
/* order preview: one window, three views (outside, close-up, inside) */
.preview__card { aspect-ratio: auto; }
.preview__card .pv { display: none; position: relative; aspect-ratio: var(--own, 1.4615); background: #efe2bd; }
.preview__card[data-side="out"] .pv[data-side="out"], .preview__card[data-side="ded"] .pv[data-side="ded"],
.preview__card[data-side="in"] .pv[data-side="in"] { display: block; }
.preview__dots { display: none; }
@media (max-width: 900px) {
  /* phone: the bar scrolls away, the card picture owns the top of the screen, no buttons */
  .order-page .bar { position: absolute; }
  .order-page .preview { top: 0; z-index: 40; padding: 0; margin-inline: calc(var(--sc-gutter) * -1); border-bottom: 1px solid var(--line); background: #efe2bd; }
  .order-page .preview__tabs { display: none; }
  .order-page .preview__card { width: 100%; max-width: none; margin: 0; border-radius: 0; box-shadow: none;
    height: min(calc(100vw / var(--ar, 1.4615)), var(--cap, 46svh));
    /* swiped sideways; an up or down drag on the picture still scrolls the page */
    display: flex; direction: ltr; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
  .order-page .preview__card::-webkit-scrollbar { display: none; }
  .order-page .preview__card .pv { display: block; flex: 0 0 100%; height: 100%; aspect-ratio: auto; scroll-snap-align: center; scroll-snap-stop: always; }
  .order-page .preview__dots { display: flex; justify-content: center; gap: 2px; background: #efe2bd; padding: 0 0 2px; }
  .order-page .preview__dots[hidden] { display: none; }
  .order-page .preview__dots button { width: 34px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
  .order-page .preview__dots button::before { content: ""; width: 22px; height: 5px; border-radius: 3px; background: rgba(83,47,22,0.28); }
  .order-page .preview__dots:not([data-at]) button:nth-child(1)::before, .order-page .preview__dots[data-at="0"] button:nth-child(1)::before,
  .order-page .preview__dots[data-at="1"] button:nth-child(2)::before, .order-page .preview__dots[data-at="2"] button:nth-child(3)::before { background: var(--brown); }
  .order-page .preview__msg { margin: 0; padding: 6px var(--sc-gutter); background: var(--paper); }
  .order-page .preview__manual { height: auto; }
  .order-page .page { padding-top: calc(var(--bar-h) + 14px); }
  .order-page .page h1 { font-size: 1.7rem; margin-bottom: 4px; }
  .order-page .page .lead { font-size: 1rem; margin-bottom: 14px; }
}

/* home, round 1 */
/* each move starts and ends gently instead of at one speed */
.card-rig { --open-e: calc(var(--open) * var(--open) * (3 - 2 * var(--open)));
  --lift-e: calc(var(--lift) * var(--lift) * (3 - 2 * var(--lift)));
  --flip-e: calc(var(--flip) * var(--flip) * (3 - 2 * var(--flip)));
  transform: translateY(calc((1 - var(--lift-e)) * 5vh)) scale(calc(var(--s0) + var(--lift-e) * (1 - var(--s0))))
    rotateX(calc((1 - var(--lift-e)) * 52deg)) rotateZ(calc((1 - var(--lift-e)) * -9deg)); }
.card3d { transform: translateX(calc((1 - var(--open-e)) * var(--w) / 2)) rotateY(calc(var(--flip-e) * 180deg)); }
.leaf--cover { transform: rotateY(calc(var(--open-e) * 180deg - 180deg)) translateZ(-0.6px); }
/* on the table: a tight contact shadow. In the hand: a wide soft one that falls away below the card */
.card-shadow { top: 2%; bottom: -5%; inset-inline: calc((1 - var(--open-e)) * var(--w) / 2 - 2%);
  background: rgba(8, 4, 1, 0.72); filter: blur(16px); opacity: calc(1 - var(--lift-e)); transform: translateZ(-2px); }
.card-shadow--far { top: 10%; bottom: -16%; inset-inline: 4%; background: rgba(6, 3, 1, 0.8); filter: blur(46px);
  opacity: calc(var(--lift-e) * 0.75); transform: translateZ(-90px) translateY(6%); }
.leaf__face { box-shadow: inset 0 0 0 1px rgba(255, 244, 214, 0.22); }
/* pictures on paper: a near shadow for the edge and a far one for the lift */
.what figure, .format img { border-radius: 3px;
  box-shadow: 0 1px 1px rgba(60, 35, 10, 0.22), 0 6px 12px rgba(60, 35, 10, 0.14), 0 26px 50px -12px rgba(60, 35, 10, 0.34); }
.format img { transition: box-shadow 180ms ease; }
.format:hover img { box-shadow: 0 1px 1px rgba(60, 35, 10, 0.24), 0 10px 18px rgba(60, 35, 10, 0.18), 0 34px 60px -12px rgba(60, 35, 10, 0.42); }
/* last section: the card stands straight, centred in its half, as it is after cutting */
.close__in > div:first-child { justify-self: start; max-width: 34rem; }
.close__card, [dir="rtl"] .close__card { transform: none; aspect-ratio: 324 / 432; width: min(100%, 52vh * 0.75); margin: 0 auto; justify-self: center;
  border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.35), 0 40px 70px -10px rgba(0, 0, 0, 0.6); }
@media (max-width: 860px) { .close__card, [dir="rtl"] .close__card { width: min(56vw, 32vh * 0.75); } }
@media (max-height: 700px) and (max-width: 860px) { .close__card, [dir="rtl"] .close__card { width: min(40vw, 25vh * 0.75); } }

/* real sizes */
/* home rail: every format at one scale (inches of the open card), so pocket and large differ as they do in the hand */
.rail { --unit: min(4.3vw, 6.2vh, 3.5rem); }
.rail .format { width: calc(var(--in) * var(--unit)); min-width: 0; }
.rail .format h3 { white-space: nowrap; }
.rail .format p { width: max(100%, 15rem); }
@media (max-width: 760px) { .rail { --unit: 6.3vw; } }
/* order page: choice boxes in one group are all the same height */
.choices { grid-auto-rows: 1fr; }
.choice { display: flex; }
.choice span { width: 100%; height: 100%; }
/* order preview: the whole card is drawn to scale against the largest one */
@media (min-width: 901px) {
  .preview__card[data-side="out"], .preview__card[data-side="in"] { width: calc(var(--scale, 1) * 100%); margin-inline: auto; }
}
@media (max-width: 900px) {
  .order-page .preview__card { height: min(calc(100vw * var(--scale-s, 1) / var(--ar, 1.4615)), var(--cap, 46svh)); }
}
/* the two calendars sit one under the other, each with room for day, month and year */
.field .row2:has(.hebdate) { grid-template-columns: 1fr; gap: 12px; }
.hebdate { grid-template-columns: minmax(5.5rem, 1fr) minmax(0, 2.2fr) minmax(5.5rem, 1fr); }

/* home, round 2 */
/* phones: formats stacked to one scale, the largest as wide as the screen allows */
.formats-stack .formats { position: static; height: auto; overflow: visible; padding: clamp(3rem, 12vw, 5rem) var(--sc-gutter); }
.formats-stack .rail { display: block; width: auto; height: auto; padding: 0; transform: none !important; }
.formats-stack .rail__lead, .formats-stack .rail__end { width: auto; }
.formats-stack .rail .format { display: block; width: calc(var(--in) / 13.5 * 100%); margin-top: 2.25rem; }
.formats-stack .rail .format h3 { margin-top: 0.9rem; font-size: 1.35rem; }
.formats-stack .rail .format p { width: max(100%, 16rem); max-width: calc(100vw - 2 * var(--sc-gutter)); }
.formats-stack .rail__end { margin-top: 2.5rem; }
/* phones: the closed card on the table is larger, so the first screen is not mostly empty */
@media (max-width: 900px) { .card-rig { --s0: 1; --w: min(45vw, 31vh); } }

/* home, round 3 */
/* the paper sections lie on the table like a sheet: their first and last edge cast a shadow on it */
main > section:nth-of-type(2) { position: relative; z-index: 5; box-shadow: 0 -22px 44px -8px rgba(0, 0, 0, 0.62), 0 -2px 6px rgba(0, 0, 0, 0.35); }
main > section:nth-of-type(4) { position: relative; z-index: 5; box-shadow: 0 22px 44px -8px rgba(0, 0, 0, 0.66), 0 2px 6px rgba(0, 0, 0, 0.4); }
main > section:nth-of-type(3) { position: relative; z-index: 4; }

/* home, round 4 */
/* while the card turns over, one half swings back behind where the soft shadow used to sit and the
   shadow was drawn over the card. The shadow now lies further back than the card can ever reach. */
.card-shadow--far { transform: translateZ(calc(var(--w) * -1.15)) translateY(9%) scale(1.26); }

/* big preview */
/* order page: the preview takes as much of the screen as it can, for every size alike */
@media (min-width: 901px) {
  .order-page .page.sc-wrap { max-width: 1560px; }
  .order-page .order { grid-template-columns: minmax(21rem, 0.62fr) minmax(0, 1.38fr); }
  .preview__card[data-side="out"], .preview__card[data-side="in"], .preview__card[data-side="ded"] {
    width: min(100%, calc((100vh - var(--bar-h) - 11.5rem) * var(--view-ar, 1.5))); margin-inline: auto; }
}
@media (max-width: 900px) {
  .order-page .preview__card { height: min(calc(100vw / var(--ar, 1.4615)), var(--cap, 46svh)); }
  .order-page .preview__size { margin: 0; padding: 4px var(--sc-gutter) 6px; background: #efe2bd; text-align: center; font-size: 0.82rem; }
}
.preview__size { margin: 10px 0 0; font-weight: 600; color: var(--brown); font-size: 0.95rem; }

/* date picker */
.dates { grid-template-columns: 1fr 1fr; }
.datefield { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; font: inherit; color: var(--brown-soft); background: #fff; border: 1px solid #c9b584; border-radius: 6px; cursor: pointer; text-align: start; }
.datefield::after { content: ""; flex: none; width: 18px; height: 18px; opacity: 0.7;
  background: no-repeat center/18px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23532f16' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.datefield.is-set { color: var(--brown-ink); font-weight: 600; }
.datefield:hover { border-color: var(--brown); }
.datefield:focus-visible { outline: 3px solid var(--sc-accent); outline-offset: 2px; }
html.wp-open { overflow: hidden; }
.wp-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(27, 18, 11, 0.55); display: grid; place-items: center; padding: 16px; }
.wp-panel { width: min(30rem, 100%); background: var(--paper); border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 30px 70px rgba(0,0,0,0.45); padding: 18px 18px 14px; color: var(--brown-ink); }
.wp-title { font-family: var(--sc-font-display); font-weight: 700; font-size: 1.3rem; margin: 0 0 12px; }
.wp-cols { display: grid; grid-template-columns: 0.8fr 1.5fr 1fr; gap: 8px; }
.wp-col-label { font-size: 0.8rem; font-weight: 600; color: var(--brown-soft); text-align: center; margin-bottom: 4px; }
.wp-col { position: relative; height: 220px; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none;
  background: #fff; border: 1px solid #c9b584; border-radius: 8px;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.wp-col::-webkit-scrollbar { display: none; }
.wp-col:focus-visible { outline: 3px solid var(--sc-accent); outline-offset: 2px; }
.wp-item { height: 44px; line-height: 44px; text-align: center; scroll-snap-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 6px; font-size: 1.05rem; color: var(--brown-soft); cursor: pointer; user-select: none; }
.wp-item.is-sel { color: var(--brown-ink); font-weight: 700; background: #fbf1d4; box-shadow: inset 0 1px 0 #e3cf9c, inset 0 -1px 0 #e3cf9c; }
.wp-pad { cursor: default; }
.wp-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.wp-bar .wp-clear { margin-inline-end: auto; }
@media (max-width: 560px) {
  .dates { grid-template-columns: 1fr; }
  .wp-overlay { place-items: end center; padding: 0; }
  .wp-panel { width: 100%; border-radius: 14px 14px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .wp-item { font-size: 1rem; }
}
/* the last screen: the card as big as the screen allows, every detail under it */
#order.reviewing { grid-template-columns: minmax(0, 1fr); }
#order.reviewing .steps, #order.reviewing #s-card, #order.reviewing #s-ded, #order.reviewing #s-you { display: none; }
#order.reviewing .preview { position: static; order: -1; margin-inline: 0; padding: 0; background: none; border: 0; }
#order.reviewing .preview__tabs { display: flex; justify-content: center; }
#order.reviewing .preview__dots { display: none; }
#order.reviewing #s-ok { max-width: 54rem; width: 100%; margin: 0 auto; border-bottom: 0; }
#order.reviewing #s-ok .step-h { display: none; }
#order.reviewing .review { font-size: 1.05rem; }
@media (max-width: 900px) {
  #order.reviewing .preview__card { height: auto; overflow: visible; display: block; }
  #order.reviewing .preview__card .pv { display: none; height: auto; aspect-ratio: var(--own, 1.5); }
  #order.reviewing .preview__card[data-side="out"] .pv[data-side="out"], #order.reviewing .preview__card[data-side="ded"] .pv[data-side="ded"],
  #order.reviewing .preview__card[data-side="in"] .pv[data-side="in"] { display: block; }
  #order.reviewing .preview__tabs button { padding: 7px 12px; min-height: 38px; }
  .order-page:has(#order.reviewing) .preview__size { background: none; }
}
