:root {
  --bg: #fbfaf7;
  --paper: #ffffff;
  --ink: #111217;
  --muted: rgba(17, 18, 23, 0.64);
  --hairline: rgba(17, 18, 23, 0.14);

  /* Category palette (provided) */
  --air-base: #ffa000;
  --water-base: #008092;
  --land-base: #4f8d00;

  /* Derived diagram colors */
  --air-fill: var(--air-base);
  --air-stroke: rgba(255, 160, 0, 0.95);

  --water-fill: var(--water-base);
  --water-stroke: rgba(0, 128, 146, 0.95);

  --land-fill: var(--land-base);
  --land-stroke: rgba(79, 141, 0, 0.95);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Helvetica, Arial, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.012em;
}

.wrap {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  padding: 40px 0 0 0;
}

.epa-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  height: 8px;
  margin-bottom: 18px;
  width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.strip {
  display: block;
  height: 100%;
}

.strip.air {
  background: var(--air-base);
}

.strip.water {
  background: var(--water-base);
}

.strip.land {
  background: var(--land-base);
}

.title {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 64px);
  line-height: 0.98;
  letter-spacing: -0.05em;
  font-weight: 800;
  text-align: center;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.02em;
  text-align: center;
}

.diagram {
  display: grid;
  gap: 20px;
}

.venn {
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  border: none;
}

.venn-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.c {
  fill: transparent;
}

.c.air {
  fill: transparent;
}
.c.water {
  fill: transparent;
}
.c.land {
  fill: transparent;
}

.stroke {
  fill: transparent;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.stroke.air {
  stroke: var(--air-stroke);
}
.stroke.water {
  stroke: var(--water-stroke);
}
.stroke.land {
  stroke: var(--land-stroke);
}

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.label {
  position: absolute;
  width: 32%;
  text-align: center;
}

.label-title {
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: clamp(20px, 2.4vw, 32px);
  color: var(--ink);
}

.label-note {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.25;
  color: var(--muted);
}

.label-air {
  left: 33%;
  top: 12%;
}

.label-air .label-title {
  color: var(--air-base);
}

.label-water {
  left: 0%;
  top: 55%;
  text-align: center;
}

.label-water .label-title {
  color: var(--water-base);
}

.label-land {
  right: 0;
  top: 55%;
  text-align: center;
}

.label-land .label-title {
  color: var(--land-base);
}

.animals {
  position: absolute;
  inset: 0;
}

.animal {
  position: absolute;
  left: calc(var(--x) * 0.1%);
  top: calc(var(--y) * 0.1%);
  width: calc(var(--w) * 1%);
  min-width: 40px;
  margin: 0;
  text-align: center;

  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 220ms linear;
}

.ready .animal {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.animal[role="button"] {
  cursor: pointer;
}

.animal[role="button"]:focus-visible {
  outline: 2px solid rgba(17, 18, 23, 0.55);
  outline-offset: 8px;
}

.animal img {
  width: 100%;
  height: auto;
  display: block;
  filter: none;
  user-select: none;
  -webkit-user-drag: none;
}

.animal figcaption {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.15;
  color: var(--ink);
  max-width: 140px;
  margin-left: auto;
  margin-right: auto;
}

.animal .meta {
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.01em;
}

.key {
  width: min(980px, 100%);
  margin: 0 auto;
  border: none;
  border-radius: 0;
  padding: 10px 0 0;
  background: transparent;
  display: grid;
  gap: 10px;
}

.key-title {
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 16px;
}

.key-items {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.key-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--muted);
}

.dot {
  width: 18px;
  height: 10px;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.24);
  background: transparent;
  flex: 0 0 18px;
}

.dot.air {
  background: var(--air-fill);
  border-color: var(--air-stroke);
}

.dot.overlap {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.25);
}

.dot.all {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.35);
}

.site-footer {
  padding: 22px 0 40px;
}

.footer-min {
  font-size: 16px;
  color: var(--muted);
  letter-spacing: 0.02em;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
}

@media (max-width: 720px) {
  .wrap {
    width: 100%;
    max-width: 1100px;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  .diagram {
    gap: 16px;
    /* Wider than the text column: bleed into side padding for a larger Venn */
    margin-left: -8px;
    margin-right: -8px;
    width: calc(100% + 16px);
  }

  .site-header {
    padding: 34px 0 16px;
  }

  .label-water,
  .label-land {
    text-align: center;
    width: 38%;
  }

  .label-water {
    left: 0;
    top: 57%;
  }

  .label-land {
    left: 53%;
    top: 57%;
  }

  .animal figcaption {
    display: none;
  }

  .label-note {
    display: none;
  }

  .key-items {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 18, 23, 0.38);
}

.modal-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100% - 32px));
  max-height: min(80vh, 720px);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(17, 18, 23, 0.18);
  border-radius: 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.modal-header {
  position: relative;
  width: 100%;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  border: none;
  background: transparent;
  padding: 4px;
  color: rgba(255, 255, 255, 0.96);
  min-width: 36px;
  min-height: 36px;
  line-height: 1;
  font-size: 28px;
  cursor: pointer;
}

.modal-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.modal-hero {
  width: 100%;
  min-height: 156px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 42%);
  gap: 12px;
  align-items: center;
  padding: 18px 16px 18px 18px;
  padding-right: 52px;
  background: transparent;
  box-sizing: border-box;
}

.modal-hero-text {
  min-width: 0;
  align-self: center;
}

.modal-hero-art {
  display: grid;
  place-items: center;
  min-height: 120px;
}

.modal-hero img {
  max-width: 100%;
  max-height: 130px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.modal-kicker {
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.78);
}

.modal-title {
  margin: 6px 0 4px;
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #fff;
}

.modal-category {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.02em;
  padding-bottom: 0;
  border-bottom: none;
}

.modal-body {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 14px;
  overflow: auto;
  flex: 1;
}

.modal-section {
  display: grid;
  gap: 8px;
}

.modal-label {
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 700;
}

.modal-text {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.005em;
}

@media (max-width: 480px) {
  .modal-hero {
    grid-template-columns: 1fr;
    padding: 14px 52px 14px 16px;
    min-height: 0;
  }

  .modal-hero-art {
    min-height: 0;
    justify-self: end;
    width: 100%;
  }

  .modal-hero-art img {
    max-height: 100px;
  }
}
