/* interactives.davidslosttt.com — shares David's Newsletter's Substack look
   (near-black ground, SF Pro / system fonts, blue pop) with its own layout. */
:root {
  --bg: #171717;
  --bg-raised: #1f1f1f;
  --bg-sunk: #121212;
  --line: #2e2e2e;
  --line-strong: #3d3d3d;
  --ink: #f5f5f4;
  --ink-2: #d6d3d1;
  --muted: #a8a29e;
  --faint: #78716c;
  --pop: #2563eb;
  --pop-hover: #1d4ed8;
  --pop-ink: #93b4ff;
  --on-pop: #ffffff;
  /* Same font stacks as the davidslosttt.com Substack theme */
  --display: "SF Pro Display", -apple-system-headline, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --meta: "SF Compact", "SF Compact Text", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1120px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fbfaf8;
  --bg-raised: #ffffff;
  --bg-sunk: #f2f0ec;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --ink: #171717;
  --ink-2: #292524;
  --muted: #57534e;
  --faint: #a8a29e;
  --pop-ink: #1d4ed8;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--pop); color: var(--on-pop); padding: 8px 12px; border-radius: 6px; }

/* ── Masthead ─────────────────────────────────────────── */
.mast {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.mast .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 6px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.005em; white-space: nowrap; }
.brand-sep { color: var(--faint); font-weight: 400; margin: 0 2px; }
.brand-sub { font-family: var(--sans); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mast-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mast-link { font-size: 0.9rem; color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.mast-link:hover { color: var(--ink); background: var(--bg-raised); }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--muted);
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: 600 0.92rem/1 var(--sans); text-decoration: none; cursor: pointer;
  padding: 11px 16px; border-radius: 8px; border: 1px solid transparent;
}
.btn-pop { background: var(--pop); color: var(--on-pop); }
.btn-pop:hover { background: var(--pop-hover); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--bg-raised); }

/* ── Section heads ────────────────────────────────────── */
.sec { padding: 44px 0; }
.sec + .sec { border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.sec-head h2 { font-family: var(--display); font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sec-head a { white-space: nowrap; font-size: 0.88rem; color: var(--muted); text-decoration: none; }
.sec-head a:hover { color: var(--ink); }

/* ── Intro (Substack-style publication header) ─────────── */
.intro { padding: 56px 0 8px; text-align: center; }
.intro-logo { width: 72px; height: 72px; border-radius: 14px; margin: 0 auto 16px; }
.intro h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
.intro p { margin: 8px 0 0; color: var(--muted); font-size: 1.05rem; }

/* ── Spotlight + index ─────────────────────────────────── */
.spot { padding: 36px 0 44px; }
.meta { margin: 0; font-family: var(--meta); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta .sep { font-weight: 400; opacity: .7; }
.meta-paid { display: inline-flex; align-items: center; gap: 4px; color: var(--pop-ink); }
.meta-paid svg { width: 11px; height: 11px; }
.spot-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: center; text-decoration: none; color: inherit; }
.spot-media { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-sunk); aspect-ratio: 16 / 10; }
.spot-media img { width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .35s; }
.spot-card:hover .spot-media img { transform: scale(1.015); }
.spot-body { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.spot-text { max-width: 720px; }
.spot h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 1.75rem); line-height: 1.15; margin: 8px 0 6px; }
.spot-card:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.spot-sub { margin: 0; color: var(--ink-2); font-size: 1.05rem; line-height: 1.45; }
.spot-go { flex: none; }
.soon-line { margin: 30px 0 0; padding: 16px 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.95rem; }
.soon-line a { color: var(--pop-ink); font-weight: 600; text-decoration: none; }
.soon-line a:hover { text-decoration: underline; }

/* ── Posts ────────────────────────────────────────────── */
.posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.post a { text-decoration: none; display: flex; flex-direction: column; gap: 10px; height: 100%; }
.post-img { aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; background: var(--bg-sunk); border: 1px solid var(--line); }
.post-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.post a:hover .post-img img { transform: scale(1.03); }
.post h3 { font-family: var(--display); font-weight: 700; font-size: 1.19rem; line-height: 1.25; margin: 0 0 4px; }
.post a:hover h3 { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.post p { margin: 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.4; }
.post-meta { display: flex; align-items: center; gap: 8px; font-family: var(--meta); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.paid { display: inline-flex; align-items: center; gap: 4px; color: var(--pop-ink); font-weight: 600; }
.paid svg { width: 12px; height: 12px; }

/* ── Subscribe band ───────────────────────────────────── */
.band {
  margin: 8px 0 56px; border-radius: 16px; padding: 36px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pop) 22%, var(--bg-raised)), var(--bg-raised) 70%);
  border: 1px solid var(--line);
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
}
.band img { width: 64px; height: 64px; border-radius: 12px; }
.band h2 { font-family: var(--display); font-size: 1.6rem; margin: 0 0 4px; line-height: 1.15; }
.band p { margin: 0; color: var(--ink-2); }

