/* ==========================================================================
   ChaiJi — Zinc 设计系统
   --------------------------------------------------------------------------
   1. Tokens        2. Reset & base      3. Layout
   4. Topbar        5. Hero              6. Section head
   7. Metrics       8. Product matrix    9. CTA
   10. Footer       11. Buttons         12. Modal
   13. Toast        14. Atmosphere      15. Motion          16. Responsive
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f4f4f5;

  --text: #18181b;
  --text-soft: #3f3f46;
  --muted: #52525b;
  --faint: #a1a1aa;

  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --hairline: #ededef;
  --dim: #71717a;
  --contact-fill: #f4f4f5;

  --solid: #18181b;
  --solid-hover: #27272a;
  --solid-text: #fafafa;

  --ring: #18181b;
  --overlay: rgba(0, 0, 0, 0.22);
  --shadow-modal: 0 32px 80px -32px rgba(9, 9, 11, 0.42), 0 2px 10px rgba(9, 9, 11, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #09090b;
  --surface: #18181b;
  --surface-muted: #27272a;

  --text: #fafafa;
  --text-soft: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;

  --border: #27272a;
  --border-strong: #3f3f46;

  --hairline: #222226;
  --dim: #a1a1aa;
  --contact-fill: #222226;

  --solid: #fafafa;
  --solid-hover: #e4e4e7;
  --solid-text: #18181b;

  --ring: #a1a1aa;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-modal: 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* ---------- 2. Reset & base --------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.32s var(--ease), color 0.32s var(--ease);
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--solid);
  color: var(--solid-text);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.skip-link:focus-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.noscript {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 3. Layout ---------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 580px;
  margin: auto 0;
  padding: 48px 24px;
}

/* ---------- 4. Topbar ---------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  border-radius: 8px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.03em;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
}

.icon-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.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;
}

/* ---------- 5. Hero & pills --------------------------------------------- */
/* ---------- 5. Hero ------------------------------------------------------ */
.hero {
  margin-top: 48px;
}

.hero-lines {
  max-width: 580px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: 0;
  text-wrap: pretty;
}

.hero-line + .hero-line {
  margin-top: 12px;
}

.hero-line--lead {
  color: var(--text);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.6;
}

