/* ==========================================================================
   BanSek Trade v2 — base: reset, type, buttons, utilities
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Technical texture: every number lines up (direction correction A3). */
  font-variant-numeric: tabular-nums;
  overflow-x: clip;
}
img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
[hidden] { display: none !important; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* --------------------------------------------------------------------------
   Focus — the one rule. Everything focusable inherits it; night surfaces
   switch the colour through --focus (lime on night, lime-ink on paper).
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--focus, var(--lime-ink));
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* --------------------------------------------------------------------------
   Type
   -------------------------------------------------------------------------- */
/* Firmer than the first direction (A4): weight 500, no negative tracking on
   mixed case, .04em on all-caps. */
h1, h2, h3, h4, h5, .serif {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: 0;
  font-optical-sizing: auto;
}
.h2 { font-size: var(--fs-h2); }
.h2--caps { text-transform: uppercase; letter-spacing: .04em; line-height: 1; }
.h3 { font-size: var(--fs-h3); }
.italic { font-style: italic; }

.micro {
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--steel);
  line-height: 1.4;
}

/* The one monospaced style — part, OE and reference numbers only (A4). */
.pn {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums slashed-zero;
}
.lead { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.65; color: var(--ink-2); max-width: 46ch; }
.prose p + p { margin-top: 1em; }
.prose { max-width: 62ch; }

/* Underline that draws in — links, nav items, tile labels */
.u-draw {
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size var(--dur-mid) var(--ease-soft);
  padding-bottom: 2px;
}
.u-draw:hover, .u-draw:focus-visible, .is-current > .u-draw, .u-draw[aria-current="page"] {
  background-size: 100% 1px;
}
.link-accent {
  color: var(--ink);
  background: linear-gradient(var(--lime-ink), var(--lime-ink)) left bottom / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: color var(--dur-fast) var(--ease-soft);
}
.link-accent:hover { color: var(--lime-text); }

/* --------------------------------------------------------------------------
   Buttons — two styles only
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 26px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-soft),
              color var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft);
}
.btn--primary { background: var(--night); color: var(--paper); }
.btn--primary:hover { background: var(--ink-2); }
.btn--ghost { border: 1px solid var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--on-dark.btn--ghost { border-color: var(--paper); color: var(--paper); }
.btn--on-dark.btn--ghost:hover { background: var(--paper); color: var(--ink); }
.btn--sm { min-height: 40px; padding: 0 16px; gap: 8px; font-size: 12px; letter-spacing: .06em; }
.btn__arrow { width: 16px; height: 16px; transition: transform var(--dur-fast) var(--ease-soft); }
.btn:hover .btn__arrow { transform: translateX(4px); }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: var(--r-pill);
  color: inherit;
  transition: background-color var(--dur-fast) var(--ease-soft), color var(--dur-fast) var(--ease-soft);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --------------------------------------------------------------------------
   Layout and utilities
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--space-l); }
.section--tight { padding-block: var(--space-m); }
.hairline { border: 0; border-top: var(--hairline); margin: 0; }

/* --------------------------------------------------------------------------
   Night — the dark technical surface (A3). Any element whose surface is
   --night carries .night; it is the only place the bright lime may appear
   (build/guards.mjs refuses var(--lime) in any other rule).
   -------------------------------------------------------------------------- */
.night { background-color: var(--night); color: var(--paper); --focus: var(--lime); }
.night .micro { color: rgb(243 240 234 / .64); }
.night h2, .night h3, .night h4, .night .serif { color: var(--paper); }
.night .btn--primary { background: var(--lime); color: var(--night); }
.night .btn--primary:hover { background: var(--paper); }
.night .btn--ghost { border-color: var(--night-line); color: var(--paper); }
.night .btn--ghost:hover { background: var(--paper); color: var(--night); }
.night .link-accent { color: var(--paper); background-image: linear-gradient(var(--lime), var(--lime)); }
.night .link-accent:hover { color: var(--lime); }
.night .pn { color: rgb(243 240 234 / .82); }

/* A full-bleed night band, rounded and inset like the hero frame. */
.band {
  margin-inline: var(--inset);
  border-radius: var(--r-hero);
  padding-block: var(--space-m);
}

/* Numbered section label — small caps under a thin double hairline (A3). */
.snum {
  display: block;
  width: 100%;
  margin-bottom: clamp(20px, 2.4vw, 32px);
  padding-top: 12px;
  border-top: 3px double var(--paper-3);
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--steel);
}
.rule { display: block; width: 48px; height: 1px; background: currentColor; opacity: .6; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
}
.skip-link:focus { top: 12px; }

/* Media frames — rounded, on paper-2 while loading */
.frame { position: relative; overflow: hidden; background: var(--paper-2); }
.frame--hero { border-radius: var(--r-hero); }
.frame--tile { border-radius: var(--r-tile); }
.frame > img { width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------------------------------
   Reveal — content is visible by default. It is only hidden once JS has
   armed it (html.js), and reveal.js un-hides it; with no JS, or under reduced
   motion, nothing is ever invisible.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .rv-img {
    clip-path: inset(6% 6% 6% 6% round var(--r-hero));
    transition: clip-path var(--dur-xslow) var(--ease-out);
  }
  html.js .rv-img.is-in { clip-path: inset(0 0 0 0 round var(--r-hero)); }
  html.js .rv-img.frame--tile { clip-path: inset(6% 6% 6% 6% round var(--r-tile)); }
  html.js .rv-img.frame--tile.is-in { clip-path: inset(0 0 0 0 round var(--r-tile)); }

  html.js .rv-up {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--dur-slow) var(--ease-soft), transform var(--dur-slow) var(--ease-soft);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  html.js .rv-up.is-in { opacity: 1; transform: none; }

  /* Failsafe: if the page's own script never boots (blocked, broken), what
     the reveal hid comes back after a few seconds instead of never. */
  html.js:not(.is-ready) .rv-up { animation: rv-failsafe 1ms linear 3s forwards; }
  html.js:not(.is-ready) .rv-img { animation: rv-failsafe-img 1ms linear 3s forwards; }
}
@keyframes rv-failsafe { to { opacity: 1; transform: none; } }
@keyframes rv-failsafe-img { to { clip-path: inset(0 0 0 0 round var(--r-tile)); } }

/* Hover zoom — 1.03 over 900ms, on any media inside a .zoom container */
.zoom img { transition: transform var(--dur-slow) var(--ease-soft); }
@media (hover: hover) {
  .zoom:hover img, .zoom:focus-visible img { transform: scale(1.03); }
}
