/* ============================================================
   Zipper Design POCs — shared design tokens + components
   Credit Pack Review redesigns
   Aesthetic mirrors the live Zipper modal: clean white card,
   forest-green primary, soft status tints, rounded pills.
   ============================================================ */

:root {
  /* brand */
  --z-green:        #1a7f4b;
  --z-green-dark:   #14663c;
  --z-green-soft:   #e8f5ee;
  --z-green-line:   #bfe3cf;

  /* status hues */
  --purchased:      #2563eb;  --purchased-soft: #e9effc;
  --used:           #5b6472;  --used-soft:      #f1f2f4;
  --returned:       #b45309;  --returned-soft:  #fdf2e3;
  --expired:        #dc2626;  --expired-soft:   #fbecec;
  --available:      #1a7f4b;  --available-soft: #e8f5ee;

  /* neutrals */
  --ink:            #1c2024;
  --muted:          #6b7280;
  --faint:          #9aa1ab;
  --line:           #ebedf0;
  --line-strong:    #dde0e5;
  --surface:        #ffffff;
  --surface-2:      #f7f8fa;
  --surface-3:      #f1f3f5;

  --radius:         16px;
  --radius-sm:      10px;
  --radius-pill:    999px;
  --shadow:         0 10px 40px rgba(20,30,40,.16), 0 2px 8px rgba(20,30,40,.06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background: #2b2f36;
}

/* dimmed studio-app backdrop so each mockup reads like a real modal */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 80px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255,255,255,.06), transparent),
    #2b2f36;
}

/* ---- modal shell ---- */
.modal {
  width: 720px;
  max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 18px;
}
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.modal-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }
.x {
  border: 0; background: transparent; color: var(--faint);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.x:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: 0 26px 26px; }

/* ---- period selector row ---- */
.period {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.period .chev { margin-left: auto; color: var(--faint); }

/* ---- pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; line-height: 1.6;
  background: var(--surface-3); color: var(--muted);
  white-space: nowrap;
}
.pill.green    { background: var(--available-soft); color: var(--available); }
.pill.blue     { background: var(--purchased-soft); color: var(--purchased); }
.pill.gray     { background: var(--used-soft);      color: var(--used); }
.pill.amber    { background: var(--returned-soft);  color: var(--returned); }
.pill.red      { background: var(--expired-soft);   color: var(--expired); }
.pill.outline  { background: #fff; border: 1px solid var(--line-strong); color: var(--muted); }

.delta {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px; padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700;
}
.delta.minus { background: var(--expired-soft);   color: var(--expired); }
.delta.plus  { background: var(--available-soft); color: var(--available); }
.delta.add   { background: var(--purchased-soft); color: var(--purchased); }

/* ---- stat row (the classic 5-metric strip) ---- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 18px 0; }
.stat  { text-align: center; padding: 14px 6px; border-top: 3px solid var(--line); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.purchased { border-top-color: var(--purchased); }
.stat.used      { border-top-color: var(--used); }
.stat.expired   { border-top-color: var(--expired); opacity: .5; }
.stat.returned  { border-top-color: var(--returned); }
.stat.available { border-top-color: var(--available); }
.stat.available .n { color: var(--available); }

/* ---- segmented toggle ---- */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-pill); padding: 3px; }
.segmented button {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 14px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button.on { background: #fff; color: var(--z-green); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--z-green); border-color: var(--z-green); color: #fff; }
.btn.primary:hover { background: var(--z-green-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }

/* ---- list rows (credit list / timeline) ---- */
.row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 4px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .name { font-weight: 600; }
.row .meta { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.row .grow { flex: 1; min-width: 0; }
.row .ts   { font-size: 12px; color: var(--faint); text-align: right; white-space: nowrap; }

/* ---- progress bar ---- */
.bar { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }

/* ---- banners ---- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5;
}
.banner.amber { background: #fff8ec; color: #8a5a12; border: 1px solid #f2e2c2; }
.banner.green { background: var(--z-green-soft); color: var(--z-green-dark); border: 1px solid var(--z-green-line); }

/* ---- misc helpers ---- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.spread { display: flex; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; }
.hrow  { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   GALLERY (index.html)
   ============================================================ */
.gallery-head { max-width: 980px; margin: 0 auto; color: #e7eaee; padding: 8px 16px 24px; }
.gallery-head h1 { font-size: 24px; margin: 0 0 6px; }
.gallery-head p  { color: #aab2bd; margin: 0; line-height: 1.55; max-width: 720px; }
.problem {
  max-width: 980px; margin: 0 auto 28px; padding: 16px 18px;
  background: #343941; border: 1px solid #434953; border-radius: 12px; color: #cfd5dd; font-size: 14px; line-height: 1.6;
}
.problem b { color: #fff; }
.grid {
  max-width: 980px; margin: 0 auto; display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 0 16px 60px;
}
.card {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid #2f343b; transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.card .thumb { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; letter-spacing: .03em; color: #fff; }
.card .cap { padding: 14px 16px; }
.card .cap h3 { margin: 0 0 4px; font-size: 15px; }
.card .cap p  { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.tag { display:inline-block; font-size:11px; font-weight:700; color:#fff; background:rgba(0,0,0,.25); padding:2px 8px; border-radius:999px; }

/* ============================================================
   RESPONSIVE — mobile-first guarantees for every variation.
   Anything using the shared shell/components becomes usable on a
   phone: full-bleed modal, no horizontal scroll, ≥44px tap targets,
   stat strip that wraps instead of crushing.
   ============================================================ */
@media (max-width: 640px) {
  .stage { padding: 0; align-items: stretch; }
  .modal {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    display: flex; flex-direction: column;
  }
  .modal-head { padding: 16px 16px 12px; position: sticky; top: 0; background: var(--surface); z-index: 5; border-bottom: 1px solid var(--line); }
  .modal-title { font-size: 18px; }
  .modal-body { padding: 0 16px 24px; flex: 1; -webkit-overflow-scrolling: touch; }

  /* stat strip: 5 columns is too tight on a phone — wrap to a 3+2 grid */
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px 0; margin: 14px 0; }
  .stat { padding: 10px 4px; border-top-width: 3px; }
  .stat .n { font-size: 21px; }
  .stat .l { font-size: 11px; }

  /* period row + toggles wrap cleanly */
  .period { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .period .chev { margin-left: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; justify-content: center; }

  /* list rows: keep timestamp under content rather than pushing off-screen */
  .row { gap: 10px; padding: 14px 2px; }
  .row .ts { text-align: left; }

  /* buttons: comfortable tap targets, stack action rows */
  .btn { min-height: 44px; padding: 11px 16px; }
  .x { min-width: 40px; min-height: 40px; }

  /* tables become horizontally scrollable instead of overflowing the viewport */
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  /* gallery collapses to one column */
  .grid { grid-template-columns: 1fr; }
}

/* tablets: gallery two-up stays, modal gets a little breathing room */
@media (min-width: 641px) and (max-width: 820px) {
  .modal { width: calc(100% - 24px); }
}
