/*
  ═══════════════════════════════════════════════════════════════════
  STORY PAGES (/read/<slug>)
  Each story takes the colours of its eye (data-eye on <body>, from
  css/theme.css) and that eye's ornament for its scene breaks.
  The story text itself is set in Newsreader, a typeface made for reading
  on screens; titles keep the House's Grenze Gotisch.
  ═══════════════════════════════════════════════════════════════════
*/
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('/assets/fonts/newsreader.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url('/assets/fonts/newsreader-italic.woff2') format('woff2');
}

.read-page {
  --font-read: 'Newsreader', Georgia, 'Times New Roman', serif;
  --read-size: 20px;          /* the story text on wide screens */
  --read-size-phone: 18px;    /* … and on phones */
  --read-line: 1.72;          /* line height */
  --read-width: 36em;         /* the text column: about 66 characters a line */
  --accent-text: var(--accent);   /* declared again here so it follows this page's eye, not the House's bronze */
  --heading: var(--accent-text);
  --tint: color-mix(in srgb, var(--accent) 6%, var(--bg));
  background: radial-gradient(120% 70% at 50% 0%, var(--tint), var(--bg) 70%) fixed, var(--bg);
}

/* ── each eye's colours ── */
.read-page[data-eye="essays"]     { --accent: var(--essays-accent); --heading: var(--essays-heading); --tint: var(--essays-bg-top); }
.read-page[data-eye="fantasy"]    { --accent: var(--fantasy-accent); --heading: var(--fantasy-heading); }
.read-page[data-eye="scifi"]      { --accent: var(--scifi-accent); --heading: var(--scifi-iris-1); --tint: var(--scifi-bg-top); }
.read-page[data-eye="historical"] { --accent: var(--historical-accent); --heading: var(--historical-heading); --tint: var(--historical-bg-top); }
.read-page[data-eye="other"]      { --accent: var(--other-accent); --accent-text: var(--other-text); --heading: var(--other-heading); --tint: var(--other-bg-top); }
.read-page[data-eye="rural"]      { --accent: var(--rural-accent); --heading: var(--rural-heading); --tint: var(--rural-bg-top); }

/* selecting story text: a soft wash of the eye's colour, easier to see than the House's glow */
.read-page .story ::selection { background: color-mix(in srgb, var(--accent) 34%, transparent); color: var(--ink); text-shadow: none; }

/* ── the progress bar ── */
.read-progress {
  position: fixed; z-index: 6; top: 0; left: 0; right: 0; height: 3px;
  pointer-events: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.read-progress span {
  display: block; height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
  transform: scaleX(0); transform-origin: left;
}
.is-finished .read-progress span { box-shadow: 0 0 16px var(--accent); }

/* a band of shadow at the top, so the way back and the eye never sit on top of the words */
.read-page::before {
  content: ''; position: fixed; z-index: 3; top: 0; left: 0; right: 0; height: 84px; pointer-events: none;
  background: linear-gradient(var(--bg) 35%, color-mix(in srgb, var(--bg) 70%, transparent) 65%, transparent);
}

/* ── the ways back: the category's eye top left, the House top right ── */
.read-nav {
  position: fixed; z-index: 5; top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-soft); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.read-nav--back { left: max(12px, env(safe-area-inset-left)); }
.read-nav--home { right: max(14px, env(safe-area-inset-right)); text-align: right; }
.read-nav-eye { display: block; width: 64px; height: 64px; margin: -8px -6px -8px -8px; }
.read-nav-eye svg { width: 100%; height: 100%; display: block; overflow: visible; }
.read-nav .return-eye svg { width: 40px; height: 40px; display: block; transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.read-nav-text {
  display: flex; flex-direction: column; line-height: 1.15;
  text-shadow: 0 2px 10px var(--shadow);
  transition: opacity .45s ease, transform .45s ease;
}
.read-nav-to { font: 400 9.5px var(--font-body); letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.read-nav-name { font: italic var(--body-weight) 16px var(--font-serif); white-space: nowrap; }
.read-nav--back .read-nav-name { color: var(--accent-text); }
.read-nav.is-quiet .read-nav-text { opacity: 0; transform: translateX(-8px); pointer-events: none; }
.read-nav--home.is-quiet .read-nav-text { transform: translateX(8px); }
.read-nav:hover .read-nav-name, .read-nav:focus-visible .read-nav-name { color: var(--heading); }
.read-nav:hover .return-eye svg, .read-nav:focus-visible .return-eye svg { transform: scale(1.1); }
.read-nav:focus-visible { outline: none; }
.read-nav:focus-visible .read-nav-text { opacity: 1; transform: none; }
.read-nav:focus-visible .read-nav-name { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 400px) { .read-nav-name { font-size: 14.5px; } .read-nav-eye { width: 56px; height: 56px; } }
@media (prefers-reduced-motion: reduce) { .read-nav-text { transition: opacity .2s; } .read-nav.is-quiet .read-nav-text { transform: none; } }

/* ── the story ── */
.read {
  position: relative; z-index: 2;
  padding: 120px 24px 120px;
}
.story { max-width: var(--read-width); margin: 0 auto; font-size: var(--read-size); }

.story-head { text-align: center; margin-bottom: 2.6em; }
/* like a category's pop-up: the eye's epithet in its colour, then the category's name */
.story-kicker { margin: 0 0 18px; }
.story-epithet { display: block; font: italic var(--body-weight) 17px/1.4 var(--font-serif); color: var(--accent-text); }
.story-category { display: block; margin-top: 6px; font: 400 11px/1.6 var(--font-body); letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }
.story-num { margin: 0 0 4px; font: 400 12px var(--font-body); letter-spacing: .3em; color: var(--muted); }
.story-head h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(42px, 7vw, 70px); line-height: 1.02;
  color: var(--heading);
  text-wrap: balance;
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 22%, transparent);
}
.story-meta {
  margin: 18px 0 0;
  font: 400 11px var(--font-body); letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted);
}

