/* styles.css */
:root {
  --murky-deep: #050302;
  --murky-bg: #0a0604;
  --murky-surface: #1a1208;
  --murky-text: #c4a882;
  --murky-text-dim: #8b7355;
  --murky-text-bright: #e8d5b8;
  --murky-accent: #f44;
  --murky-glow: #ff444480;
  --clearing-bg: #0c1a2e;
  --clearing-text: #8ab4d4;
  --clearing-accent: #4aa8d8;
  --clean-bg: #f0fdf4;
  --clean-surface: #fff;
  --clean-text: #14532d;
  --clean-text-secondary: #4a7c59;
  --clean-accent: #22c55e;
  --clean-energy: #f59e0b;
  --clean-glow: #22c55e4d;
  --font: system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Fira Code", ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--murky-deep);
  color: var(--murky-text);
  overflow-x: hidden;
  line-height: 1.6;
}

#app {
  max-width: none;
  margin: 0;
  padding: 0;
}

.section {
  min-height: 100vh;
  display: flex;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  min-height: 100dvh;
  padding: 4rem 2rem;
}

.section-title {
  text-align: center;
  letter-spacing: -.01em;
  margin-bottom: 2rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
}

.section-inner {
  display: flex;
  flex-direction: column;
  align-items:  center;
  width: 100%;
  max-width: 900px;
}

.reveal {
  opacity: 0;
  transition: opacity .8s, transform .8s;
  transform: translateY(24px);
}

.section.visible .reveal {
  opacity: 1;
  transform: translateY(0);
}

.section.visible .reveal:nth-child(2) {
  transition-delay: .12s;
}

.section.visible .reveal:nth-child(3) {
  transition-delay: .24s;
}

.section.visible .reveal:nth-child(4) {
  transition-delay: .36s;
}

.section.visible .reveal:nth-child(5) {
  transition-delay: .48s;
}

.section.visible .reveal:nth-child(6) {
  transition-delay: .6s;
}

.section--murky {
  background: var(--murky-bg);
  color: var(--murky-text);
}

.hero {
  background: radial-gradient(ellipse at 50% 110%, var(--murky-surface) 0%, transparent 60%), var(--murky-deep);
  text-align: center;
  gap: 1rem;
}

.hero h1 {
  letter-spacing: -.03em;
  color: var(--murky-text-bright);
  opacity: 0;
  animation: emerge 1.5s ease-out .3s forwards;
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  line-height: 1;
}

.hero .subtitle {
  color: var(--murky-text-dim);
  opacity: 0;
  animation: emerge 1.5s ease-out .9s forwards;
  max-width: 520px;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
}

.scroll-hint {
  position: absolute;
  display: flex;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--murky-text-dim);
  animation: pulse 2.5s ease-in-out infinite;
  flex-direction: column;
  align-items:  center;
  gap: .4rem;
  font-size: .75rem;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-hint-line {
  background: linear-gradient(to bottom, var(--murky-text-dim), transparent);
  animation: drip 2.5s ease-in-out infinite;
  width: 1px;
  height: 32px;
}

.crisis-counter {
  font-family: var(--font-mono);
  color: var(--murky-accent);
  text-align: center;
  min-height: 1.8em;
  margin-bottom: 2rem;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 600;
}

.crisis-counter.loading {
  color: var(--murky-text-dim);
}

.crisis-layout {
  display: flex;
  align-items:  center;
  gap: 3rem;
  width: 100%;
  max-width: 900px;
}

.crisis-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .75rem;
}

.spill-name {
  border-left: 3px solid var(--murky-accent);
  color: var(--murky-text);
  background: #ff444414;
  border-radius: 0 4px 4px 0;
  padding: .5rem .75rem;
  font-size: .85rem;
}

.spill-name strong {
  color: var(--murky-text-bright);
  display: block;
  font-size: .8rem;
}

.spill-name span {
  color: var(--murky-text-dim);
  font-size: .7rem;
}

.wales-map {
  flex: none;
  width: 280px;
  height: auto;
}

