@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
@import url("https://cdn.hugeicons.com/font/hgi-stroke-rounded.css");
@import url("https://unpkg.com/hugeicons.css");

:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --panel-bg: #ffffff;
  --border: #dbe1ea;
  --text-main: #1c2533;
  --text-muted: #60708f;
  --accent: #5ed6f7;
  --shadow: 0 12px 40px rgba(16, 37, 63, 0.08);
  --button-bg: #f1f4f8;
  --button-border: rgba(12, 31, 64, 0.18);
  --maxw: 1200px;
  --pad-xl: clamp(1.2rem, 2.5vw, 3rem);
  --pad-lg: clamp(1rem, 2vw, 2rem);
  --pad-md: clamp(0.75rem, 1.5vw, 1.25rem);
  --nav-height: 60px;
  --divider: rgba(12, 31, 64, 0.1);
  --accent-build: #ed1164;
  --accent-build-muted: rgba(237, 17, 100, 0.35);
  --accent-learn: #5ed6f7;
  --accent-learn-muted: rgba(94, 214, 247, 0.35);
  --accent-paper: #ffaa00;
  --accent-paper-muted: rgba(255, 170, 0, 0.35);
  --accent-teach: #56cc46;
  --accent-teach-muted: rgba(86, 204, 70, 0.35);
  --accent-code: #7f7f7f;
  --accent-code-muted: rgba(127, 127, 127, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--divider);
}

.site-nav--app {
  position: static;
  background: #ffffff;
}

.site-nav--app .site-nav__inner {
  height: var(--nav-height);
}

.site-nav__inner {
  width: min(100%, var(--maxw));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 3vw, 2rem);
  height: var(--nav-height);
  padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: #fff;
}

.site-nav__links {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.nav-link {
  --nav-accent: var(--accent);
  --nav-border: rgba(12, 31, 64, 0.12);
  --nav-hover-bg: rgba(12, 31, 64, 0.04);
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 1.1rem;
  font-weight: 600;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  border-bottom: 4px solid transparent;
  background: transparent;
  color: var(--text-main);
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--nav-accent);
  background: var(--nav-hover-bg);
  border-left-color: var(--nav-border);
  border-right-color: var(--nav-border);
  border-bottom-color: var(--nav-accent);
}

.nav-link--build {
  --nav-accent: var(--accent-build);
  --nav-border: var(--accent-build-muted);
  --nav-hover-bg: rgba(237, 17, 100, 0.1);
}

.nav-link--learn {
  --nav-accent: var(--accent-learn);
  --nav-border: var(--accent-learn-muted);
  --nav-hover-bg: rgba(94, 214, 247, 0.12);
}

.nav-link--teach {
  --nav-accent: var(--accent-teach);
  --nav-border: var(--accent-teach-muted);
  --nav-hover-bg: rgba(86, 204, 70, 0.12);
}

.nav-link--code {
  --nav-accent: var(--accent-code);
  --nav-border: var(--accent-code-muted);
  --nav-hover-bg: rgba(127, 127, 127, 0.14);
}

.nav-link--about {
  --nav-accent: var(--accent-teach);
  --nav-border: var(--accent-teach-muted);
  --nav-hover-bg: rgba(86, 204, 70, 0.12);
}

.nav-link--save {
  --nav-accent: var(--accent-learn);
  --nav-border: var(--accent-learn-muted);
  --nav-hover-bg: rgba(94, 214, 247, 0.12);
}

.nav-link--share {
  --nav-accent: var(--accent-build);
  --nav-border: var(--accent-build-muted);
  --nav-hover-bg: rgba(237, 17, 100, 0.1);
}

.nav-link--reset {
  --nav-accent: var(--accent-code);
  --nav-border: var(--accent-code-muted);
  --nav-hover-bg: rgba(127, 127, 127, 0.14);
}

.site-nav__links--app .nav-link {
  gap: 0.4rem;
}

.site-nav__links--app .nav-link i {
  font-size: 1.05rem;
  line-height: 1;
}

.site-nav:not(.site-nav--app) .nav-link {
  gap: 0.4rem;
}

.site-nav:not(.site-nav--app) .nav-link i {
  font-size: 1.05rem;
  line-height: 1;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  color: var(--text-main);
  margin: 0;
}

h1 {
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

h3 {
  font-weight: 600;
}

p {
  margin: 0;
  color: var(--text-muted);
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.site-shell > * {
  width: min(100%, var(--maxw));
  margin: 0 auto;
}

.panel {
  background: var(--panel-bg);
  border-radius: 28px;
  border: 1px solid rgba(12, 31, 64, 0.08);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 1.5vw, 2.4rem);
  position: relative;
  overflow: hidden;
}

.section-divider {
  width: 100%;
  height: 1px;
  background: var(--divider);
}

.hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.6rem, 3vw, 2.8rem);
  align-items: stretch;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  padding: 0;
}

.hero__text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1.2rem, 3vw, 2.6rem);
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  max-width: 48ch;
  align-items: center;
}

.hero__content h1 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-weight: 600;
  color: var(--text-main);
}

.hero__content p {
  margin: 0;
}

.hero__lead {
  color: var(--text-main);
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-weight: 600;
}

.hero__quiet {
  font-size: 0.98rem;
  color: var(--text-muted);
}

.inline-feature-link {
  position: relative;
  display: inline-block;
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.4s ease;
}

.inline-feature-link:visited {
  color: var(--text-main);
}

.inline-feature-link::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  bottom: -2px;
  height: 1px;
  background: rgba(12, 31, 64, 0.28);
}

.inline-feature-link::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--accent-learn);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.inline-feature-link:hover,
.inline-feature-link:focus-visible {
  color: var(--accent-learn);
}

