/* ============================================================
   mykyler.com — design system
   Dark, warm, editorial. One accent. Generous negative space.
   ============================================================ */

:root{
  /* ground */
  --ink:        #0B0A09;
  --ink-2:      #100E0C;
  --ink-3:      #16130F;

  /* type */
  --ivory:      #F2EBE1;
  --ivory-70:   rgba(242,235,225,.70);
  --ivory-52:   rgba(242,235,225,.52);
  --ivory-38:   rgba(242,235,225,.38);

  /* single accent — muted rose, never pink */
  --rose:       #C98F82;
  --champagne:  #D9BC93;
  --rule:       rgba(242,235,225,.13);

  /* type stacks — system only: zero network requests, zero CSP holes */
  --display: "Didot","Bodoni MT","Hoefler Text","Playfair Display",
             Garamond,"Times New Roman",serif;
  --sans: -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Helvetica,Arial,sans-serif;

  /* fluid spacing */
  --gap:   clamp(1rem, 2vw, 1.5rem);
  --bay:   clamp(5rem, 14vh, 10rem);

  --ease: cubic-bezier(.22,.61,.36,1);
}

*,*::before,*::after{ box-sizing:border-box; }

html{
  -webkit-text-size-adjust:100%;
  scroll-behavior:smooth;
}

body{
  margin:0;
  background:var(--ink);
  color:var(--ivory);
  font-family:var(--sans);
  font-size:clamp(1rem,.95rem + .3vw,1.125rem);
  line-height:1.75;
  font-weight:350;
  letter-spacing:.005em;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}

/* The story opens only when its invitation is accepted. */
html.intro-locked,
.intro-locked body{ overflow:hidden; overscroll-behavior:none; }
.intro-locked #main > .section,
.intro-locked .footer{ display:none; }
.intro-locked .nav,
.intro-locked .progress{ visibility:hidden; }
.intro-locked .hero{ height:100svh; min-height:0; }
.scroll-cue{ min-width:48px; }
#story:focus{ outline:none; }
.story-open .letter__rule{ box-shadow:0 0 14px rgba(201,143,130,.18); }

img{ max-width:100%; height:auto; display:block; }

::selection{ background:var(--rose); color:var(--ink); }

/* ---------- accessibility ---------- */
.skip{
  position:absolute; left:-9999px; top:0; z-index:200;
  background:var(--ivory); color:var(--ink);
  padding:.75rem 1.25rem; font-size:.9rem;
}
.skip:focus{ left:1rem; top:1rem; }

:focus-visible{
  outline:1px solid var(--rose);
  outline-offset:4px;
}

/* ---------- scroll progress ---------- */
.progress{
  position:fixed; inset:0 0 auto 0; height:1px; z-index:120;
  background:transparent; pointer-events:none;
}
.progress span{
  display:block; height:100%; width:0%;
  background:linear-gradient(90deg,transparent,var(--rose));
  transition:width .1s linear;
}

/* ---------- nav ---------- */
.nav{
  position:fixed; inset:0 0 auto 0; z-index:100;
  display:flex; align-items:center; justify-content:space-between;
  gap:1rem;
  padding:clamp(1rem,2.5vw,1.75rem) clamp(1.25rem,5vw,3.5rem);
  transform:translateY(-100%);
  opacity:0;
  transition:transform .6s var(--ease), opacity .6s var(--ease);
  background:linear-gradient(to bottom,rgba(11,10,9,.88),transparent);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.nav.is-visible{ transform:none; opacity:1; }

.nav__mark{
  font-family:var(--display);
  font-size:1.35rem;
  color:var(--ivory);
  text-decoration:none;
  line-height:1;
}

.nav__links{
  display:flex; flex-wrap:wrap; gap:clamp(.9rem,2.4vw,2rem);
}
.nav__links a{
  position:relative;
  color:var(--ivory-52);
  text-decoration:none;
  font-size:clamp(.72rem,.68rem + .2vw,.82rem);
  letter-spacing:.14em;
  text-transform:uppercase;
  padding-block:.3rem;
  transition:color .4s var(--ease);
}
.nav__links a::after{
  content:""; position:absolute; left:0; bottom:0;
  width:100%; height:1px; background:var(--rose);
  transform:scaleX(0); transform-origin:right;
  transition:transform .5s var(--ease);
}
.nav__links a:hover,.nav__links a:focus-visible{ color:var(--ivory); }
.nav__links a:hover::after,.nav__links a:focus-visible::after{
  transform:scaleX(1); transform-origin:left;
}

/* ---------- shared type ---------- */
.display{
  font-family:var(--display);
  font-weight:400;
  letter-spacing:-.015em;
  line-height:1.02;
  margin:0;
}

.eyebrow{
  font-size:clamp(.68rem,.64rem + .2vw,.78rem);
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--rose);
  margin:0 0 clamp(1.25rem,3vw,2rem);
  font-weight:400;
}

