/* ==========================================================================
   Libo Energy — Base
   Typography, resets, container, button system (§7), focus, motion, RTL.
   Loaded after Bootstrap so it overrides defaults.
   ========================================================================== */

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

html { scroll-behavior: smooth; }

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

body {
  font-family: var(--lb-font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  color: var(--lb-text-body);
  background: var(--lb-white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---- Headings (§3) ----------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4 {
  font-family: var(--lb-font-head);
  color: var(--lb-text-heading);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--sp-4);
}

h1, .h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: -0.01em; }
h2, .h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3, .h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-semibold); }
h4, .h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: var(--fw-semibold); }

p { margin: 0 0 var(--sp-4); }

a {
  color: var(--lb-royal);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--lb-red); }

ul, ol { margin: 0 0 var(--sp-4); padding-inline-start: 1.25rem; }

img { max-width: 100%; height: auto; }

/* ---- Display / utility type ------------------------------------------- */
.display-hero {
  font-family: var(--lb-font-head);
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

/* Eyebrow / section label (§3) — uppercase, tracked, Primary Red */
.eyebrow {
  display: inline-block;
  font-family: var(--lb-font-head);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lb-eyebrow);
  margin-bottom: var(--sp-3);
}
.eyebrow--on-dark { color: var(--lb-red-light); }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  font-weight: var(--fw-regular);
  color: var(--lb-slate);
}

.text-small  { font-size: var(--fs-small); line-height: var(--lh-caption); font-weight: var(--fw-medium); }
.text-muted-lb { color: var(--lb-text-muted) !important; }
.reading-column { max-width: var(--lb-reading); }

/* Constrain paragraph measure for readability (~68ch) */
.measure { max-width: 68ch; }

/* ---- Container (§4) ---------------------------------------------------- */
.container,
.container-lb {
  width: 100%;
  max-width: var(--lb-max-width);
  margin-inline: auto;
  padding-inline: var(--container-pad-x);
}
.container-wide { max-width: var(--lb-max-width-xl); }

/* ---- Section rhythm (§4 / §12) ---------------------------------------- */
.section {
  padding-block: var(--section-pad);
  position: relative;
}

/* Offset anchored targets for the fixed header (native/keyboard hash nav) */
:where(section, main, footer)[id] { scroll-margin-top: 96px; }
.section--mist  { background: var(--lb-mist); }
.section--navy  { background: var(--lb-navy); color: var(--lb-text-body-dark); }
.section--navy h1, .section--navy h2,
.section--navy h3, .section--navy h4 { color: var(--lb-text-on-dark); }
.section--depth { background: var(--lb-depth-gradient); color: var(--lb-text-body-dark); }
.section--depth h1, .section--depth h2,
.section--depth h3, .section--depth h4 { color: var(--lb-text-on-dark); }

/* Lead/body paragraphs invert to light copy inside dark sections */
.section--navy .lead,
.section--depth .lead { color: var(--lb-text-body-dark); }

/* Section heading block (red eyebrow + bold H2) — §12 principle 5 */
.section-head { margin-bottom: var(--sp-12); }
.section-head .lead { margin-top: var(--sp-3); }

/* ---- Buttons (§7) ------------------------------------------------------ */
.btn-lb {
  --_bg: var(--lb-red);
  --_bg-hover: var(--lb-red-dark);
  --_fg: var(--lb-white);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--lb-font-head);
  font-size: var(--fs-button);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--_bg);
  color: var(--_fg);
  cursor: pointer;
  text-align: center;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn-lb:hover {
  background: var(--_bg-hover);
  color: var(--_fg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Primary (default) */
.btn-lb--primary { --_bg: var(--lb-red); --_bg-hover: var(--lb-red-dark); --_fg: #fff; }

/* Secondary — Royal Blue solid */
.btn-lb--secondary { --_bg: var(--lb-royal); --_bg-hover: var(--lb-navy); --_fg: #fff; }

/* Secondary outline */
.btn-lb--outline {
  background: transparent;
  border-color: var(--lb-royal);
  color: var(--lb-royal);
}
.btn-lb--outline:hover {
  background: var(--lb-royal);
  color: #fff;
  border-color: var(--lb-royal);
}

/* On-dark — white/transparent with red hover */
.btn-lb--on-dark {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}
.btn-lb--on-dark:hover {
  background: var(--lb-red);
  border-color: var(--lb-red);
  color: #fff;
}

/* Disabled */
.btn-lb:disabled,
.btn-lb.is-disabled {
  background: var(--lb-steel);
  border-color: var(--lb-steel);
  color: #fff;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
  pointer-events: none;
}

/* Ghost / text link with animated arrow (§7) */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--lb-font-head);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-button);
  letter-spacing: 0.04em;
  color: var(--lb-royal);
  position: relative;
}
.link-arrow .fa-arrow-right,
.link-arrow .fa-arrow-right-long {
  transition: transform var(--dur-fast) var(--ease-out);
}
.link-arrow:hover { color: var(--lb-red); }
.link-arrow:hover .fa-arrow-right,
.link-arrow:hover .fa-arrow-right-long { transform: translateX(6px); }
.link-arrow::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  height: 2px; width: 0;
  background: var(--lb-red);
  transition: width var(--dur-mid) var(--ease-out);
}
.link-arrow:hover::after { width: 100%; }
.link-arrow--on-dark { color: #fff; }

/* Inline button spinner (loading state) */
.btn-spinner {
  width: 1em; height: 1em;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.7s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* ---- Focus visibility (§12) ------------------------------------------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
.btn-lb:focus-visible,
.link-arrow:focus-visible { box-shadow: var(--focus-ring); }

/* Programmatic focus targets (skip-link <main>, smooth-scroll section anchors)
   shouldn't draw the interactive ring around a whole region. */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

/* ---- Skip link (§12) --------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  top: 8px;
  z-index: 2000;
  background: var(--lb-red);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  transform: translateX(-50%) translateY(0);
  color: #fff;
}

/* ---- Decorative dividers / rules -------------------------------------- */
.rule { height: 1px; background: var(--lb-line); border: 0; }
.rule--on-dark { background: rgba(255, 255, 255, 0.12); }

/* Red micro-underline accent under headings (footer, etc.) */
.accent-underline { position: relative; padding-bottom: var(--sp-3); }
.accent-underline::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 36px; height: 3px;
  background: var(--lb-red);
}

/* ---- Reduced motion (§8 / §12) ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-aos] { opacity: 1 !important; transform: none !important; }
}

/* ---- RTL scaffolding (§12) -------------------------------------------- */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .accent-underline::after { left: auto; right: 0; }
[dir="rtl"] .link-arrow::after { left: auto; right: 0; }
[dir="rtl"] .link-arrow .fa-arrow-right,
[dir="rtl"] .link-arrow .fa-arrow-right-long { transform: scaleX(-1); }
[dir="rtl"] .link-arrow:hover .fa-arrow-right,
[dir="rtl"] .link-arrow:hover .fa-arrow-right-long { transform: scaleX(-1) translateX(6px); }

/* Visually-hidden (accessible labels) */
.visually-hidden-lb {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
