/*
 * ÁLFAR QUEST — design tokens
 * ---------------------------------------------------------------------------
 * Values extracted from the band's official store (loja.alfarquest.com.br),
 * active colour scheme "Meia-noite". See docs/brand-reference/DESIGN-TOKENS.md
 * for provenance. These are FALLBACK defaults: at runtime the application
 * overrides them from the SiteSetting table so an administrator can retune the
 * palette in Admin -> Website Appearance without a redeploy.
 */

:root {
  /* ---- Brand colours ---------------------------------------------------- */
  --aq-primary: #6c8cff;
  --aq-primary-foreground: #0b1020;
  --aq-accent: #8ea3d6;

  /* ---- Touch targets (usability audit A11Y-06) -------------------------
     The hit area of an icon control on a touch screen, and the height of a
     link in a run of links (footer, inline "more"). The glyph keeps its size;
     the control grows by padding / min-size. */
  --aq-target: 44px;
  --aq-target-link: 32px;

  /* ---- Text ------------------------------------------------------------- */
  --aq-text-100: #f2f5ff;
  --aq-text-200: #dfe5f5;
  --aq-text-300: #b4bdd4;

  /* ---- Surfaces --------------------------------------------------------- */
  --aq-bg-100: #10152a;
  --aq-bg-200: #191f38;
  /* A raised surface on --aq-bg-200: the other person's bubble, a voice message, an avatar without a
     picture (DECISIONS #229). Derived, so it follows the surface the administrator picks. */
  --aq-bg-300: color-mix(in srgb, var(--aq-text-100) 9%, var(--aq-bg-200));
  --aq-footer-bg: #0b0f1e;
  --aq-footer-bottom-bg: #070a15;

  /* ---- Derived / translucent helpers ------------------------------------ */
  --aq-border: rgb(142 163 214 / 22%);
  /* The edge of a control (input, select, textarea, checkbox, switch): 3:1 or better on the page and card
     surfaces (WCAG 1.4.11, usability audit A11Y-05). --aq-border stays for dividers and decoration. The
     accent at 60% keeps it on the administrator's palette: it follows the accent they pick. */
  --aq-border-strong: color-mix(in srgb, var(--aq-accent) 60%, transparent);
  --aq-overlay: rgb(11 15 30 / 72%);
  --aq-shadow: 0 10px 30px rgb(0 0 0 / 35%);

  /* Lighter tint of the accent for text on dark imagery. Derived rather than
     fixed so it follows the accent the administrator picks. */
  --aq-accent-light: color-mix(in srgb, var(--aq-accent) 60%, white);
  --aq-accent-glow: 0 0 24px color-mix(in srgb, var(--aq-accent) 40%, transparent);

  /* ---- Status ------------------------------------------------------------
     Read across the stylesheets with a hard-coded fallback each, and the
     fallbacks disagreed (danger was #f85149 in one rule, #c0392b in another);
     defined once here (#300). Crimson is the brand's alert red, danger its
     semantic name; the -text variants are the readable tints on dark surfaces. */
  --aq-crimson: #d4204a;
  --aq-danger: #d4204a;
  --aq-danger-text: #ff8fa3;
  /* The edge of an outlined danger button (#304): ≥ 3:1 on every page surface, unlike the crimson fill colour. */
  --aq-danger-edge: #ea5876;
  --aq-success: #3fb950;
  --aq-success-text: #7ee2a8;
  --aq-warning: #c9a227;
  --aq-warning-text: #e8c25a;
  /* The "contacted" status of a quiz winner: a violet readable on the raised surface too (4.5:1 on --aq-bg-300). */
  --aq-contacted-text: #b6a2ff;

  /*
   * Typography. Poppins/DM Sans are the official store fonts; "Noto Sans"
   * and "Noto Sans JP" are appended because neither has Cyrillic or CJK
   * glyphs, and the site ships Russian and Japanese (docs/site-languages-plan.md).
   * The browser falls back glyph by glyph, so Latin text keeps the brand fonts.
   */
  --aq-font-primary: "Poppins", "Noto Sans", "Noto Sans JP", system-ui, sans-serif;
  --aq-font-secondary: "DM Sans", "Noto Sans", "Noto Sans JP", system-ui, sans-serif;

  /*
   * Fantasy display face for the public site's big titles, echoing the
   * engraved lettering of the logo. Not an admin setting: it is part of the
   * banner design. Cinzel has no Cyrillic: Russian titles fall to Cormorant SC,
   * engraved small capitals in the same spirit (Figma page 23, rule 5), and
   * Noto Sans JP still covers Japanese titles.
   */
  --aq-font-display: "Cinzel", "Cormorant SC", "Noto Sans JP", Georgia, serif;

  /* Small interface text (the share card's follow button). The primary face, by name (#300). */
  --aq-font-ui: var(--aq-font-primary);

  /* ---- Type scale ------------------------------------------------------- */
  --aq-text-xs: 0.75rem;
  --aq-text-sm: 0.875rem;
  --aq-text-base: 1rem;
  --aq-text-lg: 1.125rem;
  --aq-text-xl: 1.5rem;
  --aq-text-2xl: 2rem;
  --aq-text-3xl: 2.5rem;
  --aq-text-hero: clamp(2.25rem, 6vw, 4.5rem);

  /* ---- Spacing / layout -------------------------------------------------
     A 4px step, with 6px (1-5) for the tight gaps of chips and icon rows (usability audit UI-04, #270).
     Write padding, margin and gap with these rather than px literals. */
  --aq-space-1: 0.25rem;
  --aq-space-1-5: 0.375rem;
  --aq-space-2: 0.5rem;
  --aq-space-3: 0.75rem;
  --aq-space-4: 1rem;
  --aq-space-5: 1.25rem;
  --aq-space-6: 1.5rem;
  --aq-space-8: 2rem;
  --aq-space-10: 2.5rem;
  --aq-space-12: 3rem;
  --aq-space-16: 4rem;

  /* ---- Corner radii (usability audit UI-03, #270) -------------------------
     The whole scale: every border-radius in the stylesheets is one of these, 0, 50% (a circle) or inherit
     (RadiusScaleTests). Small controls and chips take sm, fields and buttons' boxes the base, cards md or lg,
     the feed card and the top of a bottom sheet xl, pills and round buttons the pill. */
  --aq-radius-sm: 4px;
  --aq-radius: 8px;
  --aq-radius-md: 12px;
  --aq-radius-lg: 16px;
  --aq-radius-xl: 20px;
  --aq-radius-pill: 999px;

  --aq-content-width: 1200px;
  --aq-header-height: 72px;

  --aq-transition: 180ms ease;

  /* ---- Timeline (TASK 02 phase 2; docs/timeline-redesign-plan.md; Figma page 46, concept A) ------
     The feed's own surfaces and text, chosen for the separation the brand palette lacks (card over page
     1,11:1 before): the Community Feed's darker ground, a card a step lighter with a soft shadow, a second
     surface for what sits inside a card (a quoted post, a song, a field), and text at AA or better on both
     (text 15,5:1, muted 6,7:1, link 7,8:1 on the card). Fixed by design, not retuned from the admin's palette. */
  --aq-feed-page: #090d18;
  --aq-feed-card: #161d33;
  --aq-feed-card-2: #222b47;
  --aq-feed-border: #3b4766;
  --aq-feed-border-strong: #7683ab; /* a field's edge inside a feed card: 3:1 on --aq-feed-card-2 */
  --aq-feed-border-soft: rgb(255 255 255 / 6%);
  --aq-feed-text: #f4f6ff;
  --aq-feed-text-2: #c9d1e8;
  --aq-feed-muted: #97a3c6;
  --aq-feed-link: #8fb0ff;
  --aq-feed-heart: #ff4d6d;
  --aq-feed-radius: var(--aq-radius-xl);
  --aq-feed-media-radius: var(--aq-radius-lg);
  --aq-feed-shadow: 0 10px 28px rgb(0 0 0 / 40%);
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --aq-transition: 0ms;
  }
}

/*
 * One focus ring for the whole site (WCAG 2.4.7, 2.4.11; usability audit A11Y-06): a 2px accent outline with a
 * glow, 3:1 or better on every surface. The first selector has no specificity so a component can still choose
 * its own ring; the second list is Bootstrap's own controls, whose `:focus { outline: 0 }` rules would
 * otherwise win (same specificity, this file loads after Bootstrap). A tabindex="-1" box (the page the
 * router focuses after a navigation, a sheet) is not a stop of its own: it gets no ring unless it is a link/button. Never remove an outline without
 * drawing an equivalent: a component that wants a different ring sets `outline` itself.
 */
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.form-range:focus-visible,
.btn:focus-visible,
.btn-check:focus-visible + .btn,
.nav-link:focus-visible,
.navbar-toggler:focus-visible,
.accordion-button:focus-visible,
.page-link:focus-visible,
.btn-close:focus-visible {
  outline: 2px solid var(--aq-accent);
  outline-offset: 2px;
  box-shadow: var(--aq-accent-glow);
}

.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  border-color: var(--aq-accent);
}