/* the eye's ornament: under the title, at every scene break, and at the end */
.story-orn, .story-body hr {
  display: block; width: 168px; height: 26px; margin: 30px auto 0;
  border: 0;
  background: var(--accent);
  opacity: .8;
  -webkit-mask: var(--orn) center / contain no-repeat;
          mask: var(--orn) center / contain no-repeat;
}

.story-body {
  font-family: var(--font-read);
  font-weight: 400;
  line-height: var(--read-line);
  color: var(--ink);
  font-optical-sizing: auto;
  font-kerning: normal;
  overflow-wrap: break-word;
}
.story-body p { margin: 0 0 1.05em; }
.story-body em, .story-body i { font-style: italic; }
.story-body strong, .story-body b { font-weight: 600; }
.story-body a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.story-body a:hover { text-decoration-color: var(--accent); }
.story-body h2, .story-body h3 {
  margin: 2em 0 .7em;
  font-family: var(--font-display); font-weight: 400;
  line-height: 1.15; text-align: center;
  color: var(--heading);
}
.story-body h2 { font-size: 1.6em; }
.story-body h3 { font-size: 1.3em; }
.story-body blockquote {
  margin: 1.5em 0; padding: 0 0 0 1.1em;
  border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  font-style: italic; color: var(--ink-soft);
}
.story-body blockquote p:last-child { margin-bottom: 0; }
.story-body hr { margin: 2.2em auto; }
.story-body figure { margin: 2em 0; }
/* a tall picture is kept within the screen, so it never hides the words for long */
.story-body img { display: block; width: auto; max-width: 100%; height: auto; max-height: 78vh; margin: 0 auto; border-radius: 4px; box-shadow: 0 10px 34px color-mix(in srgb, var(--shadow) 70%, transparent); }
.story-body figcaption { margin-top: 10px; text-align: center; font: italic 400 .8em/1.45 var(--font-read); color: var(--muted); }
.story-body ul, .story-body ol { margin: 0 0 1.05em; padding-left: 1.4em; }

/* the first letter of the story, large and in the eye's colour */
.story-body > p:first-of-type::first-letter {
  float: left;
  margin: .06em .1em 0 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: 4.3em; line-height: .8;
  color: var(--accent-text);
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 40%, transparent);
}
/* the Honor Guard's stories open with a line of small capitals, as old books do */
.read-page[data-eye="historical"] .story-body > p:first-of-type::first-line { font-variant: small-caps; letter-spacing: .04em; }
/* the Common Clay's ornaments sit a little askew */
.read-page[data-eye="other"] .story-orn, .read-page[data-eye="other"] .story-body hr { transform: rotate(-4deg); }

/* ── the end of the story ── */
.story-end { margin-top: 3.4em; text-align: center; }
.story-end .story-orn { margin: 0 auto 2.4em; }
.story-next {
  display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 18px;
  max-width: 34em; margin: 0 auto; padding: 12px 20px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 5%, color-mix(in srgb, var(--panel) 70%, transparent));
  text-align: left; text-decoration: none; color: var(--ink);
  transition: border-color .35s ease, box-shadow .35s ease;
}
.story-next img { width: 112px; height: 84px; object-fit: cover; border-radius: 7px; }
.story-next-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.story-next-label { font: 400 10.5px var(--font-body); letter-spacing: .24em; text-transform: uppercase; color: var(--accent-text); }
.story-next-label em { font-style: italic; }
.story-next-title { font-family: var(--font-display); font-size: 22px; line-height: 1.1; color: var(--heading); }
.story-next-hook { font: italic 400 15px/1.4 var(--font-read); color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-next:hover, .story-next:focus-visible { border-color: var(--accent); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent); }
.story-end .modal-subscribe { margin-top: 36px; }
.story-links {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 26px;
  margin: 40px 0 0;
  font: italic var(--body-weight) 16px var(--font-serif);
}
.story-links a { color: var(--ink-soft); text-decoration: none; padding: 10px 2px; }
.story-links a:hover, .story-links a:focus-visible { color: var(--accent-text); }
.story-also { font-size: 14px; }

