/* Paperana — Coming Soon, option 2 ("Forthcoming")
   Editorial direction: forest page, ivory type, EB Garamond + Inter (brand board recommendations). */

:root {
  --forest: #12311F;
  --ivory: #F7EAD8;
  --sage: #90A267;
  --parchment: #D2CCAE;

  --text-soft: rgba(247, 234, 216, .74);
  --text-muted: #a9b18f;
  --hairline: rgba(210, 204, 174, .22);
  --error: #eaa58e;

  --serif: "EB Garamond", "Garamond", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.2, .7, .1, 1);
  --gutter: clamp(20px, 5vw, 72px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--forest);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .97 0 0 0 0 .92 0 0 0 0 .85 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 80% 60% at 30% 30%, #17402a 0%, rgba(23, 64, 42, 0) 70%);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--sage); color: var(--forest); }

button { font: inherit; color: inherit; }

/* ---------- Page frame ---------- */

.page {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  padding-inline: var(--gutter);
  overflow: hidden;
}

.rule {
  height: 1px;
  background: var(--hairline);
  transform: scaleX(0);
  transform-origin: left center;
  animation: draw-x 1.6s var(--ease-out) .15s forwards;
}

@keyframes draw-x { to { transform: scaleX(1); } }
@keyframes draw-y { to { transform: scaleY(1); } }

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal 1.1s var(--ease-out) var(--d, 0s) forwards;
}

@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: clamp(20px, 3.4vh, 34px) clamp(16px, 2.4vh, 24px);
  opacity: 0;
  animation: reveal 1s var(--ease-out) .05s forwards;
}

.logo { display: block; line-height: 0; }
.logo img { height: clamp(26px, 3.6vh, 36px); width: auto; }
.logo:focus-visible { outline: 1px solid var(--ivory); outline-offset: 8px; }

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.status-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--sage);
  animation: ping 2.8s ease-out infinite;
}

@keyframes ping {
  from { transform: scale(1); opacity: .9; }
  to { transform: scale(3.2); opacity: 0; }
}

/* ---------- Spread ---------- */

.spread {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 1px minmax(0, .9fr);
  gap: clamp(32px, 5.5vw, 96px);
  align-items: center;
  padding-block: clamp(20px, 4.2vh, 72px);
}

.rule-v {
  width: 1px;
  height: auto;
  align-self: stretch;
  transform: scaleY(0);
  transform-origin: top center;
  animation: draw-y 1.8s var(--ease-out) .6s forwards;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow-sep { width: 40px; height: 1px; background: currentColor; opacity: .6; }

.headline {
  margin: clamp(16px, 2.6vh, 28px) 0 clamp(18px, 3vh, 32px);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.9rem, min(6.4vw, 10vh), 6.2rem);
  line-height: 1;
  letter-spacing: -.022em;
}
.headline .mask { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.headline .line {
  display: block;
  transform: translateY(108%);
  animation: line-up 1.3s var(--ease-out) var(--d) forwards;
}
.headline em { font-style: italic; color: var(--sage); }

@keyframes line-up { to { transform: none; } }

.intro {
  max-width: 44ch;
  margin: 0;
  font-size: clamp(1rem, 1.15vw, 1.1rem);
  line-height: 1.7;
  color: var(--text-soft);
}

/* ---------- Signup ---------- */

.signup { max-width: 500px; margin-top: clamp(26px, 4.6vh, 48px); }

.signup-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.32rem;
  color: var(--ivory);
}

.signup-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(210, 204, 174, .38);
}
.signup-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--ivory);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .7s var(--ease-out);
}
.signup-row:focus-within .signup-line { transform: scaleX(1); }

.signup input[type="email"] {
  flex: 1;
  min-width: 0;
  height: 54px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ivory);
  font: inherit;
  font-size: 1.02rem;
}
.signup input::placeholder { color: rgba(247, 234, 216, .56); opacity: 1; }
.signup input:disabled { color: var(--text-muted); }
.signup .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.signup-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 2px;
  border: 0;
  background: none;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
}
.signup-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .5s var(--ease-out);
}
.signup-btn:hover svg, .signup-btn:focus-visible svg { transform: translateX(5px); }
.signup-btn:focus-visible { outline: 1px solid var(--ivory); outline-offset: 4px; }
.signup-btn[disabled] { cursor: progress; }
.signup.is-loading .btn-label { animation: breathe 1.1s ease-in-out infinite; }
.signup.is-done .signup-btn { color: var(--sage); }
.signup.is-done .signup-btn svg { display: none; }
.signup.is-shake .signup-row { animation: nudge .5s ease-in-out; }

.signup-msg {
  margin: 12px 0 0;
  min-height: 1.5em;
  font-size: .84rem;
  color: var(--text-muted);
  transition: color .3s;
}
.signup-msg.is-error { color: var(--error); }
.signup-msg.is-success {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.12rem;
  color: var(--ivory);
  animation: reveal .9s var(--ease-out) both;
}

