/* ============================================================
   Paper Line Dot — paperlinedot.com
   Display : Bodoni Moda   Body : IBM Plex Sans   Data : IBM Plex Mono
   ============================================================ */

@property --glow  { syntax: '<color>'; inherits: true; initial-value: #e8b13f; }
@property --glow2 { syntax: '<color>'; inherits: true; initial-value: #2b3b6b; }

:root {
  --ink:      #060910;
  --ink-2:    #0a0f1a;
  --paper:    #f4efe4;
  --paper-dim:#cdc6b7;
  --muted:    #8792a8;
  --muted-2:  #5b657a;
  --brand:    #e8b13f;
  --acc:      #e8b13f;

  --hair:     rgba(244, 239, 228, 0.13);
  --hair-soft:rgba(244, 239, 228, 0.07);

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --disp: 'Bodoni Moda', 'Didot', 'Times New Roman', serif;

  --gutter: clamp(20px, 5vw, 68px);
  --ease: cubic-bezier(.2, .75, .25, 1);

  transition: --glow 900ms linear, --glow2 900ms linear;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 200;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: .78rem;
}
.skip:focus { left: 12px; }

/* ─────────────  ATMOSPHERE  ───────────── */

#glow {
  position: fixed;
  inset: -10vh -10vw;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58vw 62vh at 76% 20%, var(--glow),  transparent 64%),
    radial-gradient(52vw 54vh at 14% 84%, var(--glow2), transparent 68%);
  opacity: .17;
  transition: opacity 1s ease;
}

#grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 90;
  pointer-events: none;
  background: var(--hair-soft);
}
#progress i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--brand), var(--acc));
}

main, .masthead, .site-foot, .rail { position: relative; z-index: 2; }

/* ─────────────  MASTHEAD  ───────────── */

.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  transition: background .4s ease, border-color .4s ease, padding .4s ease;
  border-bottom: 1px solid transparent;
}
.masthead.solid {
  background: rgba(6, 9, 16, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--hair-soft);
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand img { width: 32px; height: 32px; border-radius: 50%; }
.brand-word {
  font-family: var(--disp);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.brand-word em { font-style: italic; color: var(--brand); }

.masthead-nav { display: flex; gap: 30px; }
.masthead-nav a {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .25s ease;
}
.masthead-nav a:hover { color: var(--paper); }

/* ─────────────  INDEX RAIL  ───────────── */

.rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: none;
  gap: 4px;
}
.rail a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 7px 2px;
  color: var(--muted-2);
  transition: color .3s ease;
}
.rail-num {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
  width: 22px;
  text-align: right;
}
/* Taken out of flow so every number stays on the same vertical axis
   whatever the label length. */
.rail-name {
  position: absolute;
  right: 100%;
  margin-right: 12px;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.rail a:hover { color: var(--paper); }
.rail a:hover .rail-name { opacity: 1; transform: none; }
.rail a.active { color: var(--acc); }
.rail a.active .rail-name { opacity: 1; transform: none; }

/* ─────────────  OPENING  ───────────── */

.opening {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 132px var(--gutter) 108px;
}

.opening-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, .84fr);
  gap: clamp(32px, 4vw, 60px);
  align-items: center;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .71rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 26px;
}

.opening h1 {
  font-family: var(--disp);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(2.55rem, 6vw, 5.1rem);
  line-height: .99;
  letter-spacing: -.021em;
  text-wrap: balance;
  margin: 0 0 22px;
}
.opening h1 em {
  font-style: italic;
  font-weight: 600;
  color: var(--brand);
}

.lede {
  max-width: 44ch;
  font-size: clamp(1rem, 1.25vw, 1.14rem);
  color: var(--muted);
  margin: 0 0 34px;
}
.lede strong { color: var(--paper-dim); font-weight: 500; }

.opening-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* buttons */

.cta {
  display: inline-flex;
  align-items: center;
  gap: .7em;
  background: var(--paper);
  color: #0b0f18;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 15px 26px;
  border-radius: 2px;
  transition: transform .3s var(--ease), box-shadow .4s ease;
}
.cta::after {
  content: '→';
  transition: transform .3s var(--ease);
}
.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px -16px var(--acc);
}
.cta:hover::after { transform: translateX(4px); }

