/* haru.club - Surreal Literary Dreamscape */
/* Colors: #e8e0d0 #4a4e7f #7a2830 #c4913a #2a8a7a #1a1040 #9a92b8 #0b0e1a */

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

html{scroll-behavior:smooth;overflow-x:hidden}
body{
  font-family:'IBM Plex Mono',monospace;
  background:#0b0e1a;
  color:#e8e0d0;
  overflow-x:hidden;
}

/* Particle canvas overlay */
#particle-canvas{
  position:fixed;
  top:0;left:0;
  width:100vw;height:100vh;
  pointer-events:none;
  z-index:100;
}

/* Scroll progress */
#scroll-progress{
  position:fixed;
  top:0;left:0;
  width:0;height:2px;
  background:linear-gradient(90deg,#c4913a,#2a8a7a,#9a92b8);
  z-index:200;
  transition:width 0.1s linear;
}

/* Chapter navigation */
#chapter-nav{
  position:fixed;
  right:24px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:16px;
  z-index:150;
}
.nav-dot{
  width:10px;height:10px;
  border-radius:50%;
  border:1px solid #9a92b8;
  background:transparent;
  cursor:pointer;
  transition:all 0.4s ease;
  padding:0;
}
.nav-dot.active{
  background:#c4913a;
  border-color:#c4913a;
  box-shadow:0 0 12px rgba(196,145,58,0.4);
}
.nav-dot:hover{
  border-color:#e8e0d0;
  transform:scale(1.3);
}

