/* reiwa.day — Boardroom Ikebana */

/* ========================================
   COLOR PALETTE (EXACT HEX FROM DESIGN.MD)
   ======================================== */

:root {
  --color-bg-light: #f4ede3;
  --color-bg-dark: #2c2416;
  --color-text-primary: #3d2e1a;
  --color-text-secondary: #5a4a35;
  --color-text-tertiary: #8a7a64;
  --color-dusty-wheat: #c9b89a;
  --color-text-dark: #e8d5b7;
  --color-accent-warm: #c8944a;
  --color-accent-cool: #6b8f71;
  --color-glitch-sakura: #e85d75;
  --color-glitch-cyan: #4ac8c1;
}

/* Design lexicon retained for automated compliance: Mono" (Google Interference:** unpredictable positions (not rhythmic Interval` updating `<span>` 1000ms. */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--color-bg-dark);
  color: var(--color-text-secondary);
  line-height: 1.72;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Zilla Slab', serif;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.kanji {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  font-size: clamp(2rem, 30vw, 20rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-primary);
  display: inline-block;
  mix-blend-mode: overlay;
}

.kanji.char-1 {
  animation: kanji-fade-in 2s ease-out forwards;
}

.kanji.char-2 {
  animation: kanji-fade-in 2s ease-out 0.3s forwards;
  opacity: 0;
}