.inline-feature-link:hover::after,
.inline-feature-link:focus-visible::after {
  transform: scaleX(1);
}

.hero__media {
  position: relative;
  height: auto;
  min-height: 0;
  aspect-ratio: 10 / 9;
  width: auto;
  max-width: 100%;
  align-self: stretch;
  justify-self: end;
  border-radius: 24px;
  overflow: hidden;
}


.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.block {
  display: flex;
  flex-direction: column;
  gap: clamp(1.6rem, 3vw, 2.6rem);
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.2rem, 2.5vw, 2rem);
}

.chip {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  padding: clamp(1.2rem, 2.4vw, 2rem);
  border-radius: 2rem;
  background: var(--panel-bg);
  border: 1px solid rgba(12, 31, 64, 0.12);
  box-shadow: 0 10px 30px rgba(16, 37, 63, 0.08);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
  box-shadow: 0 14px 36px rgba(16, 37, 63, 0.16);
}

.chip:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.chip__text {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.2vw, 0.9rem);
}

.chip__text h2 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
}

.chip__text p {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--text-muted);
}

.chip__action {
  align-self: flex-start;
  margin-top: 0.2rem;
}

.chip__media {
  aspect-ratio: 1512 / 1047;
  display: grid;
  place-items: center;
  margin-top: auto;
}

.chip__media--framed {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(12, 31, 64, 0.08);
}

.chip__media img,
.chip__media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: clamp(1.4rem, 3vw, 2.4rem);
  align-items: center;
}

.split--reverse {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}

.split__media {
  min-height: clamp(220px, 32vw, 420px);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
}

.split__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.split__text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.text-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.8vw, 1.4rem);
  max-width: 60ch;
}

.text-stack h2 {
  font-weight: 600;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.text-stack p {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.cta {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.6rem);
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.action-collection,
.cta-actions {
  display: grid;
  gap: clamp(0.9rem, 1.6vw, 1.2rem);
}

.action-grid,
.topic-grid,
.cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.9rem, 1.6vw, 1.2rem);
}

.action-grid--compact {
  gap: clamp(0.8rem, 1.4vw, 1.1rem);
}

.action-card,
.topic-card {
  --action-accent: var(--accent-learn);
  --action-accent-muted: var(--accent-learn-muted);
  display: grid;
  gap: clamp(0.65rem, 1.3vw, 0.95rem);
  padding: clamp(1rem, 1.7vw, 1.3rem);
  border-radius: 22px;
  border: 1px solid rgba(12, 31, 64, 0.12);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 251, 255, 0.9) 100%);
  box-shadow: 0 0 0 rgba(16, 37, 63, 0);
}

.action-card--primary {
  --action-accent: var(--accent-build);
  --action-accent-muted: var(--accent-build-muted);
  padding: clamp(1.15rem, 1.9vw, 1.45rem);
  border-color: rgba(237, 17, 100, 0.25);
  background: linear-gradient(150deg, rgba(255, 255, 255, 1) 0%, rgba(255, 242, 248, 0.92) 100%);
}

.action-card--compact {
  padding: clamp(0.95rem, 1.5vw, 1.15rem);
}

.action-card--build {
  --action-accent: var(--accent-build);
  --action-accent-muted: var(--accent-build-muted);
}

.action-card--learn {
  --action-accent: var(--accent-learn);
  --action-accent-muted: var(--accent-learn-muted);
}

.action-card--paper {
  --action-accent: var(--accent-paper);
  --action-accent-muted: var(--accent-paper-muted);
}

.action-card--teach {
  --action-accent: var(--accent-teach);
  --action-accent-muted: var(--accent-teach-muted);
}

.action-card--code {
  --action-accent: var(--accent-code);
  --action-accent-muted: var(--accent-code-muted);
}

.action-card--link,
.topic-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.action-card--link:hover,
.action-card--link:focus-visible,
.topic-card--link:hover,
.topic-card--link:focus-visible {
  border-color: var(--action-accent);
  box-shadow: 0 14px 32px rgba(16, 37, 63, 0.14), 0 0 0 1px var(--action-accent-muted);
}

.action-card--link:focus-visible,
.topic-card--link:focus-visible {
  outline: 2px solid transparent;
}

.action-card--link:active,
.topic-card--link:active {
  box-shadow: 0 10px 22px rgba(16, 37, 63, 0.12), 0 0 0 1px var(--action-accent-muted);
}

.action-card__content,
.topic-card__content {
  display: grid;
  gap: 0.6rem;
}

.action-card__eyebrow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(12, 31, 64, 0.62);
}

.action-card__eyebrow i {
  color: var(--action-accent);
  font-size: 1rem;
}

.action-card__title {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding-bottom: 0.2rem;
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1.28;
  color: var(--text-main);
  transition: color 0.32s ease;
}

.action-card__title::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  height: 1px;
  background: rgba(12, 31, 64, 0.22);
}

.action-card__title::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  height: 2px;
  background: var(--action-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.32s ease;
}

.action-card__arrow {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--action-accent);
  font-size: 0.95em;
  opacity: 0.88;
  transform: translateX(0);
  transition: transform 0.32s ease;
}

.action-card__text {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  line-height: 1.45;
}

.action-card--link:hover .action-card__title,
.action-card--link:focus-visible .action-card__title,
.topic-card--link:hover .action-card__title,
.topic-card--link:focus-visible .action-card__title {
  color: var(--action-accent);
}

.action-card--link:hover .action-card__title::after,
.action-card--link:focus-visible .action-card__title::after,
.topic-card--link:hover .action-card__title::after,
.topic-card--link:focus-visible .action-card__title::after {
  transform: scaleX(1);
}

