/* =====================================================================
   CouponNest — mobile-first design system
   Palette:  ink #1F1B2E · paper #FBF8F2 · plum (primary) #6C4AB6
             lime (accent) #C7F464 · ticket-red (urgent) #E4572E
   Type:     Archivo Black (display) / Inter (body) / Space Mono (codes)
   Signature: paper "ticket" cards with punched notches + dashed tear-line
   ===================================================================== */

:root{
  --ink: #1F1B2E;
  --paper: #FBF8F2;
  --paper-dim: #F1ECE1;
  --primary: #6C4AB6;
  --primary-dark: #4E3585;
  --accent: #C7F464;
  --urgent: #E4572E;
  --muted: #857F9A;
  --line: #E4DECF;
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow: 0 10px 30px -12px rgba(31,27,46,0.25);
  --font-display: 'Archivo Black', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
button{ font-family: inherit; cursor:pointer; }
h1,h2,h3,h4{ font-family: var(--font-display); line-height:1.15; margin:0 0 8px; }

/* ---------------- Top bar ---------------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 18px;
  position: sticky; top:0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand-logo{ width:34px; height:34px; border-radius:50%; object-fit:cover; }
.brand-mark{ font-size:22px; }
.brand-name{ font-family: var(--font-display); font-size:18px; letter-spacing:-0.02em; }
.icon-btn{
  background:var(--ink); color:var(--paper); border:none;
  width:38px; height:38px; border-radius:50%;
  font-size:16px; display:flex; align-items:center; justify-content:center;
}

/* ---------------- Hero ---------------- */
.hero{
  margin: 14px 16px 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 100%);
  background-size: cover; background-position:center;
  min-height: 220px;
  display:flex; align-items:flex-end;
  position: relative;
  overflow:hidden;
}
.hero::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(0deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.05) 65%);
}
.hero-overlay{ position:relative; z-index:1; padding: 20px; color:#fff; }
.eyebrow{
  display:inline-block; font-family: var(--font-mono); font-size:11px;
  letter-spacing:0.08em; text-transform:uppercase;
  background: var(--accent); color: var(--ink);
  padding: 4px 10px; border-radius: 20px; margin-bottom:10px;
}
.hero h1{ font-size: 24px; color:#fff; margin-bottom:6px; }
.hero p{ margin:0; font-size:14px; opacity:0.9; max-width: 34ch; }

/* ---------------- Category chips ---------------- */
.chips{
  display:flex; gap:8px; overflow-x:auto;
  padding: 16px 16px 4px;
  scrollbar-width:none;
}
.chips::-webkit-scrollbar{ display:none; }
.chip{
  flex:0 0 auto;
  display:flex; align-items:center; gap:6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px; font-weight:600;
  white-space:nowrap;
}
.chip img{ width:16px; height:16px; border-radius:50%; object-fit:cover; }
.chip.active{ background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------------- Coupon feed / ticket cards ---------------- */
.coupon-feed{ padding: 12px 16px 8px; display:flex; flex-direction:column; gap:18px; }

.empty-state{ text-align:center; padding: 40px 20px; color: var(--muted); }
.empty-state p{ font-family: var(--font-display); color: var(--ink); margin-bottom:4px; }

.ticket{
  position: relative;
  background:#fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--line);
}
.ticket-image{ position:relative; aspect-ratio: 16/9; background: var(--paper-dim); }
.ticket-image img{ width:100%; height:100%; object-fit:cover; }
.ticket-badge{
  position:absolute; top:10px; left:10px;
  background: var(--accent); color: var(--ink);
  font-size: 11px; font-weight:700; text-transform:uppercase; letter-spacing:0.04em;
  padding: 5px 10px; border-radius: 999px;
}
.ticket-body{ padding: 16px 16px 14px; }
.ticket-body h3{ font-size:18px; }
.ticket-store{ margin:0; font-size:13px; color:var(--muted); font-weight:600; }
.ticket-expiry{ margin:6px 0 0; font-size:12px; color: var(--urgent); font-weight:600; }

/* the punched-out perforation line, styled like a real coupon tear edge */
.ticket-perforation{
  position:relative;
  height: 0;
  border-top: 2px dashed var(--line);
  margin: 0 16px;
}
.ticket-notch{
  position:absolute; top:-11px;
  width:22px; height:22px; border-radius:50%;
  background: var(--paper);
  border: 1px solid var(--line);
}
.ticket-notch.left{ left:-27px; }
.ticket-notch.right{ right:-27px; }

.ticket-foot{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 16px 16px;
}
.ticket-store-logo{ width:30px; height:30px; border-radius:50%; object-fit:cover; border:1px solid var(--line); }
.ticket-cta{ font-size:13px; font-weight:700; color: var(--primary); }

/* ---------------- Reviews ---------------- */
.reviews{ padding: 8px 0 4px; }
.reviews h2{ font-size:19px; padding: 0 16px; margin-bottom:12px; }
.review-scroll{
  display:flex; gap:12px; overflow-x:auto; padding: 0 16px 8px; scrollbar-width:none;
}
.review-scroll::-webkit-scrollbar{ display:none; }
.review-card{
  flex: 0 0 240px;
  background:#fff; border:1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px;
}
.review-head{ display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.review-head img{ width:32px; height:32px; border-radius:50%; object-fit:cover; }
.review-head strong{ display:block; font-size:13px; }
.review-head span{ font-size:11px; color:var(--muted); }
.review-card p{ font-size:13px; margin:0 0 8px; color:#3B364B; }
.review-rating{ font-size:12px; font-weight:700; color:var(--primary); }

/* ---------------- Footer ---------------- */
.site-footer{
  text-align:center; padding: 28px 20px 10px; color: var(--muted); font-size:12px;
}
.site-footer .copyright{ margin-top:6px; }

/* ---------------- Bottom sheet (coupon detail) ---------------- */
.sheet-backdrop{
  position:fixed; inset:0; background: rgba(31,27,46,0.5);
  opacity:0; pointer-events:none; transition: opacity .25s ease;
  z-index: 40;
}
.sheet-backdrop.open{ opacity:1; pointer-events:auto; }

.sheet{
  position:fixed; left:50%; bottom:0; transform: translate(-50%, 100%);
  width:100%; max-width:560px;
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 40px rgba(0,0,0,0.25);
  max-height: 88vh; overflow-y:auto;
  padding: 10px 18px 28px;
  transition: transform .32s cubic-bezier(.32,.72,0,1);
  z-index: 41;
}
.sheet.open{ transform: translate(-50%, 0); }
.sheet-handle{
  width:40px; height:4px; background: var(--line); border-radius:4px;
  margin: 6px auto 12px;
}
.sheet-close{
  position:absolute; top:14px; right:14px;
  background: var(--paper-dim); border:none; width:32px; height:32px; border-radius:50%;
  font-size:14px;
}
.sheet h2{ font-size:20px; padding-right:34px; }

.sheet-store{ display:flex; align-items:center; gap:10px; margin: 10px 0 16px; }
.sheet-store-logo{ width:44px; height:44px; border-radius:50%; object-fit:cover; border:1px solid var(--line); }
.sheet-store h3{ font-size:15px; margin:0; }
.sheet-store p{ font-size:12px; color:var(--muted); margin:2px 0 0; }

.sheet-code-block{
  position:relative;
  background: var(--ink); color:#fff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  overflow:hidden;
}
.sheet-code-block .ticket-notch{ background: var(--paper); border-color: var(--ink); }
.sheet-code-label{ font-size:11px; text-transform:uppercase; letter-spacing:0.08em; color: var(--accent); }
.sheet-code-row{ display:flex; align-items:center; justify-content:space-between; margin-top:6px; }
.sheet-code{ font-family: var(--font-mono); font-size:22px; letter-spacing:0.03em; }
.copy-btn{
  background: var(--accent); color: var(--ink); border:none; font-weight:700;
  padding: 8px 16px; border-radius: 999px; font-size:13px;
}
.copy-btn.copied{ background:#fff; }
.sheet-expiry{ display:block; margin-top:10px; font-size:12px; color: #E9E4FF; }

.sheet-stats{ display:flex; gap:10px; margin-bottom:16px; }
.stat{
  flex:1; background:#fff; border:1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px; text-align:center;
}
.stat strong{ display:block; font-size:16px; font-family: var(--font-display); }
.stat span{ font-size:11px; color:var(--muted); }

.sheet-section{ margin-bottom:16px; }
.sheet-section h4{ font-size:13px; text-transform:uppercase; letter-spacing:0.04em; color:var(--muted); margin-bottom:6px; }
.sheet-section p{ font-size:14px; margin:0; }
.detail-list{ margin:0; padding-left:18px; font-size:14px; }
.detail-list li{ margin-bottom:6px; }

.sheet-loading{ padding: 30px 0; text-align:center; color:var(--muted); }

/* ---------------- Toast ---------------- */
.toast{
  position:fixed; left:50%; bottom:24px; transform: translate(-50%, 20px);
  background: var(--ink); color:#fff; padding: 10px 18px; border-radius: 999px;
  font-size:13px; opacity:0; pointer-events:none; transition: all .25s ease;
  z-index: 60;
}
.toast.show{ opacity:1; transform: translate(-50%, 0); }

/* ---------------- Small screens polish ---------------- */
@media (max-width: 380px){
  .hero h1{ font-size:21px; }
  .sheet-code{ font-size:19px; }
}
