/* ==========================================================================
   Treetvapours — design system
   Dark, premium, tech-editorial. No smoke/neon/cannabis clichés.
   Palette: deep charcoal base, one electric accent (mint-cyan), one warm
   secondary (amber) reserved for "verified"/trust signals only.
   ========================================================================== */

:root {
  --bg-base: #0b0d10;
  --bg-surface: #14171c;
  --bg-surface-raised: #1b1f26;
  --bg-light: #f5f6f7;
  --border-subtle: #262b33;
  --border-strong: #333944;

  --text-primary: #eef1f4;
  --text-secondary: #a6adb9;
  --text-muted: #6b7280;
  --text-on-light: #14171c;

  --accent: #35e0c2;         /* electric mint-cyan */
  --accent-strong: #1fb89e;
  --accent-soft: rgba(53, 224, 194, 0.12);

  --trust: #f2b544;          /* amber — verified / trust only */
  --trust-soft: rgba(242, 181, 68, 0.14);

  --danger: #ef5a5a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.6);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --container: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { color: var(--text-secondary); margin: 0 0 14px; }

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: #06110d; }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,13,16,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 24px; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.logo .dot { color: var(--accent); }
.logo-icon { border-radius: 6px; flex-shrink: 0; }
.main-nav { display: flex; gap: 26px; }
.main-nav a { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.main-nav a:hover { color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 860px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: block; }
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(700px 300px at 15% -10%, var(--accent-soft), transparent),
    var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}
.hero-inner { max-width: 720px; }
.hero p.lead { font-size: 1.08rem; max-width: 560px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 18px;
  margin: 28px 0 14px;
  max-width: 560px;
}
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  padding: 10px 0;
}
.search-box input::placeholder { color: var(--text-muted); }
.popular-searches { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }
.popular-searches a { color: var(--text-secondary); padding: 4px 10px; border: 1px solid var(--border-subtle); border-radius: 20px; }
.popular-searches a:hover { border-color: var(--accent); color: var(--accent); }

/* Section shell */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-surface); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 20px; flex-wrap: wrap; }
.section-head p { margin: 0; }
.see-all { font-size: 0.88rem; font-weight: 600; color: var(--accent); white-space: nowrap; }

/* Grids */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Brand tile */
.brand-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.brand-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.brand-tile .brand-logo-fallback {
  width: 48px; height: 48px; border-radius: 10px; margin: 0 auto 12px;
  background: var(--bg-surface-raised); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent);
}
.brand-tile .brand-name { font-weight: 600; margin-bottom: 4px; }
.brand-tile .brand-count { font-size: 0.8rem; color: var(--text-muted); }

/* Coupon grid — auto-fit, centered, matches reference proportions
   (230–260px cards) rather than a fixed 3-column grid. */
.coupon-grid {
  display: grid; gap: 16px; justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(230px, 260px));
}

/* Coupon card — structure mirrors the reference site 1:1: top row
   (logo + provider) → headline → optional description → badges row →
   code-peek/get-deal button → meta row → optional terms line. */
.coupon-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.coupon-card__top { display: flex; align-items: center; gap: 10px; }
.coupon-card__logo { width: 40px; height: 40px; border-radius: 6px; object-fit: contain; background: var(--bg-surface-raised); flex-shrink: 0; }
.coupon-card__provider { font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); }

/* Headline, description, and badges all reserve a fixed height (clamped
   to a set number of lines) regardless of actual content length. Without
   this, a 1-line vs. 2-line headline or an empty badge row shifts every
   card's CTA button to a different vertical position — the alignment
   only holds when the space above the button is identical on every card. */
.coupon-card__headline {
  font-size: 1.05rem; font-weight: 700; color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em; line-height: 1.3;
}
.coupon-card__desc {
  font-size: 0.9rem; color: var(--text-secondary); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em; line-height: 1.3;
}
.coupon-card__badges { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; font-size: 0.75rem; min-height: 24px; }
.coupon-card__meta { font-size: 0.78rem; color: var(--text-muted); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 20px; white-space: nowrap;
}
.badge-code { background: var(--accent-soft); color: var(--accent); }
.badge-deal { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-nocode { background: rgba(53, 224, 194, 0.1); color: var(--accent); }
.badge-verified { background: var(--trust-soft); color: var(--trust); }
.badge-expiring { background: rgba(239, 90, 90, 0.14); color: var(--danger); }
.coupon-cta { display: flex; align-items: center; gap: 10px; margin-top: auto; }

/* "Get Code" button overlapping most of the code box. The peek shows a
   FIXED placeholder pattern, not a truncated slice of the real code —
   showing actual characters (even partial ones) varies in length and
   position per code, which reads as inconsistent/broken across cards
   and leaks part of the code before the click. A fixed placeholder is
   both more uniform and slightly more conservative about the code. */
.coupon-code-peek {
  position: relative; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
  height: 44px; display: flex; align-items: center; overflow: hidden; margin-top: auto;
}
.coupon-code-peek__code {
  flex: 1; text-align: right; padding-right: 16px;
  font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.14em;
  color: var(--text-muted); white-space: nowrap; font-size: 0.85rem;
}
.coupon-code-peek__btn {
  position: absolute; left: -2px; top: -2px; bottom: -2px; right: 56px;
  margin: 0; border-radius: 5px 0 0 5px; display: flex; align-items: center; justify-content: center;
}
.get-deal-btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--accent); color: #06110d;
  padding: 12px; border-radius: var(--radius-sm); font-weight: 700; height: 44px;
  line-height: 20px; margin-top: auto;
}
.get-deal-btn:hover { background: var(--accent-strong); }

