/* ============================================================
   Java Café · Gift Cards
   Tokens derived from the brand colours supplied in the brief,
   components & conventions pulled from java-cafe-design SKILL.md.
   ============================================================ */
:root {
  /* ---- Brand colours (from brief) ---- */
  --brown:        #5B3616;   /* primary brown — ink, dark surfaces */
  --gold:         #9D6F2D;   /* gold accent */
  --beige:        #F5EDE3;   /* default background — never pure white */
  --orange:       #C45A1A;   /* CTA orange */

  /* ---- Derived supporting tones ---- */
  --brown-700:    #3F2510;
  --brown-900:    #2A1810;
  --gold-soft:    #B98A3F;
  --orange-700:   #A8470F;
  --paper:        #FBF6EE;   /* card surface on beige */
  --paper-line:   #E7D9C6;   /* hairline borders */
  --ink:          #3A2615;   /* body text */
  --muted:        #8C715A;   /* secondary text */
  --cream:        #FFFDF9;

  /* ---- Gradients (skill component recipes) ---- */
  --gold-grad:  linear-gradient(135deg, #C9963F 0%, #9D6F2D 50%, #7E5620 100%);
  --orange-grad:linear-gradient(135deg, #E07434 0%, #C45A1A 55%, #A8470F 100%);
  --card-grad:  linear-gradient(160deg, #FFFFFF 0%, #FBF4EA 100%);

  /* ---- Shape ---- */
  --radius:    22px;
  --radius-sm: 14px;

  /* ---- Elevation ---- */
  --shadow:      0 18px 40px -16px rgba(91,54,22,.32);
  --shadow-soft: 0 8px 22px -10px rgba(91,54,22,.28);
  --glow-orange: 0 12px 26px -8px rgba(196,90,26,.45);
  --glow-gold:   0 12px 26px -10px rgba(157,111,45,.45);

  /* ---- Motion ---- */
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Brand background — warm radial glow on beige (skill recipe, light variant) */
.jc-bg {
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, #F4E2CB 0%, transparent 55%),
    radial-gradient(100% 70% at 50% 110%, #EFE0CC 0%, transparent 50%),
    var(--beige);
  color: var(--ink);
  font-family: "Cairo", "Poppins", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[dir="ltr"] body, [dir="ltr"].jc-bg { font-family: "Poppins", "Cairo", system-ui, sans-serif; }

/* Centered shell — mobile-first, widens gracefully */
.app-shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
}

/* ===================== Top bar ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand__logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--gold-grad);
  display: grid; place-items: center;
  box-shadow: var(--glow-gold);
}
.brand__mark {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700; font-size: 26px;
  color: var(--cream);
  line-height: 1;
}
.brand__mark--sm { font-size: 16px; color: var(--gold); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name {
  font-family: "Oswald", "Poppins", sans-serif;
  font-weight: 700; font-size: 16px;
  letter-spacing: .22em;
  color: var(--brown);
}
.brand__tag { font-size: 12px; color: var(--muted); font-weight: 600; }

.lang-toggle {
  font: inherit; font-weight: 700; font-size: 13px;
  color: var(--brown);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 100px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform .15s var(--ease), background .2s;
}
.lang-toggle:active { transform: scale(.96); }

/* ===================== Hero ===================== */
.hero { text-align: center; padding: 6px 4px 22px; }
.hero__title {
  font-family: "Oswald", "Cairo", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 8vw, 36px);
  letter-spacing: .01em;
  color: var(--brown);
  margin: 14px 0 6px;
}
[dir="rtl"] .hero__title { font-family: "Cairo", sans-serif; font-weight: 800; }
.hero__promise {
  font-weight: 700; color: var(--orange);
  margin: 0 0 10px; font-size: 16px;
}
.hero__sub {
  color: var(--muted); font-size: 14px; line-height: 1.6;
  max-width: 38ch; margin: 0 auto;
}

/* ===================== Shared components (from SKILL.md) ===================== */
.jc-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
  background: rgba(157,111,45,.10);
  border: 1px solid rgba(157,111,45,.28);
  border-radius: 100px;
}

.jc-card {
  background: var(--card-grad);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
}
.jc-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0;
  height: 3px; background: var(--gold-grad); opacity: .9;
}

.jc-cta {
  width: 100%; padding: 17px; border: none;
  border-radius: 16px;
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .02em;
  color: var(--cream);
  background: var(--orange-grad);
  cursor: pointer;
  box-shadow: var(--glow-orange);
  transition: transform .15s var(--ease), box-shadow .2s, opacity .2s;
}
.jc-cta:active { transform: translateY(2px) scale(.99); }
.jc-cta:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ===================== Builder layout ===================== */
.builder { display: flex; flex-direction: column; gap: 16px; }
.step__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 800; color: var(--brown);
  margin: 0 0 14px;
}
.step__num {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--gold-grad);
  color: var(--cream);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  font-family: "Poppins", sans-serif;
}

