/* Mugi — Shared Design System (Light & Dark)
 * Zero external CDNs. Zero trackers. Native macOS typography.
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Light */
  --bg-page: #F4F2EE;
  --bg-page-alt: #ECE9E2;
  --bg-surface: rgba(252, 251, 249, 0.88);
  --bg-surface-solid: #FCFBF9;
  --bg-well: #EAE7E0;
  --bg-nav: rgba(244, 242, 238, 0.82);

  --ink-strong: #1B1B19;
  --ink-body: #4E4C46;
  --ink-muted: #6E6B62;
  --ink-subtle: #88847B;

  --accent: #6355D8;
  --accent-soft: rgba(99, 85, 216, 0.11);
  --accent-border: rgba(99, 85, 216, 0.24);
  --attention: #D4531C;
  --attention-deep: #A63C0F;
  --attention-soft: rgba(212, 83, 28, 0.12);
  --attention-ink: #FFFFFF;
  --status-ok: #1D8F5A;
  --status-ok-soft: rgba(29, 143, 90, 0.12);

  --hairline: rgba(27, 27, 25, 0.09);
  --control-edge: rgba(27, 27, 25, 0.18);

  --radius-card: 20px;
  --radius-panel: 16px;
  --radius-control: 11px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(27, 27, 25, 0.04), 0 10px 30px -12px rgba(27, 27, 25, 0.09);
  --shadow-stage: 0 28px 64px -18px rgba(27, 27, 25, 0.22), 0 0 0 1px rgba(27, 27, 25, 0.09);
  --shadow-control: 0 1px 2px rgba(27, 27, 25, 0.06);
  --shadow-well: inset 0 1px 2px rgba(27, 27, 25, 0.05);
  --card-backdrop: blur(18px);

  --btn-primary-bg: #1B1B19;
  --btn-primary-fg: #FCFBF9;
  --btn-primary-hover: #32312D;
}

/* Dark */
:root[data-scheme="dark"] {
  --bg-page: #141412;
  --bg-page-alt: #1A1917;
  --bg-surface: rgba(31, 30, 27, 0.84);
  --bg-surface-solid: #1F1E1B;
  --bg-well: #191816;
  --bg-nav: rgba(20, 20, 18, 0.82);

  --ink-strong: #ECEBE6;
  --ink-body: #B3B0A7;
  --ink-muted: #8E8A81;
  --ink-subtle: #706D65;

  --accent: #9E91FF;
  --accent-soft: rgba(158, 145, 255, 0.15);
  --accent-border: rgba(158, 145, 255, 0.3);
  --attention: #FF8A52;
  --attention-deep: #FF8A52;
  --attention-soft: rgba(255, 138, 82, 0.15);
  --attention-ink: #121110;
  --status-ok: #46C986;
  --status-ok-soft: rgba(70, 201, 134, 0.14);

  --hairline: rgba(236, 235, 230, 0.09);
  --control-edge: rgba(236, 235, 230, 0.2);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 14px 36px -14px rgba(0, 0, 0, 0.55);
  --shadow-stage: 0 32px 72px -16px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-control: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-well: inset 0 1px 3px rgba(0, 0, 0, 0.45);

  --btn-primary-bg: #ECEBE6;
  --btn-primary-fg: #141412;
  --btn-primary-hover: #FFFFFF;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-body);
  background: var(--bg-page);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ink-strong);
  letter-spacing: -0.028em;
  line-height: 1.12;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
strong { color: var(--ink-strong); font-weight: 600; }

code, kbd, .font-mono {
  font-family: var(--font-mono);
}

kbd {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.42rem;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--ink-strong);
  background: var(--bg-well);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  box-shadow: var(--shadow-well);
}

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

/* Layout Containers */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  scroll-margin-top: 84px;
  padding: 84px 0;
}

.section-tight {
  padding: 56px 0;
}

.section-band {
  background: var(--bg-page-alt);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

/* Section Labels */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.eyebrow-accent {
  color: var(--attention-deep);
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--status-ok);
  flex-shrink: 0;
}

