/* ==========================================================================
   snakesanddoves.com — design system
   Implements DESIGN.md. Iridium purple on near-black indigo; brass rationed to
   interaction; three faces (Cormorant / Spectral / IBM Plex Mono).
   ========================================================================== */

/* --- Tokens (DESIGN.md §1) ------------------------------------------------ */
:root {
  --void:        #100E22;   /* page base — near-black indigo */
  --indigo:      #1B1638;   /* raised surfaces */
  --iridium:     #4B4664;   /* structural metal: borders, dividers, horizon */
  --iridium-hi:  #8A82A6;   /* reflective edge + secondary text */
  --brass:       #B8935A;   /* INTERACTION ONLY */
  --brass-lit:   #D4B27E;   /* brass hover/active */
  --star:        #EFE7D5;   /* primary text + stars, warm white */

  --font-display: 'Cormorant', Georgia, serif;
  --font-body:    'Spectral', Georgia, serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --measure: 62ch;          /* reading column */
  --wrap:    1160px;        /* page max width */
  --gutter:  clamp(1.25rem, 4vw, 3rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Reset-ish ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--star);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-lit); }

/* Visible keyboard focus — brass ring (brief §9) */
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 1px;
}

/* --- Type scale (DESIGN.md §2) -------------------------------------------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0; line-height: 1.1; }
.display-xl { font-size: clamp(2.75rem, 6vw, 5rem); letter-spacing: 0.02em; }
.display-l  { font-size: clamp(1.9rem, 3.2vw, 2.25rem); letter-spacing: 0.015em; }
h3, .heading { font-size: 1.5rem; font-weight: 600; }
.lead { font-size: 1.125rem; color: var(--star); }
p { margin: 0 0 1rem; max-width: var(--measure); }

/* Mono utility register — labels, coordinates, data */
.label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--iridium-hi);
}
.data { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--iridium-hi); }
.plate { font-family: var(--font-mono); color: var(--brass); letter-spacing: 0.08em; }
.price { font-family: var(--font-mono); color: var(--brass); font-size: 0.9375rem; }

/* --- Layout helpers ------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(3rem, 8vw, 6rem); }
.stack > * + * { margin-top: 1rem; }
main { flex: 1 0 auto; }

.divider {
  border: 0;
  border-top: 1px solid var(--iridium);
  margin-block: 2rem;
}

/* Section eyebrow: a mono label with a hairline rule (structural, carries meaning) */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--iridium);
}

/* --- Nav ------------------------------------------------------------------ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--void) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--iridium);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--star);
  text-transform: uppercase;
}
.brand:hover { color: var(--star); }
.nav-links { display: flex; gap: 1.75rem; align-items: center; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--iridium-hi);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--brass); }
.cart-link { position: relative; }
.cart-count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--void);
  background: var(--brass);
  border-radius: 999px;
  padding: 0 0.4em;
  margin-left: 0.35em;
  min-width: 1.5em;
  display: inline-block;
  text-align: center;
}
.cart-count:empty, .cart-count[data-count="0"] { display: none; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--brass);
  background: transparent;
  color: var(--brass);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:hover { background: var(--brass); color: var(--void); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--solid { background: var(--brass); color: var(--void); }
.btn--solid:hover { background: var(--brass-lit); border-color: var(--brass-lit); }
.btn--ghost { border-color: var(--iridium); color: var(--iridium-hi); }
.btn--ghost:hover { background: var(--iridium); color: var(--star); }

/* --- Star field + horizon (hero, DESIGN.md §5) ---------------------------- */
.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  isolation: isolate;
}
/* atmospheric vertical falloff — the ONLY decorative gradient permitted */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #0B0A1C 0%, var(--void) 62%, #0D0B20 100%);
  z-index: -3;
}
#starfield {
  position: absolute;
  inset: 0;
  bottom: var(--horizon-offset, 26%);   /* stars live ABOVE the horizon */
  z-index: -2;
}
/* Logo floating in the star field above the horizon (placeholder — see DESIGN.md §1) */
.hero-logo {
  position: absolute;
  top: clamp(5rem, 14vh, 9rem);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(200px, 32vw, 340px);
  height: auto;
  z-index: 0;
  pointer-events: none;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: var(--star);
  will-change: opacity;
}
/* opacity-only twinkle; --op is the star's resting opacity, set per-star in JS */
@keyframes twinkle {
  0%, 100% { opacity: var(--op, 0.6); }
  50%      { opacity: calc(var(--op, 0.6) * 0.35); }
}
/* The horizon: a plain, hard sight line low in frame — the observed horizon,
   without instrument markings. */