/* Manual copy row on the coupon detail page — code shown in full since
   you've already navigated here deliberately, plus a copy button. */
.manual-copy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 14px; font-family: var(--font-mono); font-weight: 700;
  letter-spacing: 0.03em; background: var(--bg-surface-raised); margin-bottom: 16px;
}
.manual-copy-btn {
  background: var(--accent); color: #06110d; border: none; border-radius: 6px;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.manual-copy-btn:hover { opacity: 0.9; }

/* Coupon popup — opens on click (current tab still navigates straight to
   the store), and auto-opens via ?showCoupon={id} on the new tab that
   reloads the same source page the trigger was on. */
body.coupon-modal-lock { overflow: hidden; }
.coupon-modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 8, 10, 0.7);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 200;
}
.coupon-modal-overlay.open { opacity: 1; pointer-events: auto; }
.coupon-modal {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 28px 24px 24px; max-width: 380px; width: 100%;
  text-align: center; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(10px) scale(0.97); transition: transform .18s ease;
}
.coupon-modal-overlay.open .coupon-modal { transform: translateY(0) scale(1); }
.coupon-modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 1.4rem; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 4px;
}
.coupon-modal-provider { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.coupon-modal-title { margin: 0 0 18px; font-size: 1.1rem; color: var(--text-primary); }
.coupon-modal-code-box {
  position: relative; border: 2px dashed var(--accent); border-radius: var(--radius-md);
  padding: 12px 14px; margin-bottom: 14px; background: var(--bg-surface-raised);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.coupon-modal-code {
  font-family: var(--font-mono); font-weight: 800; font-size: 1.3rem;
  letter-spacing: 0.06em; color: var(--text-primary);
}
.coupon-modal-copy-btn {
  background: var(--accent); color: #06110d; border: none; border-radius: 6px;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.coupon-modal-copy-btn:hover { opacity: 0.9; }
.coupon-modal #couponModalNoCode { margin-bottom: 14px; display: inline-block; }
.coupon-modal-deal-btn { display: block; }

/* Category card */
.category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  font-weight: 600;
  transition: border-color .15s ease;
}
.category-card:hover { border-color: var(--accent); }
.category-card .cat-count { display: block; font-weight: 400; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Value prop / why-us */
.value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
@media (max-width: 860px) { .value-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .value-grid { grid-template-columns: 1fr; } }
.value-item .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-weight: 700; }

/* Guide / blog card */
.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.article-card .thumb { height: 150px; background: linear-gradient(135deg, var(--bg-surface-raised), var(--bg-base)); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.75rem; }
.article-card .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-card .cat-label { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.article-card .meta { font-size: 0.76rem; color: var(--text-muted); margin-top: auto; }
.article-card .read-link { font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border-subtle); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent); font-size: 1.3rem; font-weight: 400; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: 10px; }

/* Footer */
.site-footer { background: var(--bg-surface); border-top: 1px solid var(--border-subtle); padding: 48px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; margin-bottom: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { color: var(--text-secondary); font-size: 0.9rem; }
.footer-grid a:hover { color: var(--accent); }
.footer-legal { border-top: 1px solid var(--border-subtle); padding-top: 20px; font-size: 0.78rem; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.disclaimer-box { font-size: 0.78rem; color: var(--text-muted); background: var(--bg-surface-raised); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 24px; }

/* Breadcrumbs */
.breadcrumbs { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }

/* Page header bands (guides/blog/faq/legal) */
.page-band { padding: 44px 0 32px; border-bottom: 1px solid var(--border-subtle); }

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: var(--bg-base);
  padding: 10px 18px; border-radius: 20px; font-size: 0.85rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; }

/* Article + sidebar banner layout (guides/blog) */
.article-layout { display: flex; gap: 32px; align-items: flex-start; }
.article-layout__main { flex: 1; min-width: 0; }
.article-sidebar { flex-shrink: 0; width: 160px; position: sticky; top: 84px; }
.article-sidebar__banner img { width: 100%; height: auto; border-radius: 8px; display: block; box-shadow: var(--shadow-card); }
.article-sidebar__label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; text-align: center; }
@media (max-width: 900px) {
  .article-layout { flex-direction: column; }
  .article-sidebar { width: 100%; max-width: 240px; margin: 0 auto; position: static; }
}
