/* ============================================================
   Shelfwise — design tokens
   Palette: deep spruce + paper + label-tape yellow
   ============================================================ */

:root {
  --paper:      #F6F6F3;
  --paper-2:    #FFFFFF;
  --ink:        #17302B;
  --spruce:     #1F4E46;
  --spruce-lt:  #35695F;
  --muted:      #62726E;
  --line:       #D8DDD9;
  --line-soft:  #E7EBE7;
  --tape:       #F0C244;
  --tape-deep:  #C99A1E;

  --f-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --f-body: "Newsreader", Georgia, "Times New Roman", serif;

  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.3rem + 0.75vw, 1.95rem);
  --step-3:  clamp(1.8rem, 1.5rem + 1.5vw, 2.8rem);
  --step-4:  clamp(2.2rem, 1.6rem + 3vw, 4.2rem);

  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --max: 1220px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #10201C;
    --paper-2:   #162A25;
    --ink:       #E8EDE9;
    --spruce:    #8FC5B6;
    --spruce-lt: #A6D3C6;
    --muted:     #9DB0AA;
    --line:      #2A423B;
    --line-soft: #223731;
    --tape:      #F0C244;
    --tape-deep: #F0C244;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
}

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

a { color: var(--spruce); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--tape);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 68ch; }

.skip {
  position: absolute; left: -9999px;
  background: var(--spruce); color: #fff; padding: .7rem 1rem; z-index: 99;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ============================================================
   Masthead + nav
   ============================================================ */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 50;
}

.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .85rem;
}

.logo {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--f-display); font-weight: 700;
  font-size: 1.32rem; letter-spacing: -0.03em;
  color: var(--ink); text-decoration: none;
}
.logo:hover { color: var(--ink); }

.logo-mark {
  width: 26px; height: 26px; flex: none;
  border: 2px solid var(--spruce);
  border-radius: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
}
.logo-mark span { border-right: 1.5px solid var(--spruce); border-bottom: 1.5px solid var(--spruce); }
.logo-mark span:nth-child(2) { border-right: 0; }
.logo-mark span:nth-child(3) { border-bottom: 0; background: var(--tape); }
.logo-mark span:nth-child(4) { border: 0; }

.nav { display: flex; align-items: center; gap: .35rem; }

.nav a, .nav button {
  font-family: var(--f-display);
  font-size: .95rem; font-weight: 500;
  color: var(--ink); text-decoration: none;
  padding: .5rem .7rem; border-radius: 4px;
  background: none; border: 0; cursor: pointer;
  line-height: 1;
}
.nav a:hover, .nav button:hover { background: var(--line-soft); color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--tape); }

.dropdown { position: relative; }
.dropdown > button { display: inline-flex; align-items: center; gap: .35rem; }
.chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px,-2px); }
.dropdown[open] .chev, .dropdown.open .chev { transform: rotate(-135deg) translate(-2px,-2px); }

.dropdown-panel {
  position: absolute; top: calc(100% + .4rem); left: 0;
  min-width: 300px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 34px -18px rgba(23,48,43,.5);
  padding: .4rem;
  display: none;
}
.dropdown.open .dropdown-panel { display: block; }

.dropdown-panel a {
  display: block; padding: .6rem .7rem; border-radius: 4px;
  font-family: var(--f-display); font-size: .95rem;
}
.dropdown-panel a small {
  display: block; font-family: var(--f-body); font-size: .8rem;
  color: var(--muted); font-weight: 400; margin-top: .12rem; line-height: 1.4;
}

.menu-toggle {
  display: none;
  font-family: var(--f-display); font-weight: 600; font-size: .95rem;
  padding: .55rem .9rem; border: 2px solid var(--spruce); border-radius: 4px;
  background: none; color: var(--spruce); cursor: pointer;
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .masthead-inner { flex-wrap: wrap; position: relative; }
  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
    padding: .6rem var(--gutter) 1rem;
    gap: 0;
  }
  .nav.open { display: flex; }
  .nav a, .nav button { padding: .75rem .2rem; text-align: left; }
  .dropdown-panel {
    position: static; display: block; border: 0; box-shadow: none;
    padding: 0 0 .5rem .9rem; min-width: 0; background: none;
    border-left: 2px solid var(--line);
    margin-left: .2rem;
  }
  .dropdown > button { display: none; }
}