.hero-name {
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- 6. Section head --------------------------------------------- */
.overview {
  margin-top: 40px;
}

.section-head {
  margin-bottom: 14px;
}

.slash-title {
  margin: 0;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- 7. Metrics --------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.metric {
  min-width: 0;
  padding: 0;
}

.metric + .metric {
  border-left: 0;
}

.metric-value {
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.5;
}

.metric-note {
  margin-top: 1px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------- 8. Capabilities ---------------------------------------------- */
.capabilities {
  display: flex;
  flex-direction: column;
  gap: 34px;
  margin-top: 40px;
}

.capability {
  min-width: 0;
}

.capability-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.capability-description {
  max-width: 580px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.8;
  text-wrap: pretty;
}

.capability-cases {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.cases-label {
  flex: none;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.6;
}

.case-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.case-pill:hover {
  background: var(--border);
}

.case-pill:focus-visible {
  outline-offset: 2px;
}

.case-pill-arrow {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}

.case-pill:hover .case-pill-arrow {
  color: var(--text);
  transform: translate(1px, -1px);
}

.case-pill--soon {
  border-color: var(--border-strong);
  border-style: dashed;
  background: transparent;
  color: var(--dim);
  cursor: default;
}

.case-pill--soon:hover {
  background: transparent;
}

/* ---------- 9. CTA ------------------------------------------------------- */
.cta {
  margin-top: 44px;
}

.cta-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.8;
  text-wrap: pretty;
}

.cta .btn {
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.5px;
}

/* ---------- 10. Footer --------------------------------------------------- */
.footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px dashed var(--hairline);
}

.footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.status {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.status-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: status-pulse 2.4s ease-in-out infinite;
}

.status-text {
  color: #71717a;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.18s var(--ease);
}

.status:hover .status-text,
.status:focus-visible .status-text {
  color: var(--text);
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

:root[data-theme="dark"] .status-text {
  color: #a1a1aa;
}

.footer-right {
  display: flex;
  align-items: center;
}

.footer-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s var(--ease);
}

.footer-icon:hover {
  transform: translateY(-1px);
}

.footer-icon svg {
  display: block;
}

.footer-icon--x {
  color: #000000;
}

.footer-icon--x svg {
  width: 18px;
  height: 18px;
}

.footer-icon--xhs svg {
  width: 20px;
  height: 20px;
}

:root[data-theme="dark"] .footer-icon--x {
  color: #fafafa;
}

/* ---------- 11. Buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn-solid {
  background: var(--solid);
  color: var(--solid-text);
}

.btn-solid:hover {
  background: var(--solid-hover);
}

.btn-ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text-soft);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
}

.btn-arrow {
  font-family: var(--font-mono);
  font-size: 12px;
  transition: transform 0.18s var(--ease);
}

.btn:hover .btn-arrow {
  transform: translate(2px, -2px);
}

/* ---------- 12. Modal ---------------------------------------------------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 780px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

dialog.modal:not([open]) {
  display: none;
}

dialog.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog.modal[open] {
  animation: modal-in 0.34s var(--ease-out) both;
}

dialog.modal[open]::backdrop {
  animation: fade-in 0.26s var(--ease) both;
}

.modal-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.modal-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px 22px;
  border-bottom: 0;
}

.kicker {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-close {
  flex: none;
  width: 30px;
  height: 30px;
}

.modal-close svg {
  width: 15px;
  height: 15px;
  transition: transform 0.24s var(--ease);
}

.modal-close:hover svg {
  transform: rotate(90deg);
}

.modal-body {
  flex: 1 1 auto;
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--border-strong);
}

/* Contact modal — frameless light card */
.modal.modal--contact {
  width: min(400px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] .modal.modal--contact {
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

.modal.modal--contact .modal-body {
  padding: 24px 26px;
}

.contact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.contact-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.contact-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: -3px;
  margin-right: -4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.18s var(--ease);
}

.contact-close:hover {
  color: var(--text);
}

.contact-intro {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
  text-wrap: pretty;
}

.contact-email {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--contact-fill);
}

.contact-email-address {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-email-address:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-copy {
  flex: none;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: var(--solid);
  color: var(--solid-text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), opacity 0.18s var(--ease);
}

.contact-copy:hover {
  background: var(--solid-hover);
}

.contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.contact-social {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s var(--ease);
}

.contact-social:hover {
  background: var(--border);
}

.contact-social-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.contact-social-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.contact-social-handle {
  line-height: 1.5;
}

.contact-social-arrow {
  color: var(--faint);
  font-size: 11px;
  line-height: 1;
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}

.contact-social:hover .contact-social-arrow {
  color: var(--text);
  transform: translate(1px, -1px);
}

.modal-title {
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.modal-lede {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
  text-wrap: pretty;
}

.shot {
  margin-top: 20px;
}

.shot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  aspect-ratio: 16 / 9;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
  text-align: center;
}

.shot-mark {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.16em;
}

.shot-hint {
  max-width: 30ch;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.65;
  text-wrap: pretty;
}

.shot-img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.shot-caption {
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.case-block {
  margin-top: 24px;
}

.micro-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.1em;
}

.case-block > .micro-label {
  margin-bottom: 10px;
}

.pain-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pain {
  display: flex;
  gap: 10px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.75;
}

.pain-index {
  flex: none;
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.06em;
}

.pain-text {
  text-wrap: pretty;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 26px -22px -22px;
  padding: 16px 22px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- 13. Toast ---------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 9px 15px;
  border-radius: 9px;
  background: var(--solid);
  color: var(--solid-text);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 10px 34px -12px rgba(9, 9, 11, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.toast--embedded {
  position: absolute;
  bottom: 14px;
  z-index: 5;
}

/* ---------- 14. Atmosphere ---------------------------------------------- */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.atmosphere-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.72) 26%,
    rgba(0, 0, 0, 0.38) 54%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.72) 26%,
    rgba(0, 0, 0, 0.38) 54%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
  mask-mode: alpha;
  -webkit-mask-source-type: alpha;
}

:root[data-theme="dark"] .atmosphere-canvas {
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.78) 45%,
    rgba(0, 0, 0, 0.35) 80%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.78) 45%,
    rgba(0, 0, 0, 0.35) 80%,
    transparent 100%
  );
}

.atmosphere-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: var(--grain-opacity, 0.1);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

/* Soft central scrim: keeps the reading column legible at 100% clouds. */
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(
    ellipse 68% 60% at 50% 48%,
    rgba(255, 255, 255, 0.58) 0%,
    rgba(255, 255, 255, 0.22) 52%,
    transparent 100%
  );
  pointer-events: none;
}

:root[data-theme="dark"] .atmosphere::after {
  background: radial-gradient(
    ellipse 68% 60% at 50% 48%,
    rgba(9, 9, 11, 0.24) 0%,
    rgba(9, 9, 11, 0.08) 52%,
    transparent 100%
  );
}

.atmosphere-toggle.is-active {
  color: var(--text);
  background: var(--surface-muted);
}

body.atm-dragging {
  user-select: none;
}

/* Physical mini panel — intentionally dark in both themes */
.atm-panel {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 60;
  width: 236px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, #222226 0%, #18181b 46%, #141416 100%);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #f4f4f5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transform-origin: top right;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease-out), visibility 0.2s;
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 transparent;
}

.atm-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.atm-panel::-webkit-scrollbar {
  width: 6px;
}

.atm-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #3f3f46;
}

