@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,600&family=Inter:wght@400;500;600&display=swap');

:root {
  color-scheme: dark;
  --ink: #0a0b0e;
  --ink-soft: #111319;
  --paper: #e9e2d3;
  --paper-muted: #a8a195;
  --ember: #b44935;
  --ember-bright: #e2765d;
  --gold: #b69a6a;
  --line: rgba(233, 226, 211, .14);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --reading-size: 1.27rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(99, 35, 29, .18), transparent 35rem),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  line-height: 1.6;
}
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
::selection { color: #fff; background: var(--ember); }

body::before {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.skip-link {
  position: fixed;
  z-index: 100;
  top: .75rem;
  left: .75rem;
  padding: .7rem 1rem;
  color: var(--ink);
  background: var(--paper);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.eyebrow {
  margin: 0 0 .8rem;
  color: var(--ember-bright);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.archive-hero {
  position: relative;
  min-height: min(880px, 92vh);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(10, 11, 14, .96), rgba(10, 11, 14, .54) 58%, rgba(10, 11, 14, .92)),
    radial-gradient(ellipse at 72% 38%, rgba(180, 73, 53, .16), transparent 25%),
    linear-gradient(160deg, #12151c, #08090c 70%);
}
.archive-hero::before,
.archive-hero::after {
  position: absolute;
  right: -10%;
  bottom: -10rem;
  width: 70%;
  height: 60%;
  content: "";
  opacity: .32;
  filter: blur(2px);
  background:
    linear-gradient(164deg, transparent 43%, #262c32 44% 48%, transparent 49%),
    linear-gradient(197deg, transparent 45%, #161a20 46% 57%, transparent 58%);
  transform: skewX(-8deg);
}
.archive-hero::after {
  right: 23%;
  bottom: -18rem;
  opacity: .19;
  transform: scale(.75) skewX(9deg);
}
.hero-glow {
  position: absolute;
  top: 19%;
  right: 22%;
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: #ef927d;
  box-shadow: 0 0 2rem 1rem rgba(226, 118, 93, .28), 0 0 9rem 4rem rgba(180, 73, 53, .08);
}
.hero-inner {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(7rem, 16vh, 11rem) 0 4rem;
}
.archive-hero h1 {
  max-width: 850px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(5rem, 13vw, 10.5rem);
  font-weight: 500;
  line-height: .71;
  letter-spacing: -.055em;
}
.archive-hero h1 em {
  color: transparent;
  font-weight: 500;
  -webkit-text-stroke: 1px rgba(233, 226, 211, .75);
}
.hero-intro {
  max-width: 590px;
  margin: 3.2rem 0 2.6rem;
  color: #c9c2b6;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.3vw, 1.65rem);
  line-height: 1.45;
}
.archive-stats {
  display: flex;
  gap: clamp(2rem, 6vw, 5rem);
}
.archive-stats div { display: grid; }
.archive-stats strong {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 500;
}
.archive-stats span {
  color: var(--paper-muted);
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 4rem;
  color: var(--paper-muted);
  font-size: .72rem;
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
}
.scroll-cue i {
  display: block;
  width: 4rem;
  height: 1px;
  background: var(--ember-bright);
  transition: width .2s ease;
}
.scroll-cue:hover i { width: 5rem; }

.archive-main {
  width: min(1240px, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) 0;
}
.archive-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}
.archive-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 6vw, 5rem);
  font-weight: 500;
  line-height: .95;
}
.random-button,
.no-results button {
  padding: .85rem 1.1rem;
  border: 1px solid rgba(226, 118, 93, .5);
  border-radius: 2px;
  color: var(--paper);
  background: transparent;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.random-button:hover,
.no-results button:hover {
  border-color: var(--ember-bright);
  background: rgba(180, 73, 53, .15);
  transform: translateY(-2px);
}
.random-button span { color: var(--ember-bright); margin-right: .45rem; }
.archive-controls {
  margin: 3.5rem 0 1.8rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .018);
}
.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid rgba(233, 226, 211, .22);
}
.search-box svg {
  width: 1.15rem;
  margin-right: .7rem;
  fill: none;
  stroke: var(--paper-muted);
  stroke-width: 1.5;
}
.search-box input {
  width: 100%;
  padding: .8rem 0;
  border: 0;
  outline: 0;
  color: var(--paper);
  background: transparent;
  font-family: var(--serif);
  font-size: 1.25rem;
}
.search-box input::placeholder { color: #77746e; }
.sort-box {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: .6rem;
  margin-top: .8rem;
  color: var(--paper-muted);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sort-box select {
  padding: .35rem 1.8rem .35rem .45rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  background: var(--ink-soft);
  outline: 0;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.35rem;
}
.filter-row button {
  padding: .52rem .72rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--paper-muted);
  background: transparent;
  font-size: .72rem;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.filter-row button span { margin-left: .25rem; opacity: .6; }
.filter-row button:hover,
.filter-row button.active {
  border-color: rgba(226, 118, 93, .55);
  color: var(--paper);
  background: rgba(180, 73, 53, .12);
}
.results-line {
  margin: 0 0 1.3rem;
  color: #7f7b73;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.story-card {
  position: relative;
  min-height: 390px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .012);
}
.story-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  content: "";
  background: var(--ember-bright);
  transition: width .35s ease;
}
.story-card:hover::before { width: 100%; }
.story-card[hidden] { display: none; }
.story-card > a {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  text-decoration: none;
  transition: background .25s ease;
}
.story-card > a:hover { background: rgba(180, 73, 53, .055); }
.card-topline {
  display: flex;
  justify-content: space-between;
  color: var(--paper-muted);
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.card-topline span:first-child { color: var(--ember-bright); }
.story-card h2 {
  margin: 2rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  font-weight: 500;
  line-height: 1;
  transition: color .2s ease;
}
.story-card a:hover h2 { color: #fff; }
.story-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 2rem;
  color: var(--paper-muted);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.read-link {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin-top: auto;
  color: #c9c2b6;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.read-link b {
  color: var(--ember-bright);
  font-size: 1rem;
  transition: transform .2s ease;
}
.story-card a:hover .read-link b { transform: translateX(.35rem); }
.no-results { padding: 6rem 1rem; text-align: center; }
.no-results > span { color: var(--ember-bright); font-size: 2rem; }
.no-results h2 {
  margin: 1rem 0 .4rem;
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 500;
}
.no-results p { color: var(--paper-muted); }

.story-toolbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.archive-link {
  color: var(--paper-muted);
  font-size: .72rem;
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
}
.archive-link span { margin-right: .45rem; color: var(--ember-bright); }
.archive-link:hover { color: var(--paper); }
.reading-tools { display: flex; gap: .35rem; }
.reading-tools button {
  min-width: 2.5rem;
  padding: .4rem .55rem;
  border: 1px solid var(--line);
  color: var(--paper-muted);
  background: transparent;
  font-size: .68rem;
}
.reading-tools button:hover { border-color: var(--ember); color: var(--paper); }
.reading-progress {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
}
.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ember-bright);
}
.story {
  width: min(820px, calc(100% - 2.5rem));
  margin: 0 auto;
}
.story-header {
  padding: clamp(5rem, 13vw, 9rem) 0 clamp(3rem, 8vw, 5rem);
  text-align: center;
}
.story-header h1 {
  max-width: 900px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(3.5rem, 9vw, 7rem);
  font-weight: 500;
  line-height: .9;
  letter-spacing: -.035em;
}
.story-deck {
  max-width: 680px;
  margin: 2rem auto;
  color: var(--paper-muted);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  line-height: 1.5;
}
.story-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  color: #77746e;
  font-size: .66rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin: 3rem auto 0;
}
.ornament span { width: 3rem; height: 1px; background: var(--line); }
.ornament i {
  width: .42rem;
  height: .42rem;
  border: 1px solid var(--ember-bright);
  transform: rotate(45deg);
}
.story-body {
  padding-bottom: 2rem;
  font-family: var(--serif);
  font-size: var(--reading-size);
  line-height: 1.82;
}
.story-body p { margin: 0 0 1.45em; }
.story-body p:first-child::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  color: var(--ember-bright);
  font-size: 4.2em;
  line-height: .72;
}
.story-end {
  padding: 3rem 0 5rem;
  color: var(--paper-muted);
  text-align: center;
}
.story-end .end-mark { color: var(--ember-bright); font-size: 1.4rem; }
.story-end p {
  margin: .4rem 0 0;
  font-size: .64rem;
  letter-spacing: .25em;
  text-transform: uppercase;
}
.story-nav {
  display: grid;
  width: min(1120px, calc(100% - 2.5rem));
  grid-template-columns: 1fr 1fr;
  margin: 0 auto 6rem;
  border: 1px solid var(--line);
}
.story-nav a {
  display: flex;
  min-height: 160px;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  text-decoration: none;
  transition: background .2s ease;
}
.story-nav a + a { border-left: 1px solid var(--line); }
.story-nav a:hover { background: rgba(180, 73, 53, .08); }
.story-nav .next { text-align: right; }
.story-nav span {
  color: var(--ember-bright);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.story-nav strong {
  margin-top: .5rem;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 500;
  line-height: 1.1;
}
.section-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 120px;
  padding: 2rem max(1.5rem, calc((100% - 1120px) / 2));
  border-top: 1px solid var(--line);
  color: #77746e;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.section-footer a { color: var(--paper-muted); text-decoration: none; }
.section-footer a:hover { color: var(--paper); }

html[data-reading-theme="paper"] {
  color-scheme: light;
  --ink: #e8dfcf;
  --ink-soft: #ddd2c0;
  --paper: #25221f;
  --paper-muted: #625c54;
  --line: rgba(37, 34, 31, .18);
}
html[data-reading-theme="paper"] body {
  background: #e8dfcf;
}
html[data-reading-theme="paper"] body::before { opacity: .025; }
html[data-reading-theme="paper"] .story-toolbar,
html[data-reading-theme="paper"] .section-footer { background: rgba(232, 223, 207, .7); }

:focus-visible {
  outline: 2px solid var(--ember-bright);
  outline-offset: 4px;
}
@media (max-width: 900px) {
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-hero::before { width: 100%; opacity: .18; }
}
@media (max-width: 620px) {
  .hero-inner,
  .archive-main { width: min(100% - 2rem, 1240px); }
  .archive-hero { min-height: 760px; }
  .archive-hero h1 { font-size: clamp(4rem, 24vw, 6.6rem); }
  .archive-stats { gap: 1.3rem; }
  .archive-stats strong { font-size: 1.45rem; }
  .archive-stats span { font-size: .56rem; }
  .archive-heading { display: block; }
  .random-button { margin-top: 1.5rem; }
  .story-grid { display: block; border-bottom: 0; }
  .story-card { min-height: 330px; }
  .sort-box { justify-content: start; margin: 1rem 0; }
  .story-toolbar { align-items: start; }
  .reading-tools { flex-wrap: wrap; justify-content: end; }
  .story-header { text-align: left; }
  .story-header h1 { font-size: clamp(3.2rem, 16vw, 5rem); }
  .story-deck { margin-left: 0; }
  .story-meta { justify-content: start; }
  .ornament { justify-content: start; }
  .story-nav { grid-template-columns: 1fr; }
  .story-nav a + a { border-top: 1px solid var(--line); border-left: 0; }
  .story-nav .next { text-align: left; }
  .section-footer { align-items: start; flex-direction: column; gap: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