.h2{
  font-size:clamp(2.1rem,1.4rem + 3.4vw,4.25rem);
  margin-bottom:clamp(1.75rem,4vw,3rem);
}

.prose p{ margin:0 0 1.5em; color:var(--ivory-70); max-width:60ch; }
.prose p:last-child{ margin-bottom:0; }
.prose--center p{ margin-inline:auto; }

.rule{
  width:clamp(3rem,7vw,5.5rem); height:1px;
  background:linear-gradient(90deg,var(--rose),transparent);
  margin:clamp(1.75rem,4vw,2.5rem) 0;
}
.rule--center{
  margin-inline:auto;
  background:linear-gradient(90deg,transparent,var(--rose),transparent);
}

.center{ text-align:center; }

/* ---------- layout ---------- */
.wrap{
  width:min(1180px,100% - clamp(2.5rem,10vw,8rem));
  margin-inline:auto;
}
.wrap--narrow{ width:min(720px,100% - clamp(2.5rem,10vw,8rem)); }

.section{
  position:relative;
  padding-block:var(--bay);
}
.section--alt{ background:var(--ink-2); }
.section--close{
  padding-block:clamp(7rem,20vh,14rem);
  overflow:hidden;
}

/* ---------- hero ---------- */
.hero{
  position:relative;
  min-height:100svh;
  display:grid;
  place-items:center;
  padding:6rem clamp(1.5rem,6vw,4rem) 7rem;
  overflow:hidden;
  isolation:isolate;
}

/* slow warm bloom — one element, transform-only animation */
.hero__light{
  position:absolute; z-index:-1;
  top:50%; left:50%;
  width:min(150vw,1500px); aspect-ratio:1;
  translate:-50% -50%;
  background:
    radial-gradient(circle at 50% 50%,
      rgba(201,143,130,.16) 0%,
      rgba(217,188,147,.07) 28%,
      transparent 62%);
  animation:drift 26s var(--ease) infinite alternate;
  will-change:transform;
}
.hero__light--low{
  top:120%; opacity:.75;
  animation-duration:34s;
}

@keyframes drift{
  from{ transform:translate3d(-4%,-2%,0) scale(1); }
  to  { transform:translate3d(4%,3%,0) scale(1.14); }
}

.hero__inner{
  text-align:center;
  max-width:56rem;
}

.hero__title{
  font-size:clamp(4rem,2rem + 16vw,13rem);
  margin:0;
}

.hero__inner .rule{ margin-inline:auto;
  background:linear-gradient(90deg,transparent,var(--rose),transparent); }

.hero__sub{
  margin:0;
  color:var(--ivory-52);
  font-size:clamp(1rem,.95rem + .4vw,1.2rem);
  letter-spacing:.02em;
  max-width:34ch;
  margin-inline:auto;
}

/* scroll cue */
.scroll-cue{
  position:absolute; bottom:clamp(2rem,5vh,3.5rem); left:50%;
  translate:-50% 0;
  display:flex; flex-direction:column; align-items:center; gap:.85rem;
  text-decoration:none;
  color:var(--ivory-38);
  font-size:.7rem; letter-spacing:.22em; text-transform:uppercase;
  transition:color .4s var(--ease);
}
.scroll-cue:hover,.scroll-cue:focus-visible{ color:var(--ivory-70); }
.scroll-cue__line{
  width:1px; height:clamp(2.5rem,6vh,4rem);
  background:linear-gradient(to bottom,transparent,var(--rose));
  transform-origin:top;
  animation:cue 2.8s var(--ease) infinite;
}
@keyframes cue{
  0%,100%{ transform:scaleY(.35); opacity:.4; }
  50%    { transform:scaleY(1);   opacity:1; }
}