.horizon {
  position: relative;
  z-index: 1;
  padding-bottom: clamp(2rem, 6vh, 4rem);
}
.horizon-rule {
  position: relative;
  height: 1px;
  background: var(--iridium);
  margin-top: 2rem;
}
.hero-copy { position: relative; margin-bottom: 2rem; }
.hero-copy .lead { max-width: 42ch; color: var(--iridium-hi); }

/* --- Category plates (home, DESIGN.md §3) --------------------------------- */
/* Fixed column counts, not auto-fit. There are 6 category plates, and the 1px
   gap over an iridium background draws the grout between them — so a ragged last
   row leaves lit empty cells, not blank space. 6 divides evenly by 3, 2 and 1,
   so every breakpoint fills its rows completely. Revisit if the count changes. */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--iridium);
  border: 1px solid var(--iridium);
}
.category-plate {
  background: var(--void);
  padding: 1.75rem;
  display: block;
  color: var(--star);
  transition: background 0.18s var(--ease);
}
.category-plate:hover { background: var(--indigo); color: var(--star); }
.category-plate .plate { display: block; margin-bottom: 0.5rem; }
.category-plate h3 { margin-bottom: 0.25rem; }

/* --- Product grid (shop) -------------------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.product-card { display: block; color: var(--star); }
.product-card:hover { color: var(--star); }
.product-card:hover .product-image { border-color: var(--iridium-hi); }
/* `display:grid; place-content:center; text-align:center; padding:1rem` used to
   live here to centre the composed name+plate placeholder tile. That tile was
   deleted (decision 14) but its centring apparatus stayed, and `place-content:
   center` sizes the grid track to the content — so the img's `height:100%`
   resolved against a content-sized track and never filled the box. Every photo
   sat inset by a different amount depending on its own aspect ratio, which only
   became visible once the catalogue held two different ones (788×1400 and
   1000×1250). Now the box crops, as `object-fit: cover` always intended. */
.product-image {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--iridium);
  background: var(--indigo);
  overflow: hidden;
  transition: border-color 0.18s var(--ease);
  position: relative;
}
.product-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-meta { margin-top: 0.9rem; }
.product-meta .plate { font-size: 0.7rem; }
.product-meta h3 { font-size: 1.35rem; margin: 0.15rem 0 0.35rem; }

/* --- Catalogue index (pieces without a photo) ----------------------------- */
/* Reads as a catalogue entry, not as a missing image. */
.index-heading { margin-top: clamp(2.5rem, 5vw, 4rem); }
/* No border-top: each row carries its own bottom rule, and whatever sits above
   the list (the page divider, or the "The index" eyebrow) already draws one.
   Adding another here doubles the line. */
.index-row {
  display: grid;
  grid-template-columns: 5rem 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.15rem 0.25rem;
  border-bottom: 1px solid var(--iridium);
  color: var(--star);
  transition: background 0.18s var(--ease);
}
.index-row:hover { background: var(--indigo); color: var(--star); }
.index-row:hover .index-name { color: var(--brass-lit); }
.index-plate { font-size: 0.7rem; }
.index-main { display: block; min-width: 0; }
.index-name { display: block; font-family: var(--font-display); font-size: 1.2rem; line-height: 1.25; transition: color 0.18s var(--ease); }
.index-desc { display: block; margin-top: 0.3rem; font-size: 0.9rem; color: var(--iridium-hi); max-width: 62ch; }
.index-price { white-space: nowrap; }

/* --- Product detail ------------------------------------------------------- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
/* No photo: one column, measure-limited, so it reads as finished rather than
   as a layout with a hole in it. */
.product-detail--textonly { grid-template-columns: minmax(0, 60ch); }
.product-gallery .product-image { aspect-ratio: 1 / 1; }
.spec-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.spec-table th, .spec-table td { text-align: left; padding: 0.6rem 0; border-bottom: 1px solid var(--iridium); vertical-align: top; }
.spec-table th { font-family: var(--font-mono); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--iridium-hi); width: 9rem; }
.spec-table td { font-size: 0.95rem; }

