/* koshkal3ab.com: the catalogue and the mailing list. The shop's palette (brand red, off-white, black) and fonts.
   Logical properties for layout so the Arabic page mirrors itself; the 3D boxes use physical ones on purpose
   (a box is an object: it turns the same way in both languages). Every box and card is drawn at one scale,
   1.7 px per mm (tools/pages.mjs), so the games compare at their true sizes. */
:root {
  --brand: #a32023; --brand-2: #c8322f; --white: #fcfcfc; --black: #0d0b0b;
  --bg: var(--white); --surface: #fff; --ink: #000; --muted: rgba(0, 0, 0, .62); --line: rgba(0, 0, 0, .1);
  --soft: rgba(0, 0, 0, .04); --link: var(--brand); --ok: #1d7a3e; --err: #b3261e;
  --shadow: 0, 0, 0; --hero-bg: #fff4ef; --paper: #fffdf6;
  --body: "Alexandria", system-ui, sans-serif;
  --display: "Lalezar", "Alexandria", system-ui, sans-serif;
  color-scheme: light;
}
/* Light by default (the user, 2026-11-13); dark only when the header switch picks it (html[data-theme], localStorage 'theme'). */
:root[data-theme="dark"] {
  --bg: var(--black); --surface: #151212; --ink: var(--white); --muted: rgba(252, 252, 252, .7);
  --line: rgba(252, 252, 252, .14); --soft: rgba(252, 252, 252, .06); --link: #f08a8c; --ok: #6fd28f; --err: #ff8a80;
  --hero-bg: #1c1312; --paper: #fffdf6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.65 var(--body); -webkit-font-smoothing: antialiased; }
img { display: block; }
a { color: var(--link); }

/* Header */
.top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); border-block-end: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 400 26px/1 var(--display); }
.brand span { padding-block-start: 4px; }
.actions { display: flex; align-items: center; gap: 8px; }
.cta { background: var(--brand); color: #fff; text-decoration: none; padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.cta:hover { filter: brightness(1.08); }
.lang { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; }
.lang:hover { color: var(--ink); background: var(--soft); }
.theme { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; min-height: 0; box-shadow: none; }
.theme:hover { color: var(--ink); background: var(--soft); filter: none; }
.theme svg { width: 18px; height: 18px; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }

main { max-width: 1320px; margin: 0 auto; padding: 0 clamp(12px, 2vw, 24px); }

/* The hero: take a number */
.hero { position: relative; margin-block: clamp(18px, 3vw, 32px) 8px; padding: clamp(26px, 5vw, 56px) clamp(20px, 5vw, 56px);
  border-radius: 28px; background:
    radial-gradient(120% 140% at 100% 0%, rgba(163, 32, 35, .16), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(240, 160, 60, .14), transparent 60%), var(--hero-bg);
  border: 1px solid var(--line); overflow: hidden; scroll-margin-top: 90px; }
.hero h1 { margin: 0; font: 400 clamp(44px, 8.5vw, 92px)/1.02 var(--display); color: var(--brand); letter-spacing: -.01em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .6), 0 10px 30px rgba(163, 32, 35, .18); }
:root[data-theme="dark"] .hero h1 { color: #e2453f; text-shadow: 0 10px 30px rgba(226, 69, 63, .25); }
.hero .sub { margin: 12px 0 24px; color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); max-width: 60ch; }
form { position: relative; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: start; }
form[hidden] { display: none; }
label { display: grid; gap: 6px; font-weight: 500; }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }
input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; min-height: 50px; width: 100%; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[dir="ltr"] { text-align: start; }
html[dir="rtl"] input[dir="ltr"] { text-align: right; }
input[aria-invalid="true"] { border-color: var(--err); }
small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; }
button { font: 500 16px/1 var(--body); color: #fff; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border: 0;
  border-radius: 999px; padding: 15px 28px; min-height: 50px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(163, 32, 35, .3), inset 0 1px 0 rgba(255, 255, 255, .25); }