/* ----- Live preview / gift card ----- */
.preview-wrap { perspective: 1000px; padding: 2px; }
.giftcard {
  position: relative;
  border-radius: 20px;
  padding: 20px;
  min-height: 200px;
  color: var(--cream);
  background: linear-gradient(150deg, var(--brown) 0%, var(--brown-900) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: background .4s var(--ease);
}
.giftcard__shine {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 85% -10%, rgba(255,255,255,.18) 0%, transparent 45%);
  pointer-events: none;
}
.giftcard__top {
  display: flex; align-items: center; justify-content: space-between;
}
.giftcard__brand {
  font-family: "Oswald", sans-serif; font-weight: 700;
  letter-spacing: .26em; font-size: 14px;
}
.giftcard__icon { font-size: 28px; }
.giftcard__theme {
  margin-top: 14px;
  font-weight: 700; font-size: 13px;
  color: rgba(255,255,255,.82);
}
.giftcard__amount {
  font-family: "Oswald", "Poppins", sans-serif;
  font-weight: 700; font-size: 42px; line-height: 1.1;
  margin-top: 2px;
}
.giftcard__amount small { font-size: 16px; font-weight: 600; opacity: .85; }
.giftcard__msg {
  margin-top: auto; padding-top: 16px;
  font-size: 14px; font-style: italic;
  color: rgba(255,255,255,.9);
  min-height: 20px;
}
.giftcard__foot {
  display: flex; justify-content: space-between;
  margin-top: 12px; font-size: 12px;
  border-top: 1px solid rgba(255,255,255,.16);
  padding-top: 10px;
}
.giftcard__foot small { opacity: .7; }
.giftcard__foot b { font-weight: 700; }

