:root {
  --bg-color: hsl(45deg 29% 95%); /* #f5f3ed */
  --section-color: hsl(0deg 0% 96%); /* #f4f4f4 */
  --section-color-alt: hsl(210deg 36% 96%); /* #f0f4f8 */
  --text-color: hsl(0deg 0% 20%); /* #333333 */

  --brand-accent: hsl(205deg 49% 34%); /* #2d5e82 */
  --button-bg: hsl(200deg 54% 54%); /* #4a9fc9 */
  --button-hover: hsl(205deg 49% 34%); /* #2d5e82 */
  --button-clicked: hsl(85deg 40% 45%); /* #7aa145 */
  --button-text: hsl(0deg 0% 100%); /* #ffffff */

  --client-fill: hsl(200deg 54% 54%); /* #4a9fc9 */
  --client-stroke: hsl(200deg 54% 44%);
  --repeater-fill: hsl(205deg 49% 34%); /* #2d5e82 */
  --repeater-stroke: hsl(205deg 49% 24%);
  --packet-fill: hsl(11deg 61% 62%); /* #d97762 */
  --packet-stroke: hsl(0deg 0% 100%); /* #ffffff */
  --broadcast-stroke: hsl(40deg 77% 57%); /* #e6ad3f */

  scroll-behavior: smooth;
  scroll-padding-top: 40px;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: var(--text-color);
  background-color: #fff;
}

h2 {
  margin-bottom: 1rem;
  font-size: 2rem;
  color: var(--packet-fill);
}

p {
  font-size: 1.1rem;
  line-height: 1.6;
}

p + p {
  margin-top: 1rem;
}

ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

ul li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

a {
  font-weight: 500;
  color: var(--button-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--button-bg);
}

/* ---------- NAVBAR ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background-color: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.nav-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
}

.brand {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.brand span {
  white-space: nowrap;
}

.brand .highlight {
  margin-left: 0.1em;
  color: var(--brand-accent);
  transition: color 0.2s ease;
}

.brand:hover .highlight {
  color: var(--button-bg);
}

.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
}

.nav-links a {
  padding: 0.25rem 0.5rem;
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 4px;
  transition:
    color 0.1s,
    background-color 0.4s;
}

.nav-links a:hover {
  color: var(--button-text);
  background-color: var(--button-clicked);
}

.hamburger {
  display: none;
}

@media (width <= 768px) {
  /* hide menu until toggled */
  nav {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    pointer-events: none;
    background: #fff;
    box-shadow: 0 4px 8px rgb(0 0 0 / 8%);
    opacity: 0;
    transform: translateY(-20px);
    transition:
      transform 0.2s ease,
      opacity 0.2s ease;
  }

  .nav-links {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  nav.open {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
  }

  .hamburger {
    all: unset;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
  }

  .hamburger:focus {
    outline: auto;
    outline-offset: 2px;
  }

  .hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-color);
    transition:
      transform 0.2s,
      opacity 0.2s;
  }

  .hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---------- HERO SECTION ---------- */
.hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
  min-height: 360px;
  overflow: hidden;
  touch-action: manipulation;
  /* stylelint-disable-next-line property-no-vendor-prefix */
  -webkit-user-select: none;
  user-select: none;
  background-color: var(--bg-color);
}

.hero-overlay {
  position: static;
  top: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  padding: 1rem;
  pointer-events: none;
  background: url("../img/opengraph-background.webp") center / cover no-repeat;
  box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
}

.hero-text-background {
  max-width: 90%;
  padding: 1.5rem 2rem;
  text-align: center;
  background-color: rgb(0 0 0 / 60%);
  border-radius: 5px;
}

.hero-title {
  margin-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
}

.hero-description {
  max-width: 600px;
  font-size: 1.2rem;
  color: white;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 30vh;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-bottom: 1px solid rgb(255 255 255 / 50%);
}

.info-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  padding: 0;
  color: rgb(0 0 0 / 40%); /* light semi-transparent */
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.2s ease;
}

.info-button:hover {
  color: var(--button-hover);
}

.info-button svg {
  display: block;
  width: 28px;
  height: 28px;
}

.sim-info-panel {
  position: fixed;
  top: 128px;
  left: 50%;
  z-index: 100;
  max-width: 80%;
  padding: 1rem 1.5rem;
  overflow: auto;
  color: #111;
  background: rgb(255 255 255 / 95%);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
  transform: translateX(-50%);
}

@media (width <= 768px) {
  .sim-info-panel {
    top: 100px;
    width: 90%;
    max-width: none;
  }

  .sim-info-panel p,
  .sim-info-panel li {
    font-size: 0.9rem;
  }
}

.sim-info-panel ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0;
}