/* ── Footer ───────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--faint); font-size: 0.85rem; }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot nav { display: flex; gap: 18px; }

/* ── Project page ─────────────────────────────────────── */
.proj-head { padding: 40px 0 26px; }
.crumb { font-size: 0.85rem; color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 18px; }
.crumb:hover { color: var(--ink); }
.proj-head .meta { display: flex; margin-top: 2px; }
.proj-head h1 { font-family: var(--display); font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.03; letter-spacing: -0.02em; margin: 10px 0 0; }
.proj-head .dek { font-family: var(--display); font-weight: 400; font-size: clamp(1.08rem, 1.8vw, 1.25rem); color: var(--ink-2); max-width: 60ch; margin: 14px 0 0; line-height: 1.45; }
.byline { display: flex; align-items: center; gap: 10px; margin-top: 20px; font-size: 0.86rem; color: var(--muted); flex-wrap: wrap; }
.byline img { width: 28px; height: 28px; border-radius: 50%; }
.byline b { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { font-size: 0.8rem; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--bg-raised); }
.chip b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.note {
  margin-top: 20px; padding: 13px 16px; border-left: 3px solid var(--pop);
  background: var(--bg-raised); border-radius: 0 8px 8px 0; font-size: 0.9rem; color: var(--ink-2); max-width: 820px;
}
.note b { color: var(--ink); }
.stage { max-width: 1680px; margin: 0 auto; padding: 0 20px 40px; }
#ei-shuffler-host { display: block; width: 100%; min-height: 80vh; }
.boot { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50vh; color: var(--muted); font-size: 0.92rem; }
.boot .spin { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--pop); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.method { max-width: 720px; }
.method h2 { font-family: var(--display); font-size: 1.5rem; margin: 0 0 10px; }
.method p { color: var(--ink-2); font-size: 1.08rem; line-height: 1.6; margin: 0 0 14px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 860px) {
  .spot-card { grid-template-columns: 1fr; gap: 18px; }
  .posts { grid-template-columns: 1fr; }
  .post a { flex-direction: row; align-items: flex-start; }
  .post-img { flex: none; width: 112px; }
  .band { grid-template-columns: 1fr; padding: 26px; }
}
@media (max-width: 560px) {
  .intro { padding-top: 36px; }
  .wrap, .stage { padding-left: 16px; padding-right: 16px; }
  .brand-sep, .brand-sub, .mast-link { display: none; }
  .post-img { width: 92px; }
}

/* ── Paywall / sign-in ─────────────────────────────────── */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gate { min-height: calc(100vh - 61px); display: grid; place-items: center; padding: 48px 16px; }
.gate-card { width: 100%; max-width: 500px; text-align: center; }
.gate-lock { width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--pop) 18%, var(--bg-raised)); color: var(--pop-ink); border: 1px solid var(--line); }
.gate-lock svg { width: 24px; height: 24px; }
.gate h1 { font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.1; letter-spacing: -0.015em; margin: 0; }
.gate-dek { font-family: var(--display); font-weight: 400; font-size: 1.1rem; color: var(--ink-2); margin: 14px 0 22px; }
.gate-msg { text-align: left; font-size: 0.9rem; padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; background: var(--bg-raised); border: 1px solid var(--line); border-left: 3px solid #d97706; color: var(--ink-2); }
.gate-msg.ok { border-left-color: #16a34a; }
.gate-msg b { color: var(--ink); }
.gate-form { display: flex; gap: 8px; }
.gate-form input { flex: 1; min-width: 0; font: 400 1rem var(--sans); padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-raised); color: var(--ink); }
.gate-form input:focus { outline: 2px solid var(--pop); outline-offset: 1px; }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; color: var(--faint); font-size: 0.85rem; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gate-upgrade { width: 100%; }
.paid-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pop-ink); border: 1px solid color-mix(in srgb, var(--pop) 45%, var(--line)); border-radius: 999px; padding: 3px 8px; margin-left: 8px; }
.paid-pill svg { width: 11px; height: 11px; }
@media (max-width: 480px) { .gate-form { flex-direction: column; } }
