/* ==========================================================================
   Quiet Hours — stylesheet
   Mobile-first. Tokens mirror BUILD-PLAN.md §2. Organized:
   1. Tokens   2. Reset   3. Base/type   4. Layout   5. Components
   6. Page-specific bits   7. Utilities   8. Media queries
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg:        #F7F4EF;
  --ink:       #2B2B2B;
  --sage:      #8AA398;
  --sage-dark: #6E8880; /* sage darkened for AA text-on-white use */
  --clay:      #C89B7B;
  --cta:       #2B2B2B;
  --cta-text:  #FFFFFF;
  --muted:     #5B5B5B; /* darkened from spec #6B6B6B to clear 4.5:1 on --bg */
  --line:      #E4DED4;
  --card-bg:   #FFFFFF;
  --radius:    14px;
  --radius-sm: 8px;
  --maxw:      1120px;
  --gutter:    clamp(16px, 5vw, 40px);

  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px;

  --shadow-card: 0 1px 2px rgba(43,43,43,0.06), 0 4px 16px rgba(43,43,43,0.05);
}

/* 2. Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { margin: 0; padding: 0; list-style: none; }
img, picture, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* Every icon in icons.mjs is inline, aria-hidden, and sized only by its
   viewBox — with no explicit width/height an SVG defaults to ~300x150px,
   so without this it renders huge wherever a more specific rule (below,
   in Components) doesn't already size it. */
svg[aria-hidden="true"] {
  width: 20px;
  height: 20px;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 3. Base / type ------------------------------------------------------------ */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 4.5vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.5rem, 2.5vw + 1rem, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { color: var(--ink); }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }

a.link {
  color: var(--sage-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a.link:hover { color: var(--ink); }

/* Visible focus ring everywhere, including custom components */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sage-dark);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 8px; top: -48px;
  background: var(--ink); color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

/* 4. Layout ------------------------------------------------------------------ */
.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--space-8); }
.section--tight { padding-block: var(--space-6); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.brand-mark { display: inline-flex; align-items: center; color: var(--ink); }
.brand-mark svg { height: 34px; width: auto; } /* balances against the 40px nav-toggle square and 20px cart icon beside it */

.site-nav {
  display: none;
  gap: var(--space-6);
  align-items: center;
}
.site-nav a {
  text-decoration: none;
  font-weight: 500;
  padding-block: var(--space-2);
  border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  border-bottom-color: var(--sage);
}

.header-actions { display: flex; align-items: center; gap: var(--space-3); }

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 500;
}
.cart-count {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding-inline: 4px;
  background: var(--ink); color: #fff;
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
}

.nav-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.nav-toggle svg { width: 20px; height: 20px; }