form button { margin-block-start: 29px; }
button:hover { filter: brightness(1.07); }
button[disabled] { opacity: .6; cursor: progress; }
.msg { margin: 0; font-weight: 500; grid-column: 1 / -1; }
/* Turnstile shows nothing unless it needs the visitor to click; then it takes a full row */
.cf-turnstile { grid-column: 1 / -1; order: 10; }
.cf-turnstile:empty { display: none; }
.msg:empty { display: none; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* The queue ticket, "printed" after a signup (the shadow sits on the wrapper: the torn-edge mask would cut it off) */
.paper-wrap { filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .18)) drop-shadow(0 2px 3px rgba(0, 0, 0, .12)); }
.ticket { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.ticket[hidden] { display: none; }
.paper { position: relative; display: grid; justify-items: center; gap: 2px; min-width: 230px; padding: 24px 32px 28px;
  background: var(--paper); color: #1a1414; text-align: center;
  /* torn top and bottom edges */
  -webkit-mask: radial-gradient(6px at 50% 0, #0000 98%, #000) 50% 0 / 16px 51% repeat-x, radial-gradient(6px at 50% 100%, #0000 98%, #000) 50% 100% / 16px 51% repeat-x;
          mask: radial-gradient(6px at 50% 0, #0000 98%, #000) 50% 0 / 16px 51% repeat-x, radial-gradient(6px at 50% 100%, #0000 98%, #000) 50% 100% / 16px 51% repeat-x;
  animation: print .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-14px); } to { clip-path: inset(0 0 0 0); transform: none; } }
.ticket-top { font: 400 20px/1 var(--display); color: var(--brand); }
.ticket-label { margin-top: 8px; font-size: 13px; color: #6b5f5f; letter-spacing: .04em; }
.ticket-no { font: 400 76px/1 var(--display); color: #1a1414; padding-block-start: 6px; }
.ticket-no:empty { display: none; }
.ticket-name { font-weight: 500; }
.ticket-note { margin-top: 6px; font-size: 13px; color: #6b5f5f; max-width: 26ch; }
.again { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; padding: 11px 18px; min-height: 0; font-size: 14px; }
.again:hover { background: var(--soft); filter: none; }

/* The catalogue */
.catalogue { padding-block: 24px 40px; }
.catalogue h2 { margin: 0 0 6px; font: 400 clamp(32px, 5vw, 46px)/1.15 var(--display); color: var(--brand); }
:root[data-theme="dark"] .catalogue h2 { color: #e2453f; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px 10px; align-items: end; justify-content: space-between;
  grid-template-columns: repeat(4, minmax(0, 220px)); }
.game { position: relative; outline: none; border-radius: 18px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.game:focus-visible { box-shadow: 0 0 0 3px var(--brand); }
.game.open, .game.closing { z-index: 5; }
.game h3 { position: relative; z-index: 2; margin: 0; padding: 0 8px 22px; text-align: center; font: 500 16px/1.4 var(--body); }
.game h3[lang="ar"] { font-size: 17px; }
.stage { position: relative; height: 300px; perspective: 1000px; perspective-origin: 50% 30%; }

/* Ground shadow: a tight contact shadow and a wide soft one; both breathe with the float */
.ground { position: absolute; left: 50%; bottom: 22px; width: var(--gw); height: 22px; margin-left: calc(var(--gw) / -2);
  pointer-events: none; animation: breathe 5s ease-in-out infinite alternate; animation-delay: var(--delay); }
.ground::before, .ground::after { content: ""; position: absolute; border-radius: 50%; }
.ground::before { inset: -10px 0; background: radial-gradient(closest-side, rgba(var(--shadow), .18), transparent); filter: blur(6px); }
.ground::after { inset: 5px 6%; background: radial-gradient(closest-side, rgba(var(--shadow), .42), transparent); filter: blur(2px); }
:root[data-theme="dark"] .ground::before { background: radial-gradient(closest-side, rgba(0, 0, 0, .7), transparent); }
@keyframes breathe { from { transform: scaleX(1); opacity: 1; } to { transform: scaleX(.9); opacity: .75; } }

.float { position: absolute; inset: 0; transform-style: preserve-3d; animation: bob 5s ease-in-out infinite alternate; animation-delay: var(--delay); }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-8px); } }

/* The box: six faces of the real package. --by/--bx = its resting turn; --tx/--ty = the cursor's tilt. */
.box { --by: -30deg; --bx: -15deg; position: absolute; left: 50%; bottom: calc(34px + var(--lift, 0px)); width: var(--w); height: var(--h);
  margin-left: calc(var(--w) / -2); transform-style: preserve-3d;
  transform: rotateX(calc(var(--bx) + var(--ty, 0deg))) rotateY(calc(var(--by) + var(--tx, 0deg)));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.game.open .box { --by: -18deg; --bx: -12deg; }
.wall, .lid, .shell { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.wall, .lid { background: var(--inside); }
.wall img, .lid img { width: 100%; height: 100%; backface-visibility: hidden; }
.wall .shade, .lid .shade { position: absolute; inset: 0; backface-visibility: hidden; pointer-events: none; }
.wall.front, .wall.back { width: var(--w); height: var(--h); }
.wall.front { transform: translateZ(calc(var(--d) / 2)); }
.wall.back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.wall.right, .wall.left { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); }
.wall.right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.wall.left { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.wall.bottom, .wall.top { width: var(--w); height: var(--d); top: calc((var(--h) - var(--d)) / 2); }
.wall.bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); background: none; } /* its inside drew below thin boxes */
/* the floor inside, just above the bottom wall, facing up: an open box shows its inside colour, never the page through it */
.box > .floor { position: absolute; left: 0; width: var(--w); height: var(--d); top: calc((var(--h) - var(--d)) / 2); background: var(--inside);
  transform: rotateX(90deg) translateZ(calc(var(--h) / -2 + .5px)); }
.wall.top { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); }
/* the tuck flap: hinged on the top's back edge */
.lid { width: var(--w); height: var(--d); top: calc(var(--h) / 2); transform-origin: 50% 0;
  transform: translateY(calc(var(--h) / -2)) translateZ(calc(var(--d) / -2)) rotateX(90deg);
  transition: transform .4s cubic-bezier(.4, 0, .2, 1) .85s; }
.game.open .lid { transform: translateY(calc(var(--h) / -2)) translateZ(calc(var(--d) / -2)) rotateX(208deg); transition-delay: 0s; }
/* Light: the front catches a gloss that sweeps across on opening, the side is in shade, the top is lit */
.wall.front .shade { background:
    linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .26) 48%, transparent 58%) 120% 0 / 300% 100% no-repeat,
    linear-gradient(to bottom, rgba(255, 255, 255, .08), rgba(0, 0, 0, .08));
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .25); transition: background-position 1s ease; }
.game.open .wall.front .shade { background-position: -20% 0, 0 0; }
.wall.right .shade { background: linear-gradient(to right, rgba(0, 0, 0, .2), rgba(0, 0, 0, .42)); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .3); }
.lid .shade, .wall.top .shade { background: linear-gradient(to bottom, rgba(255, 255, 255, .06), rgba(255, 255, 255, .2)); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); }

