/* Eco components. Uses only variables from tokens.css.
   Soft 4 px corners, thin grey rules, one green for actions and prices. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--text-md)/var(--line-body) var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-body); font-weight: var(--weight-heading); line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
@media (max-width: 760px) {
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Text helpers */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.lbl { font-size: var(--text-sm); color: var(--muted); }
.display { font-family: var(--font-display); font-weight: var(--weight-display); line-height: 1; text-transform: uppercase; }
.h-block { font-size: var(--text-xl); font-weight: 700; }
.h-page { font-size: var(--text-3xl); font-weight: 400; line-height: 1.1; }
.price { color: var(--price); font-weight: 700; font-size: var(--text-lg); white-space: nowrap; }
.price-old { color: var(--faint); text-decoration: line-through; font-size: var(--text-md); font-weight: 400; margin-left: var(--space-2); }
.prose p + p { margin-top: var(--space-3); }
.prose { line-height: var(--line-text); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-h); padding: 0 var(--space-4);
  border: var(--border-width) solid var(--line-soft); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-sm { height: 25px; padding: 0 10px; font-size: var(--text-md); }
.btn-md { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-md); }
.btn-lg { height: 48px; font-size: 18px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: var(--radius); background: none; color: var(--ink); cursor: pointer; position: relative;
}
.icon-btn:hover { color: var(--accent-ink); }
.icon-btn svg { width: 24px; height: 24px; }
.link-u { border-bottom: var(--border-width) solid var(--line); }
.link-u:hover { border-color: var(--accent); }

/* Badges on icons */
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-fg);
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 700;
}
.badge[data-n="0"] { display: none; }

/* Stickers: flags on product photos */
.stickers { position: absolute; top: 15px; left: 15px; display: grid; gap: 2px; justify-items: start; z-index: 2; pointer-events: none; }
.sticker {
  display: inline-block; padding: 5px 13px 5px 10px; border-radius: var(--sticker-radius);
  font-size: var(--text-xs); line-height: 1; text-transform: uppercase;
  border-left: 1px solid var(--line);
}
.sticker-sale { background: var(--sale); color: var(--sale-fg); }
.sticker-new { background: var(--accent); color: var(--accent-fg); }
.sticker-hit { background: var(--hit); color: var(--hit-fg); }

/* Forms */
.field {
  width: 100%; height: 36px; padding: 6px 8px;
  border: var(--border-width) solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); font: 400 var(--text-base) var(--font-body);
}
textarea.field { height: 86px; resize: vertical; }
.field:focus { outline: none; border-color: var(--ink); }
.field::placeholder { color: var(--faint); }
.field.invalid { border-color: var(--bad); }
.err { color: var(--bad); font-size: var(--text-sm); margin-top: var(--space-1); }
select.field { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.check { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; padding: 4px 0; }
.check input { appearance: none; width: 18px; height: 18px; margin: 0; border: var(--border-width) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-fg); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type="radio"] { border-radius: var(--radius-round); }
.check input[type="radio"]:checked::after { width: 6px; height: 6px; border: 0; border-radius: var(--radius-round); background: var(--accent-fg); transform: none; }
.check sup { color: var(--muted-2); font-size: var(--text-sm); }

/* Quantity counter */
.counter { display: inline-flex; align-items: center; height: var(--control-h); border: var(--border-width) solid var(--line); border-radius: var(--radius); background: var(--surface); }
.counter button { width: 30px; height: 100%; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.counter button:hover { color: var(--accent-ink); }
.counter input { width: 30px; height: 100%; border: 0; background: none; text-align: center; font: inherit; color: var(--fg); -moz-appearance: textfield; }
.counter input::-webkit-inner-spin-button { -webkit-appearance: none; }
.counter svg { width: 14px; height: 14px; }

/* Tabs: text tabs with a short green rule above the active one */
.tabs { display: flex; gap: var(--space-5); border-top: var(--border-width) solid var(--line); flex-wrap: wrap; }
.tab { position: relative; padding: 15px 0 0; border: 0; background: none; cursor: pointer; font-size: var(--text-base); font-weight: 700; color: var(--muted-2); }
.tab[aria-selected="true"] { color: var(--accent-ink); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent); }
.tab-panel { padding-top: var(--space-4); }

/* Big centered tabs used over carousels */
.ctabs { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; }
.ctab { border: 0; background: none; padding: 0; cursor: pointer; font-size: var(--text-xl); font-weight: 700; color: var(--ink); }
.ctab[aria-selected="true"] { color: var(--accent-ink); }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--faint); line-height: 1.6; }
.crumbs a:hover { color: var(--accent-ink); }
.crumbs svg { width: 8px; height: 8px; }

/* Segmented sort */
.seg { display: inline-flex; border: var(--border-width) solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 10px 8px; font-size: 13px; cursor: pointer; color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

/* Round arrows for carousels */
.arrow {
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: var(--border-width) solid var(--line-soft); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.arrow:disabled { opacity: .35; cursor: default; }
.arrow svg { width: 18px; height: 18px; }

/* Dots */
.dots { display: flex; gap: 6px; justify-content: center; }
.dots button { width: 10px; height: 10px; padding: 0; border-radius: var(--radius-round); border: var(--border-width) solid var(--dot-line); background: var(--dot); cursor: pointer; }
.dots button[aria-current="true"] { background: var(--accent); border-color: var(--accent); }

/* Modal and drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.modal {
  position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(790px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: var(--space-6);
}
.modal-x { position: absolute; top: 10px; right: 10px; }
@media (max-width: 760px) { .modal { padding: var(--space-5) var(--space-4); } }

/* Star rating */
.stars { display: inline-flex; gap: 6px; }
.stars button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--faint); }
.stars svg { width: 26px; height: 26px; }
.stars button.on { color: var(--star); }