.wales-land {
  fill: #1a120880;
  stroke: var(--murky-text-dim);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.spill-dot {
  fill: var(--murky-text-dim);
  opacity: .3;
}

.spill-dot.active {
  fill: var(--murky-accent);
  opacity: 1;
  animation: pulse-dot 2s ease-in-out infinite;
}

.swim-lane {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 60vh;
}

.swim-track {
  position: absolute;
  white-space: nowrap;
  animation: swim-left var(--dur, 25s) linear infinite;
  animation-delay: var(--del, 0s);
}

.fact {
  display: inline-block;
  animation: bob var(--bob, 3s) ease-in-out infinite;
  border-radius: 4px;
  padding: .7rem 1.2rem;
  font-size: clamp(.85rem, 2vw, 1rem);
}

.fact--murky {
  color: var(--murky-text);
  backdrop-filter: blur(4px);
  background: #1a1208a6;
  border: 1px solid #c4a8821f;
}

.fact--alert {
  color: #f88;
  background: #ff44441a;
  border: 1px solid #ff444440;
}

.fact--stat {
  font-family: var(--font-mono);
  color: var(--murky-text-bright);
  background: #1a1208cc;
  border: 1px solid #c4a88233;
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  font-weight: 700;
}

.scale-overlay {
  position: absolute;
  display: flex;
  pointer-events: none;
  text-align: center;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  padding: 2rem;
  inset: 0;
}

.big-number {
  font-family: var(--font-mono);
  color: var(--murky-text-bright);
  text-shadow: 0 0 60px #0a0604cc;
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 1;
}

.big-number-label {
  color: var(--murky-text-dim);
  text-shadow: 0 0 30px #0a0604e6;
  margin-top: .5rem;
  font-size: clamp(.9rem, 2vw, 1.2rem);
}

.opportunity {
  min-height: auto;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.opp-headline {
  text-align: center;
  margin-bottom: 1rem;
}

.opp-headline .big-number {
  color: var(--murky-accent);
}

.waste-counter {
  text-align: center;
  background: #ff44440f;
  border: 1px solid #ff444426;
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  margin: 1.5rem 0;
  padding: 1.5rem 2rem;
}

.counter-prefix {
  display: block;
  color: var(--murky-text-dim);
  margin-bottom: .25rem;
  font-size: .8rem;
}

.counter-value {
  display: block;
  font-family: var(--font-mono);
  color: var(--murky-accent);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
}

.counter-suffix {
  display: block;
  color: var(--murky-text);
  margin-top: .25rem;
  font-size: .9rem;
}

.counter-rate {
  display: block;
  font-size: .7rem;
  font-family: var(--font-mono);
  color: var(--murky-text-dim);
  margin-top: .5rem;
}

.opp-layout {
  display: flex;
  align-items:  flex-start;
  gap: 3rem;
  width: 100%;
  max-width: 900px;
}

.opp-map {
  flex: 0 0 300px;
}

.opp-data {
  flex: 1;
}

.map-legend {
  color: var(--murky-text-dim);
  text-align: center;
  margin-top: .5rem;
  font-size: .7rem;
}

.energy-bubble {
  fill: #f59e0b40;
  stroke: #f59e0b80;
  stroke-width: 1;
}

.energy-label {
  fill: var(--murky-text-bright);
  font-size: 11px;
  font-family: var(--font-mono);
  text-anchor: middle;
  pointer-events: none;
  font-weight: 700;
}

.energy-compare {
  width: 100%;
}

.energy-ratio {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.ratio-num {
  font-family: var(--font-mono);
  color: var(--clean-energy);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.ratio-label {
  color: var(--murky-text);
  font-size: .95rem;
  line-height: 1.4;
}

.energy-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 70px;
  align-items:  center;
  gap: .75rem;
  margin-bottom: .6rem;
  font-size: .8rem;
}

.bar-label {
  color: var(--murky-text-dim);
}

.bar-track {
  overflow: hidden;
  background: #c4a88214;
  border-radius: 3px;
  height: 18px;
}

.bar-fill {
  border-radius: 3px;
  height: 100%;
  transition: width 1s;
}

.bar--current {
  background: var(--murky-text-dim);
}

.bar--use {
  background: var(--murky-accent);
}

.bar--potential {
  background: var(--clean-energy);
}

.bar-value {
  font-family: var(--font-mono);
  color: var(--murky-text-bright);
  text-align: right;
  font-weight: 600;
}

.worst-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .5rem;
  width: 100%;
  max-width: 900px;
  margin-top: 1rem;
}

.worst-site {
  display: flex;
  border-left: 3px solid var(--murky-accent);
  background: #ff44440f;
  border-radius: 0 4px 4px 0;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem;
  padding: .6rem .8rem;
  font-size: .8rem;
}

.worst-site strong {
  color: var(--murky-text-bright);
  flex: 1;
  font-size: .8rem;
}

.worst-hours {
  font-family: var(--font-mono);
  color: var(--murky-accent);
  font-weight: 700;
}

.worst-water {
  color: var(--murky-text-dim);
  width: 100%;
  font-size: .7rem;
}

.connection {
  min-height: auto;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.conn-layout {
  display: flex;
  align-items:  flex-start;
  gap: 3rem;
  width: 100%;
  max-width: 900px;
}

.conn-map {
  flex: 0 0 300px;
}

.conn-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  margin-top: .75rem;
}

.legend-item {
  display: flex;
  color: var(--murky-text-dim);
  align-items:  center;
  gap: .3rem;
  font-size: .65rem;
}

.legend-dot {
  display: inline-block;
  border-radius: 50%;
  width: 10px;
  height: 10px;
}

.legend-dot.excellent {
  background: #22c55e;
}

.legend-dot.good {
  background: #60a5fa;
}

.legend-dot.sufficient {
  background: #fbbf24;
}

.legend-dot.poor {
  background: #ef4444;
}

.legend-circle.offgrid {
  background: #f59e0b33;
  border: 1px solid #f59e0b80;
  border-radius: 50%;
  width: 12px;
  height: 12px;
}

.bath-dot {
  opacity: .8;
}

.bath-dot.excellent {
  fill: #22c55e;
}

.bath-dot.good {
  fill: #60a5fa;
}

.bath-dot.sufficient {
  fill: #fbbf24;
}

.bath-dot.poor {
  fill: #ef4444;
}

.offgrid-bubble {
  fill: #f59e0b26;
  stroke: #f59e0b59;
  stroke-width: 1.5;
  stroke-dasharray: 3 2;
}

.conn-table-wrap {
  flex: 1;
}

.conn-header {
  display: grid;
  grid-template-columns: 1fr 65px 80px 65px;
  color: var(--murky-text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #c4a8821a;
  gap: .4rem;
  padding: .5rem .75rem;
  font-size: .65rem;
  font-weight: 600;
}

.connection-row {
  display: grid;
  grid-template-columns: 1fr 65px 80px 65px;
  border-bottom: 1px solid #c4a8820d;
  gap: .4rem;
  padding: .45rem .75rem;
  font-size: .8rem;
}

.conn-offgrid {
  font-family: var(--font-mono);
  color: var(--clean-energy);
  text-align: right;
  font-size: .8rem;
  font-weight: 600;
}

.conn-area {
  color: var(--murky-text);
}

.conn-unemp {
  font-family: var(--font-mono);
  color: var(--murky-text-bright);
  text-align: right;
  font-weight: 600;
}

.conn-water {
  color: var(--murky-text-dim);
  text-align: right;
  font-size: .75rem;
}

.section--clearing {
  background: var(--clearing-bg);
  color: var(--clearing-text);
}

.section--clearing .section-title {
  color: var(--clearing-accent);
}

.precedent-card {
  background: #4aa8d80f;
  border: 1px solid #4aa8d826;
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  padding: 2rem;
}

.precedent-card h3 {
  color: var(--clearing-accent);
  text-align: center;
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
}

.precedent-stat {
  display: flex;
  border-bottom: 1px solid #4aa8d814;
  justify-content: space-between;
  align-items: baseline;
  padding: .6rem 0;
  font-size: .95rem;
}

.precedent-stat:last-child {
  border-bottom: none;
}

.precedent-stat strong {
  color: var(--clearing-accent);
  font-family: var(--font-mono);
}

.precedent-note {
  text-align: center;
  color: #8ab4d499;
  max-width: 480px;
  margin-top: 2rem;
  font-size: .95rem;
  font-style: italic;
}

.section--transform {
  background: var(--murky-bg);
  color: var(--murky-text);
  transition: background 1.2s, color 1.2s;
}

.section--transform .section-title {
  transition: color 1.2s;
}

.section--transform .subtitle {
  text-align: center;
  color: var(--murky-text-dim);
  max-width: 500px;
  transition: color 1.2s;
  font-size: 1.05rem;
}

.pull-together {
  font-family: var(--font);
  border: 2px solid var(--murky-text-dim);
  color: var(--murky-text);
  cursor: pointer;
  background: none;
  border-radius: 50px;
  margin: 1.5rem 0;
  padding: .9rem 2.5rem;
  transition: all .6s;
  font-size: 1.1rem;
}

.pull-together:hover {
  border-color: var(--clean-accent);
  color: var(--clean-accent);
  background: #22c55e14;
  box-shadow: 0 0 30px #22c55e1a;
}

.section--transform.transformed {
  background: var(--clean-bg);
  color: var(--clean-text);
}

.section--transform.transformed .section-title {
  color: var(--clean-text);
}

.section--transform.transformed .subtitle {
  color: var(--clean-text-secondary);
}

.section--transform.transformed .pull-together {
  background: var(--clean-accent);
  border-color: var(--clean-accent);
  color: #fff;
  box-shadow: 0 4px 20px #22c55e4d;
}

.future-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 700px;
  margin-top: 1rem;
}

.future-card {
  text-align: center;
  opacity: 0;
  color: var(--murky-text-dim);
  background: #1a120866;
  border: 1px solid #c4a8821a;
  border-radius: 10px;
  padding: 1.5rem;
  transition: all .6s;
  transform: translateY(30px);
}

.future-card:first-child {
  transition-delay: .1s;
}

.future-card:nth-child(2) {
  transition-delay: .25s;
}

.future-card:nth-child(3) {
  transition-delay: .4s;
}

.future-card:nth-child(4) {
  transition-delay: .55s;
}

.transformed .future-card {
  opacity: 1;
  background: var(--clean-surface);
  color: var(--clean-text);
  border: 1px solid #22c55e26;
  transform: translateY(0);
  box-shadow: 0 2px 16px #0000000a;
}

.transformed .future-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px #22c55e1a;
}

.future-icon {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  margin: 0 auto .75rem;
  transition: background .6s;
}

.future-icon--energy, .future-icon--water, .future-icon--jobs, .future-icon--farm {
  background: #8b73554d;
}

.transformed .future-icon--energy {
  background: #f59e0b26;
}

.transformed .future-icon--water {
  background: #0ea5e926;
}

.transformed .future-icon--jobs {
  background: #22c55e26;
}

.transformed .future-icon--farm {
  background: #84cc1626;
}

.future-card h3 {
  margin-bottom: .3rem;
  font-size: .95rem;
  font-weight: 600;
}

.future-card p {
  opacity: .7;
  font-size: .8rem;
  line-height: 1.5;
}

.section--clean {
  background: var(--clean-bg);
  color: var(--clean-text);
}

.section--clean .section-title {
  color: var(--clean-text);
}

.ask-list {
  list-style: none;
  counter-reset: asks;
  width: 100%;
  max-width: 640px;
}

.ask-item {
  counter-increment: asks;
  background: var(--clean-surface);
  border-left: 4px solid var(--clean-accent);
  border-radius: 8px;
  margin-bottom: .75rem;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 1px 8px #0000000a;
}

.ask-item:nth-child(2) {
  transition-delay: 80ms;
}

.ask-item:nth-child(3) {
  transition-delay: .16s;
}

.ask-item:nth-child(4) {
  transition-delay: .24s;
}

.ask-item:nth-child(5) {
  transition-delay: .32s;
}

.ask-item:nth-child(6) {
  transition-delay: .4s;
}

.ask-item:before {
  content: counter(asks);
  font-family: var(--font-mono);
  color: var(--clean-accent);
  display: block;
  margin-bottom: .4rem;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.ask-item p {
  color: var(--clean-text-secondary);
  font-size: .9rem;
  line-height: 1.65;
}

.closing-quote {
  text-align: center;
  color: var(--clean-text-secondary);
  border-top: 1px solid #22c55e26;
  max-width: 560px;
  margin-top: 3rem;
  padding: 2rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

@keyframes emerge {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes swim-left {
  from {
    transform: translateX(100vw);
  }

  to {
    transform: translateX(calc(-100% - 40px));
  }
}

@keyframes bob {
  0%, 100% {
    transform: translateY(0)rotate(.4deg);
  }

  50% {
    transform: translateY(-10px)rotate(-.4deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: .4;
  }

  50% {
    opacity: 1;
  }
}

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

  50% {
    opacity: .5;
  }
}

@keyframes drip {
  0% {
    height: 16px;
    opacity: .2;
  }

  50% {
    height: 32px;
    opacity: 1;
  }

  100% {
    height: 48px;
    opacity: 0;
  }
}

.toast {
  position: fixed;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  border-radius: 4px;
  padding: .5rem 1rem;
  transition: opacity .2s;
  font-size: .8rem;
  bottom: 1.5rem;
  left: 50%;
  translate: -50%;
}

.toast.show {
  opacity: 1;
}

.toast.notify {
  background: var(--clean-accent);
}

.toast.alert {
  background: var(--murky-accent);
}

.briefing-link {
  display: inline-block;
  color: var(--clean-text);
  border: 1px solid var(--clean-accent);
  text-decoration: none;
  text-align: center;
  border-radius: 4px;
  margin-top: 2rem;
  padding: .75rem 1.5rem;
  transition: background .2s, color .2s;
}

.briefing-link:hover {
  background: var(--clean-accent);
  color: #fff;
}

.lang-toggle {
  position: fixed;
  z-index: 200;
  backdrop-filter: blur(8px);
  color: var(--murky-text-dim);
  cursor: pointer;
  background: #0a0604b3;
  border: 1px solid #b4a0784d;
  border-radius: 4px;
  padding: .4rem .8rem;
  transition: color .2s, border-color .2s;
  font-size: .8rem;
  top: 1rem;
  right: 1rem;
}

.lang-toggle:hover {
  color: var(--clean-accent);
  border-color: var(--clean-accent);
}

.site-footer {
  text-align: center;
  color: var(--murky-text-dim);
  background: var(--murky-bg);
  border-top: 1px solid #b4a07826;
  padding: 2.5rem 1.5rem;
  font-size: .85rem;
  line-height: 1.6;
}

.site-footer p {
  margin: .3rem 0;
}

.footer-email {
  color: var(--murky-text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.footer-email:hover {
  color: var(--clean-accent);
}

.footer-credit {
  color: #b4a07866;
  font-size: .75rem;
  margin-top: 1rem !important;
}

.footer-credit a {
  color: #b4a07880;
  text-decoration: underline;
}

.footer-credit a:hover {
  color: var(--clean-accent);
}

@media (width <= 768px) {
  .section {
    padding: 3rem 1.25rem;
  }

  .crisis-layout {
    flex-direction: column-reverse;
    gap: 2rem;
  }

  .wales-map {
    width: 220px;
  }

  .crisis-details {
    width: 100%;
  }

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

  .swim-lane {
    min-height: 50vh;
  }

  .opp-layout, .conn-layout {
    flex-direction: column;
    gap: 2rem;
  }

  .opp-map, .conn-map {
    flex: none;
    width: 220px;
    margin: 0 auto;
  }

  .energy-bar-row {
    grid-template-columns: 100px 1fr 60px;
  }

  .worst-list {
    grid-template-columns: 1fr;
  }
}

@media (pointer: coarse) {
  .pull-together {
    min-height: 48px;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
  }
}