@keyframes breathe { 50% { opacity: .4; } }
@keyframes nudge {
  0%, 100% { transform: none; }
  25% { transform: translateX(-6px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

/* ---------- Contents ---------- */

.contents { width: 100%; max-width: 460px; justify-self: end; }

.contents-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}
.contents-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1;
}
.contents-head span {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc { margin: 0; padding: 0; list-style: none; }
.toc li {
  display: grid;
  grid-template-columns: 2.4rem auto minmax(24px, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: clamp(12px, 2vh, 18px) 0;
  border-bottom: 1px solid var(--hairline);
  opacity: 0;
  transform: translateY(10px);
  animation: reveal 1s var(--ease-out) forwards;
  animation-delay: calc(1.05s + var(--i) * .12s);
}

.toc-num {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--sage);
  transition: color .4s;
}
.toc-body { display: flex; flex-direction: column; }
.toc-title {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1.8vw, 1.6rem);
  line-height: 1.15;
  transition: transform .6s var(--ease-out);
}
.toc-note {
  margin-top: 3px;
  font-size: .78rem;
  color: var(--text-muted);
}
.toc-leader {
  align-self: center;
  height: 2px;
  background-image: radial-gradient(circle, rgba(210, 204, 174, .5) 0 1px, transparent 1.2px);
  background-size: 7px 2px;
  background-repeat: repeat-x;
  transform: scaleX(0);
  transform-origin: left center;
  animation: draw-x 1.2s var(--ease-out) forwards;
  animation-delay: calc(1.35s + var(--i) * .12s);
  transition: filter .4s;
}
.toc-page {
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.toc li:hover .toc-title { transform: translateX(6px); }
.toc li:hover .toc-num { color: var(--ivory); }
.toc li:hover .toc-leader { filter: brightness(1.6); }

/* ---------- Fanned pages ---------- */

.pages {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: clamp(80px, 16vh, 200px);
  margin-bottom: -1px;
  overflow: visible;
  pointer-events: none;
}
.pages path {
  fill: none;
  stroke: var(--parchment);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform-box: view-box;
  transform-origin: 720px 300px;
  animation:
    draw-line 2.4s var(--ease-out) forwards,
    riffle 9s ease-in-out infinite;
  animation-delay: calc(.6s + var(--i) * 28ms), calc(4s + var(--i) * 70ms);
}
.pages path.is-top { stroke: var(--sage); }
.pages path.turn {
  stroke: var(--ivory);
  stroke-dashoffset: 0;
  opacity: 0;
  animation: turn 12s ease-in-out 5s infinite;
}

@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes riffle {
  0%, 72%, 100% { transform: rotate(0deg); }
  82% { transform: rotate(calc(var(--dir) * 1.4deg)); }
}
@keyframes turn {
  0% { transform: scaleX(1); opacity: 0; }
  4% { opacity: .85; }
  16% { transform: scaleX(.15) translateY(-14px); }
  18% { transform: scaleX(-.15) translateY(-14px); }
  30% { transform: scaleX(-1); opacity: .85; }
  36%, 100% { transform: scaleX(-1); opacity: 0; }
}

/* ---------- Colophon ---------- */

.colophon { position: relative; z-index: 2; }
.colophon .rule { background: rgba(210, 204, 174, .4); animation-delay: .3s; }

.colophon-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding-block: clamp(14px, 2.4vh, 22px) clamp(16px, 2.8vh, 26px);
  opacity: 0;
  animation: reveal 1s var(--ease-out) 1.5s forwards;
}

.copy, .motto { margin: 0; font-size: .78rem; color: var(--text-muted); }
.motto { justify-self: end; font-family: var(--serif); font-size: 1rem; }

.social {
  display: flex;
  gap: clamp(18px, 2.6vw, 34px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.social a {
  position: relative;
  display: inline-block;
  padding-block: 6px;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-decoration: none;
  transition: color .3s;
}
.social a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--sage);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .5s var(--ease-out);
}
.social a:hover, .social a:focus-visible { color: var(--ivory); }
.social a:hover::after, .social a:focus-visible::after { transform: scaleX(1); transform-origin: left center; }
.social a:focus-visible { outline: 1px solid var(--ivory); outline-offset: 4px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .spread {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    align-items: start;
  }
  .rule-v { display: none; }
  .contents { justify-self: start; max-width: none; }
  .colophon-row { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 12px; }
  .motto { justify-self: center; }
  .social { order: -1; }
}

@media (max-width: 520px) {
  .status { font-size: .7rem; letter-spacing: .14em; }
  .headline { font-size: clamp(2.6rem, 12.5vw, 3.6rem); }
  .signup-btn .btn-label { letter-spacing: .14em; }
  .toc li { grid-template-columns: 2rem 1fr auto; gap: 10px; }
  .toc-leader { display: none; }
  .pages { height: 80px; }
  .social { flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
  .pages path.turn { display: none; }
}