/* Design themes applied to the live card */
.giftcard[data-design="birthday"] { background: linear-gradient(150deg, #7A3A66 0%, #3D1E33 100%); }
.giftcard[data-design="thanks"]   { background: linear-gradient(150deg, #4A6157 0%, #25342E 100%); }
.giftcard[data-design="ramadan"]  { background: linear-gradient(150deg, #1E3A4A 0%, #0F1E28 100%); }
.giftcard[data-design="congrats"] { background: linear-gradient(150deg, var(--gold) 0%, #6E4D1E 100%); }
.giftcard[data-design="love"]     { background: linear-gradient(150deg, #8A2B2B 0%, #3D1414 100%); }

/* ----- Step 1: design grid ----- */
.design-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.design {
  font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px;
  background: var(--cream);
  border: 1.5px solid var(--paper-line);
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--ink);
  font-size: 12px; font-weight: 600;
  transition: transform .15s var(--ease), border-color .2s, box-shadow .2s;
}
.design:active { transform: scale(.97); }
.design[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
  transform: translateY(-2px);
}
.design__swatch {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  box-shadow: var(--shadow-soft);
}
.sw-everyday { background: linear-gradient(150deg, var(--brown), var(--brown-900)); }
.sw-birthday { background: linear-gradient(150deg, #7A3A66, #3D1E33); }
.sw-thanks   { background: linear-gradient(150deg, #4A6157, #25342E); }
.sw-ramadan  { background: linear-gradient(150deg, #1E3A4A, #0F1E28); }
.sw-congrats { background: var(--gold-grad); }
.sw-love     { background: linear-gradient(150deg, #8A2B2B, #3D1414); }

/* ----- Step 2: amount ----- */
.amount-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.amount-pill {
  font: inherit; font-weight: 700; font-size: 16px;
  padding: 14px 6px;
  background: var(--cream);
  border: 1.5px solid var(--paper-line);
  border-radius: var(--radius-sm);
  color: var(--brown); cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s, border-color .2s;
}
.amount-pill::after { content: " ر.س"; font-size: 11px; font-weight: 600; color: var(--muted); }
[dir="ltr"] .amount-pill::after { content: " SAR"; }
.amount-pill:active { transform: scale(.97); }
.amount-pill.is-selected {
  background: var(--gold-grad); color: var(--cream);
  border-color: transparent; box-shadow: var(--glow-gold);
  transform: translateY(-2px);
}
.amount-pill.is-selected::after { color: rgba(255,255,255,.85); }

.custom-amount label, .field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 8px;
}

/* Stepper (skill component) */
.stepper {
  display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center;
}
.stepper__btn {
  height: 50px; border: none; border-radius: 13px;
  background: var(--gold-grad); color: var(--cream);
  font-size: 24px; font-weight: 700; cursor: pointer;
  box-shadow: var(--glow-gold);
  transition: transform .15s var(--ease);
}
.stepper__btn:active { transform: scale(.94); }
.stepper input {
  height: 50px; text-align: center;
  font: inherit; font-size: 20px; font-weight: 700; color: var(--brown);
  border: 1.5px solid var(--paper-line); border-radius: 13px;
  background: var(--cream);
}

/* ----- Fields ----- */
.field { margin-bottom: 14px; position: relative; }
.field:last-child { margin-bottom: 0; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 15px;
  padding: 13px 14px;
  border: 1.5px solid var(--paper-line); border-radius: var(--radius-sm);
  background: var(--cream); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
  resize: none;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(157,111,45,.15);
}
.counter {
  position: absolute; inset-inline-end: 4px; bottom: -18px;
  font-size: 11px; color: var(--muted);
}

/* Segmented control */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--beige); border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm); padding: 5px; margin-bottom: 14px;
}
.seg__btn {
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 11px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .2s, color .2s;
}
.seg__btn.is-active { background: var(--cream); color: var(--brown); box-shadow: var(--shadow-soft); }

/* Saudi phone */
.phone-row {
  display: flex; align-items: stretch; gap: 8px;
}
.phone-prefix {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; font-weight: 700; font-size: 15px; color: var(--brown);
  background: var(--beige); border: 1.5px solid var(--paper-line);
  border-radius: var(--radius-sm); white-space: nowrap;
}
.phone-row input { flex: 1; }

/* Saudi flag chip (from skill flags.css) */
.jc-sa-flag {
  display: inline-block; width: 22px; height: 15px; border-radius: 3px;
  background: #006c35; position: relative; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.jc-sa-flag::after {
  content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px;
  height: 2px; background: #fff; border-radius: 2px;
}

.is-hidden { display: none !important; }
.error { color: #B23A2E; font-size: 13px; font-weight: 600; margin: 4px 0 0; min-height: 18px; }

/* ----- Summary ----- */
.summary__row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; padding: 6px 0;
}
.summary__row--muted { color: var(--muted); font-size: 14px; }
.summary__total {
  border-top: 1px dashed var(--paper-line);
  margin-top: 6px; padding-top: 12px;
  font-size: 18px; font-weight: 800; color: var(--brown);
}
.summary .jc-cta { margin-top: 16px; }
.note { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ----- Footer ----- */
.foot-note {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; font-size: 13px; color: var(--muted);
}

/* ===================== Success overlay (skill component) ===================== */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: none; place-items: center; padding: 22px;
  background: rgba(42,24,16,.55);
  backdrop-filter: blur(8px);
}
.overlay.is-open { display: grid; animation: fade .25s var(--ease); }
.overlay__card {
  max-width: 380px; width: 100%; text-align: center;
  animation: pop .35s var(--ease);
}
.overlay__card h3 { margin: 8px 0 4px; font-size: 22px; color: var(--brown); }
.overlay__sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.check {
  width: 76px; height: 76px; margin: 6px auto 4px;
  border-radius: 50%;
  background: var(--gold-grad);
  display: grid; place-items: center;
  box-shadow: var(--glow-gold);
  animation: popCheck .45s var(--ease) .1s both;
}
.check svg { width: 40px; height: 40px; fill: none; stroke: var(--cream); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.code-box {
  background: var(--beige); border: 1px dashed var(--gold-soft);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px;
}
.code-box__label { font-size: 12px; color: var(--muted); font-weight: 600; }
.code-box__code {
  font-family: "Oswald", monospace; font-size: 22px; font-weight: 700;
  letter-spacing: .12em; color: var(--brown);
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(10px); } }
@keyframes popCheck { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* ===================== Wider screens ===================== */
@media (min-width: 720px) {
  .app-shell { max-width: 920px; }
  .builder {
    display: grid;
    grid-template-columns: 360px 1fr;
    align-items: start;
    gap: 16px;
  }
  .preview-wrap {
    grid-column: 1; grid-row: 1 / span 6;
    position: sticky; top: 18px;
  }
  .builder > section:not(.preview-wrap) { grid-column: 2; }
  .preview-wrap .giftcard { min-height: 250px; }
}
