/* ==========================================================================
   LHÍ design foundation — Opni
   --------------------------------------------------------------------------
   Foundation layer for the design upgrade. Ports the type + token base from
   the LHÍ.is design system (~/Projects/LHI.is/design.md §2 Brand foundations,
   §3 Layout system) into this theme.

   Loaded AFTER avista-styles.css so it wins on source order. Everything here
   is intentionally low-risk: type, tokens, and layout primitives only.

   DELIBERATELY NOT HERE — global element resets (img{display:block},
   a:hover{underline}, body line-height). The prototype applies those on a
   clean slate; this theme carries a 506 KB Bootstrap base, and resetting
   globally would disturb components that haven't been converted yet. Those
   land per-block as each block is converted.

   To disable the whole layer: remove the wp_enqueue_style('lhi-foundation')
   call in library/bones.php. One line, fully reversible.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Sarvatrik Latin — the site typeface
   design.md §2.1: "One typeface for the entire site." Four weights.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Sarvatrik";
  src: url("../fonts/SarvatrikWebLatin-Regular.woff2") format("woff2"),
       url("../fonts/SarvatrikWebLatin-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sarvatrik";
  src: url("../fonts/SarvatrikWebLatin-Medium.woff2") format("woff2"),
       url("../fonts/SarvatrikWebLatin-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sarvatrik";
  src: url("../fonts/SarvatrikWebLatin-SemiBold.woff2") format("woff2"),
       url("../fonts/SarvatrikWebLatin-SemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sarvatrik";
  src: url("../fonts/Sarvatrik-Latin-Bold.woff2") format("woff2"),
       url("../fonts/Sarvatrik-Latin-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* LHI abc — special display face, opt-in only via .lhi-display.
   design.md §10 "LHI abc — special display face, opt-in only". Never body. */
