/* =========================================================================
   Village Spares — shared stylesheet
   Palette: deep indigo #1B1F3B + signal amber #E8A23C on warm grey #F5F3EF
   Type: Manrope (display) + Karla (body)
   Dark surface #2A2F52 on ground #12142A verified 1.403:1 (>=1.35 guard #3)
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Brand */
  --indigo: #1B1F3B;
  --indigo-deep: #12142A;
  --amber: #E8A23C;            /* fills / rules / large display only */
  --amber-text: #8A5A17;       /* small amber text on light (guard #4) */

  /* Ground + surface (light, default) */
  --bg: #F5F3EF;
  --surface: #FFFFFF;
  --surface-border: #E3DFD7;

  /* Text */
  --ink: #181A1F;
  --muted: #5C5F6B;

  /* Roles */
  --on-brand: #FFFFFF;         /* text on indigo/amber-dark surfaces — FIXED both themes (guard #5) */
  --header-bg: var(--indigo);
  --footer-bg: var(--indigo);
  --status-open: #1F7A46;

  /* Accents that live on the swappable page ground */
  --link: var(--amber-text);
  --link-hover: var(--indigo);
  --accent-rule: var(--amber);

  /* Metrics */
  --maxw: 1120px;
  --radius: 12px;
  --gap: clamp(1rem, 2.5vw, 1.75rem);
  --font-display: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Karla", -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #12142A;
  --surface: #2A2F52;          /* computed 1.403:1 vs ground */
  --surface-border: #3A4066;
  --ink: #EDEEF5;
  --muted: #A9ADC0;
  --link: #E8A23C;             /* amber reads fine on dark ground (8.3:1) */
  --link-hover: #F4C079;
  /* --on-brand stays #FFFFFF — never remapped (guard #5) */
}

/* ---- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; display: block; }

a:not([class]) { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:not([class]):hover { color: var(--link-hover); }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.eyebrow {
  display: inline-block; font-family: var(--font-display); font-weight: 700;
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber-text); margin-bottom: .5rem;
}
[data-theme="dark"] .eyebrow { color: var(--link); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.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;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  padding: .75rem 1.25rem; border-radius: var(--radius);
  text-decoration: none; border: 2px solid transparent; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--amber); color: var(--indigo); }  /* 7.4:1 label on fill */
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--surface-border); }
.btn-outline:hover { border-color: var(--amber); }
.btn-on-brand { background: var(--amber); color: var(--indigo); }
.btn .ico { display: flex; align-items: center; }  /* guard #6 */

/* ---- Header ------------------------------------------------------------- */
.site-header { background: var(--header-bg); color: var(--on-brand); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand svg { height: 26px; width: auto; display: block; }

.main-nav { display: flex; align-items: center; }
.main-nav ul { list-style: none; display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2rem); margin: 0; padding: 0; }
.main-nav a:not([class]) {
  color: var(--on-brand); text-decoration: none; font-family: var(--font-display);
  font-weight: 600; white-space: nowrap; padding: .4rem 0; border-bottom: 2px solid transparent;
}
.main-nav a:not([class]):hover { color: var(--amber); }
.main-nav a[aria-current="page"] { color: var(--amber); border-bottom-color: var(--amber); }

.header-actions { display: flex; align-items: center; gap: .75rem; }

/* Icon-button (theme toggle + hamburger) */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 2px solid rgba(255,255,255,.25); color: var(--on-brand);
}
.icon-btn:hover { border-color: var(--amber); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.nav-toggle { display: none; }

/* ---- Mobile nav drawer -------------------------------------------------- */
.nav-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; z-index: 60;
}
.nav-scrim.open { opacity: 1; visibility: visible; }

@media (max-width: 820px) {
  .header-actions { display: none; }          /* guard #2 — CTA moves into drawer */
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed; top: 0; right: 0; height: 100dvh; width: min(82vw, 340px);
    background: var(--indigo); color: var(--on-brand);
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    padding: 5rem 1.5rem 2rem; transform: translateX(100%);
    transition: transform .25s ease; z-index: 70; box-shadow: -8px 0 30px rgba(0,0,0,.3);
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: .25rem; }
  .main-nav a:not([class]) { display: block; padding: .8rem 0; font-size: 1.15rem; border-bottom: 1px solid rgba(255,255,255,.12); }
  .main-nav a[aria-current="page"] { border-bottom-color: var(--amber); }
  .drawer-cta { margin-top: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
  .drawer-cta .btn { justify-content: center; }
  .nav-close {
    position: absolute; top: 1rem; right: 1rem; width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 2px solid rgba(255,255,255,.25); border-radius: 10px;
    color: var(--on-brand); cursor: pointer;
  }
  .nav-close svg { width: 20px; height: 20px; }
}

/* drawer CTA hidden on desktop (lives in header there) */
@media (min-width: 821px) {
  .drawer-cta, .nav-close { display: none; }
}