/* The cards: inside the box at their true size, out through the top, then fanned like a hand */
.card { position: absolute; width: var(--cw); height: var(--ch); left: calc((var(--w) - var(--cw)) / 2); top: calc(var(--h) - var(--ch) - 1px);
  border-radius: 4px; transform-origin: 50% 100%; transform: translateZ(var(--z)); opacity: 0; pointer-events: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px rgba(0, 0, 0, .22); backface-visibility: hidden; }
.card.round { border-radius: 50%; }
.game.open .card { animation: card-out .95s cubic-bezier(.3, .7, .25, 1) both; animation-delay: calc(.42s + var(--k) * .1s); }
.game.closing .card { animation: card-in .55s cubic-bezier(.5, 0, .7, .4) both; animation-delay: calc((2 - var(--k)) * .05s); }
/* Clear the rim and fan out, keeping each card at its original depth and raised height. */
@keyframes card-out {
  0% { opacity: 0; transform: translateZ(var(--z)); }
  12% { opacity: 1; }
  45% { opacity: 1; transform: translateZ(var(--z)) translateY(calc(-1 * var(--h) - var(--clearance))); }
  100% { opacity: 1; transform: translateZ(var(--z)) translateY(calc(-1 * var(--h) - var(--clearance))) translateX(calc(var(--i) * var(--cw) * .32)) rotate(calc(var(--i) * 14deg)); }
}
@keyframes card-in {
  0% { opacity: 1; transform: translateZ(var(--z)) translateY(calc(-1 * var(--h) - var(--clearance))) translateX(calc(var(--i) * var(--cw) * .32)) rotate(calc(var(--i) * 14deg)); }
  55% { opacity: 1; transform: translateZ(var(--z)) translateY(calc(-1 * var(--h) - var(--clearance))); }
  92% { opacity: 1; }
  100% { opacity: 0; transform: translateZ(var(--z)); }
}

