:root {
  --bg: #faf9f4;
  --card-bg: #ffffff;
  --text: #3f4a2e;
  --text-light: #6b7460;
  --accent: #8a9a6e;
  --accent-dark: #6f7f56;
  --border: #dde2d2;
  --frame: #2b3620;
  --frame-width: 18px;
  --max-width: 1040px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--frame);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-light);
  line-height: 1.65;
  padding-top: 104px;
  border: var(--frame-width) solid var(--frame);
  min-height: 100vh;
}

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

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

.wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Floating pill nav */
.floating-nav {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1.5px dashed var(--border);
  border-radius: 999px;
  padding: 8px 8px;
  box-shadow: 0 8px 24px rgba(63, 74, 46, 0.1);
}

.nav-indicator {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 0;
  border-radius: 999px;
  background: var(--text);
  transition: left 0.25s ease, width 0.25s ease;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

.floating-nav a {
  position: relative;
  z-index: 1;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--text-light);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.floating-nav a:hover {
  color: var(--text);
  background: var(--border);
}

.floating-nav a:active {
  color: #fff;
  background: var(--text);
  transform: scale(0.96);
}

.floating-nav a.active {
  color: #fff;
  font-weight: 600;
}

.floating-nav a.active:hover {
  color: #fff;
  background: transparent;
}

.floating-nav .brand {
  padding: 10px 16px 10px 20px;
  font-weight: 700;
  color: var(--text);
  position: relative;
  z-index: 1;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 100px;
}

/* Hero */
.hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 80px;
}

.hero-photo-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 0.7vw, 8px);
  margin: 0 auto 48px;
  flex-wrap: wrap;
  width: 100vw;
  max-width: 840px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.photo-item {
  width: clamp(108px, 14vw, 148px);
  height: clamp(108px, 14vw, 148px);
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.14);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-item.photo-center {
  width: clamp(124px, 16vw, 168px);
  height: clamp(124px, 16vw, 168px);
  border-radius: 26px;
}

@media (max-width: 640px) {
  .hero-photo-row {
    gap: 4px;
  }

  .photo-item {
    width: 66px;
    height: 66px;
    border-radius: 14px;
  }

  .photo-item.photo-center {
    width: 80px;
    height: 80px;
    border-radius: 18px;
  }
}

.hero h1 {
  font-size: 2.8rem;
  color: var(--text);
  margin: 0 0 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0 0 20px;
  font-size: 1.05rem;
}

.hero-links {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  background: var(--text);
  color: #fff !important;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease;
}

.pill:hover {
  background: var(--accent-dark);
}

.pill:active {
  background: var(--frame);
  transform: scale(0.96);
}

.pill.outline {
  background: transparent;
  color: var(--text) !important;
  border: 1.5px solid var(--border);
}

.pill.outline:hover {
  background: var(--border);
  border-color: var(--text);
}

.pill.outline:active {
  background: var(--text);
  color: #fff !important;
  border-color: var(--text);
  transform: scale(0.96);
}

/* Section headers */
.section-label {
  text-align: center;
  font-size: 2.6rem;
  color: var(--text);
  margin: 0 0 40px;
  font-weight: 700;
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project-card {
  display: block;
  text-align: center;
  transition: transform 0.15s ease;
}

.project-card:hover {
  transform: translateY(-4px);
}

.project-card:active {
  transform: translateY(-1px) scale(0.98);
}

.project-card img {
  border-radius: 16px;
  width: 75%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(63, 74, 46, 0.12);
}

.project-card h3 {
  color: var(--text);
  font-size: 1.15rem;
  margin: 0 0 4px;
}

.project-card span {
  color: var(--text-light);
  font-size: 0.9rem;
}

#projects,
#resume,
#contact {
  scroll-margin-top: 110px;
}

/* Project detail pages */
.project-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}

