/* ============================================================
   midnight & starlight
   Layout, type and motion only. No words live in this file.
   ============================================================ */

:root{
  --ink:        #070b16;
  --ink-2:      #0b1222;
  --text:       #dde3f2;
  --text-soft:  #aab3cb;
  --muted:      #77809c;
  --gold:       #e8c27a;
  --gold-dim:   #8d7a4f;
  --star:       #f6f8ff;

  --measure:    34rem;     /* comfortable reading width */
  --gutter:     clamp(1rem, 5vw, 3rem);
  --chapter-gap: clamp(6rem, 18vh, 12rem);

  --ease: cubic-bezier(.22,.61,.36,1);
}

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

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

body{
  margin: 0;
  background:
    radial-gradient(120% 70% at 50% -10%, #142244 0%, transparent 62%),
    radial-gradient(90% 60% at 50% 108%, #10192f 0%, transparent 60%),
    var(--ink);
  background-attachment: fixed;
  color: var(--text);
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- starfield + vignette ---------- */

.sky{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.vignette{
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(75% 60% at 50% 45%, transparent 40%, rgba(4,6,14,.55) 100%);
}

/* ---------- reading progress ---------- */

.progress{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 40;
  background: rgba(232,194,122,.08);
}
.progress i{
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(232,194,122,.35), var(--gold));
  box-shadow: 0 0 10px rgba(232,194,122,.5);
}

/* ---------- skip link ---------- */

.skip{
  position: fixed;
  top: .5rem; left: 50%;
  transform: translate(-50%, -160%);
  z-index: 50;
  padding: .5rem 1rem;
  font-size: .85rem;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--gold);
  border-radius: 999px;
  text-decoration: none;
  transition: transform .2s var(--ease);
}
.skip:focus{ transform: translate(-50%, 0); }

/* ---------- shell ---------- */

main{
  position: relative;
  z-index: 2;
  padding-inline: var(--gutter);
}

/* ---------- hero ---------- */

.hero{
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  text-align: center;
  padding-block: 4rem 3rem;
}

.hero-inner{
  max-width: 30rem;
  align-self: center;
  animation: rise 1.6s var(--ease) both;
}

.kicker{
  margin: 0 0 1.4rem;
  font-size: .72rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
}

.name{
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 300;
  font-size: clamp(3.2rem, 14vw, 7rem);
  line-height: 1.02;
  letter-spacing: .01em;
  color: var(--star);
  text-shadow: 0 0 34px rgba(190,210,255,.28), 0 0 90px rgba(120,150,255,.14);
  animation: breathe 7s ease-in-out infinite;
}

.rule{
  width: 4.5rem;
  height: 1px;
  margin: 2rem auto;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .8;
}

.hero-line{
  margin: 0;
  font-size: 1.05em;
  font-style: italic;
  color: var(--text-soft);
  text-wrap: balance;
}

.scroll-hint{
  align-self: end;
  width: 1px;
  height: 4.5rem;
  background: linear-gradient(180deg, transparent, rgba(232,194,122,.45));
  position: relative;
  overflow: hidden;
}
.scroll-hint span{
  position: absolute;
  inset-inline: -1px;
  height: 1.6rem;
  background: linear-gradient(180deg, transparent, var(--gold));
  animation: drop 2.6s var(--ease) infinite;
}

/* ---------- the letter ---------- */

.letter{
  max-width: var(--measure);
  margin-inline: auto;
  padding-block: clamp(3rem, 10vh, 7rem) 0;
}

.chapter{ margin-block: 0 var(--chapter-gap); }

.label{
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 0 0 1rem;
  font-size: .7rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .9;
}
.label span{
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--muted);
  padding-right: .7rem;
  border-right: 1px solid rgba(232,194,122,.28);
}

.chapter h2{
  margin: 0 0 1.6rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--star);
  text-wrap: balance;
}

.chapter p{
  margin: 0 0 1.35em;
  color: var(--text);
}
.chapter p:last-child{ margin-bottom: 0; }

.chapter em{ color: var(--star); }
.chapter strong{ font-weight: 500; color: var(--star); }

/* ---------- divider ---------- */

.divider{
  display: flex;
  justify-content: center;
  margin-block: 0 var(--chapter-gap);
  color: var(--gold);
  opacity: .5;
}
.divider svg{ width: 7.5rem; height: auto; }