/* --- Cart ----------------------------------------------------------------- */
/* grid-template-areas is REQUIRED here: the line markup places every child by
   name (grid-area: id/name/qty/remove). Without it the names resolve to nothing
   and all four stack in one cell. */
.cart-line { display: grid; grid-template-columns: auto 1fr auto auto; grid-template-areas: "id name qty remove"; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--iridium); }
.cart-line .plate { font-size: 0.7rem; }
.cart-line .name { font-family: var(--font-display); font-size: 1.25rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--iridium); }
.qty button { background: transparent; border: 0; color: var(--iridium-hi); font-family: var(--font-mono); width: 2rem; height: 2rem; cursor: pointer; }
.qty button:hover { color: var(--brass); }
.qty span { font-family: var(--font-mono); min-width: 2rem; text-align: center; }
.line-remove { background: transparent; border: 0; color: var(--iridium-hi); cursor: pointer; font-family: var(--font-mono); }
.line-remove:hover { color: var(--brass-lit); }
.cart-totals { margin: 1.5rem 0; }
.cart-totals .row { display: flex; justify-content: space-between; padding: 0.4rem 0; }
.estimate-note { border: 1px solid var(--iridium); background: var(--indigo); padding: 1rem 1.25rem; font-size: 0.9rem; color: var(--iridium-hi); margin: 1.25rem 0; }

/* --- Forms ---------------------------------------------------------------- */
.field { margin-bottom: 1.25rem; }
.field label { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--iridium-hi); margin-bottom: 0.4rem; }
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--indigo);
  border: 1px solid var(--iridium);
  color: var(--star);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.85rem;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brass); outline: none; }
.field textarea { min-height: 8rem; resize: vertical; }
.field .hint { font-size: 0.8rem; color: var(--iridium-hi); margin-top: 0.35rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Status / feedback states — direction, not mood (brief voice) */
.notice { border: 1px solid var(--iridium); padding: 1.25rem 1.5rem; margin: 1.5rem 0; }
.notice--error { border-color: var(--brass); }
.notice h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }

/* --- Bead color picker ---------------------------------------------------- */
.bead-picker { border: 0; padding: 0; margin: 1.75rem 0 0; }
.bead-picker legend { padding: 0; }
.bead-note { margin: 0.35rem 0 0.85rem; }
.bead-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bead-option { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.75rem 0.45rem 0.55rem; border: 1px solid var(--iridium); cursor: pointer; }
.bead-option:hover { border-color: var(--iridium-hi); }
/* Visually hidden but still a real, focusable, announced radio — the label is
   the visible control. Do NOT use width/height:0 or opacity:0 here; that drops
   the input out of the accessibility tree in some engines. */
.bead-option input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.bead-option:has(input:checked) { border-color: var(--brass); }
.bead-option:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: 2px; }
.bead-swatch { width: 0.95rem; height: 0.95rem; border-radius: 50%; border: 1px solid var(--iridium-hi); flex: none; }
.bead-label { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--iridium-hi); }
.bead-option:has(input:checked) .bead-label { color: var(--brass-lit); }
.bead-picker--needed .bead-options { outline: 1px solid var(--brass); outline-offset: 0.5rem; }

/* Bead color on a cart line, under the name */
.line-color { display: block; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--iridium-hi); margin-top: 0.25rem; }

/* --- About ---------------------------------------------------------------- */
.about-layout { display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.bench-figure { max-width: 22rem; }
.bench-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--iridium); }
.bench-figure figcaption { margin-top: 0.7rem; }

/* --- Policy / prose pages ------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose h2 { margin: 2rem 0 0.75rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

/* --- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--iridium); margin-top: 4rem; padding-block: 2.5rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; justify-content: space-between; align-items: baseline; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a, .footer-meta { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--iridium-hi); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
  .brand { font-size: 1.05rem; }
  .cart-line { grid-template-columns: 1fr auto; grid-template-areas: "id id" "name name" "qty remove"; }
  .about-layout { grid-template-columns: 1fr; }
  .bench-figure { max-width: 100%; }
  .index-row { grid-template-columns: 1fr auto; gap: 0.5rem 1rem; }
  .index-plate { grid-column: 1 / -1; }
  .index-price { align-self: start; }
}

/* --- Reduced motion: kill parallax + twinkle, keep a composed field (§9) --- */
@media (prefers-reduced-motion: reduce) {
  .star { animation: none !important; }
  * { scroll-behavior: auto !important; }
}