.action-card--link:hover .action-card__arrow,
.action-card--link:focus-visible .action-card__arrow,
.topic-card--link:hover .action-card__arrow,
.topic-card--link:focus-visible .action-card__arrow {
  transform: translateX(3px);
}

@media (max-width: 980px) {
  .action-grid,
  .topic-grid,
  .cta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .action-card,
  .topic-card {
    padding: clamp(0.95rem, 4vw, 1.2rem);
  }

  .action-card__title {
    width: 100%;
  }
}

.btn {
  --h: 3.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: var(--h);
  line-height: 1;
  padding: 0 1.35rem;
  border-radius: 9999px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: #000;
  text-decoration: none;
  letter-spacing: 0.02em;
  font-weight: 600;
  font-size: clamp(0.95rem, 1.1vw, 1rem);
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}

.btn:hover {
  background: var(--accent);
  border-color: var(--button-border);
  box-shadow: 0 4px 14px rgba(71, 211, 229, 0.35);
  color: #fff;
}

.btn.btn--play:hover {
  background: #ed1164;
  box-shadow: 0 4px 14px rgba(237, 17, 100, 0.35);
}

.btn.btn--build:hover {
  background: #ed1164;
  box-shadow: 0 4px 14px rgba(237, 17, 100, 0.35);
}

.btn.btn--learn:hover {
  background: #5ed6f7;
  box-shadow: 0 4px 14px rgba(94, 214, 247, 0.35);
}

.btn.btn--paper:hover {
  background: #ffaa00;
  box-shadow: 0 4px 14px rgba(255, 170, 0, 0.35);
}

.btn.btn--teaching:hover {
  background: #56cc46;
  box-shadow: 0 4px 14px rgba(86, 204, 70, 0.35);
}

.btn.btn--involved:hover {
  background: #7f7f7f;
  box-shadow: 0 4px 14px rgba(127, 127, 127, 0.35);
}

.btn i,
.btn svg {
  font-size: 1.1em;
  height: 1.1em;
  width: 1.1em;
  display: block;
}

.site-footer {
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 2vw, 1.8rem);
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--divider);
  box-shadow: none;
  border-radius: 0;
  width: 100%;
}

.site-footer__inner {
  width: min(100%, var(--maxw));
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.footer-inner {
  display: grid;
  gap: clamp(1rem, 2vw, 1.6rem);
}

.credits {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 2vw, 1.6rem);
  justify-content: space-evenly;
}

.author {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.32);
  background: #fff;
}

.author-name {
  font-weight: 700;
  color: var(--text-main);
  padding-left: 0.2rem;
}

.social {
  display: flex;
  padding-top: clamp(0.6rem, 1vw, 0.9rem); 
  gap: clamp(0.6rem, 1vw, 0.9rem);
  flex-wrap: wrap;
}

.icon-pill {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.2);
  font-size: 24px;
  color: #444;
  background: #fff;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.icon-pill:hover {
  background: var(--accent);
  color: #00313a;
  box-shadow: 0 4px 14px rgba(71, 211, 229, 0.35);
}

.icon-pill svg {
  fill: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
}

.pad-xl {
  padding: var(--pad-xl);
}

.pad-lg {
  padding: var(--pad-lg);
}

.pad-md {
  padding: var(--pad-md);
}

/* Content page components */
.page-intro {
  display: grid;
  gap: clamp(0.8rem, 1.8vw, 1.3rem);
}

.page-intro__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 40%);
  gap: clamp(1rem, 2vw, 1.6rem);
  align-items: center;
}

.page-intro__media {
  margin: 0;
  border-radius: 18px;
  border: 1px solid rgba(12, 31, 64, 0.1);
  background: #fff;
  padding: clamp(0.5rem, 1vw, 0.75rem);
  overflow: hidden;
}

.page-intro__media img,
.page-intro__media video {
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

.page-intro__media--flush {
  padding: 0;
  aspect-ratio: 1134 / 786;
}

.page-intro__media--flush video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.page-intro__eyebrow {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(12, 31, 64, 0.6);
  font-weight: 600;
}

.page-intro__crumb {
  position: relative;
  display: inline-block;
  color: inherit;
  text-decoration: none;
  transition: color 0.4s ease;
}

.page-intro__crumb::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--accent-learn);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.page-intro__crumb:hover,
.page-intro__crumb:focus-visible {
  color: var(--accent-learn);
}

