/* =========================================================
   NUVANTI — Base
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

::selection { background: var(--color-accent); color: var(--color-text-inverse); }

.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;
}

/* The header mount point must not create its own box — otherwise it
   becomes the containing block for position:sticky and the header
   scrolls away with it after its own (small) height passes. */
#site-header { display: contents; }

.skip-link {
  position: absolute; left: 1rem; top: -60px; z-index: 200;
  background: var(--color-ink); color: var(--color-text-inverse);
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-editorial);
}
.skip-link:focus { top: 1rem; }

/* ---- Type ---- */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }

h1, .h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); font-weight: 500; }
h2, .h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); font-weight: 500; }
h3, .h3 { font-family: var(--font-display); font-size: var(--fs-h3); line-height: var(--lh-snug); font-weight: 500; }
.lead { font-size: var(--fs-lead); color: var(--color-muted); max-width: 46ch; }
.label {
  font-size: var(--fs-micro); letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--color-muted); font-weight: 600;
}

/* ---- Layout ---- */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section { padding-block: var(--space-8); }
.section--tight { padding-block: var(--space-7); }
.section--ink { background: var(--gradient-ink); color: var(--color-text-inverse); }
.section--ink .label { color: var(--color-muted-inverse); }
.section--ink .lead, .section--ink .section-head__title p, .section--ink .editorial-split__text p { color: var(--color-muted-inverse); }
.section--soft { background: var(--color-soft-surface); }
.section--surface { background: var(--color-surface); }
.section--ink .product-card { background: var(--color-dark-surface); border: 1px solid var(--color-border-inverse); border-radius: var(--radius-md); padding: var(--space-3); }
.section--ink .product-card__name { color: var(--color-text-inverse); }
.section--ink .product-card__compare { color: var(--color-muted-inverse); }
.section--ink .product-card__price { color: var(--color-text-inverse); }
.section--ink .product-card__media { margin-bottom: var(--space-3); }
.section--ink .btn-outline { background: var(--color-dark-surface-raised); border-color: var(--color-border-inverse); color: var(--color-text-inverse); }
.section--ink .btn-outline:hover { background: var(--gradient-brand); border-color: transparent; color: var(--color-white); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-5); margin-bottom: var(--space-6); flex-wrap: wrap;
}
.section-head__title { max-width: 34ch; }
.section-head__title p { margin-top: var(--space-2); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 1rem 2rem; font-size: var(--fs-small); font-weight: 700;
  letter-spacing: 0.01em; border: 1px solid transparent; border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-editorial), color var(--dur-fast) var(--ease-editorial),
    border-color var(--dur-fast) var(--ease-editorial), transform var(--dur-fast) var(--ease-editorial),
    box-shadow var(--dur-fast) var(--ease-editorial);
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-brand);
  color: var(--color-white); box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: var(--shadow-glow-lg); transform: translateY(-2px) scale(1.02); }
.btn-primary:active { transform: translateY(0) scale(0.99); }
.btn-outline { border-color: var(--color-border); color: var(--color-text); background: var(--color-surface); }
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.btn-ink-outline { border-color: var(--glass-dark-border); color: var(--color-text-inverse); }
.btn-ink-outline:hover { background: var(--color-text-inverse); color: var(--color-ink); border-color: var(--color-text-inverse); transform: translateY(-2px); }
.btn-text { padding: 0; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--color-border); border-radius: 0; }
.btn-text:hover { text-decoration-color: var(--color-accent); color: var(--color-accent); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-sm { padding: 0.65rem 1.4rem; font-size: var(--fs-micro); }
.btn-success { background: var(--color-success); color: var(--color-white); box-shadow: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  transition: background var(--dur-fast) var(--ease-editorial), transform var(--dur-fast) var(--ease-editorial);
  position: relative;
}
.icon-btn:hover { background: var(--color-accent-tint); transform: translateY(-1px) scale(1.06); }
.icon-btn[aria-pressed="true"] { background: var(--color-ink); color: var(--color-text-inverse); }
.icon-btn svg { width: 20px; height: 20px; }
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 1.15em; height: 1.15em; display: block; }
.plus { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.plus svg { width: 100%; height: 100%; }

.badge {
  display: inline-block; padding: 0.35rem 0.75rem; font-size: 0.65rem;
  font-weight: 800; letter-spacing: var(--ls-label); text-transform: uppercase;
  background: var(--color-ink); color: var(--color-text-inverse); border-radius: var(--radius-pill);
}
.badge--sale { background: var(--gradient-brand); }
.badge--outline { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.field label { font-size: var(--fs-small); font-weight: 600; }
.field .hint { font-size: var(--fs-micro); color: var(--color-muted); }
.field .error { font-size: var(--fs-micro); color: var(--color-error); }
.field input, .field select, .field textarea {
  padding: 0.85rem 1rem; border: 1px solid var(--color-border); background-color: var(--color-surface-raised);
  border-radius: var(--radius-sm); width: 100%;
}
/* ---- Custom select arrow: every <select> in the app gets one consistent chevron ---- */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A1620' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; background-size: 14px;
  padding-right: 2.5rem !important; cursor: pointer;
}
select:disabled { cursor: not-allowed; opacity: 0.5; }
/* Standalone inputs/selects used outside a .field wrapper (toolbars, filter bars) */
.input {
  padding: 0.7rem 1rem; border: 1px solid var(--color-border); background-color: var(--color-surface-raised);
  border-radius: var(--radius-sm); color: var(--color-text); font-size: var(--fs-small);
  transition: border-color var(--dur-fast) var(--ease-editorial);
}
.input:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-tint); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-tint); outline: none; }
.field.is-invalid input, .field.is-invalid select { border-color: var(--color-error); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-ink); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ---- Utility ---- */
.hr { border: none; border-top: 1px solid var(--color-border); }
.text-muted { color: var(--color-muted); }
.text-accent { color: var(--color-accent); }
.sr-announce { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ---- Skeleton loaders ---- */
.skeleton {
  background: linear-gradient(90deg, var(--color-border) 0%, var(--color-surface) 50%, var(--color-border) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s var(--ease-editorial) infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; opacity: 0.6; } }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-slow) var(--ease-editorial), transform var(--dur-slow) var(--ease-editorial); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---- Error-prevention feedback ---- */
.shake { animation: shake-x 400ms var(--ease-editorial); }
@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
