/* =========================================================================
   iLoveMyGadgets — stylesheet
   Editorial / premium redesign. Cool paper palette + violet accent,
   Fraunces (display serif) + Manrope (body).
   Mobile-first: base styles target phones; min-width queries scale up.
   Design tokens live in :root (light) and [data-theme="dark"] (dark).
   ========================================================================= */

:root {
  /* ---- Light theme (cool paper + violet accent) ---- */
  --bg:        #FAF9FC;
  --bg-tint:   #F3F0FB;
  --surface:   #FFFFFF;
  --surface-2: #F7F5FD;
  --ink:       #171522;
  --ink-soft:  #3A3550;
  --muted:     #6A6580;
  --line:      #ECE9F5;
  --line-strong:#DFD9F0;

  /* single accent — violet */
  --accent:     #5B2EE5;
  --accent-ink: #4A22C7;
  --accent-wash:#EFE9FE;

  /* functional tints */
  --hot:      #FF4E70;  --hot-wash:  #FFE6EC;
  --deal:     #0FA968;  --deal-wash: #E1F6EC;

  /* accent "invert" surface for primary buttons */
  --invert-bg: #5B2EE5;
  --invert-fg: #FFFFFF;

  /* cool violet-tinted shadows (single light source, soft + diffuse) */
  --shadow-sm: 0 1px 2px rgba(23,21,34,.06), 0 1px 3px rgba(23,21,34,.05);
  --shadow-md: 0 10px 30px rgba(52,38,110,.12), 0 3px 8px rgba(52,38,110,.07);
  --shadow-lg: 0 28px 60px rgba(52,38,110,.18), 0 8px 20px rgba(52,38,110,.10);

  --radius:    18px;
  --radius-sm: 10px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --maxw: 1180px;
  --hh:   64px;               /* header height */
  --ease: cubic-bezier(.22,.61,.36,1);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* subtle film grain used behind hero + CTA band */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
  /* ---- Dark theme (violet-tinted charcoal) ---- */
  --bg:        #0E0B18;
  --bg-tint:   #14102A;
  --surface:   #17132A;
  --surface-2: #1E1838;
  --ink:       #F2F0FA;
  --ink-soft:  #D6D2E8;
  --muted:     #9C97B4;
  --line:      #2A2440;
  --line-strong:#372F52;

  --accent:     #8B6BFF;
  --accent-ink: #A488FF;
  --accent-wash:#221A44;

  --hot:      #FF6B85;  --hot-wash:  #35182A;
  --deal:     #34D399;  --deal-wash: #123227;

  --invert-bg: #8B6BFF;
  --invert-fg: #140F26;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow-md: 0 12px 30px rgba(0,0,0,.5), 0 3px 8px rgba(0,0,0,.4);
  --shadow-lg: 0 30px 64px rgba(0,0,0,.6), 0 10px 24px rgba(0,0,0,.45);
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 450;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0;
  text-wrap: balance;
}

p { text-wrap: pretty; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

.eyebrow {
  font-family: var(--font-body);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 14px;
}

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 14px; height: var(--hh); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand .heart { width: 22px; height: 22px; color: var(--hot); flex: none; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-logo { display: block; height: 32px; width: auto; border-radius: 7px; }
.site-footer .brand-logo { height: 30px; border-radius: 6px; }

.nav {
  position: fixed; inset: var(--hh) 0 auto 0;
  flex-direction: column; align-items: stretch;
  display: flex; gap: 2px; margin: 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 20px 20px;
  transform: translateY(-130%); transition: transform .3s var(--ease);
  box-shadow: var(--shadow-md);
}
.nav.open { transform: translateY(0); }
.nav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: 1rem; font-weight: 600;
  padding: 12px 14px; border-radius: 10px;
  transition: background .18s var(--ease), color .18s var(--ease);
  white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--accent-ink); background: var(--accent-wash); }

.theme-toggle {
  flex: none; margin-left: auto; order: 2;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); cursor: pointer;
  display: inline-grid; place-items: center;
  transition: background .18s var(--ease), border-color .18s, transform .18s;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0) scale(.96); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-btn {
  display: inline-grid; place-items: center; order: 3; flex: none;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color .18s var(--ease), transform .18s;
}
.menu-btn:hover { border-color: var(--accent); }
.menu-btn:active { transform: scale(.96); }