.sim-info-panel li {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.sim-info-close {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 101;
  font-size: 1.5rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  background: none;
  border: none;
}

.sim-info-close:hover {
  color: #000;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  padding: 1rem;
  margin: 0 auto;
  /* stylelint-disable-next-line property-no-vendor-prefix */
  -webkit-user-select: none;
  user-select: none;
  background: linear-gradient(to bottom, hsl(45deg 29% 95%), transparent);
}

.controls button {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--button-text);
  touch-action: manipulation;
  cursor: pointer;
  background-color: var(--button-bg);
  border: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  font-size: inherit;
  line-height: 1;
}

.controls .icon {
  font-size: 1.2rem;
}

.controls button:hover {
  background-color: var(--button-hover);
}

.controls button.clicked {
  background-color: var(--button-clicked);
}

#debug-info {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 9999;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 12px;
  color: #0f0;
  pointer-events: none;
  background: rgb(0 0 0 / 60%);
  border-radius: 4px;
}

@media (width <= 768px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .canvas-wrapper {
    height: 300px;
  }

  .controls button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* ---------- ABOUT SECTION ---------- */
.info-section {
  padding: 3rem 1.5rem;
  color: var(--text-color);
  text-align: left;
  background-color: var(--section-color);
  box-shadow: inset 0 8px 8px -8px rgb(0 0 0 / 50%);
}

.info-subsection {
  padding: 3rem 1.5rem;
  background-color: #fff;
}

.info-container {
  max-width: 800px;
  margin: 0 auto;
}

.features-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin-top: 2.5rem;
}

.feature {
  flex: 1 1 200px;
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.feature .icon {
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

.cta-button {
  margin: 2rem 0;
  text-align: center;
}

/* stylelint-disable-next-line no-descending-specificity */
.cta-button a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  color: var(--button-text);
  text-decoration: none;
  background-color: var(--button-bg);
  border-radius: 4px;
  transition: background-color 0.2s;
}

.cta-button a:hover {
  background-color: var(--button-hover);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.radio-settings-table {
  max-width: 600px;
  margin: 2rem auto;
  font-size: 1rem;
  text-align: center;
  border-collapse: collapse;
  background-color: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 5%);
}

.radio-settings-table th,
.radio-settings-table td {
  padding: 0.75rem;
  border: 1px solid #ddd;
}

.radio-settings-table th {
  font-weight: 600;
  color: var(--text-color);
  background-color: var(--section-color);
}

iframe {
  display: block;
  max-width: 100%;
  margin: 2rem auto;
  box-shadow: 0 4px 8px rgb(0 0 0 / 10%);
}

/* ---------- MESH 101 SECTION ---------- */
#mesh-101 h3 {
  margin-bottom: 0.6rem;
  font-size: 1.4rem;
  color: var(--button-clicked);
}

#mesh-101 ul {
  margin-bottom: 1.8rem;
}

/* ---------- FAQ SECTION ---------- */
.faq-section {
  padding: 3rem 1.5rem;
  background-color: var(--section-color-alt);
}

.accordion {
  max-width: 800px;
  margin: 0 auto;
}

.accordion-item {
  margin-bottom: 1rem;
  overflow: hidden;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgb(0 0 0 / 10%);
}

.accordion-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  font-weight: 600;
  cursor: pointer;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content-inner {
  padding: 0 1.5rem 1.5rem;
  line-height: 1.6;
}

.accordion-icon {
  padding-left: 0.75rem;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.accordion-item .accordion-icon::before {
  content: "+";
}

.accordion-item.active .accordion-icon::before {
  content: "–";
}

/* ---------- GET INVOLVED SECTION ---------- */
.get-involved-flex {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  align-items: flex-start;
}

.get-involved-text {
  flex: 1;
}

.logo-container {
  flex-shrink: 0;
  align-self: flex-end;
  text-align: right;
}

.involved-logo {
  max-width: 200px;
  height: auto;
}

@media (width <= 768px) {
  .get-involved-flex {
    flex-direction: column;
    align-items: center;
  }

  .logo-container {
    align-self: center;
    text-align: center;
  }
}

/* ---------- FOOTER ---------- */
.site-footer {
  padding: 1rem;
  font-size: 0.85rem;
  color: #ccc;
  text-align: center;
  background-color: #2e2e2e;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

/* stylelint-disable-next-line no-descending-specificity */
.site-footer a {
  font-size: 0.85rem;
  color: #aaa;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #fff;
}

.footer-separator {
  color: #888;
  /* stylelint-disable-next-line property-no-vendor-prefix */
  -webkit-user-select: none;
  user-select: none;
}

@media (width <= 530px) {
  .footer-separator {
    display: none;
  }
}

.cc0-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.25em;
}

.cc0-icon svg {
  display: inline-block;
  width: auto;
  height: 1.2em;
  overflow: visible;
}