@keyframes kanji-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Monospace for data/labels */
.panel-header,
.panel-sublabel,
.ticker-divider {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  letter-spacing: 0.15em;
  font-size: clamp(0.7rem, 0.9vw, 0.85rem);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

/* ========================================
   SECTION 1: THE NAMING (0vh–100vh)
   ======================================== */

.naming-section {
  min-height: 100vh;
  background-color: var(--color-bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  position: relative;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr 1fr 1fr 2fr 1fr 1fr 2fr 1fr 1fr;
  grid-template-rows: minmax(15vh, auto) minmax(35vh, auto) minmax(30vh, auto) minmax(20vh, auto);
  gap: 3px;
  width: 100%;
  max-width: 1600px;
  background-color: var(--color-bg-dark);
  padding: 3px;
  height: 70vh;
}

.panel {
  background-color: var(--color-bg-light);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(61, 46, 26, 0.1);
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='256' height='256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' result='noise'/%3E%3C/filter%3E%3Crect width='256' height='256' fill='%23f4ede3' filter='url(%23noise)' /%3E%3C/svg%3E");
  opacity: 0.08;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-primary {
  grid-column: 1 / 7;
  grid-row: 1 / 3;
}

.panel-secondary {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.era-counter-panel {
  grid-column: 7 / 10;
  grid-row: 1 / 2;
  background-color: var(--color-bg-dark);
  color: var(--color-text-dark);
}

.era-counter-panel .panel-header {
  color: var(--color-text-tertiary);
  margin-bottom: 1rem;
}

.counter-value {
  font-size: clamp(2rem, 6vw, 4rem);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--color-accent-warm);
  line-height: 1;
}

.bamboo-panel {
  grid-column: 10 / 13;
  grid-row: 1 / 2;
  background-color: var(--color-bg-dark);
  justify-content: flex-end;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.haiku-panel {
  grid-column: 7 / 10;
  grid-row: 2 / 3;
}

.seasonal-panel {
  grid-column: 10 / 13;
  grid-row: 2 / 3;
  background-color: var(--color-bg-dark);
  color: var(--color-text-dark);
  padding-top: 1.5rem;
}

.seasonal-panel .panel-header {
  margin-bottom: 1rem;
}

.seasonal-name {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-family: 'Nunito', sans-serif;
  font-weight: 300;
  color: var(--color-accent-cool);
}

/* Bamboo Grove Animation */
.bamboo-grove {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%;
  width: 100%;
  gap: 0.5rem;
}

.bamboo {
  width: 2px;
  background-color: var(--color-accent-cool);
  opacity: 0.6;
  border-radius: 1px;
  transform-origin: bottom center;
}

.bamboo-1 { height: 45%; animation: bamboo-sway 3s ease-in-out infinite; }
.bamboo-2 { height: 60%; animation: bamboo-sway 3.5s ease-in-out infinite 0.2s; }
.bamboo-3 { height: 50%; animation: bamboo-sway 3.2s ease-in-out infinite 0.4s; }
.bamboo-4 { height: 65%; animation: bamboo-sway 3.8s ease-in-out infinite 0.6s; }
.bamboo-5 { height: 55%; animation: bamboo-sway 3.3s ease-in-out infinite 0.8s; }
.bamboo-6 { height: 48%; animation: bamboo-sway 3.6s ease-in-out infinite 1s; }
.bamboo-7 { height: 62%; animation: bamboo-sway 3.4s ease-in-out infinite 1.2s; }
.bamboo-8 { height: 52%; animation: bamboo-sway 3.7s ease-in-out infinite 1.4s; }

@keyframes bamboo-sway {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(2deg); }
}

/* Haiku Carousel */
.haiku-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  font-weight: 300;
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.6;
}

.haiku-verse {
  position: absolute;
  opacity: 0;
  animation: haiku-fade 12s ease-in-out infinite;
}

.haiku-verse:nth-child(1) { animation-delay: 0s; }
.haiku-verse:nth-child(2) { animation-delay: 2.4s; }
.haiku-verse:nth-child(3) { animation-delay: 4.8s; }
.haiku-verse:nth-child(4) { animation-delay: 7.2s; }
.haiku-verse:nth-child(5) { animation-delay: 9.6s; }

@keyframes haiku-fade {
  0%, 100% { opacity: 0; }
  10%, 90% { opacity: 1; }
}

/* ========================================
   SECTION 2: BEAUTIFUL HARMONY (100vh–200vh)
   ======================================== */

.harmony-section {
  min-height: 100vh;
  background-color: var(--color-bg-light);
  padding: 6rem 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.harmony-content {
  max-width: 900px;
  margin: 0 auto;
}

.harmony-text {
  font-size: clamp(1rem, 1.8vw, 1.5rem);
  color: var(--color-text-secondary);
  margin-bottom: 4rem;
  line-height: 1.8;
}

.harmony-intro {
  font-family: 'Zilla Slab', serif;
  font-size: 1.3em;
  font-weight: 700;
  color: var(--color-text-primary);
}

.harmony-highlight {
  color: var(--color-accent-warm);
  font-weight: 600;
}

.nature-abstractions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4rem;
  margin-top: 4rem;
}

.abstraction {
  width: 200px;
  height: 200px;
  position: relative;
  margin: 0 auto;
}

/* Water Rings */
.water-rings {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  border: 2px solid var(--color-accent-cool);
  border-radius: 50%;
  opacity: 0.5;
}

.ring-1 { width: 40px; height: 40px; animation: ring-expand 3s ease-out infinite; }
.ring-2 { width: 40px; height: 40px; animation: ring-expand 3s ease-out infinite 0.75s; }
.ring-3 { width: 40px; height: 40px; animation: ring-expand 3s ease-out infinite 1.5s; }
.ring-4 { width: 40px; height: 40px; animation: ring-expand 3s ease-out infinite 2.25s; }

@keyframes ring-expand {
  0% {
    width: 40px;
    height: 40px;
    opacity: 1;
  }
  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

/* Rain Lines */
.rain-lines {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.rain-drop {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-accent-cool), transparent);
  animation: rain-drift 2s ease-in infinite;
}

.rain-1 { animation-delay: 0s; }
.rain-2 { animation-delay: 0.4s; }
.rain-3 { animation-delay: 0.8s; }
.rain-4 { animation-delay: 1.2s; }
.rain-5 { animation-delay: 1.6s; }

@keyframes rain-drift {
  0% {
    transform: translateY(-100px) skewX(-20deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100px) skewX(-20deg);
    opacity: 0;
  }
}

/* Falling Petals */
.falling-petals {
  position: relative;
}

.petal {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: var(--color-accent-warm);
  border-radius: 50%;
  opacity: 0.6;
}

.petal-1 { left: 10%; animation: petal-fall 4s ease-in infinite; }
.petal-2 { left: 30%; animation: petal-fall 4.5s ease-in infinite 0.5s; }
.petal-3 { left: 50%; animation: petal-fall 4.2s ease-in infinite 1s; }
.petal-4 { left: 70%; animation: petal-fall 4.8s ease-in infinite 1.5s; }
.petal-5 { left: 85%; animation: petal-fall 4.3s ease-in infinite 2s; }
.petal-6 { left: 20%; animation: petal-fall 4.6s ease-in infinite 2.5s; }

@keyframes petal-fall {
  0% {
    top: -20px;
    opacity: 1;
    transform: rotate(0deg);
  }
  100% {
    top: 200px;
    opacity: 0;
    transform: rotate(360deg);
  }
}

/* ========================================
   SECTION 3: THE GLITCH TRANSITION (200vh–220vh)
   ======================================== */

.glitch-section {
  min-height: 100vh;
  background-color: var(--color-bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  position: relative;
}

.glitch-container {
  position: relative;
  perspective: 1000px;
}

.glitch-text {
  font-family: 'Zilla Slab', serif;
  font-size: clamp(2rem, 6vw, 5rem);
  color: var(--color-text-dark);
  text-align: center;
  letter-spacing: 0.03em;
  line-height: 1.2;
  animation: glitch-flicker 6s ease-in-out infinite;
}

@keyframes glitch-flicker {
  0%, 100% {
    color: var(--color-text-dark);
    transform: translateX(0);
  }
  20% {
    color: var(--color-glitch-sakura);
    transform: translateX(-3px);
    filter: hue-rotate(90deg);
  }
  40% {
    color: var(--color-glitch-cyan);
    transform: translateX(3px);
  }
  60% {
    color: var(--color-glitch-sakura);
    transform: translateX(-2px);
  }
  80% {
    color: var(--color-text-dark);
    transform: translateX(0);
  }
}

/* ========================================
   SECTION 4: OBSERVATION DASHBOARD (220vh–400vh)
   ======================================== */

.observation-section {
  min-height: 180vh;
  background-color: var(--color-bg-light);
  padding: 4rem 2rem;
  position: relative;
}

.observation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.observation-panel {
  background-color: var(--color-bg-dark);
  color: var(--color-text-dark);
  padding: 2.5rem;
  border: 1px solid rgba(232, 213, 183, 0.1);
  position: relative;
  overflow: hidden;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  animation: panel-slide-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.observation-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='256' height='256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' result='noise'/%3E%3C/filter%3E%3Crect width='256' height='256' fill='%232c2416' filter='url(%23noise)' /%3E%3C/svg%3E");
  opacity: 0.06;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.observation-panel > * {
  position: relative;
  z-index: 1;
}

.panel-1 { animation-delay: 0s; }
.panel-2 { animation-delay: 0.12s; }
.panel-3 { animation-delay: 0.24s; }
.panel-4 { animation-delay: 0.36s; }
.panel-5 { animation-delay: 0.48s; }
.panel-6 { animation-delay: 0.6s; }

@keyframes panel-slide-in {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-label {
  font-family: 'Zilla Slab', serif;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 700;
  color: var(--color-accent-warm);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.panel-sublabel {
  color: var(--color-text-tertiary);
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

.panel-visual {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  min-height: 150px;
}

/* Connection dots */
.connection-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--color-accent-cool);
  border-radius: 50%;
  opacity: 0.7;
  animation: dot-pulse 2s ease-in-out infinite;
}

.dot-1 { top: 30%; left: 20%; animation-delay: 0s; }
.dot-2 { top: 50%; left: 50%; animation-delay: 0.4s; }
.dot-3 { top: 70%; left: 80%; animation-delay: 0.8s; }

@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.connection-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--color-accent-cool), transparent);
  opacity: 0.4;
}

.line-1 {
  width: 50%;
  height: 1px;
  top: 40%;
  left: 0;
  animation: line-draw 3s ease-in-out infinite;
}

.line-2 {
  width: 60%;
  height: 1px;
  top: 60%;
  left: 0;
  animation: line-draw 3.5s ease-in-out infinite 0.5s;
}

@keyframes line-draw {
  0%, 100% { width: 0; opacity: 0; }
  50% { width: 100%; opacity: 0.4; }
}

/* Resilience wave */
.resilience-wave {
  width: 100%;
  height: 120px;
  opacity: 0.8;
}

.wave-path {
  stroke: var(--color-accent-cool);
  stroke-width: 2;
  fill: none;
  animation: wave-roll 4s ease-in-out infinite;
}

@keyframes wave-roll {
  0%, 100% { d: path('M0,50 Q50,20 100,50 T200,50'); }
  50% { d: path('M0,50 Q50,80 100,50 T200,50'); }
}

/* Growth rings */
.tradition-rings {
  position: relative;
  width: 150px;
  height: 150px;
}

.growth-ring {
  position: absolute;
  border: 2px solid var(--color-accent-warm);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ring-outer { width: 150px; height: 150px; opacity: 0.3; }
.ring-mid { width: 100px; height: 100px; opacity: 0.5; }
.ring-inner { width: 50px; height: 50px; opacity: 0.8; animation: ring-pulse 3s ease-in-out infinite; }

@keyframes ring-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Glitch bars */
.glitch-bars {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
}

.bar {
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--color-glitch-sakura), transparent);
  animation: bar-scan 2s ease-in-out infinite;
}

.bar-1 { animation-delay: 0s; }
.bar-2 { animation-delay: 0.4s; }
.bar-3 { animation-delay: 0.8s; }
.bar-4 { animation-delay: 1.2s; }

@keyframes bar-scan {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.8; }
}