.page-intro__crumb:hover::after,
.page-intro__crumb:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.page-callout {
  border: 1px solid rgba(86, 204, 70, 0.28);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.page-callout--link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.page-callout--link:hover,
.page-callout--link:focus-visible {
  border-color: #56cc46;
  box-shadow: 0 14px 34px rgba(86, 204, 70, 0.22);
}

.link-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.long-read {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.learn-longform {
  column-count: 1;
  column-gap: clamp(2rem, 5vw, 4rem);
  column-rule: 1px solid rgba(12, 31, 64, 0.12);
  padding-inline: clamp(1rem, 1.7vw, 1.3rem);
}

.learn-longform p {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
  color: var(--text-muted);
  break-inside: avoid-column;
  -webkit-column-break-inside: avoid;
}

.learn-longform p + p {
  margin-top: clamp(0.9rem, 1.2vw, 1.2rem);
}

.reading-section {
  border-radius: 24px;
  border: 1px solid rgba(12, 31, 64, 0.1);
  background: var(--panel-bg);
  box-shadow: 0 10px 30px rgba(16, 37, 63, 0.08);
  padding: clamp(1rem, 2vw, 1.5rem);
}

.reading-section__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.reading-section--media-left .reading-section__media {
  order: 1;
}

.reading-section--media-left .reading-section__content {
  order: 2;
}

.reading-section__content {
  display: grid;
  gap: clamp(0.6rem, 1.4vw, 0.9rem);
}

.reading-section__content h2 {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}

.reading-section__media {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(12, 31, 64, 0.1);
  background: #fff;
}

.reading-section__media img,
.reading-section__media video {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  display: block;
}

.jump-panel h2,
.resources-panel h2 {
  margin-bottom: 0.8rem;
}

.jump-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.jump-link {
  --jump-accent: rgba(12, 31, 64, 0.28);
  --jump-soft: rgba(12, 31, 64, 0.08);
  --jump-shadow: rgba(16, 37, 63, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--jump-accent);
  background: #fff;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.94rem;
  padding: 0.45rem 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.jump-link--electricity {
  --jump-accent: rgba(94, 214, 247, 0.45);
  --jump-soft: rgba(94, 214, 247, 0.2);
  --jump-shadow: rgba(94, 214, 247, 0.25);
}

.jump-link--industry {
  --jump-accent: rgba(127, 127, 127, 0.45);
  --jump-soft: rgba(127, 127, 127, 0.16);
  --jump-shadow: rgba(127, 127, 127, 0.24);
}

.jump-link--land-food {
  --jump-accent: rgba(86, 204, 70, 0.45);
  --jump-soft: rgba(86, 204, 70, 0.18);
  --jump-shadow: rgba(86, 204, 70, 0.24);
}

.jump-link--buildings {
  --jump-accent: rgba(255, 170, 0, 0.45);
  --jump-soft: rgba(255, 170, 0, 0.18);
  --jump-shadow: rgba(255, 170, 0, 0.24);
}

.jump-link--transport {
  --jump-accent: rgba(237, 17, 100, 0.45);
  --jump-soft: rgba(237, 17, 100, 0.16);
  --jump-shadow: rgba(237, 17, 100, 0.24);
}

.jump-link:hover,
.jump-link:focus-visible,
.jump-link.is-active {
  border-color: var(--jump-accent);
  background: var(--jump-soft);
  box-shadow: 0 6px 16px var(--jump-shadow);
}

.category-panel {
  --category-accent: var(--accent-learn);
  --category-accent-soft: rgba(94, 214, 247, 0.12);
  --category-accent-ring: rgba(94, 214, 247, 0.5);
  display: grid;
  gap: 1rem;
}

.category-panel--electricity {
  --category-accent: var(--accent-learn);
  --category-accent-soft: rgba(94, 214, 247, 0.12);
  --category-accent-ring: rgba(94, 214, 247, 0.5);
}

.category-panel--industry {
  --category-accent: var(--accent-code);
  --category-accent-soft: rgba(127, 127, 127, 0.12);
  --category-accent-ring: rgba(127, 127, 127, 0.5);
}

.category-panel--land-food {
  --category-accent: var(--accent-teach);
  --category-accent-soft: rgba(86, 204, 70, 0.12);
  --category-accent-ring: rgba(86, 204, 70, 0.5);
}

.category-panel--buildings {
  --category-accent: var(--accent-paper);
  --category-accent-soft: rgba(255, 170, 0, 0.12);
  --category-accent-ring: rgba(255, 170, 0, 0.5);
}

.category-panel--transport {
  --category-accent: var(--accent-build);
  --category-accent-soft: rgba(237, 17, 100, 0.12);
  --category-accent-ring: rgba(237, 17, 100, 0.5);
}

.strategy-item,
.category-panel,
#top {
  scroll-margin-top: calc(var(--nav-height) + 12px);
}

.category-panel__head {
  display: grid;
  gap: 0.45rem;
}

.strategy-list {
  display: grid;
  gap: 0.75rem;
}

.strategy-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-panel .strategy-item--focus {
  outline: 3px solid var(--category-accent-ring);
  outline-offset: 2px;
}

.strategy-item > summary {
  --strategy-summary-pad: clamp(0.75rem, 1.4vw, 1rem);
  display: block;
  list-style: none;
  cursor: pointer;
  padding: var(--strategy-summary-pad);
}

.strategy-item > summary::-webkit-details-marker {
  display: none;
}

.category-panel .strategy-item[open] {
  border-color: var(--category-accent);
  box-shadow: 0 8px 20px rgba(16, 37, 63, 0.08);
}

.category-panel .strategy-item[open] > summary {
  background: var(--category-accent-soft);
}

.strategy-summary {
  gap: 0.9rem;
}

.strategy-item > summary.strategy-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.9rem;
  padding: 0 0 4px 16px;
}

.strategy-badge {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.strategy-badge-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 0;
}

.strategy-text {
  display: grid;
  gap: 0.2rem;
}

.strategy-text--link {
  text-decoration: none;
  color: inherit;
  align-self: stretch;
  padding: var(--strategy-summary-pad) var(--strategy-summary-pad)
    calc(var(--strategy-summary-pad) - 4px) var(--strategy-summary-pad);
}

.strategy-text--link:hover .strategy-title,
.strategy-text--link:focus-visible .strategy-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.strategy-title {
  color: var(--text-main);
  font-weight: 600;
}

.strategy-lead {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.strategy-body {
  display: grid;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding: 0.9rem clamp(0.75rem, 1.4vw, 1rem) 1rem;
}

.back-panel {
  text-align: left;
}

.video-panel {
  display: grid;
  gap: 1rem;
}

.video-panel .text-stack {
  max-width: none;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(12, 31, 64, 0.16);
  background: #000;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.resource-list {
  display: grid;
  gap: 0.7rem;
}

.resource-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  border-radius: 16px;
  border: 1px solid rgba(12, 31, 64, 0.12);
  background: #fff;
  padding: 0.7rem 0.9rem;
}

.resource-item__tag {
  border-radius: 9999px;
  border: 1px solid rgba(86, 204, 70, 0.28);
  background: rgba(86, 204, 70, 0.12);
  color: #1a6020;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.52rem;
}

.resource-item__text {
  color: var(--text-main);
  font-weight: 500;
}

.resource-item__action {
  color: var(--text-muted);
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .page-intro--with-media .page-intro__layout {
    grid-template-columns: 1fr;
  }

  .page-intro--with-media .page-intro__media {
    display: none;
  }

  .reading-section__layout {
    grid-template-columns: 1fr;
  }

  .reading-section--media-left .reading-section__media,
  .reading-section--media-left .reading-section__content {
    order: initial;
  }
}

@media (min-width: 1050px) {
  .learn-longform {
    column-count: 2;
  }
}

@media (max-width: 680px) {
  .strategy-summary {
    grid-template-columns: auto 1fr;
  }

  .resource-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 760px) {
  .site-nav__inner {
    gap: 0.5rem;
    padding: 0 clamp(0.5rem, 3vw, 0.85rem);
  }

  .site-brand {
    gap: 0.45rem;
    font-size: 0.85rem;
  }

  .site-brand img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .nav-link {
    padding: 0 0.55rem;
    font-size: 0.85rem;
    border-left-width: 0;
    border-right-width: 0;
  }
}

@media (max-width: 460px) {
  .site-nav__inner {
    gap: 0.35rem;
    padding: 0 0.45rem;
  }

  .site-brand {
    gap: 0.35rem;
    font-size: 0.78rem;
  }

  .site-brand img {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }

  .nav-link {
    padding: 0 0.38rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .site-nav__links--app .nav-link {
    justify-content: center;
    min-width: 2.2rem;
  }

  .site-nav__links--app .nav-link span {
    display: none;
  }
}

@media (max-width: 360px) {
  .site-brand span {
    display: none;
  }

  .site-brand {
    gap: 0;
  }

  .nav-link {
    padding: 0 0.34rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 960px) {
  .site-shell {
    padding: clamp(1.2rem, 5vw, 2.5rem);
  }

  .hero,
  .split,
  .split--reverse {
    grid-template-columns: 1fr;
  }

  .hero__media {
    order: 1;
    min-height: 420px;
    width: 100%;
    justify-self: stretch;
  }

  .split__media {
    order: 1;
    min-height: clamp(220px, 45vw, 320px);
  }

  .hero__content,
  .text-stack {
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .btn {
    width: 100%;
  }
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
}


.app-main {
  display: grid;
  grid-template-columns: minmax(0, 58%) minmax(0, 1fr);
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.chart-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

#chart {
  position: relative;
  /* height: clamp(420px, 58vh, 560px); */
  height: 100%;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.temperature-badges {
  position: absolute;
  bottom: 7rem;
  left: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
}

.temp-badge {
  min-width: 86px;
  border-radius: 18px;
  padding: 0.6rem 0.85rem;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(12, 31, 64, 0.25);
  cursor: default;
}

.temp-badge .temp-label {
  font-size: 0.75rem;
  opacity: 0.85;
}

.temp-badge .temp-value {
  font-size: 1.15rem;
}

.category-summary {
  right: 1rem;
  bottom: 0rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 2;
}

.summary-total {
  background: rgba(12, 31, 64, 0.9);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 10px 22px rgba(12, 31, 64, 0.25);
}

.summary-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.summary-pill {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(12, 31, 64, 0.1);
  box-shadow: 0 4px 12px rgba(12, 31, 64, 0.18);
  position: relative;
}

.summary-pill .info-button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 1rem;
}

.summary-pill .tooltip {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(13rem, calc(100vw - 1rem));
  background: rgba(12, 31, 64, 0.95);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  box-shadow: 0 8px 16px rgba(12, 31, 64, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.summary-pill:first-child .tooltip {
  left: 0;
  transform: none;
}

.summary-pill:last-child .tooltip {
  right: 0;
  left: auto;
  transform: none;
}

.summary-pill:hover .tooltip,
.summary-pill:focus-within .tooltip {
  opacity: 1;
}

.baseline-selector {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.0rem 0.9rem;

}

.baseline-selector select {
  border: none;
  background: rgba(12, 31, 64, 0.05);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  appearance: none;
}

.baseline-selector select:focus {
  outline: 2px solid var(--accent);
}

.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wedge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.4rem;
  max-height: clamp(420px, 60vh, 620px);
}

.wedge-card {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  border: 2px solid transparent;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 12px 28px rgba(12, 31, 64, 0.12);
}

.wedge-card:hover {
  box-shadow: 0 16px 36px rgba(12, 31, 64, 0.2);
}

.wedge-card.flash {
  animation: card-flash 0.6s ease;
}

@keyframes card-flash {
  0% {
    box-shadow: 0 12px 28px rgba(12, 31, 64, 0.12);
  }
  50% {
    box-shadow: 0 22px 40px rgba(12, 31, 64, 0.24);
  }
  100% {
    box-shadow: 0 12px 28px rgba(12, 31, 64, 0.12);
  }
}

.wedge-card:focus-visible {
  outline: 3px solid var(--accent);
}

.wedge-card.disabled {
  filter: saturate(0.3) brightness(0.92);
  cursor: not-allowed;
}

.wedge-card img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.7);
  object-fit: contain;
}

.wedge-card .card-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.wedge-card .card-text strong {
  display: inline;
  font-size: 1rem;
  color: var(--text-main);
}

.card-info,
.card-remove {
  position: absolute;
  top: 0.6rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(12, 31, 64, 0.18);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.card-info {
  right: 0.6rem;
}

.card-info:hover,
.card-info:focus-visible,
.card-remove:hover,
.card-remove:focus-visible {
  box-shadow: 0 0 0 2px rgba(10, 126, 164, 0.3);
}

.card-remove {
  right: 3rem;
  display: none;
}

.card-remove-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.wedge-card.deployed .card-remove {
  display: grid;
}

.limit-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6rem;
  background: rgba(12, 31, 64, 0.6);
  color: #fff;
  font-weight: 600;
  text-align: center;
  border-radius: 0 0 22px 22px;
  pointer-events: none;
}

.limit-overlay.hidden {
  display: none;
}

.card-shadow {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  z-index: -1;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wedge-card:hover .card-shadow {
  opacity: 0.8;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 41, 0.55);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 2rem;
  z-index: 20;
}

.modal-overlay.hidden {
  display: none;
}

.modal-dialog {
  background: #fff;
  border-radius: 26px;
  padding: 2.2rem;
  width: min(640px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(12, 31, 64, 0.28);
}

.modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.6rem;
  display: grid;
  place-items: center;
  background: rgba(12, 31, 64, 0.06);
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(12, 31, 64, 0.18);
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.45rem;
}

.modal-content p {
  color: var(--text-muted);
}

.modal-content li {
  color: var(--text-muted);
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  z-index: 30;
}

.toast {
  min-width: 260px;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: rgba(12, 31, 64, 0.92);
  color: #fff;
  box-shadow: 0 18px 44px rgba(5, 13, 25, 0.65);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toast-in 0.25s ease;
}

.toast i {
  font-size: 1.2rem;
}

@keyframes toast-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  to {
    transform: translateY(12px);
    opacity: 0;
  }
}

.wedge-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wedge-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  font-size: 0.7em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  white-space: nowrap;
  width: max-content;
  padding: 0.06rem 0.1rem 0.06rem 0.5rem;
  border: 1px solid rgba(12, 31, 64, 0.12);
  box-shadow: 0 8px 20px rgba(12, 31, 64, 0.22);
  pointer-events: auto;
}

.wedge-label button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 0.7rem;
  font-weight: 700;
}