/* ============================================================
   Hero — compartment grid
   ============================================================ */

.hero { border-bottom: 1px solid var(--line); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5.5rem);
}

.hero h1 {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.hero p.lede {
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 44ch;
  margin: 1.2rem 0 0;
  line-height: 1.5;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.9rem; }

/* the compartment motif: a drawer organiser made of links */
.compartments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(84px, auto);
  border: 2px solid var(--spruce);
  border-radius: 5px;
  overflow: hidden;
  background: var(--paper-2);
}

.compartment {
  flex-direction: column;
  justify-content: flex-end;
  gap: .3rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: .85rem .9rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--f-display);
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.25;
  display: flex;
  align-items: flex-start;
  transition: background .12s ease;
}
.compartment:hover { background: var(--tape); color: var(--ink); }
.compartment:nth-child(3n) { border-right: 0; }
.compartment:nth-last-child(-n+3) { border-bottom: 0; }
.compartment small {
  font-family: var(--f-body); font-size: .78rem; color: var(--muted); font-weight: 400;
}
.compartment:hover small { color: #4A3C08; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .compartments { grid-auto-rows: minmax(70px, auto); }
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  font-family: var(--f-display); font-weight: 600; font-size: .96rem;
  padding: .72rem 1.15rem;
  border-radius: 4px;
  text-decoration: none;
  border: 2px solid var(--spruce);
  background: var(--spruce);
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
  transition: background .12s ease, color .12s ease;
}
.btn:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.btn-ghost { background: none; color: var(--spruce); }
.btn-ghost:hover { background: var(--spruce); color: #fff; }

.btn-amazon {
  width: 100%;
  background: var(--tape);
  border-color: var(--tape-deep);
  color: #2A2208;
}
.btn-amazon:hover { background: var(--tape-deep); border-color: var(--tape-deep); color: #1A1505; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { color: #0E1C19; background: var(--spruce); border-color: var(--spruce); }
  :root:not([data-theme="light"]) .btn:hover { background: var(--spruce-lt); border-color: var(--spruce-lt); color: #0E1C19; }
  :root:not([data-theme="light"]) .btn-ghost { background: none; color: var(--spruce); }
  :root:not([data-theme="light"]) .btn-ghost:hover { background: var(--spruce); color: #0E1C19; }
}

/* ============================================================
   Sections
   ============================================================ */

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section + .section { border-top: 1px solid var(--line-soft); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.8rem;
}
.section-head h2 { font-size: var(--step-2); }
.section-head p { margin: .5rem 0 0; color: var(--muted); max-width: 55ch; }

.page-head { padding-block: clamp(2.2rem, 5vw, 3.6rem) 0; }
.page-head h1 { font-size: var(--step-3); }
.page-head p { max-width: 60ch; color: var(--muted); font-size: var(--step-1); max-width: 60ch; margin: 1rem 0 0; line-height: 1.5; }

/* ============================================================
   Product cards — built like labelled bins
   ============================================================ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-2);
}

.product {
  display: flex; flex-direction: column;
  padding: 1.4rem 1.4rem 1.5rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-brand {
  font-family: var(--f-display);
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .01em;
  margin-bottom: .35rem;
}

.product h3 {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.22;
  margin-bottom: .6rem;
}

.rating {
  display: flex; align-items: center; gap: .45rem;
  margin-bottom: .85rem;
  font-family: var(--f-display);
  font-size: .85rem;
  color: var(--muted);
}
.stars { display: inline-flex; gap: 1px; color: var(--tape-deep); }
.stars svg { width: 15px; height: 15px; display: block; }
.rating b { color: var(--ink); font-weight: 600; }

.product-blurb { font-size: .95rem; color: var(--muted); margin: 0 0 1rem; line-height: 1.55; }

.why { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.why li {
  position: relative;
  padding-left: 1.15rem;
  font-size: .89rem;
  line-height: 1.45;
  margin-bottom: .38rem;
}
.why li::before {
  content: "";
  position: absolute; left: 0; top: .52em;
  width: 7px; height: 7px;
  background: var(--tape);
  border-radius: 1px;
}

.product-foot { margin-top: auto; }

.price-band {
  font-family: var(--f-display);
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .6rem;
}
.price-band b { color: var(--ink); }

/* ============================================================
   Category cards
   ============================================================ */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-2);
}

.cat {
  padding: 1.5rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: background .12s ease;
}
.cat:hover { background: var(--line-soft); color: var(--ink); }
.cat h3 { font-size: 1.15rem; margin-bottom: .45rem; }
.cat p { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.5; }
.cat-count { display: block; margin-top: .8rem; font-family: var(--f-display); font-size: .8rem; color: var(--spruce); font-weight: 600; }

/* ============================================================
   Blog
   ============================================================ */

.post-list { display: grid; gap: 0; border-top: 1px solid var(--line); }

.post-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-block: 1.8rem;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.post-date { font-family: var(--f-display); font-size: .85rem; color: var(--muted); padding-top: .3rem; }
.post-item h2 { font-size: var(--step-1); margin-bottom: .5rem; }
.post-item h2 a { color: var(--ink); text-decoration: none; }
.post-item h2 a:hover { text-decoration: underline; text-decoration-color: var(--tape); text-decoration-thickness: 3px; }
.post-item p { margin: 0; color: var(--muted); font-size: .97rem; max-width: 62ch; }

@media (max-width: 620px) {
  .post-item { grid-template-columns: 1fr; gap: .5rem; }
  .post-date { padding-top: 0; }
}

.article { padding-block: clamp(2rem, 5vw, 3.5rem); }
.article-head { max-width: 62ch; margin-bottom: 2.2rem; }
.article-head h1 { font-size: var(--step-3); margin-bottom: .9rem; }
.article-meta { font-family: var(--f-display); font-size: .88rem; color: var(--muted); }

.prose { max-width: 66ch; }
.prose p { margin: 0 0 1.25rem; }
.prose h2 {
  font-size: var(--step-2);
  margin: 2.6rem 0 .9rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
}
.prose h3 { font-size: var(--step-1); margin: 2rem 0 .7rem; }
.prose ul, .prose ol { margin: 0 0 1.25rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose strong { font-weight: 600; }
.prose > p:first-of-type { font-size: var(--step-1); line-height: 1.55; color: var(--ink); }

.inline-picks { margin-top: 3rem; padding-top: 2rem; border-top: 2px solid var(--spruce); }
.inline-picks h2 { font-family: var(--f-display); font-size: var(--step-2); margin-bottom: 1.4rem; }

/* ============================================================
   Disclosure strip
   ============================================================ */

.disclosure-strip {
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
  color: var(--muted);
  padding-block: .6rem;
  text-align: center;
}
.disclosure-strip a { color: var(--spruce); }

.disclosure-note {
  border-left: 3px solid var(--tape);
  padding: .9rem 1.1rem;
  background: var(--paper-2);
  font-size: .9rem;
  color: var(--muted);
  margin-top: 2.5rem;
  border-radius: 0 4px 4px 0;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 2rem;
}
.footer h4 { font-family: var(--f-display); font-size: .92rem; font-weight: 600; margin-bottom: .8rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .45rem; }
.footer a { font-size: .92rem; color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--spruce); text-decoration: underline; }
.footer-about { font-size: .92rem; color: var(--muted); max-width: 38ch; margin: .6rem 0 0; }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--muted);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