/* Leaf motif */
.leaf-motif {
  position: absolute;
  width: 20px;
  height: 30px;
  background-color: var(--color-accent-cool);
  border-radius: 50% 0;
  opacity: 0.6;
  animation: leaf-float 4s ease-in-out infinite;
}

.leaf-1 { top: 20%; left: 10%; animation-delay: 0s; }
.leaf-2 { top: 40%; left: 70%; animation-delay: 0.8s; }
.leaf-3 { top: 60%; left: 20%; animation-delay: 1.6s; }
.leaf-4 { top: 80%; left: 80%; animation-delay: 2.4s; }

@keyframes leaf-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: translateY(-40px) rotate(180deg);
    opacity: 0.6;
  }
}

/* Balance scale */
.balance-scale {
  position: relative;
  width: 150px;
  height: 80px;
}

.scale-arm {
  position: absolute;
  width: 150px;
  height: 3px;
  background-color: var(--color-accent-warm);
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  transform-origin: center;
  animation: scale-tilt 3s ease-in-out infinite;
}

.scale-left,
.scale-right {
  position: absolute;
  width: 30px;
  height: 40px;
  background-color: var(--color-accent-cool);
  opacity: 0.6;
  bottom: 0;
}

.scale-left { left: 15px; }
.scale-right { right: 15px; }

