/* ============================================================
   Costco Deals Online — Design System
   Aesthetic: warm editorial "deals magazine" + price-tag motif
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,700;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Palette — warehouse value, warm paper */
  --paper:      #FBF6EC;
  --paper-2:    #F4ECDD;
  --card:       #FFFFFF;
  --ink:        #1C1B2A;
  --ink-soft:   #4A4860;
  --ink-faint:  #7C7A90;
  --line:       #E7DECB;
  --line-strong:#D8CCB2;

  --red:        #D6252B;   /* deals / savings */
  --red-deep:   #A81B22;
  --blue:       #005CB9;   /* trust / links */
  --blue-deep:  #00427F;
  --amber:      #F4B942;   /* price tag highlight */
  --green:      #1E8A5B;   /* "available" */

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(28,27,42,.05), 0 8px 24px -12px rgba(28,27,42,.18);
  --shadow-lg:  0 2px 4px rgba(28,27,42,.06), 0 24px 60px -24px rgba(28,27,42,.32);

  --display: 'Bricolage Grotesque', ui-serif, Georgia, serif;
  --body: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  --wrap: 1180px;
}

[data-theme="dark"] {
  --paper:      #14131C;
  --paper-2:    #1B1A26;
  --card:       #1F1E2B;
  --ink:        #F3EFE6;
  --ink-soft:   #C3BFCF;
  --ink-faint:  #8F8CA1;
  --line:       #2E2C3D;
  --line-strong:#3A3850;
  --red:        #FF5A5F;
  --red-deep:   #E23B41;
  --blue:       #6BA8FF;
  --blue-deep:  #4E8FEE;
  --amber:      #F6C560;
  --green:      #3FBE86;
  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg:  0 2px 4px rgba(0,0,0,.35), 0 24px 60px -24px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(circle at 12% -5%, rgba(214,37,43,.06), transparent 42%),
    radial-gradient(circle at 92% 0%, rgba(0,92,185,.06), transparent 40%);
  background-attachment: fixed;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }

/* ---------- Header ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex; align-items: center; gap: 20px;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 800; font-size: 1.28rem; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; line-height: 1.05; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  background: var(--red); color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
  transform: rotate(-4deg);
}
.brand-mark::after { content:""; position:absolute; }
.brand small { display:block; font-family: var(--body); font-weight: 500; font-size:.62rem; letter-spacing:.14em; text-transform:uppercase; color: var(--ink-faint); margin-top:1px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink-soft); font-weight: 600; font-size: .93rem; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { color: var(--ink); background: var(--paper-2); text-decoration: none; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: transform .2s, background .2s;
}
.theme-toggle:hover { background: var(--paper-2); transform: translateY(-1px); }
.nav-toggle { display:none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--body); font-weight: 700; font-size: .95rem;
  padding: 12px 20px; border-radius: 10px; border: none; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 6px 18px -6px var(--red); }
.btn-red:hover { background: var(--red-deep); color:#fff; }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 6px 18px -6px var(--blue); }
.btn-blue:hover { background: var(--blue-deep); color:#fff; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--paper-2); }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 30px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--red-deep); background: color-mix(in srgb, var(--red) 12%, transparent);
  padding: 6px 12px; border-radius: 100px; font-weight: 500;
}
.hero h1 {
  font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: 1.02;
  font-size: clamp(2.6rem, 6vw, 4.3rem); margin: 18px 0 16px;
}
.hero h1 .mark { color: var(--red); position: relative; white-space: nowrap; }
.hero p.lead { font-size: 1.18rem; color: var(--ink-soft); max-width: 34ch; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 26px; margin-top: 30px; }
.hero-stats .stat b { font-family: var(--display); font-size: 1.7rem; font-weight: 800; display:block; letter-spacing:-.02em; }
.hero-stats .stat span { font-size: .82rem; color: var(--ink-faint); }

/* Deal-of-the-day card in hero */
.dotd { position: relative; }
.dotd-tag {
  position: absolute; top: -14px; left: 22px; z-index: 3;
  background: var(--amber); color: #3a2a00; font-family: var(--mono); font-weight: 500;
  font-size: .72rem; letter-spacing: .05em; text-transform: uppercase;
  padding: 6px 14px 6px 12px; border-radius: 6px; transform: rotate(-2.5deg);
  box-shadow: 0 6px 16px -6px rgba(244,185,66,.7);
}
.dotd-tag::before { content:"★ "; }