.wedge-label button:hover,
.wedge-label button:focus-visible {
  color: #d12f3f;
}

.share-panel {
  display: grid;
  gap: 1rem;
}

.share-block {
  display: grid;
  gap: 0.45rem;
}

.share-block label {
  font-weight: 600;
}

.share-block textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(12, 31, 64, 0.18);
  padding: 0.65rem 0.75rem;
  font-size: 0.97rem;
  color: var(--text-main);
  background: rgba(246, 249, 253, 0.9);
  resize: vertical;
}

.share-copy-button {
  justify-self: flex-start;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  border: none;
  background: #0a7ea4;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.share-copy-button:hover,
.share-copy-button:focus-visible {
  background: #065d77;
}

.save-form {
  display: grid;
  gap: 1rem;
}

.save-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
}

.save-form input,
.save-form select {
  border-radius: 12px;
  border: 1px solid rgba(12, 31, 64, 0.18);
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
}

.save-form button {
  justify-self: flex-start;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  border: none;
  background: #0a7ea4;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.save-form button:hover,
.save-form button:focus-visible {
  background: #065d77;
}

.splash-content {
  text-align: center;
}

.splash-content p {
  color: var(--text-muted);
}

.splash-content button {
  margin-top: 1.5rem;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  border: none;
  background: #0a7ea4;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.splash-content button:hover,
.splash-content button:focus-visible {
  background: #07607d;
}

.tooltip-card {
  font-size: 0.85rem;
  margin-top: 0.4rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 1200px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 45%);
  }
}

