/* ============================================================
   French with Ash — Base: reset, typography, layout, a11y
   Mobile-first. All colour/type/space via tokens.css.
   ============================================================ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* clear the sticky header on anchor jumps */
}

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-400);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

/* --- Headings & French text use Lora --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: var(--navy);
  line-height: var(--lh-tight);
  font-weight: var(--fw-semibold);
  text-wrap: balance;
}
:lang(fr), [lang="fr"], .fr { font-family: var(--font-fr); }

p, ul, ol, table, blockquote, figure, details { line-height: var(--lh-body); }

/* --- Links --- */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--color-link-hover); }

/* --- Lists --- */
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--sp-2); }

/* --- Generic tables (components override) --- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--color-border); }
th { font-weight: var(--fw-semibold); }

/* --- Inline code / reference strips --- */
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* --- Buttons (base) --- */
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  background: none;
  border: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-350);
  line-height: 1.1;
  border: 1.5px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  text-decoration: none;
}
.btn--primary { background: var(--navy); color: var(--on-navy); }
.btn--primary:hover { background: #243a64; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--hairline); }
.btn--ghost:hover { border-color: var(--navy); background: rgba(26,44,78,0.04); }
.btn--coral { /* large/bold display CTA only — text is ≥18px bold (AA large) */
  background: var(--coral);
  color: var(--on-coral);
  font-size: var(--fs-500);
  font-weight: var(--fw-bold);
  padding: 0.7rem 1.4rem;
}
.btn--coral:hover { background: #cf6646; }
.btn[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -100px;
  z-index: 100;
  background: var(--navy);
  color: var(--on-navy);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--sp-3); color: var(--on-navy); }

/* --- Site footer --- */
.site-footer {
  margin-top: var(--sp-8);
  border-top: var(--rule-w) solid var(--coral);
  background: var(--cream);
}
.site-footer__inner {
  padding-block: var(--sp-6);
  color: var(--color-text-muted);
  font-size: var(--fs-350);
  text-align: center;
}
.site-footer__sig {
  font-family: var(--font-head);
  font-style: italic;
  color: var(--navy);
  font-size: var(--fs-500);
}

/* --- Focus visibility (a11y) --- */
:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Pressed/within-card controls get a softer ring that reads on cream */
.card__flip:focus-visible,
.audio:focus-visible { outline-offset: 3px; }

/* --- Selection --- */
::selection { background: rgba(217,119,87,0.25); }

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

/* English content that the global toggle can hide (FR-4).
   Marked on every gloss, translation, and card back. */
html.fwa-hide-en .en { display: none !important; }
html.fwa-hide-en .en--inline { display: none !important; }
/* A small marker shown in place of hidden English where useful */
.en-hidden-note { display: none; color: var(--grey); font-style: italic; font-size: var(--fs-350); }
html.fwa-hide-en .en-hidden-note { display: inline; }

/* --- Reduced motion: kill all non-essential animation --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Print: show everything, drop interactive chrome --- */
@media print {
  .site-header, .audio, .deck__controls, .conj__quiz-toggle, .exercise__check, .skip-link { display: none !important; }
  html.fwa-hide-en .en { display: revert !important; }
}
