/* ==========================================================================
   GAU - THEME & CORE DESIGN SYSTEM
   Supports Light & Dark Modes via CSS Variables
   ========================================================================== */

:root,
[data-theme="light"] {
  /* Surface & Backgrounds */
  --bg-page: #eeeeee;
  --bg-page-gradient: radial-gradient(ellipse 1400px 900px at 0% 0%, #ffffff 0%, #eeeeee 55%);
  --bg-card: #ffffff;
  --bg-card-subtle: #f8f8f8;
  --bg-surface: #ffffff;
  --bg-secondary: #e5e5e5;
  --bg-table-header: #eaeaea;
  --bg-code: #ececec;
  --bg-overlay: rgba(238, 238, 238, 0.82);
  --bg-modal: #ffffff;

  /* Typography & Colors */
  --text-primary: #202020;
  --text-secondary: #4a4a4a;
  --text-muted: #575757;
  --text-subtle: #707070;
  --text-inverse: #ffffff;

  /* Borders & Dividers */
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-divider: #d7d7d7;
  --border-table: #cccccc;
  --border-card: rgba(0, 0, 0, 0.06);
  --border-input: #d0d0d0;

  /* Brand Accents */
  --accent-red: #d0354a;
  --accent-red-hover: #b32437;
  --accent-red-light: #f0dde1;
  --accent-blue: #2563eb;

  /* Topnav & Glassmorphism */
  --topnav-bg: #eeeeee;
  --topnav-tint: linear-gradient(to top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 100%);
  --topnav-btn-bg: #ffffff;
  --topnav-btn-color: #272727;
  --topnav-btn-hover-bg: #f0f0f0;

  /* Hero & Effects */
  --hero-watermark-from: #868686;
  --hero-watermark-to: #dbdbdb;

  /* Shadows */
  --shadow-card: 0px 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-card-large: 0px 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-dropdown: 0 12px 28px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 4px 6px rgba(0, 0, 0, 0.16);

  /* Footer */
  --footer-bg: #272727;
  --footer-text: #d7d7d7;
  --footer-title: #ffffff;

  /* Keycaps */
  --kbd-border: #141414;
  --kbd-bg: #eaeaea;
  --kbd-color: #202020;
}

[data-theme="dark"] {
  /* Surface & Backgrounds */
  --bg-page: #131417;
  --bg-page-gradient: radial-gradient(ellipse 1400px 900px at 0% 0%, #1e2026 0%, #131417 55%);
  --bg-card: #1c1d22;
  --bg-card-subtle: #24262d;
  --bg-surface: #1c1d22;
  --bg-secondary: #282a32;
  --bg-table-header: #26272e;
  --bg-code: #282930;
  --bg-overlay: rgba(15, 16, 19, 0.86);
  --bg-modal: #1c1d22;

  /* Typography & Colors */
  --text-primary: #f0f0f3;
  --text-secondary: #c0c3ce;
  --text-muted: #8e929f;
  --text-subtle: #757987;
  --text-inverse: #131417;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-divider: #2d2f38;
  --border-table: #333640;
  --border-card: rgba(255, 255, 255, 0.06);
  --border-input: #3b3e4a;

  /* Brand Accents */
  --accent-red: #e0465c;
  --accent-red-hover: #f0586e;
  --accent-red-light: rgba(224, 70, 92, 0.2);
  --accent-blue: #3b82f6;

  /* Topnav & Glassmorphism */
  --topnav-bg: #1c1d22;
  --topnav-tint: linear-gradient(to top, rgba(19, 20, 23, 0) 0%, rgba(19, 20, 23, 0.85) 100%);
  --topnav-btn-bg: #282a32;
  --topnav-btn-color: #f0f0f3;
  --topnav-btn-hover-bg: #353842;

  /* Hero & Effects */
  --hero-watermark-from: #2e303a;
  --hero-watermark-to: #18191e;

  /* Shadows */
  --shadow-card: 0px 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-card-large: 0px 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-dropdown: 0 12px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-btn: 0 4px 8px rgba(0, 0, 0, 0.3);

  /* Footer */
  --footer-bg: #0d0d0f;
  --footer-text: #9699a6;
  --footer-title: #f0f0f3;

  /* Keycaps */
  --kbd-border: #3b3e4a;
  --kbd-bg: #282a32;
  --kbd-color: #f0f0f3;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Surface & Backgrounds */
    --bg-page: #131417;
    --bg-page-gradient: radial-gradient(ellipse 1400px 900px at 0% 0%, #1e2026 0%, #131417 55%);
    --bg-card: #1c1d22;
    --bg-card-subtle: #24262d;
    --bg-surface: #1c1d22;
    --bg-secondary: #282a32;
    --bg-table-header: #26272e;
    --bg-code: #282930;
    --bg-overlay: rgba(15, 16, 19, 0.86);
    --bg-modal: #1c1d22;

    /* Typography & Colors */
    --text-primary: #f0f0f3;
    --text-secondary: #c0c3ce;
    --text-muted: #8e929f;
    --text-subtle: #757987;
    --text-inverse: #131417;

    /* Borders & Dividers */
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-divider: #2d2f38;
    --border-table: #333640;
    --border-card: rgba(255, 255, 255, 0.06);
    --border-input: #3b3e4a;

    /* Brand Accents */
    --accent-red: #e0465c;
    --accent-red-hover: #f0586e;
    --accent-red-light: rgba(224, 70, 92, 0.2);
    --accent-blue: #3b82f6;

    /* Topnav & Glassmorphism */
    --topnav-bg: #1c1d22;
    --topnav-tint: linear-gradient(to top, rgba(19, 20, 23, 0) 0%, rgba(19, 20, 23, 0.85) 100%);
    --topnav-btn-bg: #282a32;
    --topnav-btn-color: #f0f0f3;
    --topnav-btn-hover-bg: #353842;

    /* Hero & Effects */
    --hero-watermark-from: #2e303a;
    --hero-watermark-to: #18191e;

    /* Shadows */
    --shadow-card: 0px 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-card-large: 0px 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-dropdown: 0 12px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-btn: 0 4px 8px rgba(0, 0, 0, 0.3);

    /* Footer */
    --footer-bg: #0d0d0f;
    --footer-text: #9699a6;
    --footer-title: #f0f0f3;

    /* Keycaps */
    --kbd-border: #3b3e4a;
    --kbd-bg: #282a32;
    --kbd-color: #f0f0f3;
  }
}

/* ==========================================================================
   CSS RESET & BASE STYLES
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  font-family: 'Barlow', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body,
.page-bg,
.hero-watermark,
.topnav-outer,
.topnav-tint,
.topnav,
.footer,
.feature-card,
.highlights-bar,
.news-latest-card,
.faq-list,
.faq-item,
.versions-card,
.versions-overlay,
.theme-toggle-btn,
.topnav-toggle,
.keyboard-case,
.keycap,
.key-face,
.card,
.kanban-col,
.btn-action,
.btn-filter,
.help-card,
.help-sidebar,
.changelog,
.changelog-entry,
.legal-card {
  transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              stroke 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              fill 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page {
  position: relative;
  overflow: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Background gradient */
.page-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 640px;
  background: var(--bg-page-gradient);
  z-index: 0;
  pointer-events: none;
}

/* Background wordmark */
.hero-watermark {
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: -116px;
  transform: translateX(-50%);
  text-align: center;
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(120px, 33vw, 256px);
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(to bottom, var(--hero-watermark-from), var(--hero-watermark-to));
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
  user-select: none;
  transition: background 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TOPNAV & NAVIGATION
   ========================================================================== */

.topnav-outer {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

/* Progressive blur */
.topnav-blur {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.topnav-blur span {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(var(--b));
  backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(to top, transparent var(--m0), #000 var(--m1), #000 var(--m2), transparent var(--m3));
  mask-image: linear-gradient(to top, transparent var(--m0), #000 var(--m1), #000 var(--m2), transparent var(--m3));
}

.topnav-blur span:nth-child(1) { --b: .2px; --m0: -25%; --m1: 0%; --m2: 12.5%; --m3: 25%; }
.topnav-blur span:nth-child(2) { --b: 0.4px; --m0: -12.5%; --m1: 12.5%; --m2: 25%; --m3: 37.5%; }
.topnav-blur span:nth-child(3) { --b: 0.8px; --m0: 0%; --m1: 25%; --m2: 37.5%; --m3: 50%; }
.topnav-blur span:nth-child(4) { --b: 1.6px; --m0: 12.5%; --m1: 37.5%; --m2: 50%; --m3: 62.5%; }
.topnav-blur span:nth-child(5) { --b: 3px; --m0: 25%; --m1: 50%; --m2: 62.5%; --m3: 75%; }
.topnav-blur span:nth-child(6) { --b: 6px; --m0: 37.5%; --m1: 62.5%; --m2: 75%; --m3: 87.5%; }
.topnav-blur span:nth-child(7) { --b: 12px; --m0: 50%; --m1: 75%; --m2: 87.5%; --m3: 100%; }
.topnav-blur span:nth-child(8) { --b: 24px; --m0: 62.5%; --m1: 87.5%; --m2: 100%; --m3: 112.5%; }

.topnav-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--topnav-tint);
  transition: background 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.topnav-bar {
  display: flex;
  position: relative;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  max-width: 768px;
  margin: 0 auto;
  padding: 12px 20px 28px;
}

.topnav-logo {
  display: block;
  width: 40px;
  height: 40px;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--topnav-btn-bg);
  color: var(--topnav-btn-color);
  border-radius: 128px;
  border: 1px solid var(--border-subtle);
  padding: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn:hover {
  transform: scale(1.05);
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  transition: transform 0.3s ease;
}

.theme-toggle-btn .icon-sun {
  display: none;
}

.theme-toggle-btn .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-btn .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle-btn .icon-moon {
    display: none;
  }
}

/* Menu toggle button (Hamburger) */
.topnav-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--topnav-btn-bg);
  border-radius: 128px;
  border: 1px solid var(--border-subtle);
  padding: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.topnav-toggle:hover {
  transform: scale(1.05);
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.topnav-toggle:hover span {
  background: #ffffff;
}

.topnav-toggle:active {
  transform: scale(0.95);
}

.topnav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--topnav-btn-color);
  border-radius: 8px;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.topnav-toggle.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.topnav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.topnav-toggle.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Navigation dropdown */
.topnav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  max-width: none;
  padding: 4px 20px 16px;
  background: var(--topnav-bg);
  box-shadow: var(--shadow-dropdown);
  border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 769px) {
  .topnav {
    top: 58px;
    left: auto;
    right: max(20px, calc((100% - 768px) / 2 + 20px));
    width: 240px;
    margin-top: 0;
    padding: 6px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-dropdown);
  }
}

.topnav.mobile-open {
  display: flex;
}

.topnav a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  padding: 14px 4px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.topnav a:last-child {
  border-bottom: none;
}

.topnav a:hover,
.topnav a.active {
  color: var(--accent-red);
}

/* Accessibility */
.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;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
  width: 100%;
  background: var(--footer-bg);
  padding: 32px 0;
  position: relative;
  z-index: 1;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  transition: background-color 0.25s ease;
}

.footer-inner {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 64px;
  align-items: flex-start;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.footer-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: block;
}

.footer-copyright {
  font-size: 12px;
  color: var(--footer-text);
}

/* Link ẩn tới trang tải bản QC nội bộ (web/qc.html) — CỐ Ý cùng màu/cỡ chữ y
   hệt dòng copyright ngay trên (không nổi bật như link thường), không quảng
   bá, chỉ để Dizzy tự chỉ chỗ cho người được mời test QC bấm vào (xem
   web/qc.html, noindex/nofollow). */
.footer-qc-link {
  font-size: 12px;
  color: var(--footer-text);
  text-decoration: none;
}

.footer-qc-link:hover {
  text-decoration: underline;
}

.footer-spacer {
  flex: 1 0 0;
  align-self: stretch;
}

.footer-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--footer-title);
}

.footer-col a {
  font-size: 12px;
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: #ffffff;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-wrap: wrap;
    gap: 24px;
  }

  .footer-spacer {
    display: none;
  }
}