@media (max-width: 960px) {
  .toast-container {
    right: 1rem;
    left: 1rem;
    align-items: flex-end;
  }
}

/* Make the shell use the dynamic viewport height and act like a vertical layout */
#app {
  min-height: 100dvh;      /* modern browsers */
  /* fallback is already set earlier as 100vh */
  display: flex;
  flex-direction: column;
}

/* Let the main grid expand to fill leftover vertical space between header and bottom padding */
.app-main {
  flex: 1 1 auto;          /* grow to fill #app */
  min-height: 0;           /* important: allow children to size with flex/grid */
}

/* Ensure each panel stretches to the full height of the grid row */
.app-main > .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Prefer flex growth over % heights for the chart stack */
.chart-wrapper {
  flex: 1 1 auto;          /* replaces the need for height:100% */
  min-height: 0;
}

#chart {
  flex: 1 1 auto;          /* the SVG container fills the remaining column */
  min-height: 320px;       /* safety floor; adjust to taste */
}

/* Layout for visual wedge info */
.modal-content .wedge-info {
  display: grid;
  gap: 1rem;
}

/* Header: icon on left, title+lead on right */
.modal-content .wedge-info__header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 1rem;
}

/* Icon is sized by JS to match the header text block height */
.modal-content .wedge-info__icon {
  display: block;
  width: auto;       /* keep aspect ratio */
  height: 64px;      /* safe initial before JS adjustment */
  max-width: min(28vw, 220px);
  object-fit: contain;
}

/* Title + lead */
.modal-content .wedge-info__title {
  margin: 0;
  line-height: 1.12;
}

.modal-content .wedge-info__lead {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  display: -webkit-box;
  line-clamp: 2;            /* clamp to two lines */
  -webkit-line-clamp: 2;   /* clamp to two lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Small screens: stack header vertically */
@media (max-width: 520px) {
  .modal-content .wedge-info__header {
    grid-template-columns: 1fr;
  }
  .modal-content .wedge-info__icon {
    height: 56px !important; /* modest icon when stacked */
  }
}


/* 1) Lock the entire app to the viewport height (padding included thanks to global border-box) */
#app {
  height: 100vh;   /* fallback */
  height: 100dvh;  /* modern dynamic viewport */
  min-height: 0;   /* override earlier min-height so content can't force taller than the viewport */
}

