/* ==========================================================================
   El Noa Noa Supermarket — BASE
   Reset, document defaults, typography and accessibility primitives.
   Depends on tokens.css. Loaded second.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset in-page anchors by the sticky header reserved in Phase 3. */
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
  -moz-tab-size: 4;
  tab-size: 4;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
fieldset, legend, ol, ul {
  margin: 0;
  padding: 0;
}

ol[class],
ul[class] {
  list-style: none;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}

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

img {
  height: auto;
  border-style: none;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
  margin: var(--space-8) 0;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. TYPOGRAPHY
   Headings use Plus Jakarta Sans, body copy uses Inter, both referenced only
   through --font-heading / --font-body. Switching to self-hosted WOFF2 files
   changes the @font-face source and nothing else.
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-strong);
  text-wrap: balance;
}

h1, .h1 { font-size: var(--text-5xl); font-weight: var(--weight-extrabold); letter-spacing: var(--tracking-tighter); }
h2, .h2 { font-size: var(--text-4xl); font-weight: var(--weight-bold); }
h3, .h3 { font-size: var(--text-3xl); font-weight: var(--weight-bold); }
h4, .h4 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
h5, .h5 { font-size: var(--text-xl);  font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
h6, .h6 { font-size: var(--text-lg);  font-weight: var(--weight-semibold); line-height: var(--leading-snug); }

/* Oversized brand statement, e.g. the hero headline in Phase 4. */
.display {
  font-family: var(--font-heading);
  font-size: var(--text-6xl);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-tighter);
  text-transform: uppercase;
}

p {
  text-wrap: pretty;
}

.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

small,
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }

.text-muted   { color: var(--color-text-muted); }
.text-subtle  { color: var(--color-text-subtle); }
.text-inverse { color: var(--color-text-inverse); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.font-heading { font-family: var(--font-heading); }
.font-body    { font-family: var(--font-body); }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clamp to a fixed number of lines. Used by product names and excerpts so
   cards in a grid keep an identical height. */
.clamp-1,
.clamp-2,
.clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

/* An "eyebrow" label above a section heading. */
.eyebrow {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-primary);
}

a {
  color: var(--color-link);
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.2em;
  transition: var(--transition-colors);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-color: currentColor;
}

/* Links that are visually a block (cards, tiles) opt out of link colouring. */
a.plain,
a.plain:hover {
  color: inherit;
  text-decoration: none;
}

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

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-surface-sunken);
  border-radius: var(--radius-xs);
  padding: 0.15em 0.4em;
}

pre {
  background: var(--blue-900);
  color: var(--blue-50);
  padding: var(--space-4);
  border-radius: var(--radius);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

blockquote {
  border-left: var(--border-width-thick) solid var(--color-accent);
  padding-left: var(--space-4);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

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

/* --------------------------------------------------------------------------
   3. FOCUS AND ACCESSIBILITY
   -------------------------------------------------------------------------- */

/* Remove the default ring only where a visible replacement is provided. */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: var(--border-width-thick) solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Visible to screen readers only. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Same, but revealed when focused — the skip link. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-tooltip);
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--duration) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-on-primary);
}

/* Prevent background scrolling while a modal or drawer is open. */
body.is-locked {
  overflow: hidden;
  /* Preserve the scrollbar gutter so the page does not shift sideways. */
  padding-right: var(--scrollbar-width, 0px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   4. PRINT
   -------------------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .no-print,
  .toast-region,
  .modal {
    display: none !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
}
