/* ============================================================
   RYANWAT BASE STYLES — v2.0
   File: assets/css/base.css
   
   Global reset, body defaults, typographic base rules.
   All values reference tokens.css variables only.
   No section-specific styles here — those live in sections.css.
   ============================================================ */

/* ── BOX MODEL RESET ─────────────────────────────────────── */

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

/* ── DOCUMENT ─────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;  /* Prevent iOS font scaling on rotate */
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Prevent body scroll when mobile menu is open */
body.menu-is-open {
  overflow: hidden;
}

/* ── SKIP LINK (Accessibility) ────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--bg-dark);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  z-index: var(--z-modal);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── TYPOGRAPHY BASE ──────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Hero-scale headlines tighten further */
h1 {
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1.0;
}

h2 {
  font-size: var(--text-4xl);
  line-height: 1.1;
}

h3 {
  font-size: var(--text-2xl);
  line-height: 1.15;
}

h4 {
  font-size: var(--text-xl);
  line-height: 1.2;
}

h5 {
  font-size: var(--text-lg);
  line-height: 1.3;
}

h6 {
  font-size: var(--text-md);
  line-height: 1.35;
}

p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.68;
  color: var(--text-body);
  max-width: 68ch;  /* Enforce readable line length */
}

/* Full-width paragraphs in specific contexts — override when needed */
p.u-full-width {
  max-width: none;
}

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── LINKS ────────────────────────────────────────────────── */

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── LISTS ────────────────────────────────────────────────── */

ul, ol {
  list-style: none;
}

/* ── MEDIA ────────────────────────────────────────────────── */

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── FORM ELEMENTS BASE ───────────────────────────────────── */

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

/* ── HORIZONTAL RULE ──────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--border-light);
}

/* ── SELECTION ────────────────────────────────────────────── */

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

/* ── FOCUS VISIBLE GLOBAL ─────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ── CONTAINER ────────────────────────────────────────────── */

.container {
  max-width: var(--container-max);   /* 1280px */
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--wide {
  max-width: var(--container-wide);  /* 1440px — hero only */
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ── GRID SYSTEM ──────────────────────────────────────────── */

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-6);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

/* Grids collapse to 1 column below 768px — see responsive.css */

/* ── UTILITY CLASSES ──────────────────────────────────────── */

/* Visually hidden but accessible to screen readers */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Text alignment */
.u-text-center { text-align: center; }
.u-text-left   { text-align: left; }
.u-text-right  { text-align: right; }

/* Color utilities */
.u-text-accent  { color: var(--accent); }
.u-text-navy    { color: var(--text-primary); }
.u-text-inverse { color: var(--text-inverse); }
.u-text-muted   { color: var(--text-secondary); }

/* Spacing utilities */
.u-mt-auto { margin-top: auto; }
.u-mb-auto { margin-bottom: auto; }

/* ── SCROLL REVEAL INITIAL STATES ─────────────────────────── 
   JS (animations.js) adds/removes these via IntersectionObserver.
   Setting initial state in CSS here ensures no flash of
   unstyled content before JS initialises.
   prefers-reduced-motion override is in this block also.
──────────────────────────────────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transition:
    opacity var(--transition-slow),
    transform var(--transition-slow);
}

[data-reveal="up"] {
  transform: translateY(28px);
}

[data-reveal="left"] {
  transform: translateX(-28px);
}

[data-reveal="right"] {
  transform: translateX(28px);
}

[data-reveal="fade"] {
  transform: none;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── TICKER ANIMATION ─────────────────────────────────────── 
   Defined here so it exists before sections.css uses it.
──────────────────────────────────────────────────────────── */

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── COUNTER ANIMATION ────────────────────────────────────── */

@keyframes count-pulse {
  0%   { opacity: 0.6; transform: scale(0.96); }
  100% { opacity: 1;   transform: scale(1); }
}

/* ── MOBILE MENU ANIMATION ────────────────────────────────── */

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slide-out-right {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}