/* The Thread — site stylesheet.
   Styled like the book: paper-light ground, dark ink, Literata.
   Typography-first, quiet, no ornament. */

@font-face {
  font-family: "Literata";
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  src: url(/fonts/Literata-Regular.woff2) format("woff2");
}

@font-face {
  font-family: "Literata";
  font-weight: normal;
  font-style: italic;
  font-display: swap;
  src: url(/fonts/Literata-Italic.woff2) format("woff2");
}

@font-face {
  font-family: "Literata";
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  src: url(/fonts/Literata-Bold.woff2) format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/PlayfairDisplay.ttf) format("truetype");
}

:root {
  --paper: #f7f4ec;
  --ink: #2b2925;
  --faint: #8a8478;
  --line: #ddd7c9;
  --red: #d6231e;
}

* {
  margin: 0;
  padding: 0;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Literata", "Iowan Old Style", Palatino, Georgia, serif;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body {
  max-width: 33em;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 6rem;
}

/* Quick, subtle page-turn fade. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.13s;
}

main {
  animation: pagefade 0.18s ease-out;
}

@keyframes pagefade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
}

/* Top menu. */
header.top {
  margin-bottom: 4rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}

header.top a {
  color: var(--faint);
  text-decoration: none;
}

header.top a:hover {
  color: var(--ink);
}

header.top nav {
  display: flex;
  gap: 1.5rem;
}

/* The cover's hanging thread + red dot, centered on the homepage:
   anchored to the very top of the page, ending above the title. */
.home-thread {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  color: var(--faint);
  pointer-events: none;
}

h1 {
  font-weight: normal;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  text-align: center;
  margin: 3rem 0 3.5rem;
}

/* Homepage title, set in the cover's face, pushed down to clear the
   hero thread (150px tall from the page top). */
.home-title {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  font-size: 2.1rem;
  letter-spacing: -0.015em;
  margin-top: 5.5rem;
}

.subtitle {
  text-align: center;
  font-style: italic;
  color: var(--faint);
  margin: -2.5rem 0 3.5rem;
}

p {
  margin: 0 0 1.1em;
}

em {
  font-style: italic;
}

blockquote {
  margin: 1.6em 1.4em;
  font-style: italic;
}

blockquote em {
  font-style: normal;
}

/* ⁂ section break: centered, generous whitespace.
   As a page opener it marks the continuation of a chapter. */
.section-break {
  text-align: center;
  margin: 2.8em 0;
  color: var(--faint);
}

.section-break.opener {
  margin: 1rem 0 3rem;
}

.section-break p {
  margin: 0;
}

/* The little red dot from the cover, used as the section separator. */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}

/* The door: each chapter's closing italic paragraph(s). */
.door {
  margin-top: 4em;
}

.door p {
  margin-bottom: 0.6em;
}

/* Page-edge turn buttons. */
.edge {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  padding: 1.2rem 0.9rem;
  font-size: 3rem;
  line-height: 1;
  color: #c2bba7;
  text-decoration: none;
  user-select: none;
}

.edge:hover {
  color: var(--ink);
}

/* Sit close to the text column (rem, not em — em scales with the chevron's
   own font size); max() keeps them on-screen when narrow. */
.edge.prev {
  left: max(0.2rem, calc(50% - 19.5rem));
}

.edge.next {
  right: max(0.2rem, calc(50% - 19.5rem));
}

@media (max-width: 46em) {
  .edge {
    font-size: 2.2rem;
    padding: 1rem 0.4rem;
  }

  body {
    padding-left: 2.3rem;
    padding-right: 2.3rem;
  }
}

/* Homepage. */
.lede {
  text-align: center;
  margin: 0 auto 2.2rem;
  max-width: 28em;
}

.actions {
  text-align: center;
  margin: 2.2rem 0;
}

.actions a {
  display: inline-block;
  margin: 0 0.9rem;
  font-size: 0.95rem;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.15em;
}

.actions a.primary {
  color: var(--ink);
  border-bottom-color: var(--faint);
}

.actions a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

main h2 {
  font-weight: normal;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 3.2rem 0 1.2rem;
}

.quotes {
  margin: 3.5rem 0;
}

.quotes blockquote {
  margin: 2.4rem 0.5rem;
}

.quotes cite {
  display: block;
  margin-top: 0.6rem;
  font-style: normal;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

/* Newsletter. */
.newsletter {
  margin: 2rem 0;
}

.newsletter .row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.newsletter input[type="email"] {
  flex: 1 1 14em;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.3em 0.1em;
  border-radius: 0;
}

.newsletter input[type="email"]:focus {
  outline: none;
  border-bottom-color: var(--faint);
}

.newsletter input::placeholder {
  color: var(--faint);
  opacity: 0.7;
}

.newsletter button {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1px solid var(--faint);
  padding: 0.3em 0.1em;
  cursor: pointer;
}

.newsletter button:hover {
  border-bottom-color: var(--ink);
}

.newsletter .fine {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--faint);
}

/* Quiet footer. */
.foot {
  margin-top: 4.5rem;
  font-size: 0.85rem;
  color: var(--faint);
  text-align: center;
}

.foot a {
  color: var(--faint);
}

.foot a:hover {
  color: var(--ink);
}

/* Lists within the text (The Doors). */
main ol,
main ul {
  padding-left: 1.6em;
  margin-bottom: 1.1em;
}

main li {
  margin: 0.5em 0;
}

/* Landing page: the first chapter shown in full under the description. */
.chapter-title {
  font-weight: normal;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  text-align: center;
  margin: 3rem 0 3.5rem;
}

/* Contents (landing page). */
.contents {
  margin: 3rem 0;
}

.contents h2 {
  font-weight: normal;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.2rem;
}

.contents ol {
  list-style: none;
  padding-left: 0;
}

.contents li {
  margin: 0.35em 0;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--faint);
}

/* Prev / next page turn. */
.turn {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  font-size: 0.9rem;
  color: var(--faint);
}

.turn a {
  color: var(--faint);
  text-decoration: none;
}

.turn a:hover {
  color: var(--ink);
}