/* ── phones ── */
@media (max-width: 760px) {
  .read { padding: 92px 20px 90px; }
  .story { font-size: var(--read-size-phone); }
  .story-body { hyphens: auto; -webkit-hyphens: auto; }   /* a narrow column breaks long words rather than leaving gaps */
  .story-head { margin-bottom: 2.2em; }
  .story-epithet { font-size: 15px; }
  .story-next { grid-template-columns: 84px 1fr; gap: 14px; padding: 10px 14px 10px 10px; }
  .story-next img { width: 84px; height: 72px; }
  .story-next-title { font-size: 19px; }
  .story-body figure { margin: 1.6em -8px; }
}

/* ── the ornaments, one per eye (drawn in the eye's colour through a mask) ── */
.read-page { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H70' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M98 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M84 8L89 13L84 18L79 13Z'/%3E%3C/svg%3E"); }
.read-page[data-eye="fantasy"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H66' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M102 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Ccircle cx='84' cy='13' r='4.2'/%3E%3Cpath d='M91.50 13.00L96.50 13.00M90.50 16.75L93.09 18.25M87.75 19.50L90.25 23.83M84.00 20.50L84.00 23.50M80.25 19.50L77.75 23.83M77.50 16.75L74.91 18.25M76.50 13.00L71.50 13.00M77.50 9.25L74.91 7.75M80.25 6.50L77.75 2.17M84.00 5.50L84.00 2.50M87.75 6.50L90.25 2.17M90.50 9.25L93.09 7.75' stroke='black' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.read-page[data-eye="rural"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H66' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M102 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M78 4Q75 13 72 22M86 3Q83 13 80 23M94 4Q91 13 88 22' stroke='black' stroke-width='2.2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E"); }
.read-page[data-eye="scifi"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H68' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M100 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Ccircle cx='84' cy='13' r='9.5' fill='none' stroke='black' stroke-width='1.3'/%3E%3Cpath d='M93.00 13.00L85.27 16.26M88.50 20.79L81.81 15.73M79.50 20.79L80.54 12.47M75.00 13.00L82.73 9.74M79.50 5.21L86.19 10.27M88.50 5.21L87.46 13.53' stroke='black' stroke-width='1.1' stroke-linecap='round'/%3E%3Cpath d='M58 9V17M110 9V17' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E"); }
.read-page[data-eye="historical"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H60' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M108 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M84 6L91 13L84 20L77 13ZM68 9.5L71.5 13L68 16.5L64.5 13ZM100 9.5L103.5 13L100 16.5L96.5 13Z'/%3E%3Ccircle cx='84' cy='13' r='2' fill='white'/%3E%3C/svg%3E"); }
.read-page[data-eye="other"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H64' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M104 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Ccircle cx='72' cy='15' r='2.4'/%3E%3Ccircle cx='84' cy='11' r='3.4'/%3E%3Ccircle cx='97' cy='14.5' r='1.8'/%3E%3C/svg%3E"); }
.read-page[data-eye="essays"] { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 26'%3E%3Cpath d='M6 13H56' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M112 13H162' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Ccircle cx='64' cy='13' r='3.6' fill='none' stroke='black' stroke-width='1.1'/%3E%3Cpath d='M74 9.4a3.6 3.6 0 0 1 0 7.2Z'/%3E%3Ccircle cx='74' cy='13' r='3.6' fill='none' stroke='black' stroke-width='1.1'/%3E%3Ccircle cx='84' cy='13' r='4.6'/%3E%3Cpath d='M94 9.4a3.6 3.6 0 0 0 0 7.2Z'/%3E%3Ccircle cx='94' cy='13' r='3.6' fill='none' stroke='black' stroke-width='1.1'/%3E%3Ccircle cx='104' cy='13' r='3.6' fill='none' stroke='black' stroke-width='1.1'/%3E%3C/svg%3E"); }

/* phones: headings break into even lines, paragraphs avoid a lone last word (as on the other pages) */
@media (pointer: coarse), (max-width: 760px) {
  h1, h2, h3 { text-wrap: balance; }
  p, figcaption { text-wrap: pretty; hyphens: manual; }
}