.mobile-nav {
  border-top: 1px solid var(--line);
  padding: var(--space-4) 0;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav ul { display: flex; flex-direction: column; gap: var(--space-1); }
.mobile-nav a {
  display: block;
  padding: var(--space-3) var(--gutter);
  text-decoration: none;
  font-weight: 500;
}
.mobile-nav a[aria-current="page"] { color: var(--sage-dark); }

/* Footer */
.site-footer {
  background: var(--ink);
  color: #EDEAE3;
  padding-block: var(--space-8) var(--space-6);
  margin-top: var(--space-9);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}
.footer-brand svg { height: 26px; color: #EDEAE3; }
.footer-brand p { margin-top: var(--space-3); color: #C9C4B8; max-width: 42ch; }
.footer-col h4 { color: #fff; font-family: var(--font-body); font-size: 0.9rem;
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: var(--space-3); }
.footer-col ul { display: flex; flex-direction: column; gap: var(--space-2); }
.footer-col a { color: #D8D4C8; }
.footer-col a[href^="mailto:"] { display: inline-flex; align-items: center; gap: var(--space-2); }
.footer-col a svg { width: 16px; height: 16px; }
.footer-bottom {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  justify-content: space-between; align-items: center;
  color: #A9A497; font-size: 0.85rem;
}
.footer-bottom nav { display: flex; gap: var(--space-4); flex-wrap: wrap; }

/* Newsletter */
.newsletter { display: flex; flex-direction: column; gap: var(--space-3); }
.newsletter-form {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
}
.newsletter-form input[type="email"] {
  flex: 1 1 220px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.newsletter-form input[type="email"]::placeholder { color: #B9B4A8; }
.newsletter-note { font-size: 0.8rem; color: #A9A497; }
.newsletter-success {
  color: #DDEAE3;
  font-size: 0.9rem;
}
.newsletter-success[hidden] { display: none; }

/* 5. Components -------------------------------------------------------------- */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 44px;
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cta); color: var(--cta-text); }
.btn-primary:hover { background: #3d3d3d; }
.btn-secondary {
  background: transparent; color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Tag / pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: rgba(138,163,152,0.16);
  color: var(--sage-dark);
  font-size: 0.8rem;
  font-weight: 600;
}
.pill svg { width: 14px; height: 14px; }
.pill--clay { background: rgba(200,155,123,0.18); color: #8A5F3C; }

/* Hero */
.hero {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  padding-block: var(--space-7) var(--space-8);
}
.hero__media img {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.hero__copy .pill { margin-bottom: var(--space-4); }
.hero__copy h1 { margin-bottom: var(--space-4); }
.hero__copy .lede { margin-bottom: var(--space-5); }

/* Value row */
.value-row {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}
.value-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
}
.value-card__icon {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(138,163,152,0.18);
  display: flex; align-items: center; justify-content: center;
  color: var(--sage-dark);
  margin-bottom: var(--space-4);
}
.value-card h3 { margin-bottom: var(--space-2); }
.value-card p { color: var(--muted); }

/* Section headers */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.section-head p { color: var(--muted); margin-top: var(--space-2); }

/* Product grid + card */
.product-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  height: 100%;
}
.product-card__media { position: relative; background: var(--line); }
.product-card__media img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.product-card__body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
  flex: 1;
}
.product-card__body h3 { font-size: 1.1rem; }
.product-card__body h3 a { text-decoration: none; }
.product-card__body h3 a:hover { text-decoration: underline; }
.product-card__benefit { color: var(--muted); font-size: 0.92rem; }
.product-card__footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--space-3);
}
.product-card__price { font-weight: 700; font-size: 1.05rem; }
.rating { display: flex; align-items: center; gap: var(--space-2); font-size: 0.85rem; color: var(--muted); }
.rating__stars { color: var(--clay); letter-spacing: 1px; }
.rating--empty { color: var(--muted); font-style: italic; }

/* Price block */
.price-block { display: flex; flex-direction: column; gap: var(--space-1); }
.price-block__amount { font-size: 1.75rem; font-weight: 700; }
.price-block__note { font-size: 0.9rem; color: var(--muted); }

/* Shipping estimate */
.shipping-estimate {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: rgba(138,163,152,0.12);
  border: 1px solid rgba(138,163,152,0.35);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.shipping-estimate svg { flex: none; width: 20px; height: 20px; color: var(--sage-dark); margin-top: 2px; }
.shipping-estimate strong { display: block; }
.shipping-estimate span { color: var(--muted); }

/* Spec table */
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th, .spec-table td {
  text-align: left;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.spec-table th {
  width: 40%;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  padding-right: var(--space-4);
}

/* Is this for you */
.qualify-list { display: flex; flex-direction: column; gap: var(--space-3); }
.qualify-list li {
  display: flex; gap: var(--space-3);
  align-items: flex-start;
}
.qualify-list svg { flex: none; width: 20px; height: 20px; color: var(--sage-dark); margin-top: 2px; }

/* Box contents */
.box-list { display: flex; flex-direction: column; gap: var(--space-2); }
.box-list li { display: flex; gap: var(--space-3); align-items: baseline; }
.box-list li::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--clay);
  flex: none;
  transform: translateY(-3px);
}

/* Free shipping progress */
.ship-progress { display: flex; flex-direction: column; gap: var(--space-2); }
.ship-progress__track {
  height: 8px; border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.ship-progress__fill { height: 100%; background: var(--sage); border-radius: 999px; }
.ship-progress__label { font-size: 0.9rem; color: var(--muted); }

/* Reviews */
.review-list { display: flex; flex-direction: column; gap: var(--space-5); }
.review {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
}
.review__meta { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.review__name { font-weight: 600; }
.review-empty {
  padding: var(--space-6);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* Accordion */
.accordion-item { border-bottom: 1px solid var(--line); }
.accordion-item summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  font-weight: 600;
  list-style: none;
}
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item summary .chev { transition: transform 0.15s ease; flex: none; }
.accordion-item[open] summary .chev { transform: rotate(180deg); }
.accordion-item p { padding-bottom: var(--space-4); color: var(--muted); max-width: 68ch; }

/* Breadcrumbs */
.breadcrumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: var(--space-5); }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin-inline: var(--space-2); }

/* Trust bar */
.trust-bar {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  padding: var(--space-5);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.trust-item { display: flex; gap: var(--space-3); align-items: center; font-size: 0.9rem; }
.trust-item svg { flex: none; width: 22px; height: 22px; color: var(--sage-dark); }

/* Bundle */
.bundle {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-6);
}
.bundle__media { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.bundle__media img { border-radius: var(--radius-sm); aspect-ratio: 1/1; object-fit: cover; }
.bundle__price { display: flex; align-items: baseline; gap: var(--space-3); margin-block: var(--space-4); }
.bundle__price .was { text-decoration: line-through; color: var(--muted); font-size: 1rem; }
.bundle__price .now { font-size: 1.75rem; font-weight: 700; }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { text-align: left; padding: var(--space-4) var(--space-2); border-bottom: 1px solid var(--line); }
.cart-row__product { display: flex; gap: var(--space-4); align-items: center; }
.cart-row__product img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--muted); }
.qty-input { width: 56px; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: center; }
.remove-btn { background: none; border: none; color: var(--muted); text-decoration: underline; padding: var(--space-2); }
.cart-summary { display: flex; flex-direction: column; gap: var(--space-3); max-width: 360px; margin-left: auto; }
.cart-summary__row { display: flex; justify-content: space-between; }
.cart-summary__total { font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: var(--space-3); }

/* Form */
.form-field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.form-field label { font-weight: 600; font-size: 0.9rem; }
.form-field input, .form-field textarea, .form-field select {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* Contact / prose */
.prose { max-width: 68ch; }
.prose h2 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: var(--space-4); color: var(--ink); }
.prose ul, .prose ol { margin-bottom: var(--space-4); padding-left: 1.25em; }
.prose li { margin-bottom: var(--space-2); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

/* 6. Page-specific -------------------------------------------------------- */
.page-header { padding-block: var(--space-7) var(--space-5); }
.page-header .lede { margin-top: var(--space-3); }

.two-col {
  display: grid;
  gap: var(--space-7);
  grid-template-columns: 1fr;
}

.gallery-thumbs { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.gallery-thumbs img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
}
.gallery-thumbs img.active { border-color: var(--sage); }

/* 7. Utilities ------------------------------------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.center-text { text-align: center; }
.mt-0 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.divider { border: none; border-top: 1px solid var(--line); margin-block: var(--space-6); }

/* 8. Breakpoints ------------------------------------------------------------ */
@media (min-width: 640px) {
  .value-row { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-bar { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (min-width: 860px) {
  .site-nav { display: flex; }
  .nav-toggle { display: none; }
  .hero { grid-template-columns: 1.1fr 1fr; padding-block: var(--space-9); }
  .two-col { grid-template-columns: 1.3fr 0.9fr; }
  .bundle { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .trust-bar { grid-template-columns: repeat(4, 1fr); }
}

/* Print: keep legal pages readable when printed */
@media print {
  .site-header, .site-footer, .nav-toggle, .btn { display: none; }
}
