/* =========================================================================
   Pi Desktop Editions — shared stylesheet
   All colour and interaction styling is driven by CSS custom properties that
   switch on the <html data-theme="..."> attribute, with a no-JS fallback.
   Design doc: README.md
   ========================================================================= */

/* ------------------------------------------------------------------ tokens */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", SFMono-Regular, Consolas,
    "Liberation Mono", Menlo, monospace;

  /* light palette */
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --text: #14181a;
  --muted: #5b6663;
  --hairline: #e2e9e6;
  --hairline-strong: #cfd9d5;

  /* --accent carries every piece of text/outline; --brand is the raw logo
     colour and is only ever used as a fill (dots, primary button). */
  --accent: #0a7d5b;
  --accent-strong: #076149;
  --accent-soft: #e9f6f0;
  --accent-soft-border: #d3ece1;
  --accent-glow: rgba(18, 219, 150, 0.28);

  --brand: #12db96;
  --brand-contrast: #06251b;

  --tag-bg: #eef2f0;
  --tag-text: #5b6663;

  --nav-bg: rgba(245, 247, 246, 0.82);
  --shadow-soft: 0 2px 12px rgba(20, 24, 26, 0.05);

  /* hero flourish */
  --glow-a: rgba(18, 219, 150, 0.14);
  --grid-line: rgba(20, 24, 26, 0.035);

  /* app-window shadow */
  --shot-shadow: 0 18px 42px -14px rgba(20, 24, 26, 0.22),
    0 3px 10px -2px rgba(20, 24, 26, 0.08);
  --shot-shadow-hover: 0 34px 68px -20px rgba(20, 24, 26, 0.36),
    0 12px 26px -8px rgba(20, 24, 26, 0.14), 0 0 0 1px var(--accent-glow),
    0 14px 52px -10px var(--accent-glow);

  --ring: var(--accent);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --maxw: 1120px;
}

/* dark palette (mirrored by the @media fallback below) */
html[data-theme="dark"] {
  --bg: #090d0b;
  --surface: #111815;
  --surface-2: #161f1b;
  --text: #e9efec;
  --muted: #98a5a0;
  --hairline: #1f2a25;
  --hairline-strong: #2b3a33;

  --accent: #3ee8ab;
  --accent-strong: #6cf0c2;
  --accent-soft: #12241c;
  --accent-soft-border: #1d3a2d;
  --accent-glow: rgba(18, 219, 150, 0.26);

  --tag-bg: #161f1b;
  --tag-text: #98a5a0;

  --nav-bg: rgba(9, 13, 11, 0.82);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.4);

  --glow-a: rgba(18, 219, 150, 0.1);
  --grid-line: rgba(233, 239, 236, 0.045);

  --shot-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.6),
    0 3px 12px -2px rgba(0, 0, 0, 0.5);
  --shot-shadow-hover: 0 36px 70px -18px rgba(0, 0, 0, 0.78),
    0 14px 30px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow),
    0 14px 52px -8px var(--accent-glow);
}

/* no-JS fallback: with no inline head script <html> carries no theme
   attribute, so mirror the dark token set to match the OS preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #090d0b;
    --surface: #111815;
    --surface-2: #161f1b;
    --text: #e9efec;
    --muted: #98a5a0;
    --hairline: #1f2a25;
    --hairline-strong: #2b3a33;
    --accent: #3ee8ab;
    --accent-strong: #6cf0c2;
    --accent-soft: #12241c;
    --accent-soft-border: #1d3a2d;
    --accent-glow: rgba(18, 219, 150, 0.26);
    --tag-bg: #161f1b;
    --tag-text: #98a5a0;
    --nav-bg: rgba(9, 13, 11, 0.82);
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.4);
    --glow-a: rgba(18, 219, 150, 0.1);
    --grid-line: rgba(233, 239, 236, 0.045);
    --shot-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.6),
      0 3px 12px -2px rgba(0, 0, 0, 0.5);
    --shot-shadow-hover: 0 36px 70px -18px rgba(0, 0, 0, 0.78),
      0 14px 30px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow),
      0 14px 52px -8px var(--accent-glow);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(64px + 22px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
}

p {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.1em 0.36em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:active,
.skip-link:focus {
  top: 0;
}

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

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-logo {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
}

.brand-suffix {
  font-size: 0.98rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--muted);
}

.nav-links a {
  transition: color 0.2s var(--ease);
}
.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.815rem;
  font-weight: 600;
}

.lang {
  color: var(--muted);
  transition: color 0.2s var(--ease);
}
.lang:hover {
  color: var(--text);
}
.lang.is-active {
  color: var(--accent);
}
.lang-sep {
  color: var(--hairline-strong);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background-color 0.2s var(--ease);
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

/* icon = the action the button performs: moon in light, sun in dark */
.icon-btn .i-sun {
  display: none;
}
html[data-theme="dark"] .icon-btn .i-sun {
  display: block;
}
html[data-theme="dark"] .icon-btn .i-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .icon-btn .i-sun {
    display: block;
  }
  html:not([data-theme]) .icon-btn .i-moon {
    display: none;
  }
}

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: 84px 0 104px;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(
      62% 58% at 50% -6%,
      var(--glow-a),
      transparent 72%
    ),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 64px 64px, 64px 64px;
  -webkit-mask-image: linear-gradient(#000 0%, transparent 82%);
  mask-image: linear-gradient(#000 0%, transparent 82%);
  pointer-events: none;
}

.hero .container {
  max-width: 1380px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.44fr;
  align-items: center;
  gap: 56px;
}

.eyebrow,
.section-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.755rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.hero h1 {
  margin-top: 20px;
  font-size: clamp(2.05rem, 3.6vw, 2.95rem);
}

.lede {
  margin-top: 20px;
  max-width: 56ch;
  font-size: 1.045rem;
  color: var(--muted);
}

.os-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.os-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.815rem;
  font-weight: 500;
  color: var(--muted);
}

