:root {
  --ink: #1e1e1e;
  --warm-white: #f7f4ef;
  --parchment: #ede8df;
  --taupe: #9a8f84;
  --stone: #6b6560;
  --dust: #d4cec6;
  --shadow: #2c2926;
  --bg: var(--warm-white);
  --panel: var(--parchment);
  --text: var(--ink);
  --muted: var(--stone);
  --accent: var(--taupe);
  --rule: rgba(30, 30, 30, 0.64);
  --soft-rule: rgba(30, 30, 30, 0.18);
  --border: var(--dust);
  --cursor: var(--ink);
  --font-display: "IM Fell English", Georgia, serif;
  --font-body: "Lora", Georgia, serif;
  --max: 1180px;
  --reading: 690px;
  --section-space: 88px;
  --section-space-mobile: 58px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  --bg: var(--shadow);
  --panel: #34302c;
  --text: var(--warm-white);
  --muted: #b8afa6;
  --rule: rgba(247, 244, 239, 0.56);
  --soft-rule: rgba(247, 244, 239, 0.15);
  --border: #463f38;
  --cursor: var(--warm-white);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  transition: background-color 450ms var(--ease), color 450ms var(--ease);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  overflow-wrap: break-word;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 2000;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

body.cursor-ready,
body.cursor-ready a,
body.cursor-ready button {
  cursor: none;
}

.site-header {
  position: relative;
  z-index: 90;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color 450ms var(--ease), border-color 450ms var(--ease);
}

.header-inner {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 58px;
  padding: 10px 44px;
}

.header-logo {
  width: min(264px, 38vw);
  line-height: 0;
}

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

:root[data-theme="dark"] .logo-img-dark {
  display: block;
}

.header-menu-line {
  position: absolute;
  right: 44px;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(-50%);
}

.menu-toggle {
  appearance: none;
  position: absolute;
  right: 16px;
  top: 50%;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 0;
  line-height: 0;
  transform: translateY(-50%);
}

.menu-toggle span {
  display: block;
  width: 17px;
  height: 1.5px;
  margin: 0 auto;
  background: currentColor;
  border-radius: 999px;
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
}

.menu-toggle.is-open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.primary-menu {
  display: flex;
  gap: clamp(12px, 2.2vw, 24px);
}

.nav-link {
  position: relative;
  padding-bottom: 3px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(0.52rem, 0.9vw, 0.7rem);
  text-transform: uppercase;
  opacity: 0.3;
  transition: opacity 240ms var(--ease);
}

.nav-link::after {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  content: "";
  transition: width 300ms var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible {
  opacity: 0.7;
}

.nav-link.is-active,
.nav-link.is-active:hover,
.nav-link.is-active:focus-visible {
  opacity: 1;
}

.nav-link.is-active::after {
  width: 100%;
}

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}

.theme-toggle svg {
  position: absolute;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.icon-sun {
  opacity: 0;
  transform: rotate(35deg);
}

.icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

:root[data-theme="dark"] .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
}

:root[data-theme="dark"] .icon-moon {
  opacity: 0;
  transform: rotate(-35deg);
}

.rule-mark,
.section-divider {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(420px, 100%);
  margin: 0 auto;
}

.section-divider {
  width: min(280px, calc(100% - 40px));
  margin: var(--section-space) auto;
  gap: 5px;
}

.rule-line {
  height: 1px;
  background: var(--rule);
  transform-origin: center;
}

.section-divider .rule-line {
  background: var(--soft-rule);
}

.rule-top,
.rule-bottom {
  width: 100%;
}

.rule-mid-left {
  width: 42%;
  align-self: flex-start;
}

.rule-mid-right {
  width: 42%;
  align-self: flex-end;
  margin-top: -8px;
}

.section-divider .rule-mid-right {
  margin-top: -6px;
}

.rule-mark-small,
.hero .rule-mark {
  width: 220px;
}

.rule-mark-small {
  margin-bottom: 56px;
}

.rule-mark.animate-in .rule-line {
  animation: drawRule 950ms var(--ease) forwards;
}

.rule-mark.animate-in .rule-top,
.rule-mark.animate-in .rule-bottom,
.rule-mark.animate-in .rule-mid-left,
.rule-mark.animate-in .rule-mid-right {
  transform: scaleX(0);
}

.rule-mark.animate-in .rule-mid-left {
  transform-origin: left;
}

.rule-mark.animate-in .rule-mid-right {
  transform-origin: right;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(var(--max), calc(100% - 36px));
  min-height: 230px;
  margin: 0 auto;
  padding: 48px 0 20px;
  text-align: center;
}

.hero-line {
  max-width: 720px;
  margin: 42px auto 0;
  color: var(--accent);
  font-style: italic;
  font-size: 1.15rem;
  overflow-wrap: break-word;
  opacity: 0;
  transition: opacity 1000ms var(--ease) 600ms;
}

.hero-line.is-visible {
  opacity: 1;
}

.section,
.page-intro {
  width: min(var(--max), calc(100% - 36px));
  margin: 0 auto;
}

.section {
  padding: 0;
}

.page-intro {
  padding: var(--section-space) 0 42px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.86rem;
  text-align: center;
  text-transform: uppercase;
}

.eyebrow-left {
  text-align: left;
}

.section-title,
.page-title {
  max-width: 760px;
  margin: 0 auto 34px;
  text-align: center;
}

.section-title {
  font-size: 2.3rem;
}

.page-title {
  margin-bottom: 18px;
  font-size: 2.8rem;
}

.page-subtitle {
  max-width: var(--reading);
  margin: 0 auto;
  color: var(--accent);
  font-style: italic;
}

.prose {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.prose-narrow {
  max-width: var(--reading);
  margin: 0 auto;
}

.prose p {
  margin-bottom: 1.4em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  max-width: 860px;
  margin: 0 auto;
}

.explore-card,
.series-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background-color 400ms var(--ease), border-color 400ms var(--ease);
}

.explore-card {
  display: block;
  min-height: 250px;
  padding: 64px 36px;
  text-align: center;
}

.explore-card:hover,
.series-card:hover {
  border-color: var(--accent);
  background: var(--panel);
  text-decoration: none;
}

.explore-card h3 {
  margin: 0 0 16px;
  font-size: 1.45rem;
  text-transform: uppercase;
}

.explore-card p,
.series-card-desc,
.empty-state-subtext {
  color: var(--muted);
}

.explore-card p {
  margin-bottom: 18px;
  font-size: 0.98rem;
}

.explore-card span,
.explore-link {
  display: inline-block;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.86rem;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  transition: color 240ms var(--ease), opacity 240ms var(--ease);
}

.explore-link:hover,
.explore-link:focus-visible {
  color: var(--text);
  text-decoration: none;
}

.series-section {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.series-card {
  width: min(560px, 100%);
  padding: 64px 50px;
}

.series-card-title {
  max-width: 620px;
  margin: 0 0 18px;
  font-size: 2.15rem;
}

.series-card-desc {
  max-width: 500px;
  margin-bottom: 30px;
  overflow-wrap: break-word;
}

.empty-state {
  padding: 32px 0 0;
  text-align: center;
}

.empty-state-text {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.empty-state-subtext {
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.98rem;
}

.legal-content {
  max-width: 760px;
  padding-top: 18px;
}

.legal-content h2 {
  margin: 46px 0 14px;
  color: var(--accent);
  font-size: 1rem;
  text-transform: uppercase;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content h3 {
  margin: 26px 0 8px;
  font-size: 1.2rem;
}

.legal-content p,
.legal-content li {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.82;
}

.legal-content ul {
  margin: 0 0 24px;
  padding-left: 22px;
}

.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.quill-cursor,
.quill-follow-dot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1600;
  pointer-events: none;
  color: var(--cursor);
}

.quill-cursor {
  width: 38px;
  height: 38px;
  opacity: 0.96;
  transform: translate3d(-100px, -100px, 0) rotate(0deg);
  transition: opacity 180ms var(--ease);
}

.quill-follow-dot {
  z-index: 1599;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
  transform: translate3d(-100px, -100px, 0);
  filter: blur(0.3px);
}

.quill-cursor svg {
  width: 100%;
  height: 100%;
}

.quill-stroke {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quill-fill {
  fill: currentColor;
  opacity: 0.06;
}

.quill-cursor.is-hovering {
  opacity: 1;
}

.quill-ink-drop {
  position: fixed;
  z-index: 1598;
  width: 6px;
  height: 6px;
  pointer-events: none;
  border-radius: 50%;
  background: var(--cursor);
  transform: translate(-50%, -50%) scale(0.35);
  animation: inkSettle 700ms var(--ease) forwards;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(247, 244, 239, 0.72);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease), background-color 240ms var(--ease);
}

:root[data-theme="dark"] .back-to-top {
  background: rgba(44, 41, 38, 0.76);
}

.back-to-top.is-visible {
  opacity: 0.78;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top span {
  position: relative;
  width: 9px;
  height: 14px;
  display: block;
}

.back-to-top span::before,
.back-to-top span::after {
  position: absolute;
  content: "";
  display: block;
}

.back-to-top span::before {
  left: 4px;
  top: 2px;
  width: 1px;
  height: 12px;
  background: currentColor;
}

.back-to-top span::after {
  left: 1px;
  top: 2px;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
  transform: rotate(45deg);
}

.back-to-top::after {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  color: var(--muted);
  content: "Top";
  font-size: 0.72rem;
  opacity: 0;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.back-to-top:hover::after,
.back-to-top:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.cookie-consent {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1200;
  width: min(430px, calc(100% - 36px));
  padding: 16px;
  border: 1px solid var(--border);
  background: rgba(247, 244, 239, 0.96);
  color: var(--text);
  box-shadow: 0 18px 40px rgba(30, 30, 30, 0.08);
}

:root[data-theme="dark"] .cookie-consent {
  background: rgba(44, 41, 38, 0.96);
}

.cookie-consent p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cookie-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
}

.cookie-actions button:first-child {
  background: var(--text);
  color: var(--bg);
}

@keyframes drawRule {
  to {
    transform: scaleX(1);
  }
}

@keyframes inkSettle {
  0% {
    opacity: 0.68;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.6);
  }
}

@media (max-width: 780px) {
  .hero {
    min-height: auto;
    padding: 42px 0 18px;
  }

  .section-divider {
    margin: var(--section-space-mobile) auto;
  }

  .explore-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

}

@media (max-width: 780px) {
  .header-inner {
    min-height: 62px;
    padding: 10px 16px;
  }

  .header-logo {
    width: min(180px, 52vw);
  }

  .menu-toggle {
    display: flex;
  }

  .header-menu-line {
    position: absolute;
    left: 14px;
    right: 14px;
    top: calc(100% + 1px);
    z-index: 120;
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  }

  .header-menu-line.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .primary-menu {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .nav-link {
    font-size: 0.72rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .hero,
  .section,
  .page-intro {
    width: min(360px, calc(100% - 28px));
  }

  .hero-line {
    max-width: 320px;
    font-size: 1rem;
    line-height: 1.65;
  }

  .prose {
    max-width: 100%;
    font-size: 0.98rem;
    line-height: 1.78;
  }

  .section-title,
  .page-title {
    font-size: 2.18rem;
  }

  .page-intro {
    padding: var(--section-space-mobile) 0 32px;
  }

  .explore-card,
  .series-card {
    padding: 42px 24px;
  }

  .explore-card {
    min-height: 190px;
  }

  .series-card {
    width: 100%;
  }

  .cookie-consent {
    left: 14px;
    bottom: 14px;
    width: min(360px, calc(100% - 28px));
  }
}

@media (hover: none), (pointer: coarse) {
  body.cursor-ready,
  body.cursor-ready a,
  body.cursor-ready button {
    cursor: auto;
  }

  .quill-cursor,
  .quill-follow-dot,
  .quill-ink-drop {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .hero-line,
  .reveal {
    opacity: 1;
    transform: none;
  }

  .rule-mark.animate-in .rule-line {
    transform: scaleX(1);
  }

  .quill-cursor,
  .quill-follow-dot,
  .quill-ink-drop {
    display: none;
  }
}