/* ---------- promises ---------- */

.promise-list{
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: p;
}
.promise-list li{
  counter-increment: p;
  position: relative;
  padding: 1.05rem 0 1.05rem 3rem;
  border-top: 1px solid rgba(221,227,242,.09);
}
.promise-list li:last-child{ border-bottom: 1px solid rgba(221,227,242,.09); }
.promise-list li::before{
  content: counter(p, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.35rem;
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--gold);
  opacity: .75;
}

/* ---------- closing ---------- */

.closing{ text-align: center; }

.closing-line{
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  line-height: 1.4;
  font-weight: 300;
  color: var(--star);
  text-wrap: balance;
  margin: 0 0 1em;
}

.signature{
  margin: 2.5rem 0 0;
  font-style: italic;
  font-size: 1.05em;
  color: var(--gold);
}

/* ---------- reply ---------- */

.reply{
  margin-top: clamp(3rem, 9vh, 5rem);
  padding-top: clamp(2rem, 6vh, 3rem);
  border-top: 1px solid rgba(221,227,242,.09);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
}

.reply-note{
  margin: 0 0 .4rem;
  font-size: .95em;
  color: var(--text-soft);
  font-style: italic;
}

.btn{
  display: inline-block;
  min-width: 13rem;
  padding: .85rem 1.9rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: #12182a;
  font-family: "EB Garamond", Georgia, serif;
  font-size: .95rem;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -12px rgba(232,194,122,.6);
}
.btn.ghost{
  background: transparent;
  color: var(--gold);
  border-color: rgba(232,194,122,.45);
}
.btn.ghost:hover{
  border-color: var(--gold);
  background: rgba(232,194,122,.08);
}
.btn:focus-visible{
  outline: 2px solid var(--star);
  outline-offset: 3px;
}

/* ---------- footer ---------- */

footer{
  padding: clamp(4rem, 14vh, 8rem) 0 clamp(3rem, 8vh, 5rem);
  text-align: center;
  color: var(--gold);
  opacity: .35;
  font-size: .9rem;
  letter-spacing: .3em;
}

/* ---------- scroll reveal (JS only; without JS everything is visible) ---------- */

.js .reveal{
  opacity: 0;
  transform: translateY(2.2rem);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  will-change: opacity, transform;
}
.js .reveal.in{ opacity: 1; transform: none; }

.js .reveal .promise-list li{
  opacity: 0;
  transform: translateY(.8rem);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms + 250ms);
}
.js .reveal.in .promise-list li{ opacity: 1; transform: none; }

/* ---------- placeholder warning (disappears once every blank is filled) ---------- */

.todo-bar{
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  padding: .55rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .75rem;
  letter-spacing: .02em;
  text-align: center;
  color: #2a1608;
  background: #f0b429;
}

/* ---------- animations ---------- */

@keyframes rise{
  from{ opacity: 0; transform: translateY(1.8rem); }
  to  { opacity: 1; transform: none; }
}
@keyframes breathe{
  0%,100%{ text-shadow: 0 0 34px rgba(190,210,255,.28), 0 0 90px rgba(120,150,255,.14); }
  50%    { text-shadow: 0 0 44px rgba(200,218,255,.42), 0 0 120px rgba(130,160,255,.22); }
}
@keyframes drop{
  0%  { transform: translateY(-120%); opacity: 0; }
  25% { opacity: 1; }
  100%{ transform: translateY(400%); opacity: 0; }
}

/* ---------- motion & contrast preferences ---------- */

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal{ opacity: 1; transform: none; }
  .js .reveal .promise-list li{ opacity: 1; transform: none; }
  .scroll-hint{ display: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 30rem){
  :root{ --chapter-gap: 5rem; }
  .btn{ width: 100%; min-width: 0; }
  .promise-list li{ padding-left: 2.4rem; }
}

@media print{
  .sky, .vignette, .progress, .scroll-hint, .todo-bar, .skip{ display: none; }
  body{ background: #fff; color: #111; }
  .name, .chapter h2, .closing-line{ color: #111; text-shadow: none; }
}

.label span:only-child{
  border-right: 0;
  padding-right: 0;
}