/* 2) Let the main two-column grid occupy all remaining vertical space below the header */
.app-main {
  flex: 1 1 auto;  /* grow inside #app (which is a flex column) */
  min-height: 0;   /* critical for inner scrolling to work */
}

/* 3) Each panel is a vertical stack that can host a scrollable child */
.app-main > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;   /* allow scroll areas inside */
}

/* (nice-to-have) Ensure the left chart column also stretches cleanly */
.game-panel .chart-wrapper {
  flex: 1 1 auto;
  min-height: 0;
}
#chart {
  flex: 1 1 auto;
  min-height: 320px; /* safety floor */
}

/* 4) Make the wedge list fill the remaining space of the right panel and scroll internally */
.menu-panel { min-height: 0; } /* belt & braces */
.menu-panel .wedge-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: none;  /* override the earlier clamp(...) so flex height takes over */
}

/* ==== Wedge info layout (used by the external HTML snippets) ==== */
.modal-content .wedge-info {
  display: block;
}

.modal-content .wedge-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 0.9rem;
  margin-block-end: 1.25rem;
}

.modal-content .wedge-head .icon {
  height: 9.5rem;
  width: auto;
}

.modal-content .wedge-head .text {
  /* Keep clear of the modal close button in the top-right */
  padding-right: 2rem;
}

.modal-content .wedge-head .text h2 {
  margin: 0;
}

.modal-content .wedge-head .lead {
  padding-top: 0.5rem;
  color: var(--text-main);
  margin: 0.35rem 0 0 0;
  font-weight: 700;
}

.modal-content .wedge-body > :first-child { margin-top: 0.25rem; }

/* Responsive: stack image above text on narrow modals */
@media (max-width: 560px) {
  .modal-content .wedge-head {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }
  .modal-content .wedge-head .icon {
    /* Smaller, but still visible */
    height: clamp(44px, 18vw, 80px);
    max-width: 40%;
  }
  .modal-content .wedge-head .text { padding-right: 0; }
}

/* ========================================================================== */
/* Adaptive pathway-builder workspace                                         */
/* ========================================================================== */

#app {
  --builder-content-pad: clamp(0.35rem, 0.65vw, 0.7rem);
  --nav-height: 44px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

#app .site-nav--app {
  flex: 0 0 auto;
}

#app .site-nav--app .site-nav__inner {
  width: min(100%, 1920px);
  height: 44px;
  min-height: 44px;
}

#app .site-nav__links--app {
  align-items: center;
}

#app .site-nav__links--app .nav-link {
  height: 44px;
  line-height: 1;
  border-bottom-width: 2px;
}

#app .app-main {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 53fr) minmax(360px, 47fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

#app .app-main > .panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#app .app-main > .game-panel {
  border-right: 1px solid var(--divider);
}

#app .chart-wrapper {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--builder-content-pad);
  gap: clamp(0.35rem, 0.7vw, 0.7rem);
}

#app #chart {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-width: 0;
  min-height: 0;
}

#app .baseline-selector {
  min-height: 2rem;
  max-width: 100%;
  padding: 0 0.25rem;
  gap: clamp(0.35rem, 0.8vw, 0.6rem);
  font-size: clamp(0.76rem, 0.7rem + 0.25vw, 0.95rem);
  line-height: 1.2;
}

#app .baseline-selector select {
  max-width: 100%;
  min-height: 2rem;
  padding: 0.32rem 1.9rem 0.32rem 0.68rem;
  font: inherit;
}

#app .temperature-badges {
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  transform: translateY(-100%);
  flex-direction: row;
  align-items: flex-end;
  gap: clamp(0.25rem, 0.6vw, 0.5rem);
}

#app .temp-badge {
  min-width: clamp(64px, 6.5vw, 86px);
  border-radius: clamp(10px, 1.15vw, 16px);
  padding: clamp(0.32rem, 0.55vw, 0.58rem) clamp(0.48rem, 0.8vw, 0.8rem);
}

#app .temp-badge .temp-label {
  font-size: clamp(0.62rem, 0.56rem + 0.22vw, 0.75rem);
}

#app .temp-badge .temp-value {
  font-size: clamp(0.82rem, 0.72rem + 0.42vw, 1.15rem);
}

#app .app-main > .menu-panel {
  container-type: inline-size;
  padding: var(--builder-content-pad);
  gap: 0;
}

#app .category-summary {
  flex: 0 0 auto;
  width: auto;
  align-self: stretch;
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: clamp(0.25rem, 0.7cqi, 0.45rem);
  padding-bottom: clamp(0.4rem, 0.8cqi, 0.75rem);
  z-index: 20;
}

#app .summary-total {
  flex: 1 1 10rem;
  width: auto;
  min-width: max-content;
  padding: clamp(0.35rem, 0.7cqi, 0.5rem) clamp(0.65rem, 1.2cqi, 0.9rem);
  font-size: clamp(0.8rem, 0.73rem + 0.28cqi, 0.95rem);
  color: var(--text-main);
  background: rgba(12, 31, 64, 0.07);
  box-shadow: none;
}

#app .summary-categories {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
  gap: clamp(0.22rem, 0.55cqi, 0.35rem);
}

#app .summary-pill {
  padding: clamp(0.22rem, 0.5cqi, 0.35rem) clamp(0.42rem, 0.9cqi, 0.65rem);
  font-size: clamp(0.7rem, 0.65rem + 0.22cqi, 0.8rem);
}

