/* ==========================================================================
   BASE — Reset, Typography, Global Styles
   ========================================================================== */

/* ── Modern Reset ────────────────────────────────────────────────────────── */

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  /* Prevent content jump when mobile bottom nav appears */
  padding-bottom: var(--bottom-nav-height);
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }
}

/* ── Elements ────────────────────────────────────────────────────────────── */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

a {
  color: var(--color-primary-700);
  text-decoration: none;
  transition: var(--transition-color);
}

a:hover {
  color: var(--color-primary-500);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

ul,
ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

strong,
b {
  font-weight: var(--weight-bold);
}

em,
i {
  font-style: italic;
}

/* Remove spinners from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-neutral-900);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-md);
}

h5 {
  font-size: var(--text-base);
}

h6 {
  font-size: var(--text-sm);
}

@media (min-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  h4 { font-size: var(--text-lg); }
}

@media (min-width: 1024px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
}

p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-normal);
}

p:last-child {
  margin-bottom: 0;
}

small {
  font-size: var(--text-sm);
}

/* ── Layout Utilities ────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }
}

.section--sm {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--color-text-on-dark);
}

.section--alt {
  background-color: var(--color-bg-secondary);
}

/* ── Grid System ─────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: var(--grid-gap-md);
}

.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
}

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

/* ── Flex Utilities ──────────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Text Utilities ──────────────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-uppercase { text-transform: uppercase; letter-spacing: var(--tracking-wider); }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-primary { color: var(--color-primary-700); }
.text-gold { color: var(--color-gold-500); }
.font-heading { font-family: var(--font-heading); }
.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-medium { font-weight: var(--weight-medium); }

/* ── Spacing Utilities ───────────────────────────────────────────────────── */

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* ── Display Utilities ───────────────────────────────────────────────────── */

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hide on mobile, show on desktop */
.desktop-only {
  display: none !important;
}

@media (min-width: 1024px) {
  .desktop-only {
    display: flex !important;
  }

  .mobile-only {
    display: none !important;
  }
}

/* ── Section Title ───────────────────────────────────────────────────────── */

.section-title {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-title h2 {
  margin-bottom: var(--space-2);
  position: relative;
  display: inline-block;
}

.section-title p {
  color: var(--color-text-muted);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.section-title__leaf {
  width: 60px;
  height: auto;
  margin: var(--space-2) auto var(--space-3);
  opacity: 0.7;
}

@media (min-width: 768px) {
  .section-title {
    margin-bottom: var(--space-12);
  }
}

/* ── Body Lock (when modal/sidebar is open) ──────────────────────────────── */

body.menu-open,
body.cart-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ── Selection Color ─────────────────────────────────────────────────────── */

::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
}

/* ── Scrollbar Styling (WebKit) ──────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-neutral-100);
}

::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}

/* ── Focus Trap for Accessibility ────────────────────────────────────────── */

[tabindex="-1"]:focus:not(:focus-visible) {
  outline: 0 !important;
}