/* desktop: inline nav, hide the hamburger */
@media (min-width: 900px) {
  .nav {
    position: static; flex-direction: row; align-items: center; gap: 2px;
    margin-left: auto; background: none; border: 0; padding: 0;
    transform: none; box-shadow: none;
  }
  .nav a { font-size: .93rem; padding: 8px 13px; }
  .theme-toggle { margin-left: 6px; order: 0; }
  .menu-btn { display: none; }
}

/* ---- Disclosure bar ---- */
.disclosure-bar {
  background: var(--bg-tint);
  border-bottom: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-soft);
}
.disclosure-bar .wrap { display: flex; gap: 9px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.disclosure-bar svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.disclosure-bar a { color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.disclosure-bar a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Hero (home) ---- */
.hero { position: relative; overflow: hidden; padding: 56px 0 32px; }
@media (min-width: 700px) { .hero { padding: 92px 0 56px; } }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(70% 90% at 85% -20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 62%),
    radial-gradient(60% 80% at 0% 5%, color-mix(in srgb, var(--hot) 10%, transparent), transparent 58%);
}
.hero::after {                       /* fine grain for texture */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--grain); background-size: 140px 140px;
  opacity: .5; mix-blend-mode: soft-light;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
          mask-image: linear-gradient(180deg, #000, transparent 85%);
}
[data-theme="dark"] .hero::after { opacity: .28; mix-blend-mode: overlay; }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); font-weight: 600; letter-spacing: -.025em; max-width: 15ch; }
.hero h1 .u { font-style: italic; font-weight: 500; color: var(--accent-ink); }
.hero p.lead { font-size: clamp(1.06rem, 2.2vw, 1.3rem); color: var(--ink-soft); max-width: 48ch; margin: 22px 0 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 38px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 9px 13px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line-strong);
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s, color .18s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-md); }
.chip:active { transform: translateY(0); }
.chip .e { font-size: 1.05rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 700; font-size: .95rem;
  padding: 13px 22px; border-radius: 12px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .2s, background .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: translateY(0) scale(.985); }
.btn-primary { background: var(--invert-bg); color: var(--invert-fg); box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }

/* ---- Section scaffolding ---- */
.section { padding: 48px 0; }
@media (min-width: 700px) { .section { padding: 72px 0; } }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 30px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.section-head p { margin: 10px 0 0; color: var(--muted); max-width: 52ch; }
.section-head .see-all { text-decoration: none; color: var(--accent-ink); font-weight: 700; font-size: .92rem; white-space: nowrap; }
.section-head .see-all:hover { text-decoration: underline; text-underline-offset: 3px; }

.section-alt { background: var(--bg-tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---- Category cards (home) ---- */
.cat-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 900px) { .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.cat-card {
  position: relative; display: block; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.cat-card .cat-e { font-size: 2rem; margin-bottom: 44px; display: block; }
.cat-card h3 { font-size: 1.28rem; font-weight: 600; }
.cat-card p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }
.cat-card .go { position: absolute; top: 22px; right: 22px; color: var(--accent); transition: transform .22s var(--ease); }
.cat-card:hover .go { transform: translate(3px,-3px); }
.cat-card .count { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: 16px; display: inline-block; letter-spacing: .02em; }

/* ---- Category page hero ---- */
.cat-hero { position: relative; overflow: hidden; padding: 48px 0 12px; }
@media (min-width: 700px) { .cat-hero { padding: 72px 0 20px; } }
.cat-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 90% at 88% -25%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%);
}
.cat-hero .wrap { position: relative; z-index: 1; }
.cat-hero .cat-e { font-size: 2.6rem; display: block; margin-bottom: 12px; }
.cat-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.cat-hero p { color: var(--ink-soft); max-width: 56ch; margin: 16px 0 0; font-size: 1.08rem; }

/* ---- Category buying-guide intro ---- */
.cat-guide-sec { padding-top: 12px; padding-bottom: 8px; }
.cat-guide { max-width: 68ch; }
.cat-guide h2 { font-size: 1.35rem; margin: 0 0 14px; }
.cat-guide > p { color: var(--ink-soft); margin: 0 0 20px; line-height: 1.7; font-size: 1.04rem; }
.cat-guide ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.cat-guide li { position: relative; padding-left: 26px; color: var(--muted); line-height: 1.6; }
.cat-guide li::before { content: "\2014"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.cat-guide strong { color: var(--ink); font-weight: 700; }

/* ---- Product grid ---- */
.product-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 560px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; } }
@media (min-width: 960px) { .product-grid { grid-template-columns: repeat(3, 1fr); gap: 22px; } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }

.card-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-media .ph {
  width: 100%; height: 100%; display: grid; place-items: center; font-size: 3.6rem;
  background:
    radial-gradient(80% 80% at 30% 20%, var(--accent-wash), transparent 72%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
}
.badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-family: var(--font-body); font-size: .64rem; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 6px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.badge-hot  { background: var(--hot-wash);  color: var(--hot); }
.badge-deal { background: var(--deal-wash); color: var(--deal); }
.badge-pick { background: var(--accent-wash); color: var(--accent-ink); }

.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.18rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.card-body .blurb { color: var(--muted); font-size: .92rem; margin: 9px 0 0; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.tier { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tier .dim { color: var(--muted); }
.rating { font-size: .8rem; color: var(--muted); margin-left: auto; }
.rating b { color: var(--ink-soft); font-weight: 700; }

.card .btn { width: 100%; justify-content: center; margin-top: auto; }

/* ---- Trust strip ---- */
.trust { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .trust { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.trust-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.trust-item .ti-e { font-size: 1.6rem; }
.trust-item h3 { font-size: 1.14rem; font-weight: 600; margin-top: 14px; }
.trust-item p { color: var(--muted); font-size: .92rem; margin: 8px 0 0; }

/* ---- CTA band (deliberate deep-charcoal panel) ---- */
.band {
  position: relative; overflow: hidden;
  background: var(--accent); color: #fff;
  border-radius: var(--radius-lg); padding: 40px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .band { background: linear-gradient(120deg, #3a1f9e, #6d3bea); }
.band::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 130% at 92% 8%, rgba(255,255,255,.20), transparent 55%);
  opacity: .7;
}
.band::after {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: var(--grain); background-size: 140px 140px; mix-blend-mode: overlay;
  -webkit-mask-image: radial-gradient(120% 120% at 90% 10%, #000, transparent 62%);
          mask-image: radial-gradient(120% 120% at 90% 10%, #000, transparent 62%);
}
.band > * { position: relative; z-index: 1; }
.band h2 { color: #fff; font-size: clamp(1.6rem, 3.6vw, 2.4rem); max-width: 18ch; }
.band p { color: rgba(255,255,255,.82); margin: 10px 0 0; max-width: 42ch; }
.band .btn { background: #fff; color: var(--accent-ink); }
.band .btn:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(0,0,0,.3); }

/* ---- Article / About ---- */
.prose { max-width: 68ch; margin: 0 auto; }
.prose h1 { font-size: clamp(2.1rem, 5.5vw, 3rem); }
.prose h2 { font-size: 1.5rem; margin: 44px 0 12px; }
.prose p { color: var(--ink-soft); margin: 14px 0; }
.prose ul { color: var(--ink-soft); padding-left: 22px; }
.prose li { margin: 9px 0; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose .callout {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 20px 22px; margin: 26px 0; font-size: .96rem;
}
.prose .callout strong { color: var(--ink); }

/* ---- Empty state ---- */
.empty {
  text-align: center; padding: 64px 22px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--muted);
}
.empty .e { font-size: 2.6rem; }
.empty code { font-family: var(--font-mono); background: var(--surface-2); padding: 2px 7px; border-radius: 6px; color: var(--ink); }

/* ---- Footer ---- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 30px; padding: 50px 0 34px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; gap: 34px; } }
.footer-grid .brand { margin-bottom: 14px; }
.footer-about p { color: var(--muted); font-size: .9rem; max-width: 42ch; }
.footer-col h4 { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; margin: 0 0 12px; }
.footer-col a { display: block; text-decoration: none; color: var(--muted); font-size: .9rem; padding: 5px 0; transition: color .16s var(--ease); }
.footer-col a:hover { color: var(--accent-ink); }
.footer-disclosure {
  border-top: 1px solid var(--line); padding: 22px 0 36px;
  font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-disclosure strong { color: var(--ink-soft); font-weight: 700; }

/* ---- Focus visibility ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---- Staggered load-in (respects reduced motion via block above) ---- */
.fade-up { animation: fadeUp .7s var(--ease) both; }
.section .fade-up { animation-delay: .05s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