.project-header .tag {
  display: inline-block;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.project-header h1 {
  font-size: 2.6rem;
  color: var(--text);
  margin: 0 0 24px;
  line-height: 1.15;
}

.project-header p {
  font-size: 1.05rem;
  margin: 0;
}

.project-cover {
  border-radius: 20px;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  margin-bottom: 64px;
  box-shadow: 0 16px 40px rgba(63, 74, 46, 0.14);
}

section.block {
  max-width: 760px;
  margin: 0 auto 56px;
}

section.block h3 {
  color: var(--text);
  font-size: 1.3rem;
  margin-bottom: 16px;
}

section.block h3.centered-heading {
  text-align: center;
}

section.block h4 {
  color: var(--text);
  font-size: 1.05rem;
  margin: 20px 0 8px;
}

section.block ul {
  padding-left: 20px;
  margin: 0 0 16px;
}

section.block li {
  margin-bottom: 8px;
}

.img-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 28px 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.img-row figure {
  margin: 0;
  flex: 1 1 220px;
  max-width: 320px;
}

.img-row img {
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
}

.img-row.match-height img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.img-row.one-line {
  flex-wrap: nowrap;
}

.img-row.one-line figure {
  flex: 1 1 0;
  max-width: none;
  min-width: 0;
}

.img-row.one-line.match-height img {
  height: 200px;
}

@media (max-width: 700px) {
  .img-row.one-line {
    flex-wrap: wrap;
  }

  .img-row.one-line figure {
    flex: 1 1 40%;
    max-width: 40%;
  }
}

.img-row figcaption {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 8px;
  text-align: center;
}

.map-figure {
  margin: 0;
}

.map-figure svg,
.map-figure img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  background: #eef1e2;
}

.map-figure figcaption {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 8px;
  text-align: center;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin: 28px 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.gallery img {
  border-radius: 12px;
  width: 100%;
  height: 160px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(63, 74, 46, 0.1);
}

.media-placeholder {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--text-light);
  font-size: 0.82rem;
  line-height: 1.4;
}

.media-placeholder.large {
  height: 260px;
  font-size: 0.95rem;
}

.media-placeholder.video {
  height: auto;
  aspect-ratio: 9 / 16;
}

.media-placeholder.tall {
  height: auto;
  aspect-ratio: 4 / 5;
}

/* Wide block for side-by-side layouts */
section.block.wide {
  max-width: 900px;
}

.section-heading {
  border-top: 1px solid var(--border);
  padding-top: 48px;
  text-align: center;
  margin-bottom: 40px;
}

.section-heading h2 {
  color: var(--text);
  font-size: 2rem;
  margin: 0 0 16px;
}

.section-heading p {
  max-width: 620px;
  margin: 0 auto;
}

.two-col.middle {
  align-items: center;
}

.two-col.middle .diagram-photo {
  width: 100%;
  height: 260px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
}

.test-row {
  display: flex;
  gap: 40px;
  margin: 40px 0;
  align-items: flex-start;
}

.test-block {
  flex: 1 1 0;
  min-width: 0;
}

.test-block p {
  margin: 0 0 12px;
}

.test-block ul {
  padding-left: 20px;
  margin: 0 0 20px;
}

.test-block ul li {
  margin-bottom: 8px;
}

.test-divider {
  align-self: stretch;
  width: 0;
  border-left: 1.5px dashed var(--border);
}

.test-block .test-video {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  background: #000;
  display: block;
}

section.block ul.nested > li {
  margin-bottom: 12px;
}

section.block ul.nested ul {
  list-style: circle;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .test-row {
    flex-direction: column;
  }
  .test-divider {
    display: none;
  }
}

/* Version-by-version development table */
.version-table {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 32px 0;
}

.version-row {
  display: grid;
  grid-template-columns: 150px 1fr 220px;
  gap: 12px;
  background: var(--border);
  border-radius: 14px;
  padding: 24px;
}

.version-label strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.version-label ul {
  padding-left: 16px;
  margin: 0;
  font-size: 0.85rem;
}

.version-label ul li {
  margin-bottom: 8px;
}

.version-media {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
}

.version-media .media-placeholder {
  flex: 1 1 90px;
  height: 100px;
  font-size: 0.68rem;
  background: var(--card-bg);
}

.version-media img,
.version-media video {
  flex: 0 0 auto;
  height: 150px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 4px 12px rgba(63, 74, 46, 0.1);
  display: block;
}

.version-media video.portrait {
  height: 225px;
}

.version-notes ul {
  padding-left: 16px;
  margin: 0;
  font-size: 0.85rem;
}

.version-notes ul li {
  margin-bottom: 8px;
}

