/* ==========================================================================
   Future Power — base.css
   Reset, root element, typography utilities, layout primitives, a11y.
   Direction-agnostic: uses CSS logical properties throughout (RTL-ready).
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, picture, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul[role="list"], ol[role="list"], ul.reset, ol.reset { list-style: none; padding: 0; }

/* Links — always defined so editor-added links aren't browser-blue */
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); }

/* Focus */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-xs); }

::selection { background: var(--sun-300); color: var(--ink); }

/* Skip link */
.skip-link {
  position: absolute;
  inset-block-start: -100%;
  inset-inline-start: var(--space-4);
  z-index: var(--z-toast);
  background: var(--ink);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--r-pill);
}
.skip-link:focus { inset-block-start: var(--space-4); color: #fff; }

/* ---------- Typography utilities ---------- */
.u-display {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-display);
  line-height: .95;
  letter-spacing: var(--track-tight);
  text-wrap: balance;
}
.u-h1 { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-h1); line-height: 1; letter-spacing: var(--track-tight); text-wrap: balance; }
.u-h2 { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-h2); line-height: 1.02; letter-spacing: var(--track-tight); text-wrap: balance; }
.u-h3 { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-h3); line-height: 1.1; letter-spacing: var(--track-snug); }
.u-lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--color-text-2); text-wrap: pretty; }
.u-mono { font-family: var(--font-mono); }
.u-accent { color: var(--color-primary); }
.u-accent-sun { color: var(--sun-500); }
/* Display headings carry no color of their own, so they inherit the body ink.
   On dark bands, adopt the remapped --color-text (which .on-dark sets to #fff). */
.on-dark .u-display, .on-dark .u-h1, .on-dark .u-h2, .on-dark .u-h3 { color: var(--color-text); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.on-dark .eyebrow { color: var(--sun-400); }

/* ---------- Layout primitives ---------- */
.container {
  inline-size: 100%;
  max-inline-size: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(3.5rem, 2rem + 6vw, 6rem); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem); }
.section--sunk { background: var(--color-bg-sunk); }
.section--surface2 { background: var(--color-surface-2); }
.section--dark { background: var(--ink); }
.section--forest { background: var(--color-primary); }

.stack > * + * { margin-block-start: var(--flow, var(--space-4)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.grid { display: grid; gap: var(--space-4); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid--4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }

/* Media aspect helpers (prevent layout shift). The SANCTIONED ratio scale — do not add ad-hoc
   ratios in markup. Ratio is a property of the SLOT, not the image: store one generous master and
   let the slot crop it via object-fit:cover (+ a Portal Media focal point for object-position).
     · square (1:1) → product/catalog media (locked; cards, thumbnails, PDP gallery)
     · 4:3          → editorial in-content photos, portrait-ish context
     · 16:9         → wide editorial slots (category tiles, hero, banners, video) */
.ratio { position: relative; overflow: hidden; }
.ratio > img, .ratio > svg, .ratio > video { inline-size: 100%; block-size: 100%; object-fit: cover; }
.ratio--square, .ratio--1x1 { aspect-ratio: 1 / 1; }
.ratio--4x3 { aspect-ratio: 4 / 3; }
.ratio--16x9 { aspect-ratio: 16 / 9; }

/* ---------- Icons ---------- */
.icon { inline-size: 1.25em; block-size: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon--fill { fill: currentColor; stroke: none; }
/* Directional icons flip in RTL */
[dir="rtl"] .icon--dir { transform: scaleX(-1); }

/* ---------- Accessibility helpers ---------- */
.visually-hidden {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ---------- Skeleton shimmer (loading states) ---------- */
@keyframes fp-shimmer { 100% { background-position-x: -200%; } }
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--forest-50) 50%, var(--paper-2) 100%);
  background-size: 200% 100%;
  animation: fp-shimmer 1.3s linear infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Hide elements the binder will populate/remove; avoids flash of template */
[hidden] { display: none !important; }