.os-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--brand);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.66rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease),
    border-color 0.2s var(--ease), color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  box-shadow: 0 6px 18px -8px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--hairline-strong);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  color: var(--accent);
}
.btn-ghost:hover {
  border-color: var(--accent);
}

/* caution: --accent-strong in light mode is a dark green, so the primary
   hover keeps white text; in dark mode the override below flips it back. */
html[data-theme="dark"] .btn-primary:hover {
  background: var(--accent);
  color: var(--brand-contrast);
}

.trust {
  margin-top: 26px;
  font-family: var(--font-mono);
  font-size: 0.755rem;
  line-height: 1.75;
  color: var(--muted);
}
.trust sup {
  color: var(--accent);
}

.hero-visual {
  min-width: 0;
}

.hero-shot {
  position: relative;
  margin: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shot-shadow);
  transition: transform 0.5s var(--ease), box-shadow 0.65s var(--ease);
}
.hero-shot:hover {
  transform: translateY(-4px);
  box-shadow: var(--shot-shadow-hover);
}

/* both screenshots live in the DOM; pure CSS picks exactly one per theme so
   the right one shows even before JS runs. Never swap these with JS. */
.hero-shot img {
  display: none;
  width: 100%;
}
.hero-shot img[data-shot="light"] {
  display: block;
}
html[data-theme="dark"] .hero-shot img[data-shot="light"] {
  display: none;
}
html[data-theme="dark"] .hero-shot img[data-shot="dark"] {
  display: block;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .hero-shot img[data-shot="light"] {
    display: none;
  }
  html:not([data-theme]) .hero-shot img[data-shot="dark"] {
    display: block;
  }
}

.shot-caption {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.735rem;
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------------- sections */
.section {
  padding: 88px 0;
  border-top: 1px solid var(--hairline);
}

.section-head {
  margin-top: 16px;
  max-width: 62ch;
}

.section-head h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
}

.section-lede {
  margin-top: 14px;
  font-size: 1.02rem;
  color: var(--muted);
}

/* features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 44px;
}

.feature-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
.feature-card:hover {
  border-color: var(--accent-soft-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.feature-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent);
}

.feature-card h3 {
  margin-top: 16px;
  font-size: 1.055rem;
  line-height: 1.4;
}

.feature-card p {
  margin-top: 10px;
  font-size: 0.945rem;
  color: var(--muted);
}

.feature-card a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* platforms */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 44px;
}

.platform-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}

.platform-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.platform-head h3 {
  font-size: 1.12rem;
}

.platform-tag {
  font-family: var(--font-mono);
  font-size: 0.715rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.bullet-list {
  flex: 1;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.bullet-list li {
  position: relative;
  padding-left: 20px;
  font-size: 0.925rem;
  color: var(--muted);
}

.bullet-list li + li {
  margin-top: 11px;
}

.bullet-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.bullet-list a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 24px;
  font-size: 0.915rem;
  font-weight: 600;
  color: var(--accent);
}
.repo-link svg {
  transition: transform 0.25s var(--ease);
}
.repo-link:hover svg {
  transform: translateX(3px);
}

.disclaimer {
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
  font-size: 0.895rem;
  color: var(--muted);
}

/* how it works */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 38px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: flex;
  gap: 14px;
}

.step:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  top: 14px;
  right: -22px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--hairline-strong);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
}

.step h3 {
  font-size: 1rem;
}

.step p {
  margin-top: 7px;
  font-size: 0.925rem;
  color: var(--muted);
}

.result-badge {
  margin-top: 44px;
  padding: 16px 20px;
  border: 1px dashed var(--accent-soft-border);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  text-align: center;
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  padding: 52px 0 60px;
  border-top: 1px solid var(--hairline);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}

.footer-left {
  min-width: 0;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.footer-brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.footer-one-liner {
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.footer-copy {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.735rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: flex-end;
  max-width: 460px;
  font-size: 0.865rem;
  color: var(--muted);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s var(--ease);
}
.footer-links a:hover {
  color: var(--accent);
}

.footer-links .ext {
  opacity: 0.7;
}

/* -------------------------------------------------------------- animations */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy > *,
.hero-visual {
  animation: riseIn 0.7s var(--ease) backwards;
}
/* fill-mode stays `backwards` on purpose: a forwards fill would pin the
   final transform and swallow the screenshot's hover lift. */

.hero-copy > *:nth-child(1) {
  animation-delay: 0.02s;
}
.hero-copy > *:nth-child(2) {
  animation-delay: 0.09s;
}
.hero-copy > *:nth-child(3) {
  animation-delay: 0.16s;
}
.hero-copy > *:nth-child(4) {
  animation-delay: 0.23s;
}
.hero-copy > *:nth-child(5) {
  animation-delay: 0.3s;
}
.hero-copy > *:nth-child(6) {
  animation-delay: 0.37s;
}
.hero-visual {
  animation-delay: 0.16s;
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy > *,
  .hero-visual {
    animation: none;
  }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .hero-grid {
    gap: 40px;
  }
}

@media (max-width: 920px) {
  .hero {
    padding: 64px 0 76px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .hero-visual {
    order: 2;
  }
}

@media (max-width: 820px) {
  .feature-grid,
  .platform-grid {
    grid-template-columns: 1fr;
  }
  .section {
    padding: 68px 0;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
}

@media (max-width: 640px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .step:not(:last-child)::after {
    display: none;
  }
  .cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn {
    justify-content: center;
  }
  .hero {
    padding: 48px 0 60px;
  }
  .container {
    padding: 0 20px;
  }
}
