/* Storyds website
   Same type system as the app's ReadingStyle: Charter serif body (~1.6 line height),
   a serif display face for titles, sans for UI. Monochrome ink on paper, light and dark. */

:root {
  --paper: #ffffff;
  --paper-2: #f6f4ef;
  --ink: #1a1a1a;
  --body: #242424;
  --muted: rgba(0, 0, 0, 0.55);
  --rule: rgba(0, 0, 0, 0.1);
  --chip: rgba(0, 0, 0, 0.05);
  --skeleton: rgba(0, 0, 0, 0.06);
  --live: #2f9e5b;
  --doodle-filter: none;

  --serif: Charter, "Bitstream Charter", "Source Serif 4", Georgia, serif;
  --display: "Playfair Display", Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;

  --wrap: 1120px;
  --gutter: 24px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171719;
    --paper-2: #1f1f22;
    --ink: rgba(255, 255, 255, 0.92);
    --body: rgba(255, 255, 255, 0.84);
    --muted: rgba(255, 255, 255, 0.55);
    --rule: rgba(255, 255, 255, 0.12);
    --chip: rgba(255, 255, 255, 0.08);
    --skeleton: rgba(255, 255, 255, 0.07);
    --live: #4cc47e;
    --doodle-filter: invert(1) brightness(0.92);
  }
}

:root[data-theme="dark"] {
  --paper: #171719;
  --paper-2: #1f1f22;
  --ink: rgba(255, 255, 255, 0.92);
  --body: rgba(255, 255, 255, 0.84);
  --muted: rgba(255, 255, 255, 0.55);
  --rule: rgba(255, 255, 255, 0.12);
  --chip: rgba(255, 255, 255, 0.08);
  --skeleton: rgba(255, 255, 255, 0.07);
  --live: #4cc47e;
  --doodle-filter: invert(1) brightness(0.92);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.doodle { filter: var(--doodle-filter); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled, .home .site-header { border-bottom-color: var(--rule); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.home .site-header .wrap { max-width: none; padding: 0 clamp(24px, 4vw, 48px); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand img { height: 26px; width: auto; filter: var(--doodle-filter); }
.brand span {
  font-family: var(--display);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--sans);
  font-size: 15px;
}
.nav a { text-decoration: none; color: var(--muted); transition: color 0.15s; }
.nav a:hover { color: var(--ink); }
.nav .btn { color: var(--paper); }

@media (max-width: 720px) {
  .nav a:not(.btn) { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.lg { height: 54px; padding: 0 26px; font-size: 16px; }

.app-store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 22px 0 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-family: var(--sans);
  line-height: 1.1;
}
.app-store svg { width: 24px; height: 24px; fill: currentColor; margin-top: -3px; }
.app-store small { display: block; font-size: 11px; opacity: 0.8; }
.app-store strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Type ---------- */

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}

h1, h2, h3 {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  font-variant-numeric: lining-nums;
}

/* ---------- Home layout: about on the left, live stories on the right ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 42%);
  align-items: start;
}

.pitch { min-width: 0; }
.pitch > section, .pitch > .site-footer { padding-left: clamp(24px, 5vw, 72px); padding-right: clamp(24px, 4vw, 56px); }
.pitch > section > * { max-width: 760px; }

.library {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--rule);
  background: var(--paper);
  scrollbar-width: thin;
}

@media (max-width: 1023px) {
  /* One column: the stories come right after the hero */
  .layout { display: flex; flex-direction: column; }
  .pitch { display: contents; }
  .pitch > * { order: 2; }
  .pitch > .hero { order: 0; }
  .library {
    order: 1;
    width: 100%;
    min-width: 0;
    position: static;
    height: auto;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }
}

/* ---------- Hero ---------- */

.hero { padding-top: 88px; padding-bottom: 96px; }

.hero h1 {
  font-size: clamp(44px, 5.6vw, 76px);
  line-height: 1.03;
  max-width: 11ch;
}
.hero h1 em { font-style: italic; font-weight: 500; }

.hero .lede {
  font-size: 21px;
  max-width: 32ch;
  margin: 26px 0 36px;
  color: var(--muted);
}

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.hero-note { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 16px; }

.read-now .arrow { display: inline-block; transition: transform 0.2s; }
.read-now:hover .arrow { transform: translateX(3px); }
@media (max-width: 1023px) { .read-now .arrow { transform: rotate(90deg); } .read-now:hover .arrow { transform: rotate(90deg) translateX(3px); } }

@media (max-width: 720px) {
  .hero { padding-top: 40px; padding-bottom: 56px; }
  .hero .lede { font-size: 19px; }
}

/* ---------- Sections ---------- */

section { padding-top: 104px; padding-bottom: 104px; }
section.tint { background: var(--paper-2); }

.section-head { max-width: 720px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(34px, 4vw, 50px); line-height: 1.08; }
.section-head p:not(.eyebrow) { color: var(--muted); font-size: 20px; margin: 18px 0 0; max-width: 40ch; }

@media (max-width: 720px) {
  section { padding-top: 80px; padding-bottom: 80px; }
  .section-head { margin-bottom: 44px; }
  .section-head p:not(.eyebrow) { font-size: 18px; }
}

/* Steps */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step { border-top: 1px solid var(--ink); padding-top: 22px; }
.step img { height: 120px; width: auto; margin: 6px 0 20px; }
.step .num { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; }
.step h3 { font-size: 26px; margin: 6px 0 10px; }
.step p { margin: 0; color: var(--muted); font-size: 17px; }

@media (max-width: 1280px) and (min-width: 1024px), (max-width: 720px) {
  .steps { grid-template-columns: 1fr; gap: 44px; }
}

/* Write */

.split {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 40px;
  align-items: center;
}
.split .art img { width: 100%; max-width: 300px; margin: 0 auto; }
.split .section-head { margin-bottom: 0; }
@media (max-width: 1280px) and (min-width: 1024px), (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .split .art { order: -1; }
  .split .art img { width: 240px; margin: 0; }
}

.facts { list-style: none; margin: 36px 0 0; padding: 0; }
.facts li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  font-size: 17px;
}
.facts li:last-child { border-bottom: 1px solid var(--rule); }
.facts b { font-variant-numeric: lining-nums; font-family: var(--display); font-size: 26px; color: var(--ink); line-height: 1.2; font-weight: 700; }
.facts span { color: var(--muted); }
@media (max-width: 480px) { .facts li { grid-template-columns: 1fr; gap: 4px; } }

/* Genres */

.genres { display: flex; flex-wrap: wrap; gap: 10px; }
.genre {
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 34px);
  color: var(--ink);
  padding: 8px 22px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  line-height: 1.2;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: default;
}
.genre:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.genre.alt { font-style: italic; font-weight: 400; background: var(--chip); border-color: transparent; }
.genre-note { margin-top: 28px; color: var(--muted); font-size: 16px; font-family: var(--sans); }