#app .wedge-grid {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  grid-auto-rows: max-content;
  gap: clamp(0.4rem, 0.9cqi, 0.7rem);
  margin-inline: calc(-1 * var(--builder-content-pad));
  border-top: 1px solid var(--divider);
  padding: 0.08rem calc(var(--builder-content-pad) + clamp(0.2rem, 0.6cqi, 0.4rem)) 0.15rem calc(var(--builder-content-pad) + 0.08rem);
}

#app .wedge-card[hidden] {
  display: none !important;
}

#app .wedge-card {
  --card-action-width: 38px;
  min-width: 0;
  min-height: 104px;
  display: grid;
  grid-template-columns: clamp(78px, 13cqi, 102px) minmax(0, 1fr) var(--card-action-width);
  align-items: stretch;
  gap: clamp(0.35rem, 0.7cqi, 0.52rem);
  padding: clamp(0.38rem, 0.72cqi, 0.55rem);
  border-width: 2px;
  border-radius: clamp(12px, 1.4cqi, 17px);
  background: #fff;
  box-shadow: 0 5px 14px rgba(12, 31, 64, 0.09);
  transition: box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

#app .wedge-card:hover {
  box-shadow: 0 8px 20px rgba(12, 31, 64, 0.14);
}

#app .wedge-card.deployed {
  background: rgba(246, 249, 253, 0.96);
}

#app .wedge-card .card-shadow {
  display: none;
}

#app .wedge-card .card-icon {
  grid-column: 1;
  width: 100%;
  aspect-ratio: 1;
  align-self: center;
  position: relative;
}

#app .wedge-card img {
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: clamp(10px, 1.4cqi, 15px);
}

#app .wedge-card .card-text {
  grid-column: 2;
  min-width: 0;
  display: block;
  align-self: center;
  color: var(--text-muted);
  font-size: clamp(0.75rem, 0.7rem + 0.22cqi, 0.88rem);
  line-height: 1.25;
}

#app .wedge-card .card-text strong {
  display: inline;
  color: var(--text-main);
  font-size: clamp(0.8rem, 0.74rem + 0.26cqi, 0.95rem);
  line-height: inherit;
}

#app .wedge-card .card-detail {
  display: inline;
  font: inherit;
  line-height: inherit;
}

#app .wedge-card .card-detail::before {
  content: " ";
}

#app .card-actions {
  grid-column: 3;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  align-self: stretch;
  gap: 4px;
  position: relative;
  z-index: 2;
}

#app .card-info,
#app .card-remove {
  position: static;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  font-size: clamp(1rem, 0.9rem + 0.45cqi, 1.3rem);
}

#app .card-info {
  flex: 0 0 auto;
}

#app .card-remove {
  flex: 0 0 auto;
  display: grid;
  visibility: hidden;
}

#app .wedge-card.deployed .card-remove {
  display: grid;
  visibility: visible;
}

#app .card-count {
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  z-index: 1;
  transform: translate(-2px, -4px);
  min-height: 0;
  padding: 0;
  color: var(--text-main);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: clamp(0.68rem, 0.64rem + 0.16cqi, 0.76rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#app .card-count.hidden {
  visibility: hidden;
}

#app .limit-overlay {
  z-index: 1;
  right: 0;
  border-radius: 0 0 clamp(10px, 1.2cqi, 15px) clamp(10px, 1.2cqi, 15px);
  padding: 0.42rem;
  font-size: clamp(0.72rem, 0.66rem + 0.22cqi, 0.84rem);
}

@media (max-width: 719px) and (orientation: portrait) {
  #app .app-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 42fr) minmax(0, 58fr);
  }

  #app .app-main > .game-panel {
    border-right: 0;
    border-bottom: 1px solid var(--divider);
  }

  #app .baseline-selector {
    width: 100%;
    justify-content: space-between;
  }

  #app .temp-badge {
    min-width: 58px;
    padding: 0.24rem 0.38rem;
    border-radius: 9px;
  }

  #app .summary-total {
    padding: 0.3rem 0.62rem;
  }

  #app .wedge-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
  }

  #app .wedge-card {
    --card-action-width: 40px;
    min-height: 104px;
    grid-template-columns: clamp(76px, 22vw, 84px) minmax(0, 1fr) var(--card-action-width);
    padding: 0.42rem;
    gap: 0.42rem;
  }

  #app .wedge-card img {
    width: 100%;
    height: 100%;
  }

  #app .wedge-card .card-text strong {
    font-size: clamp(0.8rem, 2.35vw, 0.9rem);
  }

  #app .wedge-card .card-detail {
    font-size: clamp(0.75rem, 2.15vw, 0.84rem);
  }

  #app .card-info,
  #app .card-remove {
    width: 40px;
    height: 40px;
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  #app .app-main {
    grid-template-columns: minmax(0, 53fr) minmax(0, 47fr);
    grid-template-rows: minmax(0, 1fr);
  }

  #app .temp-badge {
    min-width: 54px;
    padding: 0.2rem 0.35rem;
    border-radius: 8px;
  }

  #app .baseline-selector {
    min-height: 1.75rem;
  }

  #app .wedge-card {
    --card-action-width: 32px;
    min-height: 82px;
    grid-template-columns: 56px minmax(0, 1fr) var(--card-action-width);
    gap: 0.3rem;
    padding: 0.32rem;
  }

  #app .wedge-card img {
    width: 100%;
    height: 100%;
  }

  #app .wedge-card .card-text strong {
    font-size: 0.76rem;
  }

  #app .wedge-card .card-detail {
    font-size: 0.72rem;
  }

  #app .card-info,
  #app .card-remove {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
}

@container (max-width: 250px) {
  #app .summary-categories {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app .wedge-card,
  #app .toast,
  #app .wedge-card.flash {
    animation: none;
    transition: none;
  }
}
