@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/inter-tight-medium.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --page: #f4f6f7;
  --ink: #08131f;
  --muted: #65707a;
  --rule: rgba(8, 19, 31, .18);
  --quiet-rule: rgba(8, 19, 31, .09);
  --accent: #08131f;
  --reader-size: 1.25rem;
  --ui-font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --reading-font: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --gutter: clamp(1.25rem, 4.5vw, 4.5rem);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0e12;
  --ink: #edf0f2;
  --muted: #9ba4ab;
  --rule: rgba(237, 240, 242, .2);
  --quiet-rule: rgba(237, 240, 242, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
button:disabled { cursor: default; opacity: .35; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
a:hover, button:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .32em; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--ink); color: var(--page); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  transform: translateY(-200%);
  padding: .75rem 1rem;
  background: var(--ink);
  color: var(--page);
}
.skip-link:focus { transform: none; }

.site-header, .library-view, .site-footer {
  width: min(calc(100% - (var(--gutter) * 2)), 1240px);
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--rule);
  font-size: .8125rem;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.parent-brand { justify-self: start; }
.site-header .theme-button { justify-self: end; }
.theme-button, .reader-tools button {
  min-width: 44px;
  min-height: 44px;
  padding: .55rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.theme-button { letter-spacing: normal; text-transform: none; }
.theme-button:hover:not(:disabled), .reader-tools button:hover:not(:disabled) {
  background: var(--quiet-rule);
  border-color: var(--muted);
  text-decoration: none;
}

.library-view { padding-bottom: clamp(4rem, 8vw, 8rem); }
.library-heading {
  display: grid;
  min-height: clamp(320px, 48vw, 590px);
  place-items: center;
  padding-block: clamp(4rem, 9vw, 8rem);
}
.library-heading h1 { width: min(100%, 800px); margin: 0; }
.collection-logo { width: 100%; }
:root[data-theme="dark"] .collection-logo,
:root[data-theme="dark"] .reader-logo { filter: invert(1) grayscale(1) brightness(1.08); }

.continue-panel {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1.15rem;
  border-top: 1px solid var(--rule);
  font-size: .8125rem;
}
.continue-panel p { margin: 0; }
.continue-label { margin-right: 1.25rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#continueTitle { font-weight: 500; }
#continueMeta { margin-left: .6rem; color: var(--muted); }
.continue-panel a { flex: none; border-bottom: 1px solid var(--ink); padding-bottom: .15rem; }
.continue-panel a:hover { text-decoration: none; border-color: transparent; }

.story-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.story-entry {
  --story-accent: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding-block: clamp(3rem, 6vw, 5.5rem);
  border-bottom: 1px solid var(--rule);
}
.story-entry.without-art { grid-template-columns: minmax(0, 1fr); }
.entry-copy { min-width: 0; }
.entry-copy h2 {
  max-width: 16ch;
  margin: 0;
  font-family: var(--reading-font);
  font-size: clamp(2.7rem, 5vw, 4.8rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.entry-copy h2 a:hover { color: var(--story-accent); text-decoration: none; }
:root[data-theme="dark"] .entry-copy h2 a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--story-accent); }
.entry-excerpt {
  max-width: 40ch;
  margin: 1.6rem 0 1.8rem;
  color: var(--muted);
  font-family: var(--reading-font);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.read-link { display: inline-block; border-bottom: 1px solid var(--story-accent); padding-bottom: .2rem; font-size: .875rem; }
.read-link:hover { border-color: transparent; text-decoration: none; }
.reading-action { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .6rem; row-gap: .35rem; }
.reading-time { color: var(--muted); font-size: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-art { justify-self: end; width: 100%; }
.entry-art img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.entry-art:hover { opacity: .88; text-decoration: none; }
.loading-text, .load-error { padding-block: 4rem; line-height: 1.7; }

.reader-view { min-height: 100vh; }
.reading-progress { position: fixed; z-index: 40; inset: 0 0 auto; height: 2px; pointer-events: none; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); }
.reader-nav {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--page) 94%, transparent);
  backdrop-filter: blur(12px);
  font-size: .8125rem;
}
.back-link { justify-self: start; }
.reader-logo { width: clamp(135px, 14vw, 175px); }
.reader-nav-title { color: var(--muted); }
.reader-tools { display: flex; justify-self: end; align-items: center; gap: .4rem; }

.story { width: min(calc(100% - (var(--gutter) * 2)), 1080px); margin-inline: auto; padding-bottom: 6rem; }
.story-title-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(175px, 250px);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: center;
  min-height: min(760px, calc(100vh - 76px));
  padding-block: clamp(4rem, 8vw, 7rem);
  border-bottom: 1px solid var(--rule);
}
.story-title-block.without-art { display: block; min-height: 0; }
.story-title-copy { min-width: 0; }
.story-title-copy h1 {
  max-width: 13ch;
  margin: 0;
  font-family: var(--reading-font);
  font-size: clamp(3.6rem, 7.2vw, 7rem);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.story-title-copy h1:focus, .story-copy:focus { outline: none; }
.story-description {
  max-width: 42ch;
  margin: 2rem 0 1.5rem;
  color: var(--muted);
  font-family: var(--reading-font);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.story-author { margin: 0 0 2rem; font-size: .8125rem; letter-spacing: .045em; text-transform: uppercase; }
.begin-link { display: inline-block; border-bottom: 1px solid var(--accent); padding-bottom: .2rem; font-size: .875rem; }
.begin-link:hover { border-color: transparent; text-decoration: none; }
.story-art { width: 100%; margin: 0; }
.story-art img { width: 100%; }
.story-title-block.art-wide { grid-template-columns: 1fr; }
.art-wide .story-art { width: min(100%, 860px); margin-inline: auto; }

.story-copy, .story-ending { width: min(100%, 650px); margin-inline: auto; }
.story-copy {
  padding-top: clamp(4.5rem, 9vw, 8rem);
  font-family: var(--reading-font);
  font-size: var(--reader-size);
  line-height: 1.75;
  scroll-margin-top: 100px;
  overflow-wrap: break-word;
}
.story-copy h2 {
  margin: 3.5em 0 1.5em;
  font-family: var(--ui-font);
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.story-divider { width: 2.5rem; height: 1px; margin: 3.5rem auto; background: var(--rule); }
.story-ending { margin-top: 5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }
.end-mark { display: block; width: 1.75rem; height: 1px; margin-bottom: 1.5rem; background: var(--accent); }
.story-ending > p { margin: 0 0 1.5rem; color: var(--muted); font-size: .8125rem; }
.ending-actions { display: flex; gap: 2rem; font-size: .875rem; justify-content: center; }
.ending-actions a, .ending-actions button { display: inline-flex; min-height: 44px; align-items: center; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1.25rem 3rem;
  
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.site-footer p { margin: 0; }
.share-status {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: 1rem;
  max-width: min(28rem, calc(100% - 2rem));
  margin: 0;
  padding: .8rem 1rem;
  background: var(--ink);
  color: var(--page);
  font-size: .8125rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.share-status:empty { display: none; }
.noscript { margin: 2rem var(--gutter); line-height: 1.6; }
body.is-reading .site-header, body.is-reading .site-footer { display: none; }

@media (max-width: 800px) {
  .library-heading { min-height: clamp(270px, 58vw, 420px); }
  .story-entry { grid-template-columns: minmax(0, 1fr) minmax(115px, 145px); gap: clamp(1rem, 3vw, 2rem); }
  .reader-nav { grid-template-columns: 1fr auto; }
  .reader-nav-title { display: none; }
  .story-title-block { grid-template-columns: minmax(0, 1fr) minmax(140px, 210px); gap: 2rem; }
}

@media (max-width: 560px) {
  :root { --gutter: 1.15rem; }
  .site-header { grid-template-columns: 1fr auto; min-height: 62px; }
  .library-heading { min-height: 255px; padding-block: 3rem; }
  .continue-panel { align-items: flex-start; font-size: .75rem; }
  .continue-label, #continueMeta { display: block; margin: 0 0 .35rem; }
  .story-entry { grid-template-columns: minmax(0, 1fr) 82px; gap: .8rem; padding-block: 2.75rem; }
  .entry-copy h2 { font-size: clamp(2rem, 10vw, 3.1rem); }
  .entry-excerpt { margin-block: 1.15rem 1.35rem; font-size: .9375rem; }
  .entry-art { align-self: start; margin-top: 1.65rem; }
  .reader-nav { min-height: 68px; padding-inline: 1rem; }
  .reader-logo { width: 112px; }
  .reader-tools button { min-width: 38px; padding-inline: .45rem; font-size: .75rem; }
  .story { width: min(calc(100% - 2.3rem), 1080px); }
  .story-title-block { grid-template-columns: minmax(0, 1fr) 92px; gap: 1rem; min-height: 0; padding-block: 4rem; }
  .story-title-copy h1 { font-size: clamp(2.65rem, 13vw, 4.1rem); }
  .story-description { margin-block: 1.4rem 1rem; font-size: .9375rem; }
  .story-author { margin-bottom: 1.25rem; font-size: .6875rem; }
  .story-art { align-self: start; margin-top: 2.3rem; }
  .story-copy { padding-top: 4rem; line-height: 1.7; }
  .site-footer { flex-wrap: wrap; }
}

@media (max-width: 360px) {
  body { min-width: 0; }
  .reader-nav { padding-inline: .75rem; }
  .reader-logo { width: 96px; }
  .reader-tools { gap: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