.ghost {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hair);
  color: var(--muted);
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 15px 24px;
  border-radius: 2px;
  transition: border-color .3s ease, color .3s ease;
}
.ghost:hover { border-color: var(--paper-dim); color: var(--paper); }

/* floating cover cluster */

.cluster {
  position: relative;
  height: clamp(320px, 58vh, 560px);
}
.cluster-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(112px, 12vw, 168px);
  transform:
    translate(-50%, -50%)
    translate(var(--x), calc(var(--y) + var(--py, 0px)))
    rotate(var(--r))
    scale(var(--s));
  animation: float-in 1.4s var(--ease) both;
  animation-delay: calc(var(--depth) * .5s);
}
.cluster-item img {
  width: 100%;
  border-radius: 2px;
  box-shadow:
    0 34px 60px -26px rgba(0, 0, 0, .95),
    0 6px 20px -8px rgba(0, 0, 0, .7),
    0 0 66px -22px var(--tint);
}

@keyframes float-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.scroll-cue {
  position: absolute;
  left: var(--gutter);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.scroll-cue i {
  display: block;
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, var(--muted-2), transparent);
  position: relative;
  overflow: hidden;
}
.scroll-cue i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand);
  animation: sweep 2.4s ease-in-out infinite;
}
@keyframes sweep {
  0%        { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ─────────────  CATALOG BAR  ───────────── */

.catalog-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--hair-soft);
  border-bottom: 1px solid var(--hair-soft);
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.catalog-rule {
  flex: 1;
  height: 1px;
  background: var(--hair-soft);
}

/* ─────────────  CHAPTERS  ───────────── */

.chapter {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: clamp(86px, 12vh, 124px) var(--gutter);
  border-bottom: 1px solid var(--hair-soft);
}

.chapter-inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
  gap: clamp(40px, 7vw, 108px);
  align-items: center;
}
/* Reordering alone would hand the copy the narrow column, so the
   track widths swap with it. */
.chapter.flip .chapter-inner {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
}
.chapter.flip .stage    { order: 2; }
.chapter.flip .col-text { order: 1; }

/* the book as an object */

.stage {
  position: relative;
  display: flex;
  justify-content: center;
  perspective: 1600px;
}
.stage::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.66);
  background: radial-gradient(circle, var(--acc), transparent 62%);
  opacity: 0;
  filter: blur(14px);
  transition: opacity 1.3s ease, transform 1.5s var(--ease);
  pointer-events: none;
}
.chapter.in .stage::before { opacity: .26; transform: translate(-50%, -50%) scale(1); }

.book {
  position: relative;
  width: min(330px, 78%);
  transform: rotateY(var(--ry, -13deg)) rotateX(var(--rx, 2deg));
  transition: transform .7s var(--ease);
  will-change: transform;
}
.book img {
  position: relative;
  z-index: 2;
  width: 100%;
  border-radius: 1px 3px 3px 1px;
  box-shadow:
    0 48px 72px -34px rgba(0, 0, 0, .95),
    0 14px 30px -14px rgba(0, 0, 0, .75);
}
.thickness {
  position: absolute;
  z-index: 1;
  top: 1.4%;
  bottom: 1.4%;
  right: -13px;
  width: 15px;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(90deg,
    #d6cebd 0 1px,
    #f2ece0 1px 3px);
  box-shadow: inset -6px 0 12px -6px rgba(0, 0, 0, .55);
}
.crease {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  border-radius: 1px 3px 3px 1px;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, .58) 0,
      rgba(0, 0, 0, .30) 1.4%,
      rgba(255, 255, 255, .08) 3.4%,
      rgba(255, 255, 255, .02) 5.2%,
      transparent 8.5%),
    linear-gradient(90deg, transparent 93%, rgba(0, 0, 0, .26) 100%);
}
.sheen {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  border-radius: 1px 3px 3px 1px;
  mix-blend-mode: screen;
  background: linear-gradient(104deg,
    transparent 32%,
    rgba(255, 255, 255, .13) 47%,
    rgba(255, 255, 255, .03) 55%,
    transparent 66%);
}

/* chapter copy */

.index {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: .71rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 20px;
}
.index b {
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--acc);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.index em {
  font-style: normal;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--hair);
}