/* ---------- Price tag motif ---------- */
.pricetag {
  --tag: var(--red);
  position: relative; display: inline-flex; flex-direction: column; align-items: flex-start;
  background: var(--tag); color: #fff; padding: 8px 14px 8px 20px; border-radius: 4px 8px 8px 4px;
  font-family: var(--mono);
}
.pricetag::before {
  content:""; position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--tag);
}
.pricetag .now { font-size: 1.25rem; font-weight: 500; line-height: 1; }
.pricetag .was { font-size: .72rem; opacity: .8; text-decoration: line-through; }

/* ---------- Deal cards ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 46px 0 22px; }
.section-head h2 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; font-size: 1.85rem; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--ink-faint); font-size: .95rem; }
.section-head .seelink { font-weight: 700; font-size: .9rem; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }

.deal-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.deal-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.deal-card a.cover { position: absolute; inset: 0; z-index: 2; }
.deal-thumb {
  aspect-ratio: 16 / 10; position: relative; display: grid; place-items: center;
  overflow: hidden; border-bottom: 1px solid var(--line);
}
.deal-thumb svg, .deal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.deal-savebadge {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  background: var(--ink); color: var(--paper); font-family: var(--mono); font-weight: 500;
  font-size: .74rem; padding: 5px 10px; border-radius: 7px; letter-spacing: .02em;
}
.deal-cat {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(4px);
  color: var(--ink-soft); font-size: .74rem; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line);
}
.deal-body { padding: 16px 17px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.deal-body h3 { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em; margin: 0; line-height: 1.22; }
.deal-body h3 a { color: var(--ink); }
.deal-body h3 a:hover { color: var(--red); text-decoration: none; }
.deal-price { display: flex; align-items: baseline; gap: 9px; margin-top: 2px; }
.deal-price .now { font-family: var(--mono); font-size: 1.32rem; font-weight: 500; color: var(--red); }
.deal-price .was { font-family: var(--mono); font-size: .85rem; color: var(--ink-faint); text-decoration: line-through; }
.deal-meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: .8rem; color: var(--ink-faint); }
.deal-meta .date { font-family: var(--mono); }
.avail { display:inline-flex; align-items:center; gap:5px; font-weight:600; }
.avail::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--green); }

/* ---------- Filters bar ---------- */
.toolbar {
  position: sticky; top: 68px; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 14px 0; margin-bottom: 8px;
}
.toolbar-inner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box input {
  width: 100%; font-family: var(--body); font-size: .95rem; color: var(--ink);
  padding: 11px 14px 11px 40px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--card); transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-family: var(--body); font-weight: 600; font-size: .85rem; cursor: pointer;
  padding: 8px 14px; border-radius: 100px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink-soft); transition: all .15s;
}
.chip:hover { border-color: var(--ink-faint); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.select {
  font-family: var(--body); font-weight: 600; font-size: .88rem; color: var(--ink);
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); cursor: pointer;
}
.result-count { font-size: .85rem; color: var(--ink-faint); font-family: var(--mono); }
.empty-state { text-align:center; padding: 60px 20px; color: var(--ink-faint); }