/* Chapter base */
.chapter{
  position:relative;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.parallax-bg{
  position:absolute;
  top:0;left:0;
  width:100%;height:120%;
  z-index:0;
  will-change:transform;
}
.chapter-content{
  position:relative;
  z-index:10;
  width:100%;
  max-width:1100px;
  padding:60px 40px;
  text-align:center;
}
.chapter-heading{
  font-family:'Cormorant Garamond',serif;
  font-weight:300;
  font-size:clamp(32px,5vw,72px);
  letter-spacing:0.08em;
  color:#c4913a;
  margin-bottom:40px;
  opacity:0;
  transform:translateY(30px);
  transition:opacity 1s ease,transform 1s ease;
}
.chapter-heading.visible{
  opacity:1;
  transform:translateY(0);
}

/* Chapter I: Threshold */
.chapter-threshold{
  background:radial-gradient(ellipse at 50% 60%,#1a1040 0%,#0b0e1a 70%);
}
.threshold-bg{
  background:radial-gradient(circle at 30% 40%,rgba(74,78,127,0.15) 0%,transparent 50%),
             radial-gradient(circle at 70% 60%,rgba(122,40,48,0.1) 0%,transparent 40%);
}
.kinetic-title{
  font-family:'Cormorant Garamond',serif;
  font-weight:700;
  font-size:clamp(42px,7vw,140px);
  letter-spacing:0.08em;
  color:#e8e0d0;
  margin-bottom:24px;
}
.glyph{
  display:inline-block;
  opacity:0;
  transform:translateY(20px) rotate(-5deg);
  animation:glyphReveal 0.8s ease forwards;
}
.glyph.dot{color:#c4913a}

@keyframes glyphReveal{
  0%{opacity:0;transform:translateY(20px) rotate(-5deg)}
  60%{opacity:1;transform:translateY(-3px) rotate(1deg)}
  100%{opacity:1;transform:translateY(0) rotate(0)}
}

.glyph[data-delay="0"]{animation-delay:0.2s}
.glyph[data-delay="1"]{animation-delay:0.25s}
.glyph[data-delay="2"]{animation-delay:0.3s}
.glyph[data-delay="3"]{animation-delay:0.35s}
.glyph[data-delay="4"]{animation-delay:0.4s}
.glyph[data-delay="5"]{animation-delay:0.5s}
.glyph[data-delay="6"]{animation-delay:0.55s}
.glyph[data-delay="7"]{animation-delay:0.6s}
.glyph[data-delay="8"]{animation-delay:0.65s}

.threshold-subtitle{
  font-family:'IBM Plex Mono',monospace;
  font-weight:300;
  font-size:clamp(12px,1.5vw,18px);
  color:#9a92b8;
  letter-spacing:0.2em;
  text-transform:lowercase;
  opacity:0;
  animation:fadeIn 1.5s ease 1.2s forwards;
}

.scroll-hint{
  position:absolute;
  bottom:40px;
  left:50%;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  opacity:0;
  animation:fadeIn 1s ease 2s forwards,float 3s ease-in-out 2s infinite;
}
.scroll-hint-text{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  letter-spacing:0.3em;
  color:#9a92b8;
  text-transform:uppercase;
}
.scroll-arrow{color:#9a92b8}

@keyframes fadeIn{
  to{opacity:1}
}
@keyframes float{
  0%,100%{transform:translateX(-50%) translateY(0)}
  50%{transform:translateX(-50%) translateY(8px)}
}

.falling-footnotes{
  position:absolute;
  top:0;left:0;
  width:100%;height:100%;
  pointer-events:none;
  overflow:hidden;
  z-index:5;
}
.footnote-particle{
  position:absolute;
  font-family:'IBM Plex Mono',monospace;
  font-size:10px;
  color:rgba(154,146,184,0.3);
  white-space:nowrap;
  animation:fallDown linear infinite;
}
@keyframes fallDown{
  0%{transform:translateY(-20px);opacity:0}
  10%{opacity:1}
  90%{opacity:1}
  100%{transform:translateY(100vh);opacity:0}
}

/* Chapter II: The Index */
.chapter-index{
  background:linear-gradient(180deg,#0b0e1a 0%,#1a1040 50%,#0b0e1a 100%);
}
.index-bg{
  background:radial-gradient(circle at 50% 50%,rgba(42,138,122,0.08) 0%,transparent 60%);
}
.chapter-epigraph{
  font-family:'Cormorant Garamond',serif;
  font-style:italic;
  font-weight:300;
  font-size:clamp(16px,2vw,24px);
  color:#9a92b8;
  margin-bottom:50px;
  opacity:0;
  transition:opacity 1s ease 0.3s;
}
.chapter-epigraph.visible{opacity:0.8}

.radial-charts-container{
  display:flex;
  justify-content:center;
  gap:40px;
  margin-bottom:60px;
  flex-wrap:wrap;
}
.radial-chart{
  opacity:0.7;
  animation:slowRotate 40s linear infinite;
}
.radial-chart:nth-child(2){animation-direction:reverse;animation-duration:35s}
.radial-chart:nth-child(3){animation-duration:45s}

@keyframes slowRotate{
  to{transform:rotate(360deg)}
}

.index-entries{
  max-width:700px;
  margin:0 auto;
}
.index-entry{
  display:flex;
  align-items:baseline;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid rgba(154,146,184,0.1);
  opacity:0;
  transform:translateX(-30px);
  transition:opacity 0.6s ease,transform 0.6s ease;
}
.index-entry[data-reveal="right"]{transform:translateX(30px)}
.index-entry.visible{
  opacity:1;
  transform:translateX(0);
}
.entry-number{
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  color:#2a8a7a;
  flex-shrink:0;
}
.entry-title{
  font-family:'Cormorant Garamond',serif;
  font-weight:400;
  font-size:clamp(14px,1.8vw,20px);
  color:#e8e0d0;
}
.entry-dots{
  flex:1;
  border-bottom:1px dotted rgba(154,146,184,0.3);
  min-width:20px;
  margin-bottom:4px;
}
.entry-page{
  font-family:'IBM Plex Mono',monospace;
  font-size:14px;
  color:#c4913a;
  flex-shrink:0;
}

/* Chapter III: Reading Room */
.chapter-reading{
  background:linear-gradient(180deg,#0b0e1a 0%,rgba(26,16,64,0.8) 50%,#0b0e1a 100%);
}
.reading-bg{
  background:radial-gradient(circle at 40% 40%,rgba(196,145,58,0.06) 0%,transparent 50%),
             radial-gradient(circle at 60% 70%,rgba(74,78,127,0.08) 0%,transparent 40%);
}
.network-graph-container{
  margin:0 auto 50px;
  max-width:800px;
}
#network-graph{
  width:100%;
  height:auto;
  max-height:50vh;
}
.reading-texts{
  display:flex;
  flex-direction:column;
  gap:40px;
  max-width:650px;
  margin:0 auto;
}
.ghost-text{
  font-family:'Cormorant Garamond',serif;
  font-style:italic;
  font-weight:300;
  font-size:clamp(15px,1.8vw,22px);
  line-height:1.7;
  color:rgba(232,224,208,0.6);
  border:none;
  padding:0;
  margin:0;
  opacity:0;
  transform:translateY(20px);
  transition:opacity 1.2s ease,transform 1.2s ease,color 0.5s ease;
}
.ghost-text.visible{
  opacity:1;
  transform:translateY(0);
}
.ghost-text:hover{
  color:rgba(232,224,208,0.9);
}

/* Chapter IV: Marginalia */
.chapter-marginalia{
  background:linear-gradient(180deg,#0b0e1a 0%,#1a1040 30%,rgba(122,40,48,0.15) 60%,#0b0e1a 100%);
  min-height:120vh;
}
.marginalia-bg{
  background:radial-gradient(circle at 20% 30%,rgba(122,40,48,0.1) 0%,transparent 40%),
             radial-gradient(circle at 80% 70%,rgba(42,138,122,0.06) 0%,transparent 40%);
}
.marginalia-field{
  position:relative;
  width:100%;
  min-height:400px;
  margin-bottom:40px;
}
.marginal-note{
  position:absolute;
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  color:rgba(154,146,184,0.5);
  max-width:200px;
  line-height:1.5;
  opacity:0;
  transition:opacity 1.5s ease,transform 1.5s ease;
  cursor:default;
}
.marginal-note.visible{
  opacity:1;
}
.marginal-note:hover{
  color:#c4913a;
  transition:color 0.3s ease;
}
.vine-annotations{
  position:absolute;
  top:0;left:0;
  width:100%;height:100%;
  pointer-events:none;
  z-index:2;
}
#vine-svg{
  width:100%;
  height:100%;
}
.vine-path{
  fill:none;
  stroke:#2a8a7a;
  stroke-width:1;
  opacity:0.15;
  stroke-dasharray:2000;
  stroke-dashoffset:2000;
  transition:stroke-dashoffset 3s ease;
}
.vine-path.animate{
  stroke-dashoffset:0;
}
.vine-path-2{
  stroke:#7a2830;
  opacity:0.1;
}

.data-stream{
  display:flex;
  justify-content:space-around;
  gap:20px;
  margin-top:40px;
  min-height:200px;
}
.stream-column{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:2px;
  font-family:'IBM Plex Mono',monospace;
  font-size:10px;
  color:rgba(42,138,122,0.4);
  overflow:hidden;
  max-height:200px;
}
.stream-char{
  opacity:0;
  animation:streamFade 2s ease forwards;
}
@keyframes streamFade{
  0%{opacity:0}
  50%{opacity:1;color:rgba(196,145,58,0.6)}
  100%{opacity:0.3;color:rgba(42,138,122,0.4)}
}

/* Chapter V: Colophon */
.chapter-colophon{
  background:radial-gradient(ellipse at 50% 50%,#1a1040 0%,#0b0e1a 80%);
}
.colophon-bg{
  background:radial-gradient(circle at 50% 50%,rgba(196,145,58,0.05) 0%,transparent 50%);
}
.colophon-text{
  margin-bottom:50px;
}
.colophon-line{
  font-family:'Cormorant Garamond',serif;
  font-weight:300;
  font-size:clamp(14px,1.8vw,22px);
  line-height:2;
  color:#9a92b8;
  opacity:0;
  transform:translateY(15px);
  transition:opacity 0.8s ease,transform 0.8s ease;
}
.colophon-line.visible{
  opacity:0.8;
  transform:translateY(0);
}
.colophon-sigil{
  margin:40px auto;
  animation:slowRotate 60s linear infinite;
}
.sigil-svg{
  opacity:0;
  transition:opacity 2s ease;
}
.sigil-svg.visible{opacity:1}

.colophon-domain{
  font-family:'Cormorant Garamond',serif;
  font-weight:700;
  font-size:clamp(24px,4vw,48px);
  letter-spacing:0.08em;
  color:#c4913a;
  margin-top:30px;
  opacity:0;
  transition:opacity 1.5s ease;
}
.colophon-domain.visible{opacity:1}

.colophon-year{
  font-family:'IBM Plex Mono',monospace;
  font-weight:300;
  font-size:12px;
  letter-spacing:0.4em;
  color:rgba(154,146,184,0.4);
  margin-top:12px;
  opacity:0;
  transition:opacity 1.5s ease 0.5s;
}
.colophon-year.visible{opacity:1}

/* Responsive */
@media(max-width:768px){
  .chapter-content{padding:40px 20px}
  #chapter-nav{right:12px;gap:12px}
  .nav-dot{width:8px;height:8px}
  .radial-charts-container{gap:20px}
  .radial-chart{width:180px;height:180px}
  .index-entry{gap:8px}
  .reading-texts{gap:30px}
  .data-stream{flex-direction:column;gap:10px}
}

@media(max-width:480px){
  .kinetic-title{letter-spacing:0.04em}
  .radial-charts-container{flex-direction:column;align-items:center}
}
