/* ============================================================
   "איך זה נולד" · cards-story.css  (25.10.2026)
   עמוד קומיקס מודפס אחד: נייר, מרווחי דיו בין המשבצות, ובכל משבצת
   תיבת קריינות למעלה (התוכן), ציור באמצע ובועה מעליו (הפאנץ').
   הציורים הם קלפים אמיתיים מהאוסף (cards-story.js), עם תמונה סטטית כגיבוי.
   1. הרעיון: בועת מחשבה, קלף אחד שנוטה אחרי העכבר
   2. הבנייה: מניפה שנפתחת, והמספר בבועה סופר עד 170
   3. הדפוס: הקלף מתהפך מהגב לפנים ברגע של "זה... אני?!"
   מחשב: שורה של שלוש · טאבלט: 1 + 2 · טלפון: משבצות בהחלקה
   ============================================================ */
.story-strip { position: relative; padding: clamp(56px, 7vw, 100px) 0 clamp(30px, 4vw, 54px); }

/* ---------- הדף ---------- */
.cpage { position: relative; padding: clamp(10px, 1.1vw, 16px); background: var(--paper); border: 4px solid var(--ink); border-radius: 6px; box-shadow: 10px 12px 0 var(--ink), 0 40px 80px -30px rgba(0, 0, 0, .7); rotate: -.35deg; }
.cpage::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(10, 11, 34, .1) 1.1px, transparent 1.5px); background-size: 7px 7px; }
.cpage__tab { position: absolute; z-index: 5; top: -21px; inset-inline-start: clamp(16px, 3vw, 40px); margin: 0; padding: 7px 18px 6px; background: var(--gold); color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 900 clamp(1rem, .9rem + .4vw, 1.25rem)/1 var(--f-brand); rotate: -2deg; }
.panels { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.1vw, 16px); margin: 0; padding: 0; list-style: none; }

/* ---------- המשבצת ---------- */
.cpanel { --tone-a: #fff1c4; --tone-b: #ffd977; --glow: rgba(255, 255, 255, .7);
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: clamp(470px, 38vw, 560px);
  background: linear-gradient(170deg, var(--tone-a), var(--tone-b)); color: var(--paper-ink); border: 3.5px solid var(--ink); }