@media (max-width: 800px) {
  .version-row {
    grid-template-columns: 1fr;
  }
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 56px 0;
}

.media-placeholder.dark {
  background: #1c2216;
  border-color: #1c2216;
  color: rgba(255, 255, 255, 0.7);
}

.media-placeholder.play {
  position: relative;
}

.media-placeholder.play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(63, 74, 46, 0.85);
}

.media-placeholder.play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-42%, -50%);
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #fff;
}

.media-placeholder.dark.play::before {
  background: rgba(255, 255, 255, 0.85);
}

.media-placeholder.dark.play::after {
  border-color: transparent transparent transparent var(--text);
}

.image-set {
  margin: 32px 0;
}

.image-set .row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 12px;
}

.image-set .row img,
.image-set .row .media-placeholder {
  border-radius: 12px;
  width: 100%;
  height: 180px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
}

.image-set .row.portrait img,
.image-set .row.portrait .media-placeholder {
  height: 280px;
}

.image-set .row.two {
  grid-template-columns: repeat(2, 1fr);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.image-set figcaption {
  text-align: center;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.testing-media-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 32px 0;
}

.testing-media-row figure {
  margin: 0;
}

.testing-media-row img,
.testing-media-row video {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  display: block;
  background: #000;
}

.testing-media-row figcaption {
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .testing-media-row {
    grid-template-columns: 1fr;
  }
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.4fr;
  gap: 40px;
  align-items: start;
  margin: 40px 0;
}

.feature-row .big-heading {
  color: var(--text);
  font-size: 2.2rem;
  line-height: 1.15;
  margin: 0;
}

.feature-row h4 {
  color: var(--text);
  font-size: 1rem;
  margin: 0 0 8px;
}

.feature-row ul {
  padding-left: 18px;
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.feature-row ul li {
  margin-bottom: 8px;
}

.feature-row .media-placeholder,
.feature-row img,
.feature-row video {
  border-radius: 14px;
  width: 100%;
  height: 260px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  background: #000;
  display: block;
}

.feature-row video.portrait {
  width: auto;
  max-width: 100%;
  height: 420px;
  object-fit: contain;
  margin: 0 auto;
  justify-self: center;
}

.feature-row video.square {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

@media (max-width: 900px) {
  .feature-row {
    grid-template-columns: 1fr;
  }
  .image-set .row {
    grid-template-columns: 1fr 1fr;
  }
}

.split-title {
  text-align: center;
  color: var(--text);
  font-size: 1.8rem;
  margin: 0 0 8px;
}

.split-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent);
  margin: 14px auto 32px;
  border-radius: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

.two-col h3 {
  margin-top: 0;
}

.two-col ol {
  padding-left: 20px;
  margin: 0;
}

.two-col ol li {
  margin-bottom: 16px;
}

.video-row {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 32px 0;
}

.video-row figure {
  margin: 0;
  flex: 1 1 200px;
  max-width: 220px;
}

.video-row figcaption {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 10px;
  text-align: center;
}

.video-row video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  background: #000;
  display: block;
}

.config-diagram {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  background: var(--card-bg);
}

.table-scroll {
  overflow-x: auto;
  margin: 24px 0 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table caption {
  caption-side: bottom;
  margin-top: 10px;
  font-style: italic;
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
}

.data-table td.poor {
  background: #e2554f;
  color: #fff;
  font-weight: 600;
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Contact & resume pages */
.page-header {
  text-align: center;
  margin-bottom: 48px;
}

.page-header h2 {
  color: var(--text);
  font-size: 2.6rem;
  margin: 0;
}

.contact-info {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.contact-info p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.resume-viewer {
  max-width: 720px;
  margin: 0 auto;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(63, 74, 46, 0.1);
}

.resume-viewer iframe {
  width: 100%;
  height: 760px;
  border: none;
  display: block;
}

@media (max-width: 640px) {
  .resume-viewer iframe {
    height: 480px;
  }
}

footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-light);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  body {
    padding-top: 88px;
  }
  .floating-nav {
    gap: 2px;
    padding: 6px 6px;
  }
  .floating-nav a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .project-header h1 {
    font-size: 1.9rem;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* Three-column panel layout */
.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  margin: 32px 0;
}

.three-col h3 {
  margin-top: 0;
}

.three-col ul {
  padding-left: 18px;
  margin: 0;
  font-size: 0.92rem;
}

.three-col ul li {
  margin-bottom: 8px;
}

.three-col + .divider {
  margin-top: 16px;
}

@media (max-width: 900px) {
  .three-col {
    grid-template-columns: 1fr;
  }
}

.two-col-decisions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  margin: 32px 0;
}

.two-col-decisions h3 {
  margin-top: 0;
}

.two-col-decisions ul {
  padding-left: 18px;
  margin: 0;
  font-size: 0.92rem;
}

.two-col-decisions ul li {
  margin-bottom: 8px;
}

.stacked-panels {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

@media (max-width: 900px) {
  .two-col-decisions {
    grid-template-columns: 1fr;
  }
}

/* Step process timeline */
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  margin: 32px 0;
}

.process-grid.centered-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.process-grid.centered-wrap .process-step {
  flex: 0 1 240px;
}

.process-grid.centered-wrap.one-line {
  flex-wrap: nowrap;
}

.process-grid.centered-wrap.one-line .process-step {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 700px) {
  .process-grid.centered-wrap.one-line {
    flex-wrap: wrap;
  }

  .process-grid.centered-wrap.one-line .process-step {
    flex: 1 1 45%;
  }
}

.process-step .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.process-step h4 {
  color: var(--text);
  font-size: 0.95rem;
  margin: 0 0 12px;
}

.process-step img,
.process-step .media-placeholder {
  border-radius: 12px;
  width: 100%;
  height: 140px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(63, 74, 46, 0.1);
  margin-bottom: 10px;
}

.process-step figcaption {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
}

.mini-gallery {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.mini-gallery img {
  flex: 1 1 0;
  min-width: 0;
  height: 130px;
  object-fit: contain;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}

.calc-image {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--card-bg);
}

/* Color legend rows (e.g. status thresholds) */
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 32px 0 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

/* Interactive water demo (Harbor Pulse How It Works) */
.hiw-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin: 24px 0 36px;
}

.hiw-visual {
  text-align: center;
}

.hiw-visual svg {
  width: 150px;
  height: auto;
}

.hiw-readout {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 10px 0 0;
}

.hiw-readout span {
  font-weight: 600;
  color: var(--text);
}

.hiw-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hiw-group-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin: 0 0 8px;
  text-align: center;
}