.chapter h2 {
  font-family: var(--disp);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(2.15rem, 4.5vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  text-wrap: balance;
  margin: 0 0 14px;
}

.sub {
  font-family: var(--disp);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.02rem, 1.5vw, 1.24rem);
  line-height: 1.4;
  color: var(--acc);
  margin: 0 0 26px;
  max-width: 40ch;
}

.blurb {
  max-width: 54ch;
  font-size: .98rem;
  line-height: 1.75;
  color: var(--muted);
  margin: 0 0 30px;
}

.specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  list-style: none;
  padding: 0;
  margin: 0 0 34px;
}
.specs li {
  position: relative;
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.specs li + li::before {
  content: '';
  position: absolute;
  left: -13px;
  top: 50%;
  width: 1px;
  height: 11px;
  transform: translateY(-50%);
  background: var(--hair);
}

.buy { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; }
.price {
  margin: 0;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .09em;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* ─────────────  IMPRINT  ───────────── */

.imprint {
  padding: clamp(96px, 13vh, 150px) var(--gutter);
}
.imprint-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(36px, 6vw, 76px);
  align-items: center;
}
.mark {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  padding: 14px;
  border: 1px solid var(--hair);
}
.imprint h2 {
  font-family: var(--disp);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 1.06;
  letter-spacing: -.018em;
  margin: 0 0 22px;
}
.imprint-text p {
  max-width: 56ch;
  color: var(--muted);
  margin: 0 0 15px;
  font-size: .98rem;
  line-height: 1.75;
}
.imprint-text strong { color: var(--paper); font-weight: 600; }
.signoff {
  font-family: var(--disp);
  font-style: italic;
  color: var(--brand) !important;
  margin-top: 24px !important;
  font-size: 1.1rem !important;
}

/* ─────────────  FOOTER  ───────────── */

.site-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 34px var(--gutter) 40px;
  border-top: 1px solid var(--hair-soft);
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .1em;
  color: var(--muted-2);
}
.site-foot a { transition: color .25s ease; }
.site-foot a:hover { color: var(--brand); }

/* ─────────────  REVEAL  ───────────── */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity  .95s var(--ease) var(--d, 0s),
    transform .95s var(--ease) var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ─────────────  RESPONSIVE  ───────────── */

@media (min-width: 1180px) {
  .rail { display: grid; }
}

@media (max-width: 1024px) {
  /* .chapter.flip .chapter-inner outranks a bare .chapter-inner, so the
     flipped variant has to be collapsed by name too. */
  .opening-inner,
  .chapter-inner,
  .chapter.flip .chapter-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
  }
  .chapter.flip .stage,
  .chapter.flip .col-text { order: initial; }
  .chapter { min-height: 0; padding: 88px var(--gutter); }
  .opening { padding-top: 118px; }
  .cluster { height: clamp(260px, 40vh, 360px); order: -1; }
  .cluster-item { width: clamp(104px, 20vw, 150px); }
  .book { width: min(268px, 62%); }
  .imprint-inner { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .mark { width: 128px; height: 128px; }
}

@media (max-width: 640px) {
  .masthead-nav { gap: 18px; }
  .masthead-nav a { font-size: .66rem; letter-spacing: .1em; }
  .brand-word { font-size: 1rem; }
  .scroll-cue { display: none; }
  .catalog-bar { font-size: .62rem; letter-spacing: .16em; gap: 12px; }
  .book { width: min(220px, 66%); }
  .opening-actions .cta,
  .opening-actions .ghost { flex: 1 1 auto; justify-content: center; }
  .site-foot { justify-content: flex-start; }
}

/* Tighten the masthead rather than dropping links — navigation is worth
   more than a couple of pixels of letter-spacing. */
@media (max-width: 400px) {
  .brand-word { font-size: .92rem; }
  .brand img { width: 28px; height: 28px; }
  .masthead-nav { gap: 12px; }
  .masthead-nav a { font-size: .6rem; letter-spacing: .08em; }
}

/* ─────────────  MOTION PREFERENCES  ───────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .cluster-item { animation: none; }
  .scroll-cue i::after { animation: none; opacity: .4; }
  .book { transform: none; transition: none; }
  .stage::before { transition: none; }
  .cta, .ghost, .rail a, .masthead { transition: none; }
  .cta:hover { transform: none; }
}
