[hidden] {
  display: none !important;
}

.nav-icon,
.fact-icon,
.topic-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--green);
  font-size: 20px;
  line-height: 1;
}

.nav-icon {
  width: 22px;
}

.fact-icon {
  width: 24px;
  height: 24px;
}

.topic-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #edf0e6;
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: stretch;
  background: #17251ecc;
  overscroll-behavior: contain;
}

.mobile-nav-panel {
  width: min(360px, 88vw);
  height: 100%;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background: #f6f6f0;
  box-shadow: 12px 0 40px #14231d26;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-open {
  overflow: hidden;
}

.mobile-nav-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -18px -9px 12px;
  padding: max(14px, env(safe-area-inset-top)) 9px 12px;
  background: #f6f6f0;
  color: var(--green);
  font-family: var(--font-heading);
  font-size: 18px;
}

.mobile-nav-heading button,
.dialog-close {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-size: 26px;
}

.mobile-nav-panel .nav-item {
  min-height: 48px;
  font-size: 13px;
  padding: 15px 12px;
}

.mobile-nav-panel .sidebar-note {
  margin-top: 25px;
}

dialog.script-menu {
  position: fixed;
  inset: 0;
  width: min(44rem, calc(100vw - 2rem));
  max-width: 44rem;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 24px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 22px 80px #14231d3b;
}

dialog.html-runner {
  width: min(64rem, calc(100vw - 2rem));
  max-width: 64rem;
}

dialog.script-menu::backdrop {
  background: #17251eaa;
  backdrop-filter: blur(2px);
}

.script-menu-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.script-menu-header p {
  max-width: 56rem;
  margin-top: 8px;
  color: var(--muted-ink);
  font-size: 12px;
  line-height: 1.7;
}

.script-menu-title {
  margin: 0;
}

.dialog-close {
  flex: 0 0 auto;
  font-size: 30px;
}

.outline-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--green);
  font: inherit;
  font-size: 11px;
}

.outline-button:hover {
  background: #edf0e6;
}

.outline-button:focus-visible,
.dialog-close:focus-visible,
.mobile-nav-heading button:focus-visible,
.mobile-menu:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.outline-button:disabled,
.button-primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.script-menu-warning {
  margin: 14px 0 20px;
}

.script-menu-editor {
  margin: 16px 0;
}

.script-menu-editor textarea {
  max-width: 100%;
}

.script-menu-editor input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.script-menu-actions {
  justify-content: flex-start;
  margin: 16px 0;
}

.script-menu-feedback {
  margin-top: 14px;
}

.script-menu-error {
  color: #a23c34;
}

dialog.html-runner[open] {
  display: grid;
  gap: 12px;
}

.html-runner-modes {
  margin-bottom: 4px;
}

.html-runner-preview {
  min-height: 180px;
}

.html-runner-preview iframe {
  height: min(45dvh, 420px);
}

