/* sillyapps.co — quiet, editorial, dark-first. */
:root {
  color-scheme: dark;
  --paper: light-dark(#fafaf9, #0a0a0b);
  --paper-2: light-dark(#f2f2f0, #111113);
  --ink: light-dark(#18181b, #ededef);
  --muted: light-dark(#57575f, #9d9da6);
  --faint: light-dark(#6b6b75, #8a8a94);
  --card: light-dark(#ffffff, #121214);
  --line: light-dark(#e4e4e1, #232327);
  --line-strong: light-dark(#d0d0cc, #34343a);
  --accent: light-dark(#3d5a80, #a9bde0);
  --accent-ink: light-dark(#ffffff, #0a0a0b);
  --sage: light-dark(#2f5d50, #9fcfbf);
  --slate: light-dark(#3d5a80, #a9bde0);
  --err: light-dark(#a1262b, #f2a7a7);
  --btn: light-dark(#18181b, #ededef);
  --btn-ink: light-dark(#fafaf9, #0a0a0b);
  --shadow-color: light-dark(rgba(24, 24, 27, 0.06), rgba(0, 0, 0, 0.5));
  --shadow: 0 1px 2px var(--shadow-color), 0 8px 24px var(--shadow-color);
  --radius: 14px;
  --radius-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* 4px spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: light) {
  html[data-theme="system"], html:not([data-theme]) { color-scheme: light; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip { position: absolute; left: var(--s3); top: -4rem; z-index: 20; padding: var(--s2) var(--s3); background: var(--ink); color: var(--card); border-radius: var(--radius-sm); }
.skip:focus { top: var(--s3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
@media (max-width: 480px) { .wrap { width: calc(100% - 40px); } }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s5) 0;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.wordmark-mark { width: 22px; height: 22px; }
.header-tools { display: flex; align-items: center; gap: var(--s5); margin-left: auto; }
.byline { display: flex; align-items: center; gap: var(--s5); margin: 0; color: var(--muted); font-size: 14px; }
.byline a, .header-waitlist { color: var(--muted); text-decoration: none; font-size: 14px; }
.byline a:hover, .header-waitlist:hover { color: var(--ink); }
.nav-hide-sm { }
@media (max-width: 640px) { .nav-hide-sm { display: none; } .header-tools { gap: var(--s3); } }

.theme-toggle { position: relative; display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.theme-toggle legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-toggle label { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.theme-toggle label:has(input:checked) { color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.theme-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.theme-toggle label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shared type */
.eyebrow { margin: 0 0 var(--s4); color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.section-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.1; letter-spacing: -0.02em; }
.section-lead { margin: var(--s4) 0 0; max-width: 34rem; color: var(--muted); font-size: 17px; }

/* Hero */
.hero { padding: var(--s9) 0 var(--s9); border-bottom: 1px solid var(--line); }
.hero h1 {
  margin: 0; max-width: 15ch; font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 8vw, 88px); line-height: 1.02; letter-spacing: -0.03em;
}
.hero h1 em { font-style: italic; color: var(--muted); }
.hero-lead { margin: var(--s6) 0 0; max-width: 36rem; color: var(--muted); font-size: clamp(17px, 1.6vw, 19px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s7); }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: var(--s7) 0 0; padding: 0; list-style: none; color: var(--faint); font-size: 13px; }
.hero-meta li::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 10px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
@media (max-width: 640px) { .hero { padding: var(--s8) 0; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-primary:hover { color: var(--btn-ink); background: color-mix(in srgb, var(--btn) 86%, var(--paper)); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn .arrow { transition: transform .15s ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* Apps */
.apps { padding: var(--s9) 0; }
.apps-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s7); }
.app-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .app-grid { grid-template-columns: repeat(2, 1fr); } }
.app-card {
  display: flex; flex-direction: column; gap: var(--s5);
  padding: var(--s6); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s ease;
}
.app-card:hover { border-color: var(--line-strong); }
.app-top { display: flex; align-items: center; justify-content: space-between; }
.icon { width: 48px; height: 48px; border-radius: 12px; }
.app-index { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.app-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; letter-spacing: -0.015em; }
.app-card .pitch { margin: var(--s2) 0 0; color: var(--ink); font-size: 16px; }
.app-card .blurb { margin: 0; color: var(--muted); font-size: 15px; }
.notes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.notes li { padding: 2px 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; line-height: 20px; }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin: auto 0 0; padding-top: var(--s2); }
.cta-row .btn { min-height: 40px; font-size: 13px; padding: 0 14px; }

.card-note { margin: calc(var(--s2) * -1) 0 0; color: var(--faint); font-size: 12px; }
.card-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* Snippets download tip */
.download-note {
  width: min(26rem, calc(100% - 40px)); padding: var(--s6); margin: auto;
  color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.download-note::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.download-note h2 { margin: 0 0 var(--s3); font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; letter-spacing: -0.015em; }
.download-note p { margin: 0 0 var(--s5); color: var(--muted); }
.download-note .eyebrow { margin-bottom: var(--s3); }
.download-note .btn { width: 100%; }

/* Waitlist */
.waitlist { padding: 0 0 var(--s9); }
.waitlist-panel {
  display: grid; gap: var(--s7); padding: var(--s8);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
}
@media (min-width: 880px) { .waitlist-panel { grid-template-columns: 1fr 1.1fr; align-items: center; } }
@media (max-width: 640px) { .waitlist-panel { padding: var(--s6) var(--s5); } }
.waitlist-card { display: grid; gap: var(--s4); }
.admin-login.waitlist-card { padding: var(--s6); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.waitlist-card h2, .admin-login h1 { margin: 0; }
.waitlist-lead { margin: 0; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.waitlist-fields { display: grid; gap: var(--s3); }
@media (min-width: 520px) { .waitlist-fields { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; }
.field label { color: var(--ink); font-size: 13px; font-weight: 500; }
.optional { color: var(--faint); font-weight: 400; }
.field input, .field select, .admin-filters select, .admin-table input[type="text"], .admin-table input[type="search"] {
  width: 100%; min-height: 44px; padding: 0 var(--s3);
  color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; color-scheme: inherit; transition: border-color .15s ease;
}
.field input:hover { border-color: var(--faint); }
.field input:focus, .field select:focus, .admin-filters select:focus, .admin-table input[type="text"]:focus, .admin-table input[type="search"]:focus {
  border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0;
}
.field input:disabled, .admin-table input:disabled, .admin-filters select:disabled { opacity: .6; cursor: not-allowed; }
::placeholder { color: var(--faint); opacity: 1; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); caret-color: var(--ink); box-shadow: 0 0 0 1000px var(--card) inset; }
.waitlist-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.waitlist-submit:disabled { cursor: wait; opacity: .7; }
.privacy { margin: 0; color: var(--muted); font-size: 13px; }
.form-status { flex-basis: 100%; min-height: 1.4em; margin: 0; font-size: 14px; font-weight: 500; }
.form-status:empty { min-height: 0; }
.form-status[data-kind="ok"] { color: var(--sage); }
.form-status[data-kind="err"] { color: var(--err); }
.form-status[data-kind="pending"] { color: var(--muted); }
.waitlist-card.is-success .waitlist-fields, .waitlist-card.is-success .waitlist-submit, .waitlist-card.is-success .hp { display: none; }

/* Footer */
.site-footer { padding: var(--s7) 0 var(--s8); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: grid; gap: var(--s6); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 720px) { .site-footer .wrap { grid-template-columns: 1fr auto; } }
.footer-brand p { margin: var(--s2) 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: var(--s4) 0 0; padding: 0; list-style: none; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.share-qr { display: flex; align-items: center; gap: var(--s4); margin: 0; }
.share-qr img {
  width: 96px; height: 96px; padding: 4px; background: #fff; border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--line); image-rendering: pixelated; /* stays black-on-white so it scans */
}
.share-qr figcaption { color: var(--muted); font-size: 13px; line-height: 1.4; }
.share-qr figcaption strong { display: block; color: var(--ink); font-weight: 500; }

/* 404 */
.lost { padding: var(--s10) 0; }
.lost h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 6vw, 56px); letter-spacing: -0.02em; }
.lost p { color: var(--muted); }

/* Subtle entrance; off for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
  .hero > :nth-child(2) { animation-delay: .06s; } .hero > :nth-child(3) { animation-delay: .12s; } .hero > :nth-child(4) { animation-delay: .18s; } .hero > :nth-child(5) { animation-delay: .24s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.wrap-wide {
  width: min(88rem, calc(100% - 2rem));
}

.admin-body .site-header {
  align-items: center;
}

.admin-logout {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.admin-main {
  padding: 0.5rem 0 3rem;
}

.admin-login h1,
.admin-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.admin-login-form {
  display: grid;
  gap: 0.85rem;
}

.admin-login-form .btn {
  justify-self: start;
}

.admin-board {
  display: grid;
  gap: 1rem;
}

.admin-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-count {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.admin-spark {
  margin: 0;
  color: var(--accent);
  min-width: 10rem;
}

.admin-spark figcaption {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-spark svg {
  width: 10rem;
  height: 2.4rem;
}

.admin-banner {
  margin: 0;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.9rem;
}

.admin-filters {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}

.admin-exports {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.admin-table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-table {
  width: 100%;
  min-width: 52rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-email {
  font-weight: 650;
  word-break: break-all;
}

.admin-when {
  white-space: nowrap;
  color: var(--muted);
}

.admin-emailed {
  width: 5.5rem;
}

.admin-emailed input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.admin-delete {
  min-height: 2.2rem;
  padding: 0.3rem 0.75rem;
  color: var(--err);
}

.admin-empty,
.admin-footnote {
  margin: 0;
}

@media (min-width: 760px) {
  .admin-filters {
    grid-template-columns: minmax(10rem, 1.4fr) repeat(2, minmax(8rem, 0.8fr)) minmax(7rem, 0.7fr) auto;
    align-items: end;
  }

  .admin-filter-actions {
    padding-bottom: 0.05rem;
  }
}
