/* Self-hosted, unmodified upstream subsets; provenance/licenses: /fonts/README.md.
   Latin body faces cover the site's English text and punctuation. Pi supplies
   arrows/symbols; other scripts retain the readable system fallback. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/SpaceGrotesk-Latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-Regular-Pi.woff2") format("woff2");
  unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-Medium-Pi.woff2") format("woff2");
  unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/IBMPlexSans-SemiBold-Pi.woff2") format("woff2");
  unicode-range: U+0E3F, U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2113, U+2116, U+2126, U+212E, U+2150-2151, U+2153-215E, U+2190-2199, U+21A9-21AA, U+21B0-21B3, U+21B6-21B7, U+21BA-21BB, U+21C4, U+21C6, U+2202, U+2206, U+220F, U+2211, U+2215, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+274C, U+2B0E-2B11, U+ECE0, U+EFCC, U+FEFF, U+FFFD;
}

/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-tint: #fff5f0;          /* warm wash */
  --surface: #ffffff;
  --surface-hover: #fff8f4;
  --ink: #1c1512;              /* warm near-black */
  --muted: #6e625a;            /* warm gray; readable over the ambient glow */
  --border: #f0e6df;
  --border-strong: #e3d5cb;
  --accent: #ff7a4d;           /* warm orange */
  --accent-strong: #b93824;    /* deep ember; text contrast over the warm glow */
  --accent-soft: rgba(255, 122, 77, 0.12);
  --glow: rgba(255, 138, 69, 0.28);
  --brand-gradient: linear-gradient(120deg, #ff8c45 0%, #ff645f 100%);

  --badge-live-bg: #ecfdf5;
  --badge-live-ink: #047857;
  --badge-beta-bg: #fff7ed;
  --badge-beta-ink: #c2410c;
  --badge-soon-bg: #f1f5f9;
  --badge-soon-ink: #475569;

  --radius: 16px;
  --radius-sm: 999px;
  --shadow: 0 1px 2px rgba(28, 21, 18, 0.04), 0 8px 24px rgba(28, 21, 18, 0.06);
  --shadow-hover: 0 2px 4px rgba(28, 21, 18, 0.06), 0 16px 40px rgba(255, 100, 95, 0.16);

  --maxw: 900px;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --terminal-bar: #221611;
}

