/* hibiki.day — styles.css */
/* Aurora-gradient, japanese-minimal, timeline-vertical */

/* Color: #fff8e7 — candle tip used in flame SVG gradients (also referenced in DESIGN.md) */

:root {
  --candle-tip: #fff8e7;
}

/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ─── Aurora Background Animation ─────────────────────────────── */
@keyframes aurora-drift {
  from { background: linear-gradient(125deg, #04050d 0%, #0d1a2e 40%, #1a0d2e 70%, #04050d 100%); }
  to   { background: linear-gradient(145deg, #04050d 0%, #0d1a2e 35%, #1a0d2e 65%, #04050d 100%); }
}

body {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: #f2f4f7;
  background: linear-gradient(135deg, #04050d 0%, #0d1a2e 40%, #1a0d2e 70%, #04050d 100%);
  animation: aurora-drift 12s ease-in-out infinite alternate;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Grain Overlay ────────────────────────────────────────────── */
#grain-filter {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

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

/* ─── Header ───────────────────────────────────────────────────── */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: linear-gradient(to bottom, rgba(4,5,13,0.85) 0%, rgba(4,5,13,0) 100%);
}

.header-flame {
  display: flex;
  align-items: center;
}

.flame-svg {
  filter: drop-shadow(0 0 8px rgba(248,200,74,0.4));
}

@keyframes flame-pulse {
  from { opacity: 0.7; }
  to   { opacity: 1.0; }
}

#flame-left {
  animation: flame-pulse 2.4s ease-in-out infinite alternate;
}

.header-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.header-kanji {
  font-family: 'Noto Serif JP', serif;
  font-weight: 300;
  font-size: 1.4rem;
  color: #f2f4f7;
  letter-spacing: 0.04em;
}

.header-hibiki {
  font-family: 'Jost', sans-serif;
  font-style: italic;
  font-weight: 200;
  font-size: 1.1rem;
  color: rgba(242,244,247,0.7);
  letter-spacing: 0.06em;
}

.header-date {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f8c84a;
}

/* ─── Hero ─────────────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#hero-svg {
  width: clamp(280px, 60vw, 560px);
  height: clamp(280px, 60vw, 560px);
  display: block;
}

#hero-kanji-text {
  transform-origin: 200px 200px;
}

.hero-subtitle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}

.hero-domain {
  font-family: 'Jost', sans-serif;
  font-weight: 100;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  letter-spacing: 0.18em;
  color: rgba(242,244,247,0.5);
  text-transform: lowercase;
}

.hero-tagline {
  font-family: 'Jost', sans-serif;
  font-weight: 100;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(242,244,247,0.3);
  text-transform: lowercase;
}

/* ─── Timeline Container ───────────────────────────────────────── */
#timeline-container {
  position: relative;
  width: 100%;
  padding-bottom: 120px;
}

/* ─── Spine ────────────────────────────────────────────────────── */
.timeline-spine {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spine-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.15);
  z-index: 1;
}

.spine-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(to bottom, #3dffc0, #9b5de5, #4361ee);
  transition: height 0.1s linear;
}

/* Origin flame node at top of spine */
.spine-origin {
  position: relative;
  z-index: 5;
  margin-top: 40px;
  margin-bottom: 0;
  display: flex;
  justify-content: center;
}

.origin-flame {
  filter: drop-shadow(0 0 12px rgba(248,200,74,0.5));
  animation: flame-pulse 2.4s ease-in-out infinite alternate;
}

/* ─── Timeline Entry ───────────────────────────────────────────── */
.timeline-entry {
  position: relative;
  width: 100%;
  min-height: 80vh;
  display: flex;
  align-items: flex-start;
  padding-top: 10vh;
  z-index: 2;

  /* Zoom-focus entrance */
  opacity: 0;
  transform: scale(0.92);
  transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-entry.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Right entry: card on right side */
.timeline-entry[data-side="right"] {
  justify-content: flex-end;
}

.timeline-entry[data-side="right"] .entry-card {
  margin-right: calc(50% + 40px);
  margin-left: auto;
}

/* Left entry: card on left side */
.timeline-entry[data-side="left"] {
  justify-content: flex-start;
}

.timeline-entry[data-side="left"] .entry-card {
  margin-left: calc(50% + 40px);
  margin-right: auto;
}

/* ─── Entry Node ───────────────────────────────────────────────── */
.entry-node {
  position: absolute;
  left: 50%;
  top: 10vh;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.node-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3dffc0;
  box-shadow: 0 0 12px rgba(61,255,192,0.6);
  position: relative;
  z-index: 2;
}

/* Concentric ripple rings */
.node-ripples {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes ripple-expand {
  0%   { width: 8px; height: 8px; opacity: 0; }
  20%  { opacity: 0.04; }
  100% { width: 120px; height: 120px; opacity: 0; }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(61,255,192,0.04);
  animation: ripple-expand 3s ease-out infinite;
}

.ripple.r1 { animation-delay: 0s; }
.ripple.r2 { animation-delay: 0.33s; }
.ripple.r3 { animation-delay: 0.66s; }
.ripple.r4 { animation-delay: 0.99s; }
.ripple.r5 { animation-delay: 1.32s; }
.ripple.r6 { animation-delay: 1.65s; }
.ripple.r7 { animation-delay: 1.98s; }
.ripple.r8 { animation-delay: 2.31s; }
.ripple.r9 { animation-delay: 2.64s; }

/* Only show ripples when entry is visible */
.timeline-entry:not(.is-visible) .ripple {
  animation-play-state: paused;
}

/* ─── Entry Card ───────────────────────────────────────────────── */
.entry-card {
  position: relative;
  max-width: 480px;
  width: calc(50% - 60px);
  background: #0d1a2e;
  padding: 28px 32px 32px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 0 40px rgba(61,255,192,0.04);
  overflow: hidden;
}

.entry-date {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f8c84a;
  margin-bottom: 12px;
}

/* ─── Data-viz elements ────────────────────────────────────────── */
.entry-dataviz {
  margin-bottom: 20px;
}

.waveform-svg {
  display: block;
  width: 100%;
  height: auto;
}

.waveform-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1200ms ease-out;
}

.timeline-entry.is-visible .waveform-path {
  stroke-dashoffset: 0;
}

/* Frequency scatter hover shimmer */
.scatter-svg circle {
  transition: opacity 0.3s ease;
}

@keyframes shimmer-opacity {
  0%, 100% { opacity: var(--base-op, 0.7); }
  50%       { opacity: 0.2; }
}

.timeline-entry.is-visible .scatter-svg circle {
  animation: shimmer-opacity 2s ease-in-out infinite;
}

.timeline-entry.is-visible .scatter-svg circle:nth-child(2)  { animation-delay: 0.15s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(3)  { animation-delay: 0.3s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(4)  { animation-delay: 0.45s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(5)  { animation-delay: 0.6s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(6)  { animation-delay: 0.75s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(7)  { animation-delay: 0.9s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(8)  { animation-delay: 1.05s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(9)  { animation-delay: 1.2s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(10) { animation-delay: 1.35s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(11) { animation-delay: 1.5s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(12) { animation-delay: 1.65s; }
.timeline-entry.is-visible .scatter-svg circle:nth-child(13) { animation-delay: 1.8s; }

/* Spectrogram bars */
.spectrogram-bars {
  display: flex;
  align-items: flex-end;
  height: 80px;
  gap: 2px;
  width: 100%;
}

.spec-bar {
  flex: 1;
  height: var(--h, 50%);
  background: var(--c, #3dffc0);
  opacity: 0.7;
  transition: height 0.125s ease-in-out;
}

@keyframes spec-animate {
  0%, 100% { height: var(--h, 50%); }
  50%       { height: calc(var(--h, 50%) * 0.4 + 10%); }
}

.timeline-entry.is-visible .spec-bar {
  animation: spec-animate 0.5s ease-in-out infinite;
}

.timeline-entry.is-visible .spec-bar:nth-child(2)  { animation-delay: 0.06s; }
.timeline-entry.is-visible .spec-bar:nth-child(3)  { animation-delay: 0.12s; }
.timeline-entry.is-visible .spec-bar:nth-child(4)  { animation-delay: 0.18s; }
.timeline-entry.is-visible .spec-bar:nth-child(5)  { animation-delay: 0.24s; }
.timeline-entry.is-visible .spec-bar:nth-child(6)  { animation-delay: 0.30s; }
.timeline-entry.is-visible .spec-bar:nth-child(7)  { animation-delay: 0.36s; }
.timeline-entry.is-visible .spec-bar:nth-child(8)  { animation-delay: 0.42s; }
.timeline-entry.is-visible .spec-bar:nth-child(9)  { animation-delay: 0.48s; }
.timeline-entry.is-visible .spec-bar:nth-child(10) { animation-delay: 0.54s; }
.timeline-entry.is-visible .spec-bar:nth-child(11) { animation-delay: 0.60s; }
.timeline-entry.is-visible .spec-bar:nth-child(12) { animation-delay: 0.66s; }
.timeline-entry.is-visible .spec-bar:nth-child(13) { animation-delay: 0.72s; }
.timeline-entry.is-visible .spec-bar:nth-child(14) { animation-delay: 0.78s; }
.timeline-entry.is-visible .spec-bar:nth-child(15) { animation-delay: 0.84s; }
.timeline-entry.is-visible .spec-bar:nth-child(16) { animation-delay: 0.90s; }
.timeline-entry.is-visible .spec-bar:nth-child(17) { animation-delay: 0.96s; }
.timeline-entry.is-visible .spec-bar:nth-child(18) { animation-delay: 1.02s; }
.timeline-entry.is-visible .spec-bar:nth-child(19) { animation-delay: 1.08s; }
.timeline-entry.is-visible .spec-bar:nth-child(20) { animation-delay: 1.14s; }

/* ─── Entry Text ───────────────────────────────────────────────── */
.entry-title {
  font-family: 'Jost', sans-serif;
  font-weight: 100;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  letter-spacing: 0.04em;
  color: #f2f4f7;
  margin-bottom: 12px;
  line-height: 1.3;
}

.entry-body {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(242,244,247,0.75);
}

/* Haiku-style watermark text behind entry */
.entry-haiku-bg {
  position: absolute;
  bottom: -16px;
  right: -8px;
  font-family: 'Noto Serif JP', serif;
  font-weight: 300;
  font-size: 8rem;
  color: #9b5de5;
  opacity: 0.04;
  writing-mode: vertical-rl;
  transform: rotate(90deg);
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

/* ─── Footer ───────────────────────────────────────────────────── */
#site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 60px 40px 40px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-kanji {
  font-family: 'Noto Serif JP', serif;
  font-weight: 300;
  font-size: 1.2rem;
  color: rgba(242,244,247,0.3);
}

.footer-name {
  font-family: 'Jost', sans-serif;
  font-style: italic;
  font-weight: 200;
  font-size: 0.95rem;
  color: rgba(242,244,247,0.4);
  letter-spacing: 0.06em;
}

.footer-meta {
  font-family: 'Jost', sans-serif;
  font-weight: 100;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(242,244,247,0.2);
  text-transform: lowercase;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .entry-card {
    width: calc(50% - 32px);
    padding: 20px 22px 24px;
  }

  .timeline-entry[data-side="right"] .entry-card {
    margin-right: calc(50% + 24px);
  }

  .timeline-entry[data-side="left"] .entry-card {
    margin-left: calc(50% + 24px);
  }
}

@media (max-width: 600px) {
  #site-header {
    padding: 16px 20px;
  }

  .timeline-entry {
    justify-content: center !important;
    min-height: 60vh;
    padding-top: 80px;
  }

  .timeline-entry[data-side="right"] .entry-card,
  .timeline-entry[data-side="left"] .entry-card {
    margin-left: 20px;
    margin-right: 20px;
    width: 100%;
    max-width: 100%;
  }

  .entry-node {
    top: 32px;
  }

  .entry-haiku-bg {
    font-size: 5rem;
  }
}