.cpanel--2 { --tone-a: #d6f5fa; --tone-b: #86d4e0; }
.cpanel--3 { --tone-a: #ffe3f0; --tone-b: #f3a3cb; }
/* אור מאחורי הציור + נקודות הדפסה שמתחזקות למטה */
.cpanel::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(55% 42% at 50% 66%, var(--glow), transparent 72%), radial-gradient(rgba(10, 11, 34, .2) 1.3px, transparent 1.8px);
  background-size: auto, 9px 9px; -webkit-mask-image: linear-gradient(180deg, transparent 18%, #000 70%); mask-image: linear-gradient(180deg, transparent 18%, #000 70%); }
/* קווי תנועה: בנייה = אקשן */
.cpanel--2::after, .cpanel--3::after { content: ""; position: absolute; inset: -20%; z-index: -1; pointer-events: none; opacity: .32;
  background: repeating-conic-gradient(from 0deg at 50% 66%, rgba(255, 255, 255, .9) 0 2.2deg, transparent 2.2deg 9deg);
  -webkit-mask-image: radial-gradient(50% 50% at 50% 66%, transparent 18%, #000 60%, transparent 92%); mask-image: radial-gradient(50% 50% at 50% 66%, transparent 18%, #000 60%, transparent 92%); }
.cpanel--3::after { opacity: 0; transition: opacity .6s var(--ease) .5s; }
.cpanel--3.is-on::after { opacity: .4; }

.cpanel__no { position: absolute; z-index: 4; top: 10px; inset-inline-start: 10px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--gold); color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 900 1.25rem/1 var(--f-brand); rotate: -6deg; }

/* תיבת קריינות: מלבן, נייר צהבהב, כמו בקומיקס */
.cpanel__cap { position: relative; z-index: 3; margin: 14px; margin-inline-start: 58px; padding: 12px 15px 13px; background: #fffaf0; border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font-size: clamp(.95rem, .9rem + .15vw, 1.03rem); line-height: 1.58; text-wrap: pretty; rotate: .6deg; }
.cpanel--2 .cpanel__cap { rotate: -.5deg; }
.cpanel__cap b { display: block; margin-bottom: 3px; font: 900 1.22rem/1.1 var(--f-brand); }

/* ---------- הבמה: הציור ---------- */
.cpanel__stage { position: relative; z-index: 1; min-height: 250px; }
.cpanel__fallback { position: absolute; left: 50%; bottom: 0; width: auto; max-width: 92%; max-height: 88%; translate: -50% 6%; }
.cpanel__stage.is-live .cpanel__fallback { display: none; }

/* הבועה מעל הציור */
.cpanel__stage, .cpanel .balloon { grid-row: 2; grid-column: 1; }
.cpanel .balloon { position: relative; z-index: 3; align-self: start; justify-self: center; max-width: min(84%, 300px); margin: 20px 12px 0; text-align: center; }
.cpanel .balloon--think { padding: 16px 24px; font-size: clamp(1.05rem, .95rem + .4vw, 1.3rem); }
.cpanel .balloon--shout { padding: 26px 34px; }

/* בועת מחשבה: זנב של עיגולים במקום חץ */
.balloon--think::before, .balloon--think::after { content: ""; position: absolute; background: #fff; border: 3px solid var(--ink); border-radius: 50%; box-shadow: 2px 3px 0 var(--ink); transform: none !important; }
.balloon--think::after { top: calc(100% + 6px); inset-inline-end: 30%; width: 20px; height: 16px; }
.balloon--think::before { top: calc(100% + 26px); inset-inline-end: 24%; width: 11px; height: 9px; }

/* ---------- הקלפים ---------- */
.sc { position: absolute; display: block; padding: 0; border: 0; background: none; cursor: pointer; aspect-ratio: var(--ar, 2 / 3); -webkit-tap-highlight-color: transparent; }
.sc img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 6.5% / 4.5%; border: 2.5px solid var(--ink); box-shadow: 4px 6px 0 var(--ink), 0 18px 30px -12px rgba(10, 11, 34, .55); }
.sc:focus-visible { outline: none; }
.sc:focus-visible img { outline: 3px solid var(--ink); outline-offset: 3px; }

/* 1. הרעיון: קלף אחד, נוטה אחרי העכבר, ברק עובר עליו */
.st-idea { left: 50%; bottom: -7%; width: clamp(140px, 42%, 196px); translate: -50% 0; perspective: 900px; }
.st-idea__tilt { position: relative; display: block; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotate(-4deg); transform-style: preserve-3d; transition: transform .5s var(--ease); }
.st-idea__tilt::after { content: ""; position: absolute; inset: 0; border-radius: 6.5% / 4.5%; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(115deg, transparent calc(var(--mx, 30%) - 22%), rgba(255, 255, 255, .85) var(--mx, 30%), transparent calc(var(--mx, 30%) + 22%)); }
.cpanel--1.is-hover .st-idea__tilt { transition-duration: .12s; }

/* 2. הבנייה: מניפה */
.st-fan { left: 50%; bottom: -9%; width: clamp(112px, 38%, 168px); translate: -50% 0; transform-origin: 50% 118%; transform: rotate(calc(var(--k) * var(--spread, 3deg))) translateY(calc(var(--d) * var(--lift, 0px)));
  transition: transform .75s var(--spring); transition-delay: calc(var(--n) * 50ms); z-index: var(--z); }
.cpanel--2.is-on { --spread: 15deg; --lift: 10px; }
.cpanel--2.is-hover { --spread: 19deg; --lift: 14px; }
.st-fan:hover { translate: -50% -10px; }

/* 3. הדפוס: הקלף מתהפך */
.st-flip { left: 50%; bottom: -7%; width: clamp(140px, 42%, 196px); translate: -50% 0; perspective: 1100px; }
.st-flip__in { position: relative; display: block; aspect-ratio: var(--ar, 2 / 3); transform-style: preserve-3d; transform: rotateY(180deg) rotate(3deg); transition: transform 1.1s cubic-bezier(.2, .9, .25, 1.08); }
.cpanel--3.is-on .st-flip__in { transform: rotateY(0deg) rotate(-3deg); }
.st-flip__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.st-flip__face--back { transform: rotateY(180deg); }
.cpanel--3.is-hover.is-on .st-flip__in { transform: rotateY(0deg) rotate(-1deg) translateY(-8px) scale(1.03); }

/* הופעת הבועה אחרי הציור */
.js-motion .cpanel .balloon { opacity: 0; scale: .6; transition: opacity .3s var(--ease), scale .6s var(--spring); transition-delay: .45s; }
.js-motion .cpanel--3 .balloon { transition-delay: 1.05s; }
.js-motion .cpanel.is-on .balloon { opacity: 1; scale: 1; }

/* ---------- נקודות (טלפון) ---------- */
.panels-dots { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.panels-dots button { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--muted); border: 2px solid var(--line); font: 900 1rem/1 var(--f-brand); transition: background .25s, color .25s, border-color .25s, transform .4s var(--spring); }
.panels-dots button[aria-current="true"] { background: var(--gold); color: var(--ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: rotate(-6deg); }

/* ---------- טאבלט: 1 + 2, כמו עמוד קומיקס ---------- */
@media (max-width: 1000px) and (min-width: 621px) {
  .panels { grid-template-columns: 1fr 1fr; }
  .cpanel { min-height: 490px; }
  .cpanel--1 { grid-column: 1 / -1; min-height: 0; grid-template-rows: auto; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
  .cpanel--1 .cpanel__cap { grid-column: 1; grid-row: 1; align-self: end; margin: 64px 16px 22px 20px; }
  .cpanel--1 .cpanel__stage { grid-column: 2; grid-row: 1; min-height: 330px; }
  .cpanel--1 .balloon { grid-column: 1; grid-row: 1; align-self: start; justify-self: center; margin-top: 18px; max-width: 80%; }
  .cpanel--1 .st-idea { width: clamp(150px, 62%, 200px); bottom: 6%; left: 42%; }
  .cpanel--1::before { background: radial-gradient(40% 70% at 30% 60%, var(--glow), transparent 72%), radial-gradient(rgba(10, 11, 34, .2) 1.3px, transparent 1.8px); background-size: auto, 9px 9px; }
}

/* ---------- טלפון: משבצות בהחלקה, כל אחת על מסך ---------- */
@media (max-width: 620px) {
  .story-strip { padding: 44px 0 20px; }
  .cpage { padding: 8px; rotate: 0deg; box-shadow: 6px 7px 0 var(--ink); border-width: 3px; }
  .cpage__tab { top: -18px; padding: 6px 14px 5px; }
  .panels { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 88%; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-padding-inline: 0; }
  .panels::-webkit-scrollbar { display: none; }
  .cpanel { scroll-snap-align: start; min-height: min(118vw, 480px); border-width: 3px; }
  .cpanel__cap { margin: 12px; margin-inline-start: 50px; padding: 10px 12px 11px; font-size: .93rem; line-height: 1.5; }
  .cpanel__cap b { font-size: 1.08rem; }
  .cpanel__no { width: 32px; height: 32px; font-size: 1.05rem; }
  .cpanel .balloon { max-width: 88%; font-size: 1.05rem; }
  .cpanel .balloon--think { padding: 12px 18px; }
  .cpanel .balloon--shout { padding: 20px 26px; }
  .st-idea, .st-flip { width: clamp(124px, 42%, 166px); }
  .st-fan { width: clamp(100px, 36%, 136px); }
}

/* ---------- פחות תנועה: מצב הסיום, בלי מעברים ---------- */
@media (prefers-reduced-motion: reduce) {
  .st-idea__tilt, .st-fan, .st-flip__in, .cpanel .balloon, .cpanel--3::after { transition: none !important; }
}
html:not(.js-motion) .cpanel { --spread: 13deg; --lift: 8px; }
html:not(.js-motion) .st-flip__in { transform: rotate(-3deg); }
html:not(.js-motion) .cpanel--3::after { opacity: .4; }