[data-theme="dark"] {
  --bg: #16110e;             /* warm charcoal */
  --bg-tint: #1d1611;
  --surface: #1e1712;
  --surface-hover: #271e18;
  --ink: #f4ece6;
  --muted: #b0a49b;
  --border: #322620;
  --border-strong: #47372c;
  --accent: #ff9a63;         /* warm orange, brighter on dark */
  --accent-strong: #ffb488;
  --accent-soft: rgba(255, 138, 69, 0.16);
  --glow: rgba(255, 138, 69, 0.20);
  --terminal-bar: #0d0907;

  --badge-live-bg: rgba(16, 185, 129, 0.14);
  --badge-live-ink: #6ee7b7;
  --badge-beta-bg: rgba(249, 115, 22, 0.14);
  --badge-beta-ink: #fdba74;
  --badge-soon-bg: rgba(148, 163, 184, 0.14);
  --badge-soon-ink: #cbd5e1;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.45), 0 18px 44px rgba(255, 100, 95, 0.22);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Warm ambient glow */
.glow {
  position: fixed;
  top: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: 120vw;
  height: 80vh;
  background: radial-gradient(50% 50% at 50% 50%, var(--glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  display: inline-flex;
  align-items: center;
}
.wordmark:hover { text-decoration: none; }
.wordmark img {
  height: 30px;
  width: auto;
  display: block;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.4s ease;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Layout ---------- */
.container {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 72px 0 48px;
  text-align: center;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.hero-sub {
  margin: 0 auto;
  max-width: 36ch;
  color: var(--muted);
  font-size: 1.075rem;
}

/* ---------- App grid ---------- */
.app-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Catalog sections */
.catalog-section {
  margin-bottom: 56px;
}
.catalog-section:last-of-type {
  margin-bottom: 64px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 20px;
}
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease,
              border-color 0.22s ease, background-color 0.4s ease;
}
.app-card > a {
  display: block;
  padding: 22px 22px 20px;
  color: inherit;
}
.app-card > a:hover { text-decoration: none; }
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.app-head-left {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  max-width: 100%;
}
.app-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
}
.app-name {
  min-width: 0;
  /* Preserve words unless a name is wider than the entire available row. */
  overflow-wrap: break-word;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.app-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.app-head-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.app-arrow {
  color: var(--muted);
  transition: transform 0.22s ease, color 0.22s ease;
}
.app-card:hover .app-arrow { color: var(--accent); transform: translate(3px, -3px); }

/* Local App terminal-inspired variant */
.app-card--local::before {
  content: "";
  display: block;
  height: 22px;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background:
    radial-gradient(circle at 21px 11px, #ff5f57 0 4px, transparent 4.5px),
    radial-gradient(circle at 40px 11px, #febc2e 0 4px, transparent 4.5px),
    radial-gradient(circle at 59px 11px, #28c840 0 4px, transparent 4.5px),
    var(--terminal-bar);
}
.app-card--local > a {
  padding-top: 16px;
}
.app-card--local:hover .app-arrow {
  transform: translateX(3px);
}

.app-cta {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent-strong);
}

/* Status badge */
.badge {
  flex: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}
.badge--live { background: var(--badge-live-bg); color: var(--badge-live-ink); }
.badge--beta { background: var(--badge-beta-bg); color: var(--badge-beta-ink); }
.badge--soon { background: var(--badge-soon-bg); color: var(--badge-soon-ink); }

.app-grid[hidden] { display: none; }

.app-empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 0 64px;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.footer-meta > * + *::before {
  content: "·";
  margin-right: 10px;
  color: var(--border-strong);
}
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--accent-strong); }
.site-footer .support-link {
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}
.site-footer .support-link:hover { color: var(--ink); }
.site-footer .support-link:focus-visible { outline-color: var(--accent-strong); }

/* ---------- Privacy ---------- */
.privacy-container {
  max-width: 760px;
}
.privacy-hero {
  padding: 64px 0 32px;
}
.privacy-kicker {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.privacy-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.privacy-intro {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}
.privacy-card {
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.privacy-card section + section {
  margin-top: 36px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}
.privacy-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.privacy-card p,
.privacy-card ul {
  margin: 0;
  color: var(--muted);
}
.privacy-card p + p,
.privacy-card p + ul,
.privacy-card ul + p {
  margin-top: 12px;
}
.privacy-card ul {
  padding-left: 1.25rem;
}
.privacy-card li + li {
  margin-top: 8px;
}
.privacy-card strong {
  color: var(--ink);
  font-weight: 600;
}
.privacy-date {
  margin: 24px 0 56px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- App detail page ---------- */
.app-page {
  max-width: 760px;
}

.back-link {
  padding: 32px 0 0;
}
.back-link a {
  display: inline-block;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.back-link a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-hero {
  padding: 32px 0 40px;
}
.app-hero-mark {
  margin-bottom: 20px;
}
.app-hero-mark img {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.app-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.app-tagline {
  margin: 0 0 20px;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.1rem;
}
.app-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.app-meta-item {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.4s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn--source {
  color: var(--accent-strong);
}

.app-section {
  margin-bottom: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.app-section h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.app-section h3 {
  margin: 20px 0 10px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.app-section p,
.app-section ul {
  margin: 0;
  color: var(--muted);
}
.app-section p + p,
.app-section p + ul,
.app-section ul + p {
  margin-top: 12px;
}
.app-section ul {
  padding-left: 1.25rem;
}
.app-section li + li {
  margin-top: 8px;
}
.app-section strong {
  color: var(--ink);
  font-weight: 600;
}
.app-section code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Terminal command blocks */
.terminal {
  margin-top: 12px;
  border: 1px solid var(--terminal-bar);
  border-radius: 12px;
  background: var(--terminal-bar);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.terminal-dot:nth-child(1) { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #febc2e; }
.terminal-dot:nth-child(3) { background: #28c840; }
.terminal-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.copy-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.4;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.copy-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.copy-btn--ok {
  color: #28c840;
  border-color: rgba(40, 200, 64, 0.5);
}
.copy-btn--ok:hover { color: #28c840; }
.copy-btn--err {
  color: #ff5f57;
  border-color: rgba(255, 95, 87, 0.5);
}
.copy-btn--err:hover { color: #ff5f57; }
.copy-btn svg { flex: none; }
.terminal pre {
  margin: 0;
  padding: 16px;
}
.terminal code {
  display: block;
  padding: 0;
  background: none;
  color: #f4ece6;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Controls table */
.table-wrap {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}
.controls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.controls-table th,
.controls-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.controls-table tr:last-child td {
  border-bottom: 0;
}
.controls-table th {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.controls-table td:first-child {
  white-space: nowrap;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
}
.controls-table td:last-child {
  color: var(--muted);
}

.source-note {
  margin: 24px 0 56px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.source-note a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .app-section {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
