/* ============================================================
   base.css — ARIA design system
   Ported from the BookWare design language: dark-gray surfaces
   (never pure black), rounded corners, soft shadows, DM Sans /
   DM Serif Display, a single accent hue with semantic siblings.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  color-scheme: dark;

  /* ── Surfaces — dark gray, never pure black ── */
  --bg: #1a1a1e;
  --bg-card: #22222a;
  --bg-inset: #16161a;
  --bg-hover: #2a2a34;

  /* ── Borders ── */
  --border: #2d2d38;
  --border-strong: #3b3b48;

  /* ── Text ── */
  --text: #f0f0f0;
  --text-2: #b0b0be;
  --text-3: #6e6e80;

  /* ── Accent ──
     --accent-base is the raw brand hue; --accent-text is that hue
     re-lightened so accent-coloured TEXT stays legible on either
     background. Both are re-written at runtime by themes.js. */
  --accent-base: #f8291c;
  --accent: var(--accent-base);
  --accent-text: var(--accent-base);
  --accent-hover: #cb2015;
  --accent-bg: rgba(248, 41, 28, 0.1);
  --accent-border: rgba(248, 41, 28, 0.24);

  /* ── Semantic ── */
  --success-base: #2ecc71;
  --success: var(--success-base);
  --success-text: var(--success-base);
  --success-bg: rgba(46, 204, 113, 0.1);
  --success-border: rgba(46, 204, 113, 0.24);
  --danger-base: #f8291c;
  --danger: var(--danger-base);
  --danger-text: var(--danger-base);
  --danger-bg: rgba(248, 41, 28, 0.1);
  --danger-border: rgba(248, 41, 28, 0.24);
  --warning-base: #f39c12;
  --warning: var(--warning-base);
  --warning-text: var(--warning-base);
  --info-base: #2398e1;
  --info: var(--info-base);
  --info-text: var(--info-base);

  /* ── Radius ── */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);

  /* ── Typography ── */
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "DM Serif Display", Georgia, serif;
  --font-mono-stack: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;

  /* ── Composer ── */
  --input-h: 38px;

  /* ── Transitions ── */
  --tr: 0.18s ease;
  --tr-slow: 0.28s ease;

  /* ============================================================
     COMPATIBILITY LAYER
     ARIA stylesheets reference the old cyberpunk token names in
     ~800 places. Rather than rewrite every call site, each legacy
     name is aliased onto its design-system equivalent, so the whole
     app repaints from the tokens above.
     ============================================================ */

  /* Accent family (was the red neon ramp) */
  --red-core: var(--accent);
  --red-hot: var(--accent-hover);
  --red-neon: var(--accent-text);
  --red-deep: var(--accent-hover);
  --red-dim: var(--border);
  --red-ember: var(--warning);

  /* Surfaces */
  --bg-void: var(--bg);
  --bg-abyss: var(--bg-inset);
  --bg-panel: var(--bg-card);
  --bg-elevated: var(--bg-card);
  --bg-raised: var(--bg-hover);

  /* Text */
  --text-blaze: var(--text);
  --text-hot: var(--accent-text);
  --text-muted: var(--text-2);
  --text-dim: var(--text-3);

  /* Borders */
  --border-cut: var(--border);
  --border-glow: var(--accent-border);
  --border-live: var(--accent);

  /* Status */
  --status-success: var(--success);
  --status-warning: var(--warning);
  --status-error: var(--danger);

  /* Glows are now elevation shadows, not neon bloom */
  --glow-sm: var(--shadow-sm);
  --glow-md: var(--shadow);
  --glow-lg: var(--shadow-lg);
  --glow-ultra: var(--shadow-lg);

  /* Mode-driven knobs (themes.js overwrites these) */
  --radius-sm: var(--r-sm);
  --radius-md: var(--r);
  --radius-lg: var(--r-lg);
  --font-body: var(--font-sans);
  --font-head: var(--font-sans);
  --font-mono: var(--font-mono-stack);
  --text-spacing: 0;
  --cursor-style: default;
  --scanline-opacity: 0;
  --shadow-card: var(--shadow-sm);
  --anim-speed: 1;
}

/* ── LIGHT THEME ── */
html[data-theme="light"],
html.light-mode {
  color-scheme: light;
  --bg: #ffffff;
  --bg-card: #f5f5f8;
  --bg-inset: #ececf0;
  --bg-hover: #e4e4ea;
  --border: #dcdce8;
  --border-strong: #c6c6d4;
  --text: #18181b;
  --text-2: #4a4a58;
  --text-3: #8a8a9a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16);
}

/* ============================================================
   GLOBAL RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

button,
input,
select,
a,
textarea,
.homeCard,
.chatItem,
.voiceBtn {
  transition: background var(--tr), border-color var(--tr),
    box-shadow var(--tr), color var(--tr), transform var(--tr),
    opacity var(--tr);
}

/* ============================================================
   BODY
   ============================================================ */
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  cursor: default;
  position: relative;
}

/* The scanline + vignette overlays of the old theme are retired.
   Kept as no-op rules so nothing that targeted them breaks. */
body::before,
body::after {
  content: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1,
h2,
h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.15rem;
}
h3 {
  font-size: 0.95rem;
}

/* Display headings — the serif face, used for logos and hero titles */
.display,
.aboutLogo,
.bootAriaLogo,
.chatHeaderARIA {
  font-family: var(--font-display, var(--font-serif));
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

code,
pre,
kbd {
  font-family: var(--font-mono-stack);
}

/* Small uppercase section label, straight from BookWare */
.section-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent-text);
  font-weight: 600;
  margin-bottom: 10px;
}

.muted-text {
  color: var(--text-3);
}
.small-text {
  font-size: 0.72rem;
  line-height: 1.6;
}

/* ============================================================
   RETIRED EFFECTS
   The neon / glitch / bracket decorations are no longer part of
   the design language. The classes stay so markup keeps working.
   ============================================================ */
.neon {
  filter: none;
}

.glitch:hover {
  animation: none;
  text-shadow: none;
}

.bracket-corner::before,
.bracket-corner::after {
  content: none;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-full);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ============================================================
   SETTINGS BUTTON IN CHAT HEADER
   ============================================================ */
#ariaSettingsBtn {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-2);
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font-sans);
  letter-spacing: 0;
  flex-shrink: 0;
}
#ariaSettingsBtn:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
  background: var(--accent-bg);
}
#ariaSettingsBtn:active {
  transform: translateY(1px);
}
