/* ---------- tokens ---------- */
:root{
  --paper:#f7f4ec;           /* cahier cream */
  --paper-line:rgba(23,58,122,.075);
  --card:#ffffff;
  --ink:#173a7a;             /* the label's own navy ink */
  --ink-soft:#5b6b8c;
  --rule:#e3e6ee;
  --marker:#f6c531;          /* crown yellow: step markers */
  --girl:#ef3f78; --girl-soft:#ffe1ec;
  --boy:#1a6fd0;  --boy-soft:#dcedff;
  --accent:var(--girl); --accent-soft:var(--girl-soft);
  --danger:#c62f2f;
  --display:'Baloo 2','Nunito',system-ui,sans-serif;
  --body:'Nunito',system-ui,sans-serif;
  --arabic:'Cairo','Nunito',system-ui,sans-serif;
  --radius:18px;
}
body[data-style="boy"]{--accent:var(--boy);--accent-soft:var(--boy-soft)}
html[dir=rtl] body{font-family:var(--arabic)}
html[dir=rtl] h1,html[dir=rtl] h2,html[dir=rtl] h3,html[dir=rtl] .btn,html[dir=rtl] .brand-text{font-family:var(--arabic)}

*{box-sizing:border-box}
[hidden]{display:none!important}
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto} *{transition:none!important;animation:none!important}}
body{
  margin:0;color:var(--ink);font-family:var(--body);font-size:15px;line-height:1.5;
  background-color:var(--paper);
  background-image:
    linear-gradient(var(--paper-line) 1px,transparent 1px),
    linear-gradient(90deg,var(--paper-line) 1px,transparent 1px);
  background-size:28px 28px;
}
h1,h2,h3{font-family:var(--display);margin:0;line-height:1.15}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--marker);outline-offset:2px;border-radius:6px}

/* ---------- top bar ---------- */
.topbar{display:flex;align-items:center;justify-content:space-between;padding:14px 22px;max-width:1240px;margin:0 auto}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);font-family:var(--display);font-weight:800;font-size:19px}
.brand-mark{width:30px;height:20px;border-radius:7px;border:3px solid var(--accent);background:var(--accent-soft);position:relative;transition:border-color .25s,background .25s}
.brand-mark::after{content:"";position:absolute;inset:3px 5px;border-top:2px dashed var(--accent);border-bottom:2px dashed var(--accent);opacity:.7}
.lang{display:flex;background:var(--card);border:1px solid var(--rule);border-radius:999px;padding:3px}
.lang-btn{border:0;background:transparent;padding:5px 12px;border-radius:999px;cursor:pointer;font-weight:700;color:var(--ink-soft)}
.lang-btn[aria-pressed=true]{background:var(--ink);color:#fff}

/* ---------- page ---------- */
.page{max-width:1240px;margin:0 auto;padding:6px 22px 60px}
.hero{display:grid;grid-template-columns:1fr minmax(280px,360px);gap:24px;align-items:center;padding:10px 0 26px}
.hero h1{font-size:clamp(28px,4vw,44px);font-weight:800;letter-spacing:-.01em}
.hero h1::after{content:"";display:block;width:88px;height:6px;border-radius:3px;background:var(--accent);margin-top:8px;transition:background .25s}
.lead{margin:12px 0 18px;color:var(--ink-soft);font-size:17px;max-width:46ch}

/* the offer: a price tag pinned to the notebook */
.offer{
  position:relative;background:var(--card);border:2px solid var(--accent);border-radius:20px;padding:20px 22px 16px;
  box-shadow:0 14px 34px rgba(23,58,122,.12);transform:rotate(1.2deg);transition:border-color .25s
}
.offer::before{content:"";position:absolute;top:-12px;left:50%;width:70px;height:22px;margin-left:-35px;background:rgba(246,197,49,.7);border-radius:3px;transform:rotate(-2deg)}
.offer-tag{display:inline-block;font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--accent);background:var(--accent-soft);padding:3px 9px;border-radius:999px}
.offer h2{font-size:22px;font-weight:800;margin:8px 0 2px}
.offer-price{font-family:var(--display);font-size:46px;font-weight:800;line-height:1.05;color:var(--accent);margin:2px 0 10px}
.offer-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;font-size:14px}
.offer-list li{display:flex;gap:8px;align-items:baseline}
.offer-list li::before{content:"✓";font-weight:800;color:var(--accent)}
.offer-list b{font-family:var(--display);font-size:18px}
.offer-two{font-weight:700}
.offer-note{margin:12px 0 0;font-size:12.5px;color:var(--ink-soft)}

