/* =========================
   Design System Variables
   ========================= */
:root {
  /* Colors */
  --clr-bg: #FAF7F2;
  --clr-text: #000000;
  --clr-logo-red: #D62828;
  --clr-btn: #222222;
  --clr-btn-hover: #444444;
  --clr-white: #FFFFFF;
  --clr-border: #DDDDDD;

  /* Typography */
  --ff-script: "Great Vibes", cursive;
  --ff-heading: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans";
  --ff-body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans";

  /* Layout */
  --container-max: 1200px;
  --radius: 6px;

  /* Spacing (4px scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 12px 30px rgba(0,0,0,0.14);
  --transition: 200ms ease;
  --duration-fade: 700ms;

  /* Product card size control (new) */
  --product-card-size: clamp(160px, 22vw, 260px);
}

/* =========================
   Base Styles / Resets
   ========================= */
*,
*::before,
*::after { box-sizing: border-box; }

html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--ff-body);
  color: var(--clr-text);
  background-color: var(--clr-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visually hidden */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 8px; top: -40px;
  background: var(--clr-white);
  color: var(--clr-text);
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.skip-link:focus { top: 8px; z-index: 1000; }

/* -------------------------
   Legacy minimal .site-nav
   (used on index until replaced)
   ------------------------- */
.site-nav {
  position: absolute;
  right: 20px; top: 16px;
  font-size: 14px;
}
.site-nav ul { display: flex; gap: 16px; }
.site-nav a {
  padding: 6px 8px;
  border-radius: 6px;
}
.site-nav a:focus-visible {
  outline: 3px solid var(--clr-logo-red);
  outline-offset: 2px;
}

/* -------------------------
   New Top Bar Navigation (mobile-safe)
   Use this on pages with .topbar (e.g., order.html)
   ------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mini__mark {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
}
.brand-mini__ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.brand-mini__logo { width: 72%; height: 72%; object-fit: contain; }
.brand-mini__name {
  font-family: var(--ff-script);
  font-size: 20px;
  line-height: 1;
}

.primary-nav ul {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;           /* prevents clipping on small widths */
}
.primary-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
}
.primary-nav a:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
.primary-nav a:focus-visible {
  outline: 3px solid var(--clr-logo-red);
  outline-offset: 2px;
}
.social-link svg { width: 20px; height: 20px; display: block; }

/* Containers & Sections */
.container {
  width: min(100% - 32px, var(--container-max));
  margin-inline: auto;
}
.section {
  width: 100%;
  display: grid;
  place-items: center;
  text-align: center;
}

/* Section height targets */
.section--branding { min-height: 30vh; }
.section--hero     { min-height: 12vh; }
.section--products { min-height: 40vh; }
.section--cta      { min-height: 10vh; }

@media (max-width: 640px) {
  .section--hero { min-height: 15vh; }
}

/* =========================
   Branding
   ========================= */
.brand {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
}
.logo-emblem {
  position: relative;
  width: clamp(160px, 22vw, 240px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.logo-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.logo-image { width: 78%; height: 78%; object-fit: contain; }
.brand-wordmark {
  font-family: var(--ff-script);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  margin: 0;
  color: var(--clr-text);
  font-weight: 400;
}

/* =========================
   Hero Text
   ========================= */
.hero__title {
  margin: 0;
  font-family: var(--ff-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(28px, 3.2vw, 48px);
}
.hero__subtitle {
  margin: 12px 0 0 0;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 400;
}

/* =========================
   Product Gallery (updated)
   ========================= */
.product-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, var(--product-card-size)); /* smaller squares */
  justify-content: center;  /* center the fixed-size columns */
  gap: var(--space-6);
  margin-inline: auto;
}
.card {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: clip;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  will-change: transform;
}
.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.card:hover,
.card:focus-within {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* =========================
   CTA Button
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-family: var(--ff-heading);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn--primary { background: var(--clr-btn); color: var(--clr-white); }
.btn--primary:hover { background: var(--clr-btn-hover); }
.btn--primary:active { transform: translateY(1px); }
.btn--primary:focus-visible {
  outline: 3px solid var(--clr-logo-red);
  outline-offset: 2px;
  box-shadow: var(--shadow-sm);
}

/* order.html: fallback CTA group under iframe */
.open-form-cta {
  margin-top: var(--space-6);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/* =========================
   Footer
   ========================= */
.site-footer {
  padding: var(--space-8) 0;
  font-size: 14px;
  color: #333;
}

/* =========================
   Subtle Load-in Animation
   ========================= */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0;
  animation: fade-in-up var(--duration-fade) ease-out forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .card,
  .btn,
  .reveal {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================
   Responsive Tweaks
   ========================= */

/* Tablet */
@media (max-width: 1024px) {
  .product-grid { gap: var(--space-6); }
}

/* Mobile */
@media (max-width: 640px) {
  /* Keep legacy absolute nav alignment if index still uses it */
  .site-nav { right: 12px; top: 8px; }

  /* Topbar stacks brand and nav so nothing overlaps */
  .topbar__inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .primary-nav ul { justify-content: center; }

  /* Product grid becomes single column; cap card width for comfort */
  .product-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    width: 100%;
    margin-inline: auto;
  }
  .card { max-width: 360px; margin-inline: auto; }
}