/* ---- Hero --------------------------------------------------------------- */
.hero { background: var(--indigo); color: var(--on-brand); }
.hero .container { padding-block: clamp(2.75rem, 7vw, 5rem); }
.hero h1 { color: var(--on-brand); max-width: 16ch; }
.hero p { color: rgba(255,255,255,.85); font-size: 1.2rem; max-width: 52ch; }
.hero .accent { color: var(--amber); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: 1.5rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin-top: 2rem; }
.hero-meta .label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.6); }
.hero-meta .value { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--on-brand); }
.hero-meta .value.tel { font-variant-numeric: tabular-nums; }

/* status dot */
.status-open { display: inline-flex; align-items: center; gap: .4rem; }
.status-open .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status-open); display: inline-block; }

/* ---- Cards / surfaces --------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--surface-border);
  border-radius: var(--radius); padding: 1.5rem;
}
.grid { display: grid; gap: var(--gap); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.section-head { max-width: 60ch; margin-bottom: 2rem; }
.rule { width: 48px; height: 4px; background: var(--amber); border: 0; border-radius: 2px; margin: 0 0 1.25rem; }

/* Chips — light-on-dark chips sit on the amber-tinted pill in both themes (guard #8) */
.chip {
  display: inline-block; font-size: .72rem; font-weight: 700; font-family: var(--font-display);
  letter-spacing: .04em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 999px;
  background: var(--indigo); color: var(--on-brand); margin-left: .4rem; vertical-align: middle;
}
[data-theme="dark"] .chip { background: var(--amber); color: var(--indigo); }

/* stock list */
.stock-item h3 { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.stock-item .ico {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; background: rgba(232,162,60,.15);
  color: var(--amber-text); margin-bottom: .85rem;
}
[data-theme="dark"] .stock-item .ico { color: var(--amber); background: rgba(232,162,60,.18); }
.stock-item .ico svg { width: 24px; height: 24px; }

/* ---- Hours table -------------------------------------------------------- */
.hours-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hours-table th, .hours-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--surface-border); }
.hours-table th { font-family: var(--font-display); font-weight: 600; }
.hours-table td { text-align: right; color: var(--muted); }

/* ---- Placeholder image block ------------------------------------------- */
.img-placeholder {
  border: 2px dashed var(--surface-border); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(232,162,60,.06) 12px, rgba(232,162,60,.06) 24px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 260px; padding: 1.5rem; color: var(--muted);
}
.img-placeholder .inner { max-width: 34ch; }
.img-placeholder strong { display: block; font-family: var(--font-display); color: var(--ink); margin-bottom: .35rem; }

/* ---- Find-us / map ------------------------------------------------------ */
.map-embed { width: 100%; border: 0; border-radius: var(--radius); min-height: 340px; background: var(--surface); }
.note {
  font-size: .92rem; color: var(--muted); border-left: 3px solid var(--amber);
  padding: .5rem .85rem; background: rgba(232,162,60,.07); border-radius: 0 8px 8px 0; margin: 1rem 0;
}

/* ---- Social row --------------------------------------------------------- */
.social-row { display: flex; flex-wrap: wrap; gap: .85rem; }
.social-link {
  display: inline-flex; align-items: center; gap: .6rem; text-decoration: none;
  font-family: var(--font-display); font-weight: 600; color: var(--ink);
  border: 1px solid var(--surface-border); border-radius: var(--radius); padding: .7rem 1.1rem;
  background: var(--surface);
}
.social-link:hover { border-color: var(--amber); }
.social-link .ico { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; color: var(--amber-text); }
[data-theme="dark"] .social-link .ico { color: var(--link); }

/* ---- Contact form ------------------------------------------------------- */
.form-grid { display: grid; gap: 1rem; }
.field label { display: block; font-family: var(--font-display); font-weight: 600; margin-bottom: .35rem; }
.field input, .field textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--surface-border); border-radius: 10px; padding: .7rem .8rem;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--amber); }
.field textarea { resize: vertical; min-height: 120px; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: .3rem; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { background: var(--footer-bg); color: var(--on-brand); padding-block: 2.5rem; margin-top: auto; }
.site-footer .container { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-footer h4 { color: var(--on-brand); font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; }
.site-footer p, .site-footer address { color: rgba(255,255,255,.8); font-style: normal; margin: 0 0 .4rem; }
.site-footer a:not([class]) { color: rgba(255,255,255,.85); text-decoration: none; }
.site-footer a:not([class]):hover { color: var(--amber); text-decoration: underline; }
.footer-brand svg { height: 24px; margin-bottom: .75rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); margin-top: 1.5rem; padding-top: 1.25rem; font-size: .85rem; color: rgba(255,255,255,.6); }

/* Guard #1: dark-mode link recolor scoped for BOTH footer and nav */
[data-theme="dark"] .site-footer a:not([class]) { color: rgba(255,255,255,.85); }
[data-theme="dark"] .site-footer a:not([class]):hover { color: var(--amber); }
[data-theme="dark"] .main-nav a:not([class]) { color: var(--on-brand); }
[data-theme="dark"] .main-nav a:not([class]):hover,
[data-theme="dark"] .main-nav a[aria-current="page"] { color: var(--amber); }

/* ---- Page layout scaffold ---------------------------------------------- */
.page { display: flex; flex-direction: column; min-height: 100dvh; }
main { flex: 1 0 auto; }

/* ---- Motion preference -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