.offer-strip{display:flex;justify-content:center;gap:10px;font-weight:700;font-size:14px;color:var(--ink);margin:6px 0 10px}
.price-inline{font-family:var(--display);font-weight:800}

.sticky-bar{display:none}

.layout{display:grid;grid-template-columns:minmax(340px,440px) 1fr;gap:22px;align-items:start}
.column{display:flex;flex-direction:column;gap:22px}
.previews{position:sticky;top:16px}

/* ---------- cards / steps ---------- */
.card{background:var(--card);border:1px solid var(--rule);border-radius:var(--radius);padding:22px;box-shadow:0 10px 30px rgba(23,58,122,.06)}
.step-head{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.step-head h2{font-size:22px;font-weight:800}
.step-num{
  width:34px;height:34px;border-radius:10px;display:grid;place-items:center;
  background:var(--marker);color:var(--ink);font-family:var(--display);font-weight:800;font-size:17px;
  box-shadow:0 2px 0 #cf9d12;transform:rotate(-4deg)
}

/* ---------- fields ---------- */
.field{display:block;margin-bottom:14px}
.label{display:block;font-weight:700;font-size:13px;margin-bottom:6px;color:var(--ink)}
input[type=text],input[type=tel],input[type=number],textarea{
  width:100%;padding:11px 13px;border:1.5px solid #d6dbe6;border-radius:12px;background:#fff;outline:none;
  transition:border-color .15s,box-shadow .15s
}
input[type=text]:focus,input[type=tel]:focus,input[type=number]:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
input[dir=rtl]{font-family:var(--arabic);font-size:16px}
textarea{resize:vertical}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.muted{color:var(--ink-soft)}
.privacy{display:flex;gap:8px;align-items:flex-start;font-size:12.5px;color:var(--ink-soft);margin:10px 0 0;padding:8px 10px;border-radius:10px;background:#f4f7fb}
.privacy svg{flex:0 0 auto;width:16px;height:16px;margin-top:1px;color:var(--accent)}

/* eye toggle: leave a line blank on the label, to be written by hand */
.input-wrap{position:relative;display:block}
/* the eye sits at the end of the text run: right for Latin inputs, left for Arabic ones */
.input-wrap input:not([dir=rtl]){padding-right:42px}
.input-wrap input[dir=rtl]{padding-left:42px}
.input-wrap:has(input[dir=rtl]) .blank-toggle{right:auto;left:6px}
.blank-toggle{position:absolute;top:50%;right:6px;transform:translateY(-50%);width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:#9aa5bd;cursor:pointer;display:grid;place-items:center}
.blank-toggle svg{width:20px;height:20px}
.blank-toggle:hover{background:#eef2fa;color:var(--ink)}
.blank-toggle .eye-off{display:none}
/* blank state: the input is hidden, a dashed note takes its place */
.input-wrap.is-blank input{display:none}
.input-wrap.is-blank{min-height:44px;border:1.5px dashed #c3cde0;border-radius:12px;background:repeating-linear-gradient(-45deg,#fafbfd 0 6px,#f1f4f9 6px 12px);display:flex;align-items:center;padding:0 44px 0 13px;font-size:13px;color:var(--ink-soft);font-weight:600}
.input-wrap.is-blank:has(input[dir=rtl]){padding:0 13px 0 44px;justify-content:flex-end}
.input-wrap.is-blank::before{content:attr(data-blank-text)}
.input-wrap.is-blank .blank-toggle .eye{display:none}
.input-wrap.is-blank .blank-toggle .eye-off{display:block}
.input-wrap.is-blank .blank-toggle{color:var(--accent)}

/* segmented style picker */
.segmented{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.segmented.three{grid-template-columns:1fr 1fr 1fr}
.seg:has(.lang-choice:checked){border-color:var(--ink);background:#eef2fa;color:var(--ink)}
.seg{position:relative;display:block;text-align:center;padding:11px;border-radius:12px;border:1.5px solid #d6dbe6;cursor:pointer;font-weight:700;background:#fff;transition:all .15s}
.seg input{position:absolute;opacity:0;pointer-events:none}
.seg.girl:has(input:checked){border-color:var(--girl);background:var(--girl-soft);color:#b8215a}
.seg.boy:has(input:checked){border-color:var(--boy);background:var(--boy-soft);color:#0f4c9a}
.seg:has(input:focus-visible){outline:3px solid var(--marker);outline-offset:2px}

/* photo + cropper */
.upload{
  display:flex;flex-direction:column;align-items:center;gap:4px;padding:26px 16px;border:2px dashed #c3cde0;border-radius:14px;
  background:#fbfcff;color:var(--ink-soft);cursor:pointer;text-align:center;transition:border-color .15s,background .15s
}
.upload:hover,.upload.drag{border-color:var(--accent);background:var(--accent-soft)}
.upload svg{width:34px;height:34px;color:var(--accent)}
.upload strong{color:var(--ink)}
.cropper{display:flex;gap:16px;align-items:center}
.crop-canvas{width:170px;height:170px;border-radius:50%;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;flex:0 0 auto;background:#eef2f8;box-shadow:0 6px 18px rgba(23,58,122,.12)}
.crop-canvas:active{cursor:grabbing}
.crop-controls{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
.crop-controls .label{margin-bottom:0}
.zoom-row{display:flex;align-items:center;gap:8px}
.zoom-row input{flex:1;min-width:0;accent-color:var(--accent);height:32px}
.zoom-btn{width:38px;height:38px;flex:0 0 auto;border:1.5px solid #d6dbe6;border-radius:10px;background:#fff;font-size:20px;font-weight:700;cursor:pointer}
.zoom-btn:hover{background:var(--accent-soft)}
.link{border:0;background:none;padding:0;color:var(--accent);font-weight:700;cursor:pointer;text-decoration:underline;text-underline-offset:3px;text-align:start}

/* ---------- previews (the sticker sheet) ---------- */
.sheet{
  background:
    radial-gradient(circle at 1px 1px,rgba(23,58,122,.10) 1px,transparent 1.6px) 0 0/16px 16px,
    #f2f5fb;
}
.preview{margin:0 0 18px}
.preview-frame{background:#fff;border-radius:14px;padding:10px;box-shadow:0 1px 2px rgba(0,0,0,.06),0 14px 30px rgba(23,58,122,.12)}
.preview canvas{display:block;width:100%;height:auto;border-radius:8px}
.preview figcaption{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:8px;font-size:13px;font-weight:700;color:var(--ink-soft)}
.cap{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
/* ruler tag: tick marks along the top edge, like a tape measure */
.dim{
  display:inline-block;padding:3px 9px 2px;border-radius:6px;font-family:var(--display);font-weight:800;font-size:12px;letter-spacing:.02em;
  color:var(--ink);background:#fff;border:1.5px solid var(--marker);
  background-image:repeating-linear-gradient(90deg,var(--marker) 0 1.5px,transparent 1.5px 6px);
  background-size:100% 4px;background-repeat:no-repeat;background-position:0 0
}

/* ---------- children ---------- */
.child .step-head{position:relative}
.child .remove-child{margin-inline-start:auto;font-size:13px;color:var(--ink-soft)}
.child:first-child .remove-child{display:none}
.add-child{text-align:center}
.add-child .small{font-size:13px;margin:8px 0 0}
.preview-group{margin-bottom:22px}
.preview-group:last-child{margin-bottom:8px}
.preview-title{font-size:15px;font-weight:800;margin:0 0 10px;color:var(--ink-soft)}
.preview-title b{color:var(--ink)}

/* ---------- order ---------- */
.pack{border:2px solid var(--accent);border-radius:14px;padding:14px;background:var(--accent-soft);margin-bottom:10px}
.pack-head{display:flex;justify-content:space-between;align-items:baseline;font-family:var(--display)}
.pack-head strong{font-size:18px;font-weight:800}
.pack-price{font-size:24px;font-weight:800;color:var(--accent)}
.pack-desc{margin:4px 0 8px;font-weight:700}
.pack-split{margin:0 0 12px;padding:0;list-style:none;font-size:13.5px}
.pack-split li{padding:5px 10px;background:rgba(255,255,255,.7);border-radius:8px;margin-bottom:5px}
.pack .qty{background:#fff}
.qty-row{display:flex;flex-direction:column;gap:10px;margin:6px 0 14px}
.qty{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;border:1.5px solid var(--rule);border-radius:12px}
.qty-text{display:flex;flex-direction:column}
.qty-text strong{font-size:14px}
.stepper{display:flex;align-items:center;border:1.5px solid #d6dbe6;border-radius:10px;overflow:hidden}
.stp{width:36px;height:36px;border:0;background:#f4f6fb;cursor:pointer;font-size:18px;font-weight:700}
.stp:hover{background:var(--accent-soft)}
.stepper input{width:48px;height:36px;border:0;border-radius:0;text-align:center;padding:0;-moz-appearance:textfield}
.stepper input::-webkit-inner-spin-button,.stepper input::-webkit-outer-spin-button{-webkit-appearance:none}
.total{margin:0 0 14px;font-weight:800;font-family:var(--display);font-size:18px}

.errors{margin:0 0 14px;list-style:disc;padding:10px 14px 10px 30px;border-radius:10px;background:#fff1f1;color:var(--danger);font-size:13.5px;font-weight:600}
html[dir=rtl] .errors{padding:10px 30px 10px 14px}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:12px;padding:12px 18px;
  font-family:var(--display);font-weight:800;font-size:16px;cursor:pointer;text-decoration:none;transition:transform .1s,filter .15s
}
.btn:active{transform:translateY(1px)}
.btn.primary{background:var(--accent);color:#fff;box-shadow:0 6px 16px color-mix(in srgb,var(--accent) 35%,transparent)}
.btn.primary:hover{filter:brightness(1.06)}
.btn.primary[disabled]{opacity:.6;cursor:progress}
.btn.secondary{background:var(--accent-soft);color:var(--ink)}
.btn.big{width:100%;padding:15px 18px;font-size:17px}

.done{text-align:center;padding:8px 0}
.done-icon{width:64px;height:64px;margin:0 auto 12px;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-size:30px;font-weight:800}
.done h3{font-size:24px;margin-bottom:6px}
.done .ref code{background:#f1f3f8;padding:2px 8px;border-radius:6px;font-size:15px}
.demo-note{font-size:13px;color:#8a6d00;background:#fff7d6;border-radius:10px;padding:8px 12px}

/* ---------- responsive ---------- */
@media (max-width:900px){
  .hero{grid-template-columns:1fr;gap:18px}
  .offer{transform:none}
  .sticky-bar{
    display:flex;position:fixed;left:0;right:0;bottom:0;z-index:20;align-items:center;justify-content:space-between;gap:12px;
    padding:10px 14px calc(10px + env(safe-area-inset-bottom));background:rgba(255,255,255,.96);backdrop-filter:blur(8px);
    border-top:1px solid var(--rule);box-shadow:0 -8px 24px rgba(23,58,122,.10)
  }
  .sticky-bar[hidden]{display:none}
  .sticky-text{display:flex;flex-direction:column;line-height:1.2}
  .sticky-text b{font-size:20px;color:var(--accent)}
  .sticky-text small{color:var(--ink-soft);font-size:12px}
  .page{padding-bottom:90px!important}
  .layout{grid-template-columns:1fr}
  .previews{position:static}
  /* order flow: child → preview → order */
  .forms{display:contents}
  .layout{display:flex;flex-direction:column}
  #children{order:1}
  #addChildBox{order:2}
  .previews{order:3}
  #step-order{order:4}
  .grid2{grid-template-columns:1fr}
  .page{padding:0 14px 40px}
  .topbar{padding:12px 14px}
}
@media (max-width:600px){
  /* phones: a big crop circle you can actually drag and pinch, controls underneath */
  .cropper{flex-direction:column;align-items:stretch;gap:12px}
  .crop-canvas{width:min(260px,72vw);height:min(260px,72vw);margin:0 auto}
  .zoom-btn{width:44px;height:44px}
  .zoom-row input{height:44px}
}
