/* ==========================================================================
   Chatoshi QA Dashboard — shared design tokens & components
   Used by index.html and tests.html
   ========================================================================== */

:root {
  /* Brand */
  --brand: #FF8D00;
  --brand-deep: #EA580C;
  --brand-darker: #C2410C;
  --brand-light: #FFEDD5;

  /* Surfaces */
  --bg: #FBF8F3;
  --surface: #FFFFFF;
  --surface-soft: #FFF9F1;

  /* Text */
  --ink: #1C1917;
  --ink-soft: #44403C;
  --muted: #78716C;
  --faint: #A8A29E;

  /* Borders */
  --border: #F0E4D2;
  --border-strong: #E7D5B8;

  /* Semantic */
  --success: #059669;
  --success-bg: #D1FAE5;
  --success-strong: #10B981;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --warning-strong: #F59E0B;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --purple: #6D28D9;
  --purple-bg: #EDE9FE;
  --pink: #BE185D;
  --pink-bg: #FCE7F3;
  --teal: #0F766E;
  --teal-bg: #CCFBF1;

  /* Shape */
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(28,25,23,0.05);
  --shadow-sm: 0 2px 8px -2px rgba(28,25,23,0.07), 0 1px 2px rgba(28,25,23,0.04);
  --shadow-md: 0 8px 24px -8px rgba(28,25,23,0.12), 0 2px 6px -2px rgba(28,25,23,0.06);
  --shadow-brand: 0 20px 45px -14px rgba(234,88,12,0.35), 0 8px 18px -10px rgba(28,25,23,0.12);

  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

/* subtle warm mesh backdrop — adds depth without competing with content */
body {
  background-image:
    radial-gradient(560px circle at 92% -6%, rgba(255,141,0,0.09), transparent 60%),
    radial-gradient(480px circle at -6% 18%, rgba(255,141,0,0.06), transparent 55%);
  background-attachment: fixed;
}

a { color: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

::selection { background: var(--brand-light); color: var(--brand-darker); }

:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 248, 243, 0.82);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.topnav-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}
.topnav-brand-text {
  font-family: 'Onest', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topnav-brand-text span { color: var(--brand-deep); }
.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
}
.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.topnav-link:hover { color: var(--brand-darker); background: var(--brand-light); }
.topnav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 4px 10px -3px rgba(234,88,12,0.5);
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #FF8D00 0%, #FB923C 48%, #F97316 100%);
  color: white;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-brand);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(420px circle at 8% -10%, rgba(255,255,255,0.16), transparent 60%),
    radial-gradient(360px circle at 104% 110%, rgba(0,0,0,0.12), transparent 55%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at 85% 15%, black, transparent 65%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.6);
  animation: pulse-dot 2.2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); }
  70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.hero h1 {
  font-family: 'Onest', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}
.hero p {
  opacity: 0.96;
  position: relative;
  z-index: 1;
}
.hero-meta {
  display: flex;
  gap: 22px;
  font-size: 13.5px;
  opacity: 0.94;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.hero-meta span { display: flex; align-items: center; gap: 6px; }

/* ---------- Section headings ---------- */
.section-title {
  font-family: 'Onest', 'Inter', sans-serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 52px 0 6px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 22px;
}
.section-link {
  color: var(--brand-deep);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s var(--ease), color 0.2s var(--ease);
}
.section-link:hover { gap: 8px; color: var(--brand-darker); }

/* ---------- Generic surface card ---------- */
.surface {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease),
    background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.surface-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 13px;
}
.footer-nav { display: flex; gap: 18px; }
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}
.footer-nav a:hover { color: var(--brand-deep); }

/* ---------- Motion ---------- */
.reveal {
  animation: reveal-up 0.6s var(--ease) both;
}
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal-delay-1 { animation-delay: 0.06s; }
.reveal-delay-2 { animation-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .live-dot { animation: none; }
  * { transition-duration: 0.001ms !important; }
}

@media (max-width: 768px) {
  .container { padding: 20px 16px 40px; }
  .topnav-brand-text { display: none; }
  .section-title { font-size: 21px; margin-top: 40px; }
}

/* ==========================================================================
   Dark mode
   ========================================================================== */
:root[data-theme="dark"] {
  --bg: #181613;
  --surface: #211E1A;
  --surface-soft: #26221D;

  --ink: #F2ECE3;
  --ink-soft: #D3C9BC;
  --muted: #9C9186;
  --faint: #6B6259;

  --border: #332D26;
  --border-strong: #474036;

  --brand: #FF9A1F;
  --brand-deep: #FFA94D;
  --brand-darker: #FFCB8A;
  --brand-light: #3A2A16;

  --success: #34D399;
  --success-bg: #16281F;
  --success-strong: #10B981;
  --danger: #F87171;
  --danger-bg: #2C1518;
  --warning: #FBBF24;
  --warning-bg: #2B2210;
  --warning-strong: #F59E0B;
  --info: #60A5FA;
  --info-bg: #17233A;
  --purple: #A78BFA;
  --purple-bg: #241B3D;
  --pink: #F472B6;
  --pink-bg: #34182A;
  --teal: #2DD4BF;
  --teal-bg: #102A28;
}

[data-theme="dark"] .topnav {
  background: rgba(24, 22, 19, 0.82);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
  font-size: 16px;
  padding: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.32); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .ti-moon { display: none; }
[data-theme="dark"] .theme-toggle .ti-sun { display: none; }
[data-theme="dark"] .theme-toggle .ti-moon { display: inline-block; }
