/* 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%);
  /* Deeper stops keep gradient headline text >= 3:1 over the light glow. */
  --text-gradient: linear-gradient(120deg, #d9480f 0%, #c4314b 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: 20px;
  --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;
}

[data-theme="dark"] {
  --bg: #121010;             /* deep, near-neutral charcoal */
  --bg-tint: #181413;
  --surface: #1a1615;
  --surface-hover: #221c1a;
  --ink: #f4ece6;
  --muted: #b0a49b;
  --border: #2c2523;
  --border-strong: #3e3431;
  --accent: #ff9a63;         /* warm orange, brighter on dark */
  --accent-strong: #ffb488;
  --accent-soft: rgba(255, 122, 90, 0.16);
  --glow: rgba(255, 110, 90, 0.18);   /* coral, not brown */
  --text-gradient: var(--brand-gradient);

  --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;
  min-height: 100dvh;
  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 .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;
  text-wrap: balance;
}
.hero-accent {
  background: var(--text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (forced-colors: active) {
  .hero-accent { background: none; color: CanvasText; }
}
.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;
  /* Column flex pins the host line to the bottom of every card in a row. */
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  -webkit-tap-highlight-color: transparent;
}
.app-card:active { background: var(--surface-hover); }
/* The name is the card's only link; its ::after overlay makes the whole card
   clickable while the link's accessible name stays just the app name. */
.app-link {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
/* Outranks the global a:hover underline, which would otherwise fire anywhere
   over the card (the overlay belongs to the link), even after a tap. */
.app-card .app-link { text-decoration: none; }
.app-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
}
/* Transparent (not none) keeps a ring in forced-colors mode; the visible ring
   wraps the whole card instead of just the name. */
.app-link:focus-visible { outline: 2px solid transparent; }
.app-card:has(.app-link:focus-visible) {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.app-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.app-head-left {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}
/* Name with its status badge beneath, so the badge never squeezes the name. */
.app-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  outline: 1px solid var(--border);
  outline-offset: -1px;
  flex: none;
}
/* Uncanny's own favicon is a hard-edged square; keep that silhouette. */
.app-icon[src$="/uncanny.svg"] { border-radius: 0; }
.app-name {
  margin: 0;
  text-wrap: balance;
  /* Preserve words unless a name is wider than the entire available row. */
  overflow-wrap: break-word;
  line-height: 1.3;
  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;
  line-height: 1.55;
  text-wrap: pretty;
}
.app-host {
  margin-top: auto;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.app-head-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  flex: none;
  padding-top: 4px;
}
.app-arrow {
  color: var(--muted);
  transition: transform 0.22s ease, color 0.22s ease;
}

/* 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); }

/* Category jump links and sections */
.catalog-groups[hidden] { display: none; }
.category-nav ul {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.2s ease, background-color 0.4s ease;
}
.category-nav a:focus-visible { border-radius: var(--radius-sm); }
.category-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
}
.category + .category { margin-top: 40px; }
.category { scroll-margin-top: 24px; }
.category-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.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;
}
/* Divider inset to the content column so it aligns with the cards. */
.site-footer::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: 28px;
  background: var(--border);
}
/* Utility row: Privacy, Contact. */
.footer-links {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 20px;
}
/* Keep each label on one line; whole items wrap instead. */
.footer-links li {
  position: relative;
  white-space: nowrap;
}
/* A drawn dot, not a text character, so screen readers never announce it. */
.footer-links li + li::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 50%;
  background: var(--border-strong);
}
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
/* Pad footer links to the 24×24px minimum target size. */
.footer-links a {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.footer-links a:hover { color: var(--accent-strong); }
/* Creator row: "Made by MR" beside a smaller support pill. */
.footer-credit {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
}
.footer-credit a:not(.btn) {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  padding: 4px 2px;
}
.site-footer a:hover { color: var(--accent-strong); }
.site-footer .support-link {
  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;
}
/* Prose links sit close to --muted in luminance, so colour alone cannot mark them. */
.privacy-card a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.privacy-card strong {
  color: var(--ink);
  font-weight: 600;
}
.privacy-date {
  margin: 24px 0 56px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Contact ---------- */
.contact-form { display: grid; gap: 20px; }
.contact-field { display: grid; gap: 6px; }
.contact-field label { font-weight: 600; }
.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 10px 14px;
  /* --muted keeps field boundaries above the 3:1 non-text contrast minimum. */
  border: 1px solid var(--muted);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.contact-field textarea { resize: vertical; min-height: 140px; }
.contact-field input:hover,
.contact-field textarea:hover { border-color: var(--accent-strong); }
/* Off-screen rather than display:none so naive bots still fill it in. */
.contact-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.contact-note,
.contact-status { margin: 0; color: var(--muted); font-size: 0.9rem; }
.contact-status.is-error { color: var(--accent-strong); font-weight: 600; }
.contact-submit { justify-self: start; min-height: 44px; cursor: pointer; }
.contact-submit:disabled { opacity: 0.6; cursor: progress; transform: none; }

/* ---------- Buttons ---------- */
/* Shared by the 404 page link, footer support links and contact form. */
.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--small {
  padding: 6px 12px;
  font-size: 0.85rem;
  min-height: 36px;
}

/* Hover effects only where hover is real; touch screens would otherwise keep
   a "stuck" hover after a tap. */
@media (hover: hover) {
  .theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
  .app-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover), 0 0 0 3px var(--accent-soft);
    border-color: var(--border-strong);
    background: var(--surface-hover);
  }
  .app-card:hover .app-host { color: var(--accent-strong); }
  .app-card:hover .app-arrow { color: var(--accent); transform: translate(3px, -3px); }
  .category-nav a:hover { text-decoration: none; border-color: var(--accent); }
  .btn:hover {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-1px);
  }
}

/* Phones: tighter spacing so more content fits without feeling cramped. */
@media (max-width: 480px) {
  .site-header { padding: 20px 16px 0; }
  .container { padding: 0 16px; }
  .hero { padding: 44px 0 32px; }
  .app-grid { gap: 14px; }
  .app-card { padding: 18px 18px 16px; }
  .category + .category { margin-top: 32px; }
  .catalog-section,
  .catalog-section:last-of-type { margin-bottom: 40px; }
  .privacy-hero { padding: 40px 0 24px; }
  .site-footer { padding: 24px 16px; }
  /* Spacing instead of dots so a wrapped row never starts with a stray dot. */
  .footer-links li + li::before { content: none; }
}

/* Phones and touch pointers: 44px footer targets. */
@media (max-width: 480px), (pointer: coarse) {
  .footer-links a,
  .footer-credit a:not(.btn) {
    min-height: 44px;
    padding: 12px 6px;
  }
  .footer-credit a:not(.btn) { min-width: 44px; }
  .footer-credit .btn--small { min-height: 44px; }
}

/* Touch pointers: 44px targets. */
@media (pointer: coarse) {
  .category-nav a { min-height: 44px; }
  .theme-toggle { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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