/* Rune — Snow & Paper design system (mirrors RuneTheme.swift) */
:root {
  color-scheme: light;
  --paper: #FFFFFF;
  --rail: #F7F7F4;
  --raised: #FFFFFF;
  --ink: #1A1A18;
  --ink2: #52524E;
  --ink3: #666661;
  --ink4: #767671;
  --line: rgba(26, 26, 24, 0.09);
  --line-strong: rgba(26, 26, 24, 0.16);
  --wash: rgba(26, 26, 24, 0.045);
  --wash-strong: rgba(26, 26, 24, 0.08);
  --cta: #1A1A18;
  --cta-ink: #FFFFFF;
  --status-on: #286D42;
  --aura-sage: rgba(126, 158, 132, 0.24);
  --aura-warm: rgba(214, 211, 198, 0.36);
  --shot-shadow: 0 2px 8px rgba(26, 26, 24, 0.06), 0 18px 44px rgba(26, 26, 24, 0.09);
  --icon-shadow: 0 6px 20px rgba(26, 26, 24, 0.14), 0 1px 3px rgba(26, 26, 24, 0.08);
  --font-display: ui-serif, "New York", "Iowan Old Style", "Newsreader", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1F1F1E;
  --rail: #171717;
  --raised: #2B2B2A;
  --ink: #F4F4F1;
  --ink2: #C6C6C1;
  --ink3: #9E9E99;
  --ink4: #8D8D87;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --wash: rgba(255, 255, 255, 0.06);
  --wash-strong: rgba(255, 255, 255, 0.10);
  --cta: #F4F4F1;
  --cta-ink: #1F1F1E;
  --status-on: #74C690;
  --aura-sage: rgba(110, 156, 124, 0.16);
  --aura-warm: rgba(235, 232, 220, 0.06);
  --shot-shadow: 0 2px 10px rgba(0, 0, 0, 0.32), 0 24px 54px rgba(0, 0, 0, 0.44);
  --icon-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: clip;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Soft Rune botanical sage-and-paper wash behind hero (mirrors RuneArtwork) */
.hero-aura {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1240px, 100vw);
  height: 540px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(52% 62% at 50% 34%, var(--aura-sage) 0%, transparent 72%),
    radial-gradient(44% 52% at 32% 28%, var(--aura-warm) 0%, transparent 70%);
  filter: blur(28px);
}

/* Top Navigation */
.site-nav {
  position: relative;
  z-index: 20;
}

.nav-inner {
  max-width: 58rem;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-height: 36px;
  transition: opacity 0.14s ease;
}

@media (hover: hover) and (pointer: fine) {
  .brand-link:hover {
    opacity: 0.78;
  }
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: block;
}

.nav-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  font-size: 13.5px;
  color: var(--ink3);
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 9999px;
  transition: color 0.14s ease, background-color 0.14s ease;
}

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: var(--ink);
    background: var(--wash);
  }
}

.nav-link[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
}

/* Theme toggle pill (matches Rune's quiet segmented control) */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink2);
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border-radius: 9999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.theme-toggle:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover {
    color: var(--ink);
    border-color: var(--line-strong);
    background: var(--wash);
  }
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 15px;
  height: 15px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

:root .theme-toggle .icon-sun { opacity: 0; transform: scale(0.8); }
:root .theme-toggle .icon-moon { opacity: 1; transform: scale(1); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: scale(1); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: scale(0.8); }

/* Main wrapper */
main {
  position: relative;
  z-index: 10;
}

/* Centered Hero (clearly.md structure + Granola serif voice) */
.hero {
  padding: 52px 24px 36px;
  text-align: center;
  animation: heroEnter 0.42s ease-out both;
}

@keyframes heroEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-inner {
  max-width: 48rem;
  margin: 0 auto;
}

.hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: block;
  margin: 0 auto 28px;
  box-shadow: var(--icon-shadow);
}

.hero h1 {
  margin: 0 auto;
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.8vw, 3.25rem);
  font-weight: 400;
  line-height: 1.09;
  letter-spacing: -0.028em;
  color: var(--ink);
  text-wrap: balance;
}