/* ---------- timeline ---------- */
.timeline{
  list-style:none; margin:0; padding:0;
  display:grid; gap:clamp(2.5rem,6vw,4.5rem);
  border-left:1px solid var(--rule);
  padding-left:clamp(1.5rem,4vw,3.5rem);
  max-width:60rem;
}
.timeline__item{ position:relative; }
.timeline__item::before{
  content:""; position:absolute;
  left:calc(-1 * clamp(1.5rem,4vw,3.5rem) - 3px);
  top:.7em;
  width:5px; height:5px; border-radius:50%;
  background:var(--rose);
}
.timeline__date{
  margin:0 0 .5rem;
  font-size:.74rem; letter-spacing:.2em; text-transform:uppercase;
  color:var(--ivory-38);
}
.timeline__title{
  font-family:var(--display); font-weight:400;
  font-size:clamp(1.4rem,1.1rem + 1.2vw,2.1rem);
  line-height:1.2; margin:0 0 .75rem;
  letter-spacing:-.01em;
}
.timeline__body{ margin:0; color:var(--ivory-70); max-width:52ch; }

/* ---------- letter ---------- */
.letter{
  margin:0;
  padding:clamp(2rem,5vw,3.75rem);
  background:
    linear-gradient(180deg,rgba(242,235,225,.045),rgba(242,235,225,.012));
  border:1px solid var(--rule);
  border-radius:2px;
}
.letter__body{ margin:0; }
.letter__body p{
  font-family:var(--display);
  font-size:clamp(1.15rem,1rem + .9vw,1.65rem);
  line-height:1.62;
  color:var(--ivory);
  margin:0 0 1.1em;
  letter-spacing:-.005em;
}
.letter__body p:last-child{ margin-bottom:0; }
.letter__sign{
  display:flex; align-items:center; gap:1rem;
  margin-top:clamp(2rem,4vw,2.75rem);
  font-size:.76rem; letter-spacing:.24em; text-transform:uppercase;
  color:var(--rose);
}
.letter__rule{ flex:0 0 clamp(2rem,5vw,3.5rem); height:1px; background:var(--rose); }

/* ---------- footer ---------- */
.footer{
  padding:clamp(2.5rem,6vw,4rem) clamp(1.5rem,6vw,4rem);
  text-align:center;
  border-top:1px solid var(--rule);
}
.footer p{
  margin:0;
  font-size:.72rem; letter-spacing:.24em; text-transform:uppercase;
  color:var(--ivory-38);
}

/* ---------- film grain ---------- */
.grain{
  position:fixed; inset:-50%;
  z-index:150; pointer-events:none;
  opacity:.032;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation:grain 7s steps(6) infinite;
  will-change:transform;
}
@keyframes grain{
  0%  { transform:translate3d(0,0,0); }
  20% { transform:translate3d(-2%,3%,0); }
  40% { transform:translate3d(3%,-2%,0); }
  60% { transform:translate3d(-3%,-1%,0); }
  80% { transform:translate3d(2%,2%,0); }
  100%{ transform:translate3d(0,0,0); }
}

/* ---------- reveal ----------
   Hidden ONLY when JS is confirmed alive (html.js, set by boot.js).
   No JS -> no .js class -> content renders normally. Never blank. */
.js .reveal{
  opacity:0;
  transform:translate3d(0,18px,0);
  transition:opacity 1s var(--ease), transform 1s var(--ease);
  will-change:opacity,transform;
}
.js .reveal.is-in{ opacity:1; transform:none; }
.reveal--slow{ transition-duration:1.5s; }