/* Safety */

.promises { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.promise {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 26px 24px;
}
.promise img { height: 70px; width: auto; margin-bottom: 16px; }
.promise h3 { font-size: 22px; margin-bottom: 8px; }
.promise p { margin: 0; font-size: 16px; color: var(--muted); line-height: 1.55; }
@media (max-width: 560px) { .promises { grid-template-columns: 1fr; } }

/* FAQ */

.faq { max-width: 760px; }
.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 0;
  font-family: var(--display);
  font-size: 21px;
  color: var(--ink);
  font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--sans);
  font-weight: 300;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: -6px 0 22px; color: var(--muted); font-size: 17px; max-width: 60ch; }

/* Final CTA */

.cta { text-align: center; padding-top: 112px; padding-bottom: 112px; }
.pitch > .cta > * { margin-left: auto; margin-right: auto; }
.cta img { height: 72px; width: auto; margin: 0 auto 28px; filter: var(--doodle-filter); }
.cta h2 { font-size: clamp(36px, 4.6vw, 58px); line-height: 1.05; max-width: 14ch; margin: 0 auto; }
.cta p { color: var(--muted); font-size: 20px; margin: 20px auto 36px; max-width: 34ch; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-top: 36px;
  padding-bottom: 44px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}
.site-footer, .site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.site-footer:has(.wrap) { display: block; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Live stories panel ---------- */

.library-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 26px 28px 0;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 1023px) { .library-head { top: var(--header-h); padding: 26px var(--gutter) 0; } }

.library-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.library-title h2 { font-size: 28px; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.chips {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  margin: 14px -28px 0;
  padding: 0 28px;
  font-family: var(--sans);
  font-size: 14px;
}
.chips::-webkit-scrollbar { display: none; }
@media (max-width: 1023px) { .chips { margin: 14px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter); } }