@font-face {
  font-family: "LHI abc";
  src: url("../fonts/lhiabc-ExtraBold.woff2") format("woff2"),
       url("../fonts/lhiabc-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens — design.md §2.2 Color, §3 Layout system
   These 19 do not collide with the theme's 507 --bs-* properties, so both
   systems coexist while blocks are converted one at a time.
   -------------------------------------------------------------------------- */

:root {
  --ink: #0a0a0a;          /* primary text + dark surfaces */
  --ink-2: #1a1a1a;        /* secondary text on light */
  --paper: #ffffff;        /* primary surface */
  --paper-2: #0a0a0a0f;    /* ~6% ink tint for sections / hovers */
  --line: rgba(10, 10, 10, 0.12);        /* hairline dividers */
  --line-strong: rgba(10, 10, 10, 0.2);  /* pill borders, icon-button outlines */
  --muted: rgba(10, 10, 10, 0.6);

  --ice: #c5ecff;          /* LHÍ Ice Blue */
  --pink: #ff9797;         /* LHÍ Morning Pink */
  --red: #a51f0f;          /* LHÍ Equator Red */
  --green: #069367;        /* Open LHÍ Green — the Opni accent (§2.2) */
  --purple: #53085b;       /* Hugarflug Purple */

  /* Atmospheric: pale pastels for backgrounds/orbs. Never put readable type
     on this over white — contrast fails AA. */
  --grad: linear-gradient(110deg, #c5ecff 0%, #d6d5ec 50%, #ff9797 100%);
  /* Typographic emphasis: darker translation of --grad's hue journey, tuned
     to pass AA Large on white. Display type only (≥ 36px). */
  --grad-text: linear-gradient(110deg, #3a8eb5 0%, #a04688 50%, #cc5a6a 100%);

  --maxw: 1440px;
  --pad: clamp(20px, 4vw, 56px);
  --r: 2px;                /* hairline radii read editorial; larger reads Web 2.0 */
}

/* --------------------------------------------------------------------------
   3. Type swap — BentonSans → Sarvatrik
   The theme routes most type through Bootstrap custom properties, so three
   redefinitions cover the bulk. The explicit rules below cover the seven
   places avista-styles.css hardcodes the family and would otherwise keep
   rendering BentonSans.
   -------------------------------------------------------------------------- */

:root {
  --bs-body-font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --bs-btn-font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --input-font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Bootstrap pins every heading to a fixed colour:
       h1..h6 { color: var(--bs-heading-color) }   (avista-styles.css:229)
     A direct rule always beats inheritance, so a heading inside a dark
     section renders #141d26 on dark no matter what the section sets. The
     old .hero-section worked around it per-component with
     `color: inherit` (avista-styles.css:21026); doing it once here fixes
     every block we convert.

     Site-wide effect on unconverted pages: headings shift #141d26 → #000
     (--bs-body-color), which is imperceptible and moves toward the
     design system's --ink anyway. */
  --bs-heading-color: inherit;
}

body {
  font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* avista-styles.css:223 — the heading block */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
  font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* avista-styles.css:16228 / :18933 / :19021 — form controls and nice-select.
   Family only; size/line-height stay with the existing rules because those
   use the `font:` shorthand and belong to components not yet converted. */
select,
.form-control-wrap .form-control,
.form-control-wrap .nice-select .nice-select-dropdown .option,
.alm-filter--select .nice-select .nice-select-dropdown .option {
  font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* avista-styles.css:21964 sets `font: 2rem "BentonSans" … !important` on form
   fields — a shorthand, and flagged, so nothing unflagged can win. Every input
   on the site was still rendering in the old face: the newsletter in the
   footer on every page, and the contact form. !important is used here only
   because the declaration being overridden is. Family only — the shorthand's
   size and line-height still apply. */
.form-controller input,
.form-controller textarea,
.form-controller select {
  font-family: "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

/* --------------------------------------------------------------------------
   4. Layout primitives — design.md §3
   .wrap is the prototype's container. It sits alongside Bootstrap's
   .container rather than replacing it; converted blocks use .wrap, unconverted
   blocks keep .container.
   -------------------------------------------------------------------------- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Default vertical rhythm for converted sections. Opt in with .lhi-section —
   a bare `section` selector would re-space every unconverted block. */
.lhi-section {
  padding: clamp(64px, 9vw, 128px) 0;
}

/* --------------------------------------------------------------------------
   5. Headline emphasis — design.md §2.1
   Upright + dark-gradient clip. NOT italic: the earlier pale-italic treatment
   failed AA contrast on white and was replaced.
   -------------------------------------------------------------------------- */

.grad {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Display face, opt-in only. */
.lhi-display {
  font-family: "LHI abc", "Sarvatrik", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 800;
}

/* Icelandic compounds go ragged when justified — design.md §11. */
.lhi-section h1,
.lhi-section h2 {
  text-wrap: balance;
}

/* ==========================================================================
   Buttons — design.md §5.1
   .btn.primary: "solid ink, hovering to pink."

   Lives in the foundation because it was written four times — lhi-course.css,
   columns.css, intro-block.css and accordion.css — with the values identical
   apart from a padding that had drifted to 13px 26px in the accordion. Block
   stylesheets are enqueued per block, so the shared rule has to sit in a file
   that loads everywhere; this is that file.

   Scoped to .btn--primary, never to .btn. `.btn` is Bootstrap's, worn by every
   theme button on the site including the Gravity Forms submits — a global rule
   on it would reach far outside the converted work. .btn--primary appears only
   in markup this upgrade wrote.

   .btn--ghost-light is deliberately NOT here: it has two instances with
   genuinely different boxes (the home hero's is a larger CTA), so it stays with
   the components that draw it.
   ========================================================================== */

.btn--primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 14px 28px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .25s cubic-bezier(.2, .7, .2, 1), color .25s ease, border-color .25s ease;
}

.btn--primary:hover {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--ink);
  text-decoration: none;
}

/* avista-styles.css:16568 sets `outline: 0 !important` on .btn itself, so the
   ring has to be flagged to land. */
.btn--primary:focus-visible {
  outline: 2px solid var(--ink) !important;
  outline-offset: 3px;
}

.btn--primary .arrow { display: inline-block; transition: transform .25s ease; }
.btn--primary:hover .arrow { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  .btn--primary,
  .btn--primary .arrow { transition: none; }
  .btn--primary:hover .arrow { transform: none; }
}