.hero-lead {
  margin: 20px auto 0;
  max-width: 46ch;
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  line-height: 1.6;
  color: var(--ink2);
  text-wrap: pretty;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border-radius: 9999px;
  background: var(--cta);
  color: var(--cta-ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -0.005em;
  transition: opacity 0.14s ease, transform 0.12s ease;
}

.btn-download:active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .btn-download:hover {
    opacity: 0.88;
  }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 9999px;
  background: var(--raised);
  color: var(--ink2);
  border: 1px solid var(--line-strong);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.btn-secondary:active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    color: var(--ink);
    background: var(--wash);
  }
}

.hero-requires {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink4);
  font-variant-numeric: tabular-nums;
}

/* Horizontal Drag-Scrollable Real Mac Screenshot Gallery */
.gallery-section {
  padding: 20px 0 44px;
}

.screenshot-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 58rem;
  margin: 0 auto;
  padding: 0 24px;
}

.shot-frame {
  margin: 0;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shot-shadow);
  background: var(--rail);
  aspect-ratio: 1200 / 780;
  user-select: none;
}

.shot-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* Theme-matched real macOS screenshots */
:root .shot-dark { display: none; }
:root .shot-light { display: block; }
:root[data-theme="dark"] .shot-dark { display: block; }
:root[data-theme="dark"] .shot-light { display: none; }

@media (min-width: 768px) {
  .gallery-section {
    padding: 28px 0 52px;
  }

  .screenshot-gallery {
    flex-direction: row;
    gap: 22px;
    max-width: none;
    margin: 0;
    padding: 10px max(24px, calc((100vw - 64rem) / 2)) 28px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
  }

  .screenshot-gallery:active {
    cursor: grabbing;
  }

  .screenshot-gallery::-webkit-scrollbar {
    display: none;
  }

  .shot-frame {
    height: 31rem;
    width: auto;
  }

  .shot-frame img {
    pointer-events: none;
  }
}

/* Editorial Feature Specification (clearly.md dl cadence in Rune Snow/Paper) */
.features {
  padding: 44px 24px 80px;
}

.features-inner {
  max-width: 47rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.feature-group h2 {
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink4);
}

.feature-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.feature-row {
  display: block;
  font-size: 14.5px;
  line-height: 1.62;
}

.feature-row dt {
  display: inline;
  font-weight: 550;
  color: var(--ink);
}

.feature-row dd {
  display: inline;
  margin: 0;
  color: var(--ink3);
}

.feature-row dd .dash {
  display: inline;
  color: var(--ink4);
  margin: 0 5px 0 4px;
}

.feature-row code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--wash);
  color: var(--ink2);
  padding: 1px 5px;
  border-radius: 5px;
}

@media (max-width: 520px) {
  .feature-row dt {
    display: block;
  }

  .feature-row dd {
    display: block;
  }

  .feature-row dd .dash {
    display: none;
  }
}

/* Compact CLI / MCP bar at the end of Harnesses */
.cli-strip {
  margin-top: 22px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--rail);
  border: 1px solid var(--line);
}

.cli-strip code {
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink2);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.cli-strip code::-webkit-scrollbar {
  display: none;
}

.cli-copy {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--ink);
  height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  transition: transform 0.12s ease, border-color 0.14s ease, color 0.14s ease;
}

.cli-copy:active { transform: scale(0.95); }
.cli-copy .slot { grid-area: 1 / 1; transition: opacity 0.14s ease; }
.cli-copy .slot-done { opacity: 0; color: var(--status-on); }
.cli-copy.copied .slot-idle { opacity: 0; }
.cli-copy.copied .slot-done { opacity: 1; }
.cli-copy.copied { border-color: var(--status-on); }

/* Sub-pages (Changelog & Privacy) */
.prose-page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 52px 24px 80px;
}

.prose-page h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.65rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.prose-subtitle {
  margin: 0 0 40px;
  color: var(--ink3);
  font-size: 15px;
}

.release-entry {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.release-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.release-version {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
}

.release-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink4);
}

.prose-section {
  margin-bottom: 24px;
}

.prose-section h3 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink4);
}

.prose-section p,
.prose-section li {
  color: var(--ink2);
  font-size: 14.5px;
  line-height: 1.65;
}

.prose-section ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prose-section code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--wash);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--ink);
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--line);
}

.footer-inner {
  max-width: 58rem;
  margin: 0 auto;
  padding: 28px 24px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13.5px;
  color: var(--ink4);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.footer-links a {
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.14s ease;
}

@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover {
    color: var(--ink);
  }
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}

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