.chip {
  flex: none;
  background: none;
  border: 0;
  padding: 6px 0 12px;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.chip[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.cards { padding: 8px 28px 40px; }
@media (max-width: 1023px) { .cards { padding: 8px var(--gutter) 40px; } }

.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.card .thumb {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--skeleton);
}
.card-meta { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.card h3 { font-size: 21px; line-height: 1.22; margin-bottom: 8px; overflow-wrap: anywhere; }
.card .excerpt {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The newest story leads with a full-width cover */
.card.lead { grid-template-columns: 1fr; padding-top: 20px; }
.card.lead .thumb { order: -1; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 14px; }
.card.lead h3 { font-size: 28px; }
.card.lead .excerpt { -webkit-line-clamp: 4; font-size: 16.5px; color: var(--body); }

.byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
.byline b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  text-transform: uppercase;
}
.avatar.lg { width: 36px; height: 36px; font-size: 15px; }

/* Loading */
.card.skeleton { pointer-events: none; }
.skeleton .bar { height: 12px; border-radius: 6px; background: var(--skeleton); margin-bottom: 10px; }
.skeleton .bar.t { height: 20px; width: 80%; margin-bottom: 14px; }
.skeleton .bar.s { width: 40%; }
.skeleton .thumb { animation: shimmer 1.4s ease-in-out infinite; }
.skeleton .bar { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: 0.45; } }

/* Empty, error and end-of-list states */
.state {
  text-align: center;
  padding: 48px 12px 24px;
  font-family: var(--sans);
}
.state img { width: auto; height: 120px; margin: 0 auto 18px; }
.state h3 { font-size: 22px; margin-bottom: 6px; }
.state p { margin: 0 auto 18px; color: var(--muted); font-size: 15px; max-width: 30ch; line-height: 1.5; }

/* ---------- Reader (one story, inside the panel) ---------- */

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 1023px) { .reader-bar { top: var(--header-h); } }

.back {
  background: none;
  border: 0;
  padding: 8px 10px;
  margin-left: -10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.back:hover { background: var(--chip); }

.reader-body { padding: 28px 32px 56px; }
@media (max-width: 1023px) { .reader-body { padding: 24px var(--gutter) 56px; max-width: 720px; margin: 0 auto; } }

.reader-body .cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; margin-bottom: 26px; background: var(--skeleton); }
.reader-body .card-meta { font-size: 13px; }
.reader-body h1 { font-size: clamp(30px, 3vw, 38px); line-height: 1.14; margin: 4px 0 18px; overflow-wrap: anywhere; }
.reader-body .byline { font-size: 14px; margin-bottom: 32px; }
.reader-body .story p { font-size: 19px; line-height: 1.62; color: var(--body); margin: 0 0 1.35em; overflow-wrap: break-word; }

.the-end {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 40px 0 28px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
.the-end::before, .the-end::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.after-story {
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  gap: 18px;
  align-items: center;
  font-family: var(--sans);
}
.after-story img { height: 48px; width: auto; flex: none; filter: var(--doodle-filter); }
.after-story p { margin: 0 0 12px; font-size: 15px; line-height: 1.45; color: var(--body); }
.after-story .btn { height: 38px; font-size: 14px; padding: 0 16px; }

.reader-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  font-family: var(--sans);
  font-size: 14px;
}
.reader-actions .report { color: var(--muted); text-underline-offset: 3px; }
.reader-actions .report:hover { color: var(--ink); }

/* ---------- Legal / support pages ---------- */

.doc { padding: 72px 0 112px; }
.doc .wrap { max-width: 720px; }
.doc h1 { font-size: clamp(38px, 6vw, 56px); line-height: 1.08; margin-bottom: 12px; }
.doc .updated { font-family: var(--sans); font-size: 14px; color: var(--muted); margin: 0 0 40px; }
.doc .intro { font-size: 21px; color: var(--body); }
.doc h2 { font-size: 26px; margin: 48px 0 12px; }
.doc p { margin: 0 0 1em; }
.doc a { text-underline-offset: 3px; }
.doc .doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
  font-family: var(--sans);
  font-size: 14px;
}
.doc .doc-nav a {
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.doc .doc-nav a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.contact-card {
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 28px;
  margin: 32px 0;
  display: flex;
  gap: 24px;
  align-items: center;
}
.contact-card img { height: 90px; width: auto; flex: none; }
.contact-card p { margin: 0 0 14px; }
@media (max-width: 560px) { .contact-card { flex-direction: column; align-items: flex-start; } }

/* ---------- Motion ---------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
.fade-in { animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .fade-in, .live i, .skeleton .bar, .skeleton .thumb { animation: none; }
}