/* stagger children within a revealed group */
.reveal:nth-child(2){ transition-delay:.08s; }
.reveal:nth-child(3){ transition-delay:.16s; }
.reveal:nth-child(4){ transition-delay:.24s; }

/* ============================================================
   REDUCED MOTION — kill everything non-essential
   ============================================================ */
@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
  .reveal{ opacity:1; transform:none; }
  .grain{ display:none; }
  .hero__light{ animation:none; }
}

/* small screens: tighten the hero so it never overflows */
@media (max-width:480px){
  .hero{ min-height:92svh; }
  .nav__links{ gap:.85rem; }
}

.error-title{font-size:clamp(3rem,1.5rem + 9vw,7rem)}
.error-return{margin-top:2.5rem}
.error-link{color:var(--rose);text-decoration:none;font-size:.76rem;letter-spacing:.24em;text-transform:uppercase;border-bottom:1px solid var(--rose);padding-bottom:.3rem}

.world-invitation{margin-top:clamp(4rem,10vw,7rem)}
.world-button{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:1rem;max-width:100%;padding:1.2rem 1.5rem;border:1px solid rgba(201,143,130,.3);border-radius:100px;background:linear-gradient(120deg,rgba(201,143,130,.07),rgba(217,188,147,.02));color:var(--ivory);font:inherit;font-size:clamp(.8rem,2.8vw,.95rem);letter-spacing:.04em;cursor:pointer;transition:border-color .4s,background .4s,transform .4s}
.world-button:hover{border-color:rgba(201,143,130,.65);background:rgba(201,143,130,.09);transform:translateY(-2px)}
.world-ring{flex:none;width:26px;height:26px;border-radius:50%;border:1px solid var(--champagne);box-shadow:inset 0 0 7px rgba(201,143,130,.25),0 0 12px rgba(201,143,130,.23);animation:ring-breathe 3.8s ease-in-out infinite}
@keyframes ring-breathe{0%,100%{transform:scale(.94);opacity:.65;box-shadow:inset 0 0 5px rgba(201,143,130,.15),0 0 8px rgba(201,143,130,.16)}50%{transform:scale(1.06);opacity:1;box-shadow:inset 0 0 10px rgba(201,143,130,.3),0 0 22px rgba(201,143,130,.35),0 0 40px rgba(201,143,130,.07)}}
.world-arrow{color:var(--rose);font-size:1.2rem}
.world-dialog{box-sizing:border-box;width:min(540px,calc(100% - 2rem));max-height:85svh;padding:clamp(2rem,6vw,3.5rem);border:1px solid var(--rule);border-radius:20px;background:var(--ink-2);color:var(--ivory);box-shadow:0 20px 100px #0008}
.world-dialog::backdrop{background:rgba(11,10,9,.82);backdrop-filter:blur(10px)}
.world-dialog p{color:var(--ivory-70)}
.world-dialog .eyebrow{color:var(--rose)}
.world-dialog .world-status{font-size:.85rem;color:var(--ivory-52);margin-top:2rem}
.world-close{position:absolute;right:12px;top:12px;width:44px;height:44px;background:transparent;border:0;color:var(--ivory-70);font-size:1.6rem;cursor:pointer}
@media(prefers-reduced-motion:reduce){.world-ring{animation:none}.world-button{transition:none}}

.world-button{text-decoration:none}

.world-progress{appearance:none;display:block;width:100%;height:4px;border:0;border-radius:10px;overflow:hidden;background:rgba(201,143,130,.1);box-shadow:0 0 22px rgba(201,143,130,.13)}
.world-progress::-webkit-progress-bar{background:rgba(201,143,130,.1);border-radius:10px}
.world-progress::-webkit-progress-value{background:linear-gradient(90deg,#8c5e58,var(--rose),var(--champagne));border-radius:10px;box-shadow:0 0 12px rgba(201,143,130,.5)}
.world-progress::-moz-progress-bar{background:linear-gradient(90deg,#8c5e58,var(--rose),var(--champagne));border-radius:10px}
.world-direct{display:inline-block;margin-top:1.4rem;color:var(--rose);font-size:.8rem;text-decoration:none;border-bottom:1px solid rgba(201,143,130,.2)}
