:root {
  color-scheme: light;
  --ink: #22201d;
  --muted: #6c645a;
  --paper: #f5f0e7;
  --paper-raised: #fffdf8;
  --line: #d8cec0;
  --accent: #81552e;
  --accent-dark: #5f3a1e;
  --focus: #246b9f;
  --active-surface: #eee5d9;
  --neutral-chip: #eee5d9;
  --neutral-chip-ink: #5b4632;
  --positive-chip: #e1eddf;
  --positive-chip-ink: #345d35;
  --info-chip: #e2e8f4;
  --info-chip-ink: #344f78;
  --warning-chip: #f2e8d2;
  --warning-chip-ink: #6a4c1f;
  --danger-chip: #eee1df;
  --danger-chip-ink: #74453f;
  --card-shadow: rgb(65 48 30 / 8%);
  --card-shadow-hover: rgb(65 48 30 / 14%);
  --cover-matte: #17130f;
  --cover-shadow: rgb(48 36 24 / 18%);
  --worldline-bg: #f2ede4;
  --worldline-panel: #fbf8f1;
  --worldline-panel-raised: #fffdf8;
  --worldline-ink: #24211d;
  --worldline-muted: #665f56;
  --worldline-line: rgb(62 48 34 / 20%);
  --worldline-subtle-line: rgb(62 48 34 / 10%);
  --worldline-amber: #92580f;
  --worldline-blue: #326e91;
  --worldline-teal: #176e5c;
  --worldline-violet: #70548b;
  --worldline-grey: #697074;
  --worldline-page-glow: rgb(168 105 32 / 10%);
  --worldline-hero-background:
    radial-gradient(circle at 82% 18%, rgb(23 110 92 / 10%), transparent 25rem),
    radial-gradient(circle at 24% 20%, rgb(146 88 15 / 16%), transparent 30rem),
    linear-gradient(155deg, #fff4df, #eef5f2 62%, #f2ede4);
  --worldline-skip-bg: #2c241b;
  --worldline-skip-ink: #fffaf2;
  --worldline-art-bg: #ddd5c9;
  --worldline-nav-bg: rgb(242 237 228 / 94%);
  --worldline-hover: rgb(80 58 35 / 7%);
  --worldline-control-active: #6c4826;
  --worldline-control-active-ink: #fffaf1;
  --worldline-input-bg: #fffdf8;
  --worldline-glass-bg: rgb(255 253 248 / 88%);
  --worldline-shadow: rgb(65 44 25 / 14%);
  --worldline-epoch-tone: 93%;
  --worldline-epoch-end-tone: 98%;
  --worldline-era-tone: 94%;
  --worldline-era-end-tone: 88%;
  --worldline-node-bg: #fbf8f1;
  --worldline-drawer-bg: #fbf8f1;
  --worldline-cover-bg: #17130f;
  --worldline-marker-center: #f2ede4;
  --worldline-badge-ink: #fffdf8;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1ece4;
  --muted: #b9afa2;
  --paper: #151412;
  --paper-raised: #211f1b;
  --line: #403a33;
  --accent: #d4a06e;
  --accent-dark: #e2b582;
  --focus: #79c6ff;
  --active-surface: #332e27;
  --neutral-chip: #35302a;
  --neutral-chip-ink: #e1c7ac;
  --positive-chip: #1e3a2a;
  --positive-chip-ink: #a7d7ae;
  --info-chip: #223149;
  --info-chip-ink: #adc7ef;
  --warning-chip: #463720;
  --warning-chip-ink: #e8c681;
  --danger-chip: #442927;
  --danger-chip-ink: #efafa6;
  --card-shadow: rgb(0 0 0 / 24%);
  --card-shadow-hover: rgb(0 0 0 / 34%);
  --cover-matte: #090807;
  --cover-shadow: rgb(0 0 0 / 42%);
  --worldline-bg: #08090a;
  --worldline-panel: #111315;
  --worldline-panel-raised: #17191c;
  --worldline-ink: #f8f0e3;
  --worldline-muted: #bdb4a7;
  --worldline-line: rgb(246 230 207 / 18%);
  --worldline-subtle-line: rgb(246 230 207 / 9%);
  --worldline-amber: #efa94f;
  --worldline-blue: #82b3cf;
  --worldline-teal: #82ddc0;
  --worldline-violet: #b79bd6;
  --worldline-grey: #99a0a2;
  --worldline-page-glow: rgb(239 169 79 / 8%);
  --worldline-hero-background:
    radial-gradient(circle at 82% 18%, rgb(130 221 192 / 12%), transparent 25rem),
    radial-gradient(circle at 24% 20%, rgb(239 169 79 / 18%), transparent 30rem),
    linear-gradient(155deg, #17120d, #0d1012 62%, #08090a);
  --worldline-skip-bg: #fff7e9;
  --worldline-skip-ink: #12100e;
  --worldline-art-bg: #050708;
  --worldline-nav-bg: rgb(8 9 10 / 94%);
  --worldline-hover: rgb(255 255 255 / 6%);
  --worldline-control-active: #f0e4d1;
  --worldline-control-active-ink: #15110d;
  --worldline-input-bg: #111315;
  --worldline-glass-bg: rgb(10 12 13 / 84%);
  --worldline-shadow: rgb(0 0 0 / 28%);
  --worldline-epoch-tone: 18%;
  --worldline-epoch-end-tone: 6%;
  --worldline-era-tone: 16%;
  --worldline-era-end-tone: 8%;
  --worldline-node-bg: #0b0d0f;
  --worldline-drawer-bg: #0d0f11;
  --worldline-cover-bg: #08090a;
  --worldline-marker-center: #0a0c0d;
  --worldline-badge-ink: #091116;
}

@layer base {

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.65;
}

body {
  background: var(--paper);
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--accent);
}

a:focus-visible {
  border-radius: 0.15rem;
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.site-header,
.library,
.story {
  margin-inline: auto;
  width: min(100% - 2rem, 80rem);
}

.site-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  padding-block: 1.2rem;
}

.site-name {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav {
  align-items: center;
  display: flex;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  gap: 0.3rem;
  margin-left: auto;
}

.site-nav a {
  border-radius: 999px;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent-dark);
}

.site-nav a[aria-current="page"] {
  background: var(--active-surface);
  color: var(--ink);
}

.site-actions {
  align-items: center;
  display: flex;
  gap: 0.3rem;
}

.theme-toggle {
  align-items: center;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 0.38rem;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.theme-icon {
  fill: none;
  height: 1rem;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 1rem;
}

.theme-icon-dark,
[data-theme-label="dark"] {
  display: none;
}

:root[data-theme="dark"] .theme-icon-light,
:root[data-theme="dark"] [data-theme-label="light"] {
  display: none;
}

:root[data-theme="dark"] .theme-icon-dark,
:root[data-theme="dark"] [data-theme-label="dark"] {
  display: inline;
}

.repository-link {
  align-items: center;
  border-radius: 50%;
  color: var(--ink);
  display: inline-flex;
  height: 2.25rem;
  justify-content: center;
  transition: background-color 150ms ease, color 150ms ease;
  width: 2.25rem;
}

.repository-link:hover {
  background: var(--paper-raised);
  color: var(--accent);
}

.repository-link svg {
  fill: currentcolor;
  height: 1.35rem;
  width: 1.35rem;
}

.library {
  padding-block: clamp(3.5rem, 8vw, 7rem);
}

.collection-count,
.story-page-meta {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

h1 {
  font-size: clamp(2.7rem, 7vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0;
  text-wrap: balance;
}

.library h1 {
  text-wrap: wrap;
}

.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  margin: 1.4rem 0 0;
  max-width: 38rem;
}

.collection-count {
  font-size: 0.82rem;
  margin: 1rem 0 0;
}

.story-grid {
  display: grid;
  align-items: stretch;
  gap: clamp(1rem, 2vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.story-card {
  height: 100%;
  min-width: 0;
}

.story-card-link {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  box-shadow: 0 0.4rem 1.4rem var(--card-shadow);
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.story-card-link:hover {
  border-color: var(--accent);
  box-shadow: 0 0.8rem 2rem var(--card-shadow-hover);
  transform: translateY(-2px);
}

.card-cover {
  aspect-ratio: 9 / 16;
  background: var(--cover-matte);
  display: block;
  height: auto;
  object-fit: contain;
  width: 100%;
}

.card-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1.25rem;
}

.story-title {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

.card-prompt {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
  line-height: 1.45;
}

.card-details {
  border-top: 1px solid var(--line);
  display: grid;
  font-family: ui-sans-serif, system-ui, sans-serif;
  gap: 0.8rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: auto 0 0;
  padding-top: 0.9rem;
}

.card-detail {
  min-width: 0;
}

.card-detail:last-child {
  grid-column: 1 / -1;
}

.card-detail dt {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  margin-bottom: 0.28rem;
  text-transform: uppercase;
}

.card-detail dd {
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.3;
  margin: 0;
}

.prompt-label {
  color: var(--muted);
  display: block;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.word-count,
.rating,
.status {
  background: var(--neutral-chip);
  border-radius: 999px;
  color: var(--neutral-chip-ink);
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  padding: 0.18rem 0.55rem;
  text-transform: uppercase;
}

.status-canon,
.status-final {
  background: var(--positive-chip);
  color: var(--positive-chip-ink);
}

.status-reviewed {
  background: var(--info-chip);
  color: var(--info-chip-ink);
}

.status-candidate {
  background: var(--warning-chip);
  color: var(--warning-chip-ink);
}

.status-abandoned {
  background: var(--danger-chip);
  color: var(--danger-chip-ink);
}

.rating-pg {
  background: var(--positive-chip);
  color: var(--positive-chip-ink);
}

.rating-ya {
  background: var(--info-chip);
  color: var(--info-chip-ink);
}

.rating-r-plus {
  background: var(--danger-chip);
  color: var(--danger-chip-ink);
}

.story {
  max-width: 42rem;
  padding-block: clamp(3rem, 8vw, 6rem);
}

.back-link {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  margin: 0 0 2.5rem;
}

.story-page-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.72rem;
  gap: 0.5rem 0.8rem;
  margin: 0 0 1.5rem;
}

.story h1 {
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  margin-bottom: 0.8rem;
}

.prompt {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  margin: 0 0 2rem;
  padding: 1rem 1.15rem;
}

.prompt blockquote,
.story .prompt blockquote {
  border: 0;
  color: var(--ink);
  margin: 0;
  padding: 0;
}

.story-cover {
  margin: 0 auto clamp(3rem, 8vw, 5rem);
  max-width: 30rem;
}

.story-cover img {
  aspect-ratio: 9 / 16;
  border-radius: 0.65rem;
  box-shadow: 0 1rem 2.5rem var(--cover-shadow);
  display: block;
  height: auto;
  width: 100%;
}

.story-prose {
  margin-top: 0;
}

.story h2 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 500;
  line-height: 1.2;
  margin: 2.75rem 0 1rem;
}

.story h3 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 2.25rem 0 0.75rem;
}

.story p {
  hyphens: auto;
  margin: 0 0 1.25em;
  orphans: 3;
  widows: 3;
}

.story li {
  margin-bottom: 0.45rem;
}

.story blockquote {
  border-left: 3px solid var(--line);
  color: var(--muted);
  margin: 1.75rem 0;
  padding-left: 1.25rem;
}

.story table {
  border-collapse: collapse;
  display: block;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  margin-block: 2rem;
  max-width: 100%;
  overflow-x: auto;
}

.story th,
.story td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.story hr {
  border: 0;
  color: var(--muted);
  margin: 3.5rem auto;
  overflow: visible;
  text-align: center;
}

.story hr::after {
  content: "⁂";
  font-size: 1.1rem;
  letter-spacing: 0.4em;
}

}