.section-title {
  font-size: clamp(1.85rem, 3.4vw, 2.75rem);
  font-weight: 650;
  letter-spacing: -0.032em;
  margin-bottom: 16px;
}

.section-lead {
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  color: var(--ink-body);
  max-width: 56ch;
  line-height: 1.62;
}

/* Navbar */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 0 0 1px var(--hairline);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink-strong);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  color: var(--ink-muted);
  background: var(--bg-well);
  border: 1px solid var(--hairline);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.15s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink-strong);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Appearance Toggle */
.scheme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-control);
  border: 1px solid var(--hairline);
  background: var(--bg-surface-solid);
  color: var(--ink-muted);
  box-shadow: var(--shadow-control);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.scheme-toggle:hover {
  color: var(--ink-strong);
  border-color: var(--control-edge);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  border-radius: var(--radius-control);
  padding: 10px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn-sm {
  font-size: 13.5px;
  padding: 7px 14px;
}

.btn-lg {
  font-size: 16px;
  padding: 13px 24px;
  border-radius: 13px;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  box-shadow: var(--shadow-control);
}

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

.btn-secondary {
  background: var(--bg-surface-solid);
  color: var(--ink-strong);
  border-color: var(--control-edge);
  box-shadow: var(--shadow-control);
}

.btn-secondary:hover {
  border-color: var(--ink-muted);
}

/* Cards & Surfaces */
.surface-card {
  background: var(--bg-surface);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.surface-well {
  background: var(--bg-well);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-well);
  padding: 20px;
}

/* Hero */
.hero {
  padding: 68px 0 56px;
}

.hero-header {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--bg-surface-solid);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-control);
  margin-bottom: 24px;
  text-decoration: none;
}

.hero-title {
  font-size: clamp(2.45rem, 5.4vw, 4.15rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.04;
  margin-bottom: 20px;
}

.hero-title-muted {
  color: var(--ink-muted);
  font-weight: 500;
}

.hero-sub {
  font-size: clamp(1.06rem, 1.5vw, 1.24rem);
  color: var(--ink-body);
  max-width: 58ch;
  margin: 0 auto 28px;
  line-height: 1.58;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--ink-muted);
}

.hero-meta-sep {
  opacity: 0.4;
}

/* Interactive Room Showcase Stage */
.stage-wrap {
  margin-top: 44px;
}

.room-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.room-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--bg-surface);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.room-tab:hover {
  color: var(--ink-strong);
  border-color: var(--control-edge);
}

.room-tab[aria-selected="true"] {
  background: var(--ink-strong);
  color: var(--bg-page);
  border-color: var(--ink-strong);
}

.stage-frame {
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-surface-solid);
  box-shadow: var(--shadow-stage);
  border: 1px solid var(--hairline);
}

.stage-media {
  position: relative;
  background: #1B1B19;
  aspect-ratio: 16 / 10.3;
  overflow: hidden;
}

.stage-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.stage-media img.is-active {
  opacity: 1;
  pointer-events: auto;
}

.stage-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--bg-surface-solid);
  font-size: 13.5px;
}

.stage-caption-title {
  font-weight: 600;
  color: var(--ink-strong);
  margin-right: 8px;
}

.stage-caption-text {
  color: var(--ink-muted);
}

/* Principle Strip */
.trust-strip {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-page-alt);
  padding: 26px 0;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.trust-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
}

.trust-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--attention-deep);
  background: var(--attention-soft);
}

.trust-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.trust-item span {
  color: var(--ink-muted);
  line-height: 1.45;
}

/* Two-Column Editorial */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  align-items: start;
}

.two-col-equal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.stack-sm > * + * { margin-top: 12px; }
.stack-md > * + * { margin-top: 18px; }
.stack-lg > * + * { margin-top: 28px; }

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  color: var(--ink-body);
  line-height: 1.58;
}

.check-icon {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--attention-deep);
}

