/* QAVA Support — branding from docs/colors.md, fonts from the app (constants/theme.ts) */

:root {
  /* Light mode (default) */
  --bg: #fbf8f2;
  --card: #ffffff;
  --text: #0d0d0d;
  --text-secondary: #6c6b69;
  --accent: #c37d5d; /* Tertiary */
  --accent-soft: #ccb39d; /* Alternate */
  --accent-tint: rgba(195, 125, 93, 0.1);
  --border: rgba(13, 13, 13, 0.1);
  --error: #b32c1b;
  --success: #414931;

  --radius: 16px;
  --radius-sm: 12px;
  --maxw: 980px;
  --shadow: 0 1px 2px rgba(13, 13, 13, 0.04), 0 6px 24px rgba(13, 13, 13, 0.06);

  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
}

/* Dark-mode tokens. Applied when the OS prefers dark (unless the user forced
   light), or when the user explicitly chose dark via the header toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --card: #1e1f22;
    --text: #fbf8f2;
    --text-secondary: #a3a2a0;
    --accent: #ccb39d; /* dark-mode Tertiary */
    --accent-soft: #c37d5d;
    --accent-tint: rgba(204, 179, 157, 0.12);
    --border: rgba(251, 248, 242, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --card: #1e1f22;
  --text: #fbf8f2;
  --text-secondary: #a3a2a0;
  --accent: #ccb39d; /* dark-mode Tertiary */
  --accent-soft: #c37d5d;
  --accent-tint: rgba(204, 179, 157, 0.12);
  --border: rgba(251, 248, 242, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: var(--accent);
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}

/* logo is dark-on-transparent; lift it on dark backgrounds */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo {
    filter: invert(1) brightness(1.6);
  }
}
:root[data-theme="dark"] .brand-logo {
  filter: invert(1) brightness(1.6);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-link {
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
}
.header-link:hover {
  color: var(--accent);
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
/* Show the sun in dark mode (to switch to light), the moon in light mode */
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 48px);
  margin-bottom: 12px;
}

.hero-sub {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 28px;
}

/* ---------- Search ---------- */
.search-wrap {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 16px 48px 16px 50px;
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder {
  color: var(--text-secondary);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.search-clear:hover {
  color: var(--text);
  background: var(--accent-tint);
}

/* ---------- Migration banner ---------- */
.migration {
  margin: 24px 0 8px;
}

.migration .container {
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: var(--maxw);
}

.migration-tag .tag-mobile {
  display: none;
}

.migration-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.migration-heading {
  font-size: clamp(24px, 4vw, 32px);
  margin-bottom: 8px;
}

.migration-intro {
  color: var(--text-secondary);
  margin: 0 0 22px;
  max-width: 620px;
}

.migration-grid {
  display: grid;
  gap: 10px;
}

/* ---------- FAQ accordion ---------- */
.faqs {
  padding: 40px 0 8px;
}

.section-heading {
  font-size: clamp(22px, 4vw, 28px);
  margin-bottom: 8px;
}

.faq-group {
  margin-top: 28px;
}

.faq-group-title {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* migration cards reuse .faq-item but sit on the tinted band */
.migration-grid .faq-item {
  border-color: var(--accent-soft);
  /* grid gap handles spacing here; drop the inherited margin so the gap
     matches the regular FAQ list (10px) instead of stacking to ~24px */
  margin-bottom: 0;
}

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  padding: 18px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.faq-q:hover {
  color: var(--accent);
}

.faq-chevron {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-a {
  display: none;
  padding: 0 20px 20px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-line;
}
.faq-item.open .faq-a {
  display: block;
}

.faq-a a {
  color: var(--accent);
}

mark {
  background: var(--accent-tint);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.no-results {
  margin: 32px 0;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ---------- Contact form ---------- */
.contact {
  padding: 48px 0 64px;
}

.contact-inner {
  /* match the FAQ list width (--maxw) — .container already provides it */
}

.contact-sub {
  color: var(--text-secondary);
  margin: 8px 0 28px;
}

.contact-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.optional {
  font-weight: 400;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.field textarea {
  resize: vertical;
}
.field input.invalid,
.field textarea.invalid {
  border-color: var(--error);
}

/* honeypot — visually hidden, off-screen */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-primary {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 26px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.btn-primary:hover {
  opacity: 0.92;
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-status {
  margin: 0;
  font-size: 15px;
}
.form-status.error {
  color: var(--error);
}
.form-status.success {
  color: var(--success);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  .hero {
    padding: 40px 0 24px;
  }
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .migration .container {
    /* inset the box from the screen edges instead of full-bleed */
    width: auto;
    margin: 0 16px;
    padding: 24px 20px;
  }
  /* on mobile the banner reads as "Common Questions" */
  .migration-tag .tag-desktop {
    display: none;
  }
  .migration-tag .tag-mobile {
    display: inline;
  }
  .contact-form {
    padding: 20px;
  }
}