/* ---------- Deal detail page ---------- */
.crumbs { font-size: .84rem; color: var(--ink-faint); margin: 22px 0 8px; font-family: var(--mono); }
.crumbs a { color: var(--ink-soft); }
.deal-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; margin: 14px 0 20px; }
.deal-hero-media { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 4/3; }
.deal-hero-media svg, .deal-hero-media img { width: 100%; height: 100%; object-fit: cover; }
.deal-hero h1 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.06; margin: 8px 0 14px; }
.pricerow { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 8px 0 18px; }
.pricerow .big { font-family: var(--mono); font-size: 2.4rem; font-weight: 500; color: var(--red); line-height: 1; }
.pricerow .old { font-family: var(--mono); font-size: 1.1rem; color: var(--ink-faint); text-decoration: line-through; }
.pricerow .save { background: var(--green); color: #fff; font-family: var(--mono); font-size: .82rem; padding: 6px 11px; border-radius: 7px; font-weight: 500; }
.spec-list { list-style: none; padding: 0; margin: 18px 0; border-top: 1px solid var(--line); }
.spec-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.spec-list li span:first-child { color: var(--ink-faint); }
.spec-list li span:last-child { font-family: var(--mono); font-weight: 500; text-align: right; }
.cta-stack { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.igback { display:inline-flex; align-items:center; gap:8px; font-weight:700; }

/* Quick answer / AEO box */
.quick-answer {
  background: color-mix(in srgb, var(--blue) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-left: 4px solid var(--blue); border-radius: 12px; padding: 18px 20px; margin: 8px 0 24px;
}
.quick-answer h2 { font-family: var(--body); font-size: .78rem; letter-spacing:.08em; text-transform:uppercase; color: var(--blue-deep); margin: 0 0 7px; font-weight: 700; }
[data-theme="dark"] .quick-answer h2 { color: var(--blue); }
.quick-answer p { margin: 0; font-size: 1.06rem; color: var(--ink); }

.prose { max-width: 68ch; font-size: 1.06rem; color: var(--ink-soft); }
.prose h2 { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-size: 1.5rem; margin: 34px 0 10px; }
.prose p { margin: 0 0 16px; }

/* FAQ */
.faq { border-top: 1px solid var(--line); margin-top: 10px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 2px; font-family: var(--display); font-weight: 700; font-size: 1.08rem; display: flex; justify-content: space-between; gap: 12px; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--red); font-size: 1.3rem; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--ink-soft); }

/* ---------- Archive timeline ---------- */
.month-head { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; font-size: 1.35rem; margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--line-strong); display:flex; align-items:baseline; gap:10px; }
.month-head span { font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); font-weight: 400; }

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 44px 40px;
  margin: 60px 0; position: relative; overflow: hidden;
}
.newsletter::before { content:""; position:absolute; inset:0; background:
  radial-gradient(circle at 85% 20%, rgba(214,37,43,.35), transparent 45%),
  radial-gradient(circle at 10% 90%, rgba(0,92,185,.3), transparent 45%); }
.newsletter > * { position: relative; }
.newsletter h2 { font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing:-.02em; margin: 0 0 8px; }
.newsletter p { color: color-mix(in srgb, var(--paper) 78%, transparent); max-width: 46ch; margin: 0 0 22px; }
.nl-form { display: flex; gap: 10px; flex-wrap: wrap; max-width: 480px; }
.nl-form input {
  flex: 1; min-width: 200px; padding: 14px 16px; border-radius: 10px; border: none;
  font-family: var(--body); font-size: 1rem; background: color-mix(in srgb, var(--paper) 96%, transparent); color: var(--ink);
}
.nl-note { font-size: .78rem; color: color-mix(in srgb, var(--paper) 60%, transparent); margin-top: 12px; }

/* ---------- Category tiles ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.cat-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 6px; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); text-decoration:none; }
.cat-tile .emoji { font-size: 1.8rem; }
.cat-tile b { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--ink); letter-spacing:-.01em; }
.cat-tile span { font-size: .88rem; color: var(--ink-faint); }
.cat-tile .count { margin-top: 6px; font-family: var(--mono); font-size: .78rem; color: var(--red); font-weight: 500; }

/* ---------- Disclosure / affiliate note ---------- */
.disclosure-inline {
  font-size: .82rem; color: var(--ink-faint); background: var(--paper-2);
  border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 16px; margin: 18px 0;
}
.disclosure-inline strong { color: var(--ink-soft); }

/* ---------- Related ---------- */
.related { margin: 50px 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 70px; padding: 46px 0 40px; background: var(--paper-2); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { font-family: var(--body); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 12px; }
.footer-grid a { display: block; color: var(--ink-soft); font-size: .92rem; padding: 4px 0; }
.footer-grid a:hover { color: var(--red); }
.footer-brand p { color: var(--ink-faint); font-size: .9rem; max-width: 34ch; margin: 12px 0 0; }
.footer-legal { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-faint); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Static content pages ---------- */
.page-narrow { max-width: 720px; margin: 0 auto; }
.page-narrow h1 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; font-size: clamp(2rem,4vw,2.8rem); margin: 30px 0 6px; }
.page-narrow .prose { max-width: none; }
.page-narrow h2 { font-size: 1.4rem; }

/* ---------- Reveal animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.reveal:nth-child(2) { animation-delay: .05s; }
.reveal:nth-child(3) { animation-delay: .1s; }
.reveal:nth-child(4) { animation-delay: .15s; }
.reveal:nth-child(5) { animation-delay: .2s; }
.reveal:nth-child(6) { animation-delay: .25s; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } * { scroll-behavior: auto; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .deal-hero { grid-template-columns: 1fr; gap: 24px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .cat-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 620px) {
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 22px 16px; gap: 2px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; width: 100%; }
  .nav-toggle { display: grid; place-items: center; margin-left: auto; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 18px; }
  .newsletter { padding: 32px 24px; }
}
