:root {
  /* text */
  --ink: #4a3c2e;          /* primary text — ~9.6:1 on paper */
  --ink-soft: #5f4d3a;      /* secondary text — ~7.3:1 on paper */
  --sage-text: #445536;     /* eyebrow / accent text — ~7.3:1 on paper */
  --clay-text: #7a4530;     /* price text — ~7.3:1 on card */

  /* surfaces */
  --paper: #faf3e8;
  --card: #fffaf2;
  --card-edge: #ecdfc9;

  /* badge fills (paired with --tag-light / --gold-text below) */
  --sage-bg: #5f7350;
  --clay-bg: #9c5b3f;
  --gold-bg: #d3a35d;

  --tag-light: #fffaf2;     /* light text for sage/clay badges */
  --gold-text: #3d3122;     /* fixed dark text for the pale gold badge, both themes */

  --shadow: rgba(90, 66, 40, 0.12);
  --display: "Baloo 2", "Nunito", -apple-system, sans-serif;
  --body: "Nunito", -apple-system, sans-serif;
  color-scheme: light dark;
}

html[data-theme="dark"] {
  --ink: #ecdfce;            /* ~13.1:1 on paper */
  --ink-soft: #b8a68e;       /* ~7.3:1 on paper */
  --sage-text: #a3b892;      /* ~8.0:1 on paper */
  --clay-text: #e2a37e;      /* ~7.2:1 on card */

  --paper: #211a14;
  --card: #2c2319;
  --card-edge: #423528;

  --sage-bg: #9bab8c;
  --clay-bg: #d69a78;
  --gold-bg: #e2b876;

  --tag-light: #211a14;
  --gold-text: #3d3122;

  --shadow: rgba(0, 0, 0, 0.34);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --ink: #ecdfce;
    --ink-soft: #b8a68e;
    --sage-text: #a3b892;
    --clay-text: #e2a37e;

    --paper: #211a14;
    --card: #2c2319;
    --card-edge: #423528;

    --sage-bg: #9bab8c;
    --clay-bg: #d69a78;
    --gold-bg: #e2b876;

    --tag-light: #211a14;
    --gold-text: #3d3122;

    --shadow: rgba(0, 0, 0, 0.34);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Theme toggle — fixed to the viewport corner, out of the flow */
.theme-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 100;
  display: inline-flex;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 3px 10px var(--shadow);
}

.theme-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.theme-toggle button:focus-visible {
  outline: 2px solid var(--clay-bg);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .theme-toggle button { width: 40px; height: 40px; }
}

/* Header */
.site-header {
  padding: 64px 0 44px;
  text-align: center;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, var(--card) 0%, transparent 70%);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-text);
  font-weight: 700;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(34px, 6vw, 52px);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.tagline {
  margin: 16px 0 0;
  font-size: 17px;
  color: var(--ink-soft);
}

/* Shelf / grid */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 26px;
  padding: 44px 0 24px;
}

/* Product card */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 16px;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px var(--shadow);
}

/* Tags float over the card like little magnets — pulled out of
   normal flow so they never push the product name down. */
.card-tags {
  position: absolute;
  top: -11px;
  left: 14px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.tag {
  font-family: var(--body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  border-radius: 7px;
  box-shadow: 0 2px 5px var(--shadow), 0 1px 1px rgba(0, 0, 0, 0.15);
}

.tag:nth-child(1) { transform: rotate(-6deg); }
.tag:nth-child(2) { transform: rotate(4deg); }
.tag:nth-child(3) { transform: rotate(-3deg); }

.tag--new  { background: var(--sage-bg); color: var(--tag-light); }
.tag--hot  { background: var(--clay-bg); color: var(--tag-light); }
.tag--sale { background: var(--gold-bg); color: var(--gold-text); }
.tag--default { background: var(--ink-soft); color: var(--tag-light); }

.card-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  margin: 2px 0 0;
}

.card-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  flex-grow: 1;
}

.card-price {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  color: var(--clay-text);
  margin: 2px 0 4px;
}

.buy-form { display: block; text-decoration: none; }

.buy-form button {
  width: 100%;
  padding: 12px 0;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.buy-form button:hover { background: var(--sage-bg); color: var(--tag-light); }
.buy-form button:active { transform: scale(0.98); }
.buy-form button:focus-visible {
  outline: 2px solid var(--clay-bg);
  outline-offset: 2px;
}

/* Footer */
.site-footer {
  margin-top: 44px;
  padding: 28px 0 52px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

@media (max-width: 480px) {
  .shelf { grid-template-columns: 1fr; }
  .brand { font-size: clamp(28px, 8vw, 40px); }
}