.html-runner-fullscreen.html-runner {
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.html-runner-fullscreen > :not(.html-runner-preview) {
  display: none;
}

.html-runner-fullscreen .html-runner-preview,
.html-runner-preview:fullscreen {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  border: 0;
  border-radius: 0;
}

.html-runner-fullscreen .html-runner-preview iframe,
.html-runner-preview:fullscreen iframe {
  flex: 1;
  height: 0;
  min-height: 0;
}

.not-found-page {
  min-height: 55vh;
  padding-top: 15vh;
}

@media (max-width: 700px) {
  .site-header {
    gap: 12px;
    padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    flex: 0 0 auto;
  }

  .mobile-menu {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  .header-search {
    min-width: 0;
  }

  .header-search input,
  .directory-search input,
  .script-menu-editor textarea,
  .script-menu-editor input {
    min-width: 0;
    font-size: 16px;
  }

  .page-content {
    padding: 24px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  }

  .page-content h1 {
    overflow-wrap: anywhere;
  }

  .hero {
    min-height: 0;
  }

  .hero-image {
    min-height: clamp(220px, 62vw, 340px);
  }

  .fact-strip {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .fact-strip > div,
  .fact-strip > div:first-child {
    min-width: 0;
    flex-direction: row;
    align-items: center;
    padding: 14px 4px;
  }

  .fact-strip > div + div {
    border-top: 1px solid var(--line);
  }

  .fact-strip > div {
    border-right: 0;
  }

  .fact-strip p,
  .fact-strip strong,
  .fact-strip p > span {
    font-size: 12px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    overflow-wrap: anywhere;
  }

  .directory-search {
    gap: 8px;
    padding-left: 12px;
  }

  .directory-search .button-primary {
    min-height: 44px;
    flex: 0 0 auto;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    margin-right: calc(-1 * max(16px, env(safe-area-inset-right)));
    padding: 0 max(16px, env(safe-area-inset-right)) 14px 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tabs a {
    min-height: 40px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .article-heading {
    gap: 12px;
  }

  .article-heading > div {
    min-width: 0;
  }

  .share-button {
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 auto;
  }

  .article-body,
  .article-aside,
  .article-figure,
  .article-sources,
  .photo-credit-list > div {
    min-width: 0;
  }

  .article-layout {
    display: flex;
    flex-direction: column;
  }

  .article-aside {
    order: -1;
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .article-figure img {
    max-width: 100%;
    height: auto;
  }

  .article-figure figcaption {
    gap: 8px;
    overflow-wrap: anywhere;
  }

  .site-footer {
    gap: 16px;
    padding: 22px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .site-footer > div {
    min-width: 0;
  }

  .site-footer p {
    line-height: 2;
  }

  .footer-support {
    min-height: 44px;
  }

  dialog.script-menu,
  dialog.html-runner {
    inset: 0;
    width: calc(100% - 16px);
    max-width: none;
    max-height: calc(100% - 16px);
    margin: auto;
    padding: 16px;
    border-radius: 10px;
    overscroll-behavior: contain;
  }

  dialog.html-runner[open] {
    gap: 10px;
  }

  .script-menu-header {
    align-items: flex-start;
  }

  .script-menu-header > div {
    min-width: 0;
  }

  .script-menu-title {
    font-size: 22px;
  }

  .dialog-close {
    min-width: 44px;
    min-height: 44px;
  }

  .script-menu-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .script-menu-actions > button {
    min-height: 44px;
    flex: 1 1 auto;
  }

  .script-menu-editor textarea {
    min-height: 180px;
    max-height: 38dvh;
    font-size: 16px;
  }

  .html-runner-modes {
    display: flex;
    gap: 8px;
  }

  .html-runner-modes > button {
    min-height: 44px;
    flex: 1;
  }

  .html-runner-preview {
    min-height: 150px;
    overflow: hidden;
  }

  .html-runner-preview iframe {
    width: 100%;
    min-height: 180px;
  }

  .html-runner-preview-toolbar > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .html-runner-preview-toolbar button {
    min-height: 44px;
  }

  dialog.script-menu {
    max-height: calc(100dvh - 16px);
  }

  dialog.html-runner {
    max-height: calc(100dvh - 16px);
  }

  .html-runner-preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 490px) {
  .hero h1 {
    font-size: clamp(34px, 10vw, 43px);
  }

  .section-heading {
    flex-wrap: wrap;
  }

  .section-heading .text-link {
    min-height: 44px;
  }

  .species-grid {
    grid-template-columns: 1fr;
  }

  .species-grid .species-card-image {
    aspect-ratio: 1.65;
  }

  .species-grid .species-card-content {
    padding: 16px;
  }

  .species-grid .species-card-content h3 {
    font-size: 19px;
  }

  .species-grid .species-card-content p {
    font-size: 12px;
  }

  .reading-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .reading-item > svg {
    grid-column: 3;
    grid-row: 1;
  }

  .article-heading {
    flex-wrap: wrap;
  }

  .article-heading .share-button {
    margin-top: 0;
    font-size: 11px;
  }

  .breadcrumbs {
    flex-wrap: wrap;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .site-header {
    gap: 8px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-name {
    font-size: 22px;
  }

  .brand-tagline {
    font-size: 7px;
  }

  .page-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .directory-search {
    gap: 5px;
    padding-left: 8px;
  }

  .directory-search .button-primary {
    padding-right: 9px;
    padding-left: 9px;
  }

  .site-footer {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-panel {
    scroll-behavior: auto;
  }
}