/* No box yet: a stack of card backs; its cards fan out from behind it */
.stack { --by: -12deg; --bx: -8deg; position: absolute; left: 50%; bottom: 34px; width: var(--cw); height: var(--ch);
  margin-left: calc(var(--cw) / -2); transform-style: preserve-3d;
  transform: rotateX(calc(var(--bx) + var(--ty, 0deg))) rotateY(calc(var(--by) + var(--tx, 0deg)));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.back { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 5px;
  transform: translateZ(calc(var(--j) * -2.5px)) translate(calc(var(--j) * 2.5px), calc(var(--j) * -2px)) rotate(calc(var(--j) * -2deg));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 22px rgba(0, 0, 0, .18); }
.stack .card { top: 0; left: 0; transform: translateZ(calc(-14px + var(--z))); }
.game.stacked.open .card { animation: stack-out .7s cubic-bezier(.3, .7, .25, 1) both; animation-delay: calc(.05s + var(--k) * .08s); }
.game.stacked.closing .card { animation: stack-in .45s ease-in both; animation-delay: 0s; }
@keyframes stack-out {
  from { opacity: 0; transform: translateZ(calc(-14px + var(--z))); }
  25% { opacity: 1; }
  to { opacity: 1; transform: translateZ(calc(-14px + var(--z))) translateY(calc(var(--ch) * -.55)) translateX(calc(var(--i) * var(--cw) * .42)) rotate(calc(var(--i) * 13deg)); }
}
@keyframes stack-in {
  from { opacity: 1; transform: translateZ(calc(-14px + var(--z))) translateY(calc(var(--ch) * -.55)) translateX(calc(var(--i) * var(--cw) * .42)) rotate(calc(var(--i) * 13deg)); }
  80% { opacity: 1; }
  to { opacity: 0; transform: translateZ(calc(-14px + var(--z))); }
}

@media (prefers-reduced-motion: reduce) {
  .float, .ground, .paper { animation: none; }
  .box, .stack, .lid, .shell { transition-duration: .01s; }
  .game.open .card, .game.closing .card { animation-duration: .01s; animation-delay: 0s; }
}

.bottom { border-block-start: 1px solid var(--line); padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 220px)); }
  form { grid-template-columns: 1fr 1fr; }
  form button { margin: 0; grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 560px) {
  .top { gap: 8px; }
  .brand { font-size: 21px; }
  .brand img { width: 32px; height: 32px; }
  .cta { padding: 7px 12px; }
  .actions { gap: 6px; }
  form { grid-template-columns: 1fr; }
  form button { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 160px)); gap: 0 8px; }
  .stage { zoom: .63; }
  .game h3 { font-size: 14px; padding-block-end: 16px; }
  .game h3[lang="ar"] { font-size: 15px; }
}

/* Keep the original heading-above-form layout, with the updated phone control. */
.hero-action { margin-block-start: 24px; min-width: 0; }
.ticket-name { overflow-wrap: anywhere; }

.phone-field { display: grid; gap: 6px; min-width: 0; }
.phone-row { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr); gap: 8px; }
.phone-row select { min-width: 0; width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; }
.phone-row select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
html[dir="rtl"] .phone-row input { text-align: left; }

.mixed-cards.open .card { animation-delay: calc(.42s + var(--k) * .08s); }
.mixed-cards.closing .card { animation-delay: calc((4 - var(--k)) * .05s); }

@media (max-width: 1080px) and (min-width: 901px) {
  form { grid-template-columns: 1fr 1.3fr; }
  form button { margin: 29px 0 0; }
}
@media (max-width: 560px) {
  .ticket { gap: 18px; }
  .paper { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
}

/* Bring the first boxes close to the catalogue heading; open fans float above the grid. */
@media (min-width: 901px) { .game:nth-child(-n+4) .stage { height: 260px; } }
@media (min-width: 561px) and (max-width: 900px) { .game:nth-child(-n+3) .stage { height: 260px; } }
@media (max-width: 560px) { .game:nth-child(-n+2) .stage { height: 260px; } }

.game-picker { grid-column: 1 / -1; order: 5; border-block-start: 1px solid var(--line); padding-block-start: 12px; }
.game-picker summary { cursor: pointer; font-weight: 500; }
.selection-count { margin-inline-start: 8px; color: var(--brand); font-size: 12px; }
.game-picker fieldset { border: 0; padding: 16px 0 0; margin: 0; min-width: 0; }
.game-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.game-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; }
.game-option { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.game-option input { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; padding: 0; box-shadow: none; accent-color: var(--brand); }
.select-all { margin-block-end: 14px; }
@media (max-width: 650px) { .game-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