/* Bento Capabilities Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.bento-card {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bento-wide {
  grid-column: span 2;
}

.bento-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--attention-deep);
  background: var(--attention-soft);
  margin-bottom: 4px;
}

.bento-card h3 {
  font-size: 1.12rem;
  font-weight: 650;
}

.bento-card p {
  font-size: 14.5px;
  color: var(--ink-body);
  line-height: 1.58;
}

.bento-meta {
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* Feature Highlight Callout */
.whats-new-card {
  margin-top: 28px;
  padding: 28px 30px;
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  box-shadow: var(--shadow-card);
}

.whats-new-card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

/* Version List / Preview Section */
.bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  font-size: 14.5px;
  color: var(--ink-body);
}

.bullet-list li {
  position: relative;
  padding-left: 16px;
  line-height: 1.55;
}

.bullet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--attention-deep);
}

.bullet-list-muted li::before {
  background: var(--ink-muted);
}

/* Download Banner */
.download-box {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px;
  align-items: center;
  padding: 36px;
  border-radius: calc(var(--radius-card) + 4px);
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
}

/* Prose (Manual, EULA, Preview, Acknowledgements) */
.prose-page {
  padding: 52px 0 80px;
}

.prose-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
}

.prose-header h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  margin-bottom: 10px;
}

.prose-body h1 { font-size: 2rem; margin: 0 0 1rem; }
.prose-body h2 { font-size: 1.38rem; margin: 2.2rem 0 0.75rem; }
.prose-body h3 { font-size: 1.12rem; margin: 1.6rem 0 0.5rem; }
.prose-body p, .prose-body li { color: var(--ink-body); line-height: 1.72; margin-bottom: 0.85rem; }
.prose-body ul, .prose-body ol { padding-left: 1.4rem; margin: 0.5rem 0 1.2rem; }
.prose-body a { color: var(--attention-deep); text-decoration: underline; text-underline-offset: 3px; }
.prose-body a:hover { color: var(--ink-strong); }
.prose-body code {
  font-size: 0.88em;
  background: var(--bg-well);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--hairline);
  color: var(--ink-strong);
}
.prose-body pre {
  background: var(--bg-well);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-panel);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.2rem 0;
  box-shadow: var(--shadow-well);
}
.prose-body pre code {
  background: none;
  border: none;
  padding: 0;
}
.prose-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 14.5px;
}
.prose-body th, .prose-body td {
  border-bottom: 1px solid var(--hairline);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.prose-body th {
  color: var(--ink-strong);
  font-weight: 600;
}
.prose-body blockquote {
  border-left: 3px solid var(--attention-deep);
  margin: 1.2rem 0;
  padding: 4px 0 4px 16px;
  color: var(--ink-muted);
}
.prose-body img {
  border-radius: 12px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  margin: 1.25rem 0;
}
.prose-body em:only-child {
  display: block;
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-top: -0.5rem;
  margin-bottom: 1.25rem;
}

/* Chapter list */
.chapter-list {
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.14s ease;
}

.chapter-row:last-child { border-bottom: none; }
.chapter-row:hover { background: var(--bg-well); }
.chapter-title { font-weight: 600; color: var(--ink-strong); font-size: 15px; }
.chapter-desc { font-size: 13.5px; color: var(--ink-muted); margin-top: 2px; }
.chapter-arrow { color: var(--ink-muted); flex-shrink: 0; }

/* Release Changelog Cards */
.release-block {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
}

.release-block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.release-ver-pill {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--attention-deep);
}

.release-date {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.badge-version {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--status-ok-soft);
  color: var(--status-ok);
}

/* Inline Link */
.text-link {
  color: var(--attention-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.text-link:hover {
  color: var(--ink-strong);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 40px 0 48px;
  font-size: 13px;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.footer-links a {
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.14s ease;
}

.footer-links a:hover {
  color: var(--ink-strong);
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 960px) {
  .trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .two-col-equal, .download-box { grid-template-columns: 1fr; gap: 28px; }
  .bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-wide { grid-column: span 2; }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .hero { padding: 44px 0 36px; }
  .trust-grid, .bento-grid { grid-template-columns: 1fr; }
  .bento-wide { grid-column: span 1; }
  .download-box { padding: 24px; }
  .surface-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