.hiw-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.hiw-btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hiw-btn:hover {
  border-color: var(--accent);
}

.hiw-btn.active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.graph-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 32px auto;
}

.graph-row figure {
  margin: 0;
}

.graph-row img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
}

.graph-row figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 8px;
}

@media (max-width: 700px) {
  .graph-row {
    grid-template-columns: 1fr;
  }
}

/* "How it works" annotated tube diagram */
.diagram-scroll {
  overflow-x: auto;
  margin: 32px auto;
  max-width: 900px;
  padding-bottom: 6px;
}

.diagram-svg {
  display: block;
  min-width: 720px;
  width: 100%;
  height: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.diagram-callout {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Annotated setup photo with numbered markers */
.testing-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 32px;
  margin: 32px auto;
  max-width: 620px;
}

.annotated-photo {
  position: relative;
  flex: 0 0 348px;
  width: 348px;
  height: 464px;
  margin: 0;
}

.annotated-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(63, 74, 46, 0.1);
  display: block;
}

.annotated-marker {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  transform: translate(0, -50%);
}

.annotated-marker .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c24a42;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #c24a42;
  flex-shrink: 0;
}

.annotated-marker .label {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.inset-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 0 0 120px;
  width: 120px;
}

.inset-column figure {
  margin: 0;
}

.inset-column img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(63, 74, 46, 0.1);
  display: block;
}

.inset-column figcaption {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 6px;
  text-align: center;
}

@media (max-width: 640px) {
  .testing-layout {
    flex-direction: column;
    align-items: center;
  }
  .annotated-photo {
    margin: 0 auto;
  }
  .inset-column {
    flex-direction: row;
    width: 100%;
    max-width: 360px;
    gap: 14px;
    margin-top: 20px;
  }
  .inset-column figure {
    flex: 1;
  }
}