.atm-panel :focus-visible {
  outline: 2px solid #a1a1aa;
  outline-offset: 2px;
}

.atm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 2px 10px;
}

.atm-panel-title {
  color: #71717a;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.06em;
}

.atm-panel-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3f3f46;
  transition: background-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.atm-panel.is-open .atm-panel-led {
  background: #10b981;
  box-shadow: 0 0 7px rgba(16, 185, 129, 0.65);
}

.atm-control {
  display: block;
  margin-top: 13px;
}

.atm-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.atm-label {
  color: #71717a;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.06em;
}

.atm-value {
  color: #a1a1aa;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.atm-control--knob .atm-control-head {
  margin-bottom: 2px;
}

.atm-knob {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 2px auto 0;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}

.atm-knob.is-dragging {
  cursor: grabbing;
}

.atm-knob-ticks {
  position: absolute;
  inset: 0;
}

.atm-knob-tick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.38);
  transform-origin: center;
}

.atm-knob-dial {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, #3a3a40 0%, #242428 42%, #141416 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), inset 0 -6px 12px rgba(0, 0, 0, 0.65),
    0 7px 14px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--atm-angle, -48deg));
}

.atm-knob-dial::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #0d0d0f;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.22);
}

.atm-knob-indicator {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 2px;
  height: 13px;
  margin-left: -1px;
  border-radius: 2px;
  background: #fafafa;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.42);
}

.atm-range {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.atm-range::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: #27272a;
}

.atm-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #fafafa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  -webkit-appearance: none;
  appearance: none;
}

.atm-range::-moz-range-track {
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: #27272a;
}

.atm-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fafafa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.atm-range--spectrum::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #ff8f8f 0%, #ffc72e 17%, #8de36b 34%, #68e0d0 51%, #6aa8ff 68%, #b28dff 84%, #ff8fce 100%);
}

.atm-range--spectrum::-moz-range-track {
  background: linear-gradient(90deg, #ff8f8f 0%, #ffc72e 17%, #8de36b 34%, #68e0d0 51%, #6aa8ff 68%, #b28dff 84%, #ff8fce 100%);
}

.atm-range--grain::-webkit-slider-runnable-track {
  background: repeating-linear-gradient(90deg, #52525b 0 1px, #27272a 1px 4px);
}

.atm-range--grain::-moz-range-track {
  background: repeating-linear-gradient(90deg, #52525b 0 1px, #27272a 1px 4px);
}

.atm-range--stars::-webkit-slider-runnable-track {
  background: radial-gradient(circle at 3px 50%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.4px) 0 0 / 10px 6px,
    #202027;
}

.atm-range--stars::-moz-range-track {
  background: radial-gradient(circle at 3px 50%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.4px) 0 0 / 10px 6px,
    #202027;
}

.atm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}

.atm-theme {
  display: flex;
  align-items: center;
  gap: 6px;
}

.atm-theme-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3f3f46;
  transition: background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.atm-theme-led.is-night {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.atm-switch {
  display: flex;
  flex: none;
  align-items: center;
  width: 36px;
  height: 20px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: #0b0b0d;
  cursor: pointer;
}

.atm-switch-thumb {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d4d4d8;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}

.atm-switch[aria-checked="true"] .atm-switch-thumb {
  background: #10b981;
  transform: translateX(16px);
}

.atm-reset {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: transparent;
  color: #a1a1aa;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.atm-reset:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: #fafafa;
}

@media (max-width: 1120px) {
  .atm-panel {
    top: auto;
    right: auto;
    bottom: 20px;
    left: 50%;
    max-height: calc(100svh - 40px);
    transform: translate(-50%, 10px);
    transform-origin: bottom center;
  }

  .atm-panel.is-open {
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .atm-panel,
  .atm-panel-led,
  .atm-knob-dial,
  .atm-switch-thumb {
    transition: none;
  }
}

/* ---------- 15. Motion --------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

[data-reveal] {
  animation: rise 0.78s var(--ease-out) both;
  animation-delay: calc(var(--reveal, 0) * 65ms + 40ms);
}

/* ---------- 16. Responsive ---------------------------------------------- */
@media (max-width: 560px) {
  .metrics {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .metric {
    padding: 0;
  }

  .footer-main {
    gap: 16px;
  }

  dialog.modal {
    width: calc(100vw - 24px);
    max-height: 88vh;
  }

  .modal-head {
    padding: 13px 14px 11px 18px;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-actions {
    margin-right: -18px;
    margin-bottom: -18px;
    margin-left: -18px;
    padding: 14px 18px;
  }

  .modal-actions .btn {
    flex: 1 1 auto;
  }

  .toast {
    bottom: 18px;
  }
}

@media (max-width: 360px) {
  .footer-main {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }

  .status-dot {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

@media print {
  .topbar,
  .cta,
  .footer-icons,
  .toast {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .page {
    max-width: none;
    padding: 0;
  }
}