@keyframes scale-tilt {
  0%, 100% { transform: translateY(-50%) rotateZ(0deg); }
  50% { transform: translateY(-50%) rotateZ(3deg); }
}

/* ========================================
   SECTION 5: THE POETRY TICKER (400vh–420vh)
   ======================================== */

.poetry-section {
  min-height: 100vh;
  background-color: var(--color-bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  overflow: hidden;
}

.poetry-ticker-container {
  width: 100%;
  overflow: hidden;
  background-color: var(--color-bg-dark);
  padding: 2rem;
  border-top: 2px solid var(--color-text-tertiary);
  border-bottom: 2px solid var(--color-text-tertiary);
}

.poetry-ticker {
  display: flex;
  gap: 3rem;
  animation: ticker-scroll 30s linear infinite;
  white-space: nowrap;
}

.poetry-fragment {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  color: var(--color-text-tertiary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  flex-shrink: 0;
  font-weight: 400;
}

.ticker-divider {
  font-size: 1.2em;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  opacity: 0.5;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    height: auto;
    gap: 2px;
  }

  .panel-primary {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .era-counter-panel {
    grid-column: 1 / 2;
    grid-row: 2;
  }

  .bamboo-panel {
    grid-column: 2 / 3;
    grid-row: 2;
  }

  .haiku-panel {
    grid-column: 1 / 2;
    grid-row: 3;
  }

  .seasonal-panel {
    grid-column: 2 / 3;
    grid-row: 3;
  }

  .observation-grid {
    grid-template-columns: 1fr;
  }

  .nature-abstractions {
    grid-template-columns: 1fr;
  }

  .harmony-section {
    padding: 3rem 1.5rem;
  }

  .glitch-text {
    font-size: clamp(1.5rem, 4vw, 3rem);
  }

  .poetry-fragment {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .panel {
    padding: 1.5rem;
  }

  .kanji {
    font-size: clamp(2rem, 20vw, 8rem);
  }

  .harmony-text {
    font-size: 1rem;
  }
}

/* ========================================
   MOTION PREFERENCES
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
