/* Base layer: Gilt palette (dark/light) + Outfit typography + layout.
   Matches arminoorata.com treatment. Status colors for PASS/FAIL/BORDERLINE/SKIP
   added below the theme palette since they're semantic and not part of the
   brand palette. */

html[data-theme="dark"] {
  --bg: #090b0f;
  --bg-alt: #0d1015;
  --surface: #11151b;
  --surface-alt: #151a21;
  --surface-soft: rgba(255, 255, 255, 0.018);
  --text: #f1ece3;
  --text-secondary: #b2aba0;
  --text-muted: #8b919d;
  --line: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --border-focus: #c4a44a;
  --accent: #c4a44a;
  --accent-strong: #d6b85f;
  --accent-soft: rgba(196, 164, 74, 0.14);
  --accent-light: rgba(196, 164, 74, 0.12);
  --button-fill: rgba(17, 21, 27, 0.95);
  --button-fill-strong: rgba(39, 33, 15, 0.82);
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);

  /* Status semantic colors (dark-optimized) */
  --green: #4ad07c;
  --green-bg: rgba(74, 208, 124, 0.1);
  --green-border: rgba(74, 208, 124, 0.3);
  --red: #ef6b6b;
  --red-bg: rgba(239, 107, 107, 0.1);
  --red-border: rgba(239, 107, 107, 0.3);
  --amber: #e0a73a;
  --amber-bg: rgba(224, 167, 58, 0.1);
  --amber-border: rgba(224, 167, 58, 0.35);
  --skip: #8b919d;
  --skip-bg: rgba(139, 145, 157, 0.08);
  --skip-border: rgba(139, 145, 157, 0.25);
}

html[data-theme="light"] {
  --bg: #f3efe7;
  --bg-alt: #ede8dd;
  --surface: #f7f3eb;
  --surface-alt: #efe9dd;
  --surface-soft: rgba(17, 21, 27, 0.022);
  --text: #15181d;
  --text-secondary: #4a4439;
  --text-muted: #666056;
  --line: rgba(21, 24, 29, 0.1);
  --border: rgba(21, 24, 29, 0.14);
  --border-focus: #9b7b24;
  --accent: #9b7b24;
  --accent-strong: #b8902f;
  --accent-soft: rgba(155, 123, 36, 0.14);
  --accent-light: rgba(155, 123, 36, 0.1);
  --button-fill: rgba(247, 243, 235, 0.96);
  --button-fill-strong: rgba(224, 205, 155, 0.52);
  --shadow-soft: 0 18px 48px rgba(21, 24, 29, 0.1);
  --shadow-sm: 0 1px 3px rgba(21, 24, 29, 0.08);
  --shadow-md: 0 4px 12px rgba(21, 24, 29, 0.1);

  --green: #1a8c5b;
  --green-bg: #e6f5ee;
  --green-border: #a7d9bf;
  --red: #c73a3a;
  --red-bg: #fce8e8;
  --red-border: #e6a5a5;
  --amber: #b07c10;
  --amber-bg: #fef5e0;
  --amber-border: #e6c97a;
  --skip: #666056;
  --skip-bg: #ece7db;
  --skip-border: #d3ccbf;
}

* {
  box-sizing: border-box;
}

html {
  font-optical-sizing: auto;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    transition:
      background-color 320ms cubic-bezier(0.22, 1, 0.36, 1),
      color 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.hidden { display: none !important; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* ── App header ────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.app-header-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.app-title:hover { color: var(--accent); }

.app-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.version {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover { border-color: var(--accent); }

.theme-icon-sun, .theme-icon-moon {
  position: absolute;
  opacity: 0;
  transform: rotate(-35deg) scale(0.75);
}

@media (prefers-reduced-motion: no-preference) {
  .theme-icon-sun, .theme-icon-moon {
    transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1), transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

html[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

html[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ── 9-dot nav menu (ported from arminoorata.com pattern) ──── */

.menu-cluster {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dot-button:hover { border-color: var(--accent); }

.dot-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dot-grid {
  width: 13px;
  height: 13px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.dot-grid span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.88;
}

.menu-links {
  position: absolute;
  right: 44px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
  white-space: nowrap;
  z-index: 20;
}

.menu-links a {
  position: relative;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  transform: translateX(8px);
  opacity: 0;
  padding-bottom: 3px;
}

.menu-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 50%;
  height: 1px;
  background: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .menu-links a::after {
    transition: left 320ms cubic-bezier(0.22, 1, 0.36, 1), right 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

.menu-links a:hover, .menu-links a:focus-visible {
  color: var(--text);
  outline: none;
}

.menu-links a:hover::after, .menu-links a:focus-visible::after {
  left: 0;
  right: 0;
}

.menu-cluster.open .menu-links {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.menu-cluster.open .menu-links a {
  transform: translateX(0);
  opacity: 1;
}

.menu-cluster.open .menu-links a:nth-child(1) { transition-delay: 40ms; }
.menu-cluster.open .menu-links a:nth-child(2) { transition-delay: 90ms; }
.menu-cluster.open .menu-links a:nth-child(3) { transition-delay: 140ms; }
.menu-cluster.open .menu-links a:nth-child(4) { transition-delay: 190ms; }
.menu-cluster.open .menu-links a:nth-child(5) { transition-delay: 240ms; }

@media (prefers-reduced-motion: no-preference) {
  .menu-links {
    transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1), transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .menu-links a {
    transition: opacity 240ms ease, transform 240ms ease, color 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@media (max-width: 760px) {
  .menu-links {
    right: 0;
    top: calc(100% + 10px);
    flex-direction: column;
    align-items: flex-start;
    width: 200px;
    padding: 16px 18px;
    gap: 14px;
    border-radius: 14px;
  }
  .menu-links a::after {
    left: 0;
    right: auto;
    width: 0;
  }
  @media (prefers-reduced-motion: no-preference) {
    .menu-links a::after {
      transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
    }
  }
  .menu-links a:hover::after, .menu-links a:focus-visible::after {
    right: auto;
    width: 100%;
  }
}

/* ── Top disclaimer notice ──────────────────────────────────── */

.topnotice {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  padding: 8px 24px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.topnotice strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.topnotice-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.topnotice-link:hover {
  border-bottom-style: solid;
}

/* ── Main container ─────────────────────────────────────────── */

.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* ── App footer ─────────────────────────────────────────────── */

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 24px 0 32px;
  margin-top: 48px;
}

.app-footer-inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 40px;
}

.footer-disclaimer {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0 0 24px;
  font-style: italic;
}

.footer-disclaimer strong {
  color: var(--text-secondary);
  font-style: normal;
  font-weight: 600;
}

/* Bottom strip — mirrors the fair/signs/arminoorata.com footer pattern.
   Attribution + tool description on the left, domain badge on the right. */
.footer-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (min-width: 768px) {
  .footer-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
}

.footer-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-meta p { margin: 0; }

.footer-meta a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-meta a:hover { color: var(--accent); }

.footer-version {
  margin-top: 6px !important;
  font-size: 12px;
}

.footer-version .mono {
  margin-left: 4px;
  opacity: 0.85;
}

.footer-domain {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .app-header-inner {
    padding: 12px 16px;
  }
  .app-main { padding: 16px 16px 40px; }
  .topnotice { padding: 8px 16px; font-size: 11px; }
  .app-footer-inner { padding: 0 16px; }
}

/* ── Print stylesheet ───────────────────────────────────────── */

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  .no-print, .app-header, .tab-bar, .progress-bar, .btn-row { display: none !important; }
  .app-main { max-width: none; padding: 0; }
  .tab-panel.hidden { display: none !important; }
}
