/* ============================================================
   Tsinglan iGEM Wiki — "You NAILed it!" visual system
   Fonts and images from static.igem.wiki. No external CDNs. No localStorage.
   ============================================================ */

@font-face {
  font-family: "Playfair Display";
  src: url("https://static.igem.wiki/teams/6190/wiki/font/playfair-display-500.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("https://static.igem.wiki/teams/6190/wiki/font/playfair-display-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("https://static.igem.wiki/teams/6190/wiki/font/playfair-display-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("https://static.igem.wiki/teams/6190/wiki/font/playfair-display-900.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="ocean"] {
  --navy: #1f426b;
  --mustard: #e9b91a;
  --cream: #e8d59a;
  --cream-light: #f5ebc4;
  --ink: #1a3352;
  --muted: #4a6280;
  --card-shadow: 10px 10px 0 0 #1f426b;
  --nav-bg: rgba(31, 66, 107, 0.94);
  --nav-text: #e8d59a;
  --nav-hover: #ffffff;
  --hero-title: #f5ebc4;
  --link: #1f426b;
  --link-hover: #163455;
  --swatch: #1f426b;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-nav: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Playfair Display", Georgia, "Times New Roman", serif;
}

[data-theme="purple"] {
  --navy: #4b365f;
  --mustard: #c4be92;
  --cream: #e8e0d0;
  --cream-light: #f4efe6;
  --ink: #3d2f4f;
  --muted: #6b568d;
  --card-shadow: 10px 10px 0 0 #4b365f;
  --nav-bg: rgba(75, 54, 95, 0.94);
  --nav-text: #c4be92;
  --nav-hover: #ffffff;
  --hero-title: #c4be92;
  --link: #6b568d;
  --link-hover: #4b365f;
  --swatch: #8e7ca8;
}

[data-theme="sage"] {
  --navy: #3d5a54;
  --mustard: #b8c9a9;
  --cream: #e4ecdc;
  --cream-light: #f2f6ee;
  --ink: #2f453f;
  --muted: #b85450;
  --card-shadow: 10px 10px 0 0 #3d5a54;
  --nav-bg: rgba(61, 90, 84, 0.94);
  --nav-text: #e4ecdc;
  --nav-hover: #ffd6c8;
  --hero-title: #e4ecdc;
  --link: #b85450;
  --link-hover: #8a3f3c;
  --swatch: #b85450;
}

[data-theme="burgundy"] {
  --navy: #581d1d;
  --mustard: #c9a86c;
  --cream: #e1d3b5;
  --cream-light: #f3ead8;
  --ink: #3d2b2b;
  --muted: #7b5e5e;
  --card-shadow: 10px 10px 0 0 #581d1d;
  --nav-bg: rgba(88, 29, 29, 0.94);
  --nav-text: #e1d3b5;
  --nav-hover: #fff3d8;
  --hero-title: #e1d3b5;
  --link: #581d1d;
  --link-hover: #3d2b2b;
  --swatch: #581d1d;
}

/* ============================================================
   Base
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: 64px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--mustard);
  transition: background-color 0.35s ease, color 0.35s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
  color: var(--navy);
}

h1 {
  font-family: var(--font-display);
  font-weight: 900;
}

h2, h3, h4, h5, h6 {
  font-weight: 600;
}

a {
  color: var(--link);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

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

/* ============================================================
   Decorative full-page biology background
   ============================================================ */

.bio-canvas {
  position: relative;
  /* clip (not hidden) so decorations stay boxed without breaking position:sticky TOC */
  overflow: hidden;
  overflow: clip;
  min-height: 100vh;
  background-color: var(--mustard);
}

.bio-canvas__pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(31, 66, 107, 0.14) 0 42px, transparent 43px),
    radial-gradient(circle at 82% 38%, rgba(31, 66, 107, 0.1) 0 70px, transparent 71px),
    radial-gradient(circle at 12% 72%, rgba(31, 66, 107, 0.08) 0 36px, transparent 37px),
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(31, 66, 107, 0.16), transparent 70%);
  opacity: 0.9;
}

/* Floating shell / conch decorations */
.bio-canvas__decorations {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bio-decor {
  position: absolute;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  object-fit: contain;
  opacity: 0.68;
  filter: drop-shadow(0 4px 12px rgba(31, 66, 107, 0.28));
  animation: decor-drift 14s ease-in-out infinite;
}

.bio-decor--1 {
  top: 6%;
  left: 2%;
  width: clamp(64px, 8vw, 110px);
  transform: rotate(-18deg);
  animation-delay: 0s;
}

.bio-decor--2 {
  top: 4%;
  right: 3%;
  width: clamp(72px, 9vw, 130px);
  transform: rotate(22deg);
  animation-delay: -2s;
}

.bio-decor--3 {
  top: 38%;
  left: -1%;
  width: clamp(56px, 7vw, 95px);
  transform: rotate(12deg);
  animation-delay: -4s;
}

.bio-decor--4 {
  top: 32%;
  right: 1%;
  width: clamp(60px, 7.5vw, 105px);
  transform: rotate(-28deg);
  animation-delay: -6s;
}

.bio-decor--5 {
  bottom: 18%;
  left: 4%;
  width: clamp(68px, 8.5vw, 120px);
  transform: rotate(8deg);
  animation-delay: -1s;
}

.bio-decor--6 {
  bottom: 12%;
  right: 5%;
  width: clamp(52px, 6.5vw, 90px);
  transform: rotate(-14deg);
  animation-delay: -3s;
}

.bio-decor--7 {
  top: 58%;
  left: 6%;
  width: clamp(58px, 7vw, 100px);
  transform: rotate(-8deg);
  opacity: 0.58;
  animation-delay: -5s;
}

.bio-decor--8 {
  top: 52%;
  right: 7%;
  width: clamp(62px, 7.5vw, 108px);
  transform: rotate(16deg);
  opacity: 0.62;
  animation-delay: -7s;
}

.bio-decor--9 {
  bottom: 32%;
  left: 14%;
  width: clamp(48px, 5.5vw, 78px);
  transform: rotate(24deg);
  opacity: 0.55;
  animation-delay: -8s;
}

.bio-decor--10 {
  bottom: 28%;
  right: 12%;
  width: clamp(50px, 6vw, 82px);
  transform: rotate(-20deg);
  opacity: 0.55;
  animation-delay: -9s;
}

@keyframes decor-drift {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.bio-canvas > .site-main {
  position: relative;
}

.bio-canvas > .wave-separator,
.page-article {
  position: relative;
  z-index: 1;
}

/* ============================================================
   Navbar
   ============================================================ */

.tsinglan-navbar {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  background-color: var(--nav-bg) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(232, 213, 154, 0.18);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.tsinglan-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: 1rem;
  font-family: var(--font-nav);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--nav-text) !important;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  /* No transform on hover: the dock slot must stay still for logo-shrink.js. */
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.tsinglan-brand__slot {
  display: block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.tsinglan-brand__name {
  line-height: 1;
}

.tsinglan-brand:hover,
.tsinglan-brand:focus {
  color: var(--nav-hover) !important;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tsinglan-nav-link {
  position: relative;
  margin: 0 0.02rem;
  padding: 0.4rem 0.55rem !important;
  font-family: var(--font-nav);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--nav-text) !important;
  border-radius: 0.3rem;
  transition: color 0.25s ease, background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.tsinglan-nav-link:hover,
.tsinglan-nav-link:focus,
.tsinglan-nav-link.show {
  color: var(--nav-hover) !important;
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.tsinglan-nav-link::after {
  content: "";
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.15rem;
  height: 2px;
  background-color: var(--nav-hover);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.tsinglan-nav-link:hover::after,
.tsinglan-nav-link:focus::after,
.tsinglan-nav-link.show::after {
  transform: scaleX(1);
}

.tsinglan-toggler {
  border: 1px solid rgba(232, 213, 154, 0.55);
  border-radius: 0.35rem;
  padding: 0.3rem 0.5rem;
}

.tsinglan-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(232, 213, 154, 0.3);
}

.tsinglan-toggler .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28232, 213, 154, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.tsinglan-dropdown {
  margin-top: 0.4rem;
  padding: 0.35rem 0;
  background-color: var(--navy);
  border: 1px solid rgba(232, 213, 154, 0.2);
  border-radius: 0.45rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.tsinglan-dropdown .dropdown-item {
  color: var(--nav-text);
  font-family: var(--font-nav);
  font-weight: 700;
  padding: 0.5rem 1rem;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.tsinglan-dropdown .dropdown-item:hover,
.tsinglan-dropdown .dropdown-item:focus {
  color: var(--nav-hover);
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

@media (max-width: 991.98px) {
  .tsinglan-navbar .navbar-collapse {
    margin-top: 0.65rem;
    padding: 0.7rem;
    background-color: rgba(0, 0, 0, 0.18);
    border-radius: 0.55rem;
  }

  .tsinglan-nav-search {
    width: 100%;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(232, 213, 154, 0.16);
  }

  .tsinglan-brand {
    font-size: 1.15rem;
    gap: 0.45rem;
    margin-right: 0.5rem;
  }

  .tsinglan-brand__slot {
    width: 36px;
    height: 36px;
  }

  .tsinglan-nav-link {
    margin: 0.12rem 0;
    transform: none;
  }

  .tsinglan-nav-link:hover,
  .tsinglan-nav-link:focus,
  .tsinglan-nav-link.show {
    transform: translateY(-1px);
  }

  .tsinglan-nav-link::after {
    display: none;
  }

  .tsinglan-dropdown {
    border: none;
    box-shadow: none;
    background-color: rgba(0, 0, 0, 0.15);
  }
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  background-color: var(--navy);
  color: var(--hero-title);
  padding: 3.5rem 0 2.75rem;
  margin-bottom: 0;
  overflow: hidden;
  position: relative;
}

/* Full-bleed homepage banner (clears fixed navbar via body padding-top) */
.hero--banner {
  padding: 0;
  background-color: #1a2740;
}

.hero__banner-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
}

.hero__inner {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  color: var(--hero-title) !important;
  letter-spacing: 0.03em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.hero__title .nail-accent {
  letter-spacing: 0.08em;
}

.hero__lead {
  max-width: 36rem;
  margin: 0 auto;
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 500;
  color: var(--cream) !important;
  opacity: 0.92;
}

.hero__page-label {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.25rem 0.85rem;
  border: 1px solid rgba(245, 235, 196, 0.35);
  border-radius: 999px;
  font-family: var(--font-nav);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
}

/* ============================================================
   Main content area
   ============================================================ */

.site-main {
  padding: 2.5rem 0 3rem;
}

.site-main .container {
  max-width: 1080px;
}

/* Auto-surface bare page rows so non-home pages still match the design */
.site-main .container > .row,
.site-main #main-content > .row {
  background-color: var(--cream);
  border-radius: 0.65rem;
  box-shadow: var(--card-shadow);
  padding: 1.35rem 1.5rem 1.5rem;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 1.75rem;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.site-main .container > .row:hover,
.site-main #main-content > .row:hover {
  transform: translate(-2px, -2px);
  box-shadow: 12px 12px 0 0 var(--navy);
}

.site-main .container > .row + .row,
.site-main #main-content > .row + .row {
  margin-top: 0;
}

/* ============================================================
   Reusable igem-card
   ============================================================ */

.igem-card {
  position: relative;
  background-color: var(--cream);
  border-radius: 0.65rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2.25rem;
  overflow: hidden;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.igem-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 13px 13px 0 0 var(--navy);
}

.igem-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.15rem;
  background-color: var(--navy);
  color: var(--cream);
}

.igem-card__bar h2,
.igem-card__bar h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cream);
}

.igem-card__chips {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.igem-card__chip {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(135deg, #9eb8c9, #6f8799);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.igem-card__chip--alt {
  background: linear-gradient(135deg, #b8b8b8, #8a8a8a);
}

.igem-card__body {
  padding: 1.35rem 1.5rem 1.6rem;
}

.igem-card__body > h2:first-child,
.igem-card__body > h3:first-child {
  margin-top: 0;
}

.igem-card__body p:last-child,
.igem-card__body ul:last-child {
  margin-bottom: 0;
}

.igem-card--plain .igem-card__body {
  padding-top: 1.5rem;
}

.igem-card--plain .igem-card__title {
  margin: 0 0 0.85rem;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--navy);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  margin-bottom: 2.25rem;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .card-grid .igem-card:nth-child(2) {
    margin-top: 2rem;
  }
}

.section-title-float {
  margin: 0 0 1rem;
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  color: var(--navy);
  text-shadow: 3px 3px 0 rgba(31, 66, 107, 0.12);
}

/* ============================================================
   Wave separator + footer
   ============================================================ */

.wave-separator {
  height: 88px;
  margin-top: 1rem;
  background-color: var(--cream-light);
  background-image:
    radial-gradient(ellipse 90px 56px at 8% 0, var(--mustard) 70%, transparent 71%),
    radial-gradient(ellipse 110px 64px at 28% 0, var(--mustard) 70%, transparent 71%),
    radial-gradient(ellipse 80px 50px at 50% 0, var(--mustard) 70%, transparent 71%),
    radial-gradient(ellipse 120px 70px at 74% 0, var(--mustard) 70%, transparent 71%),
    radial-gradient(ellipse 95px 58px at 94% 0, var(--mustard) 70%, transparent 71%);
}

.site-footer {
  background-color: var(--cream-light);
  color: var(--navy);
  padding: 2.5rem 0 2rem;
  margin-top: 0;
}

.site-footer h4 {
  color: var(--navy);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.site-footer p,
.site-footer li {
  color: var(--ink);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.site-footer hr {
  border-color: rgba(31, 66, 107, 0.2);
  opacity: 1;
}

.site-footer .license-block {
  font-size: 0.85rem;
}

/* ============================================================
   Callouts (kept for page compatibility)
   ============================================================ */

.bd-callout {
  padding: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(31, 66, 107, 0.2);
  border-left-width: 0.35rem;
  border-radius: 0.4rem;
  background-color: rgba(255, 255, 255, 0.35);
}

.bd-callout h4 { margin-bottom: 1rem; }
.bd-callout p:last-child { margin-bottom: 0; }
.bd-callout + .bd-callout { margin-top: -0.25rem; }
.bd-callout-info { border-left-color: #5bc0de; }
.bd-callout-warning { border-left-color: #f0ad4e; }
.bd-callout-danger { border-left-color: #d9534f; }

/* Legacy helpers */
.left-aligned { margin-left: auto; }
.bg-dark { background-color: var(--navy) !important; }
.bg-hero { background-color: var(--navy) !important; }
.page-surface { background: transparent; padding: 0; margin: 0; }

/* ============================================================
   Theme switcher (memory / URL only — no localStorage)
   ============================================================ */

.theme-switcher {
  position: fixed;
  right: 1.35rem;
  bottom: 1.35rem;
  z-index: 1080;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  padding: 0;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background-color: var(--navy);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, background-color 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.07);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.theme-toggle__icon {
  display: block;
  width: 2.7rem;
  height: 2.7rem;
  object-fit: contain;
  pointer-events: none;
}

/* ============================================================
   Back to top (appears after scrolling)
   Sits above the nail-polish theme switcher on the right.
   ============================================================ */

.back-to-top {
  position: fixed;
  right: 1.45rem;
  bottom: 5.5rem;
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background-color: var(--navy);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease, background-color 0.3s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-2px) scale(1.05);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.back-to-top svg {
  width: 1.15rem;
  height: 1.15rem;
}

body.wiki-toc-lock .back-to-top {
  visibility: hidden;
  pointer-events: none;
}

.theme-palette {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.7rem);
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 0.95rem;
  border: 2px solid var(--navy);
  border-radius: 2rem;
  background-color: var(--cream);
  box-shadow: 6px 6px 0 0 var(--navy);
  animation: palette-in 0.25s ease;
}

.theme-palette[hidden] {
  display: none;
}

@keyframes palette-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-swatch {
  position: relative;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch.is-active {
  box-shadow: 0 0 0 3px var(--navy), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transform: scale(1.08);
}

.theme-swatch[data-theme="ocean"] { background-color: #1f426b; }
.theme-swatch[data-theme="purple"] { background-color: #8e7ca8; }
.theme-swatch[data-theme="sage"] { background-color: #b85450; }
.theme-swatch[data-theme="burgundy"] { background-color: #581d1d; }

.theme-swatch .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   In-page search (navbar + floating assistant)
   ============================================================ */

.tsinglan-nav-search {
  min-width: min(100%, 15rem);
}

.tsinglan-search-form {
  width: 100%;
}

.tsinglan-search-input,
.wiki-assistant__input {
  border: 1px solid rgba(232, 213, 154, 0.45);
  background-color: rgba(255, 255, 255, 0.12);
  color: var(--nav-text);
}

.tsinglan-search-input::placeholder,
.wiki-assistant__input::placeholder {
  color: rgba(232, 213, 154, 0.72);
}

.tsinglan-search-input:focus,
.wiki-assistant__input:focus {
  border-color: var(--cream);
  background-color: rgba(255, 255, 255, 0.18);
  color: var(--nav-hover);
  box-shadow: 0 0 0 0.15rem rgba(232, 213, 154, 0.28);
}

.tsinglan-search-btn,
.wiki-assistant__btn {
  border: 1px solid rgba(232, 213, 154, 0.55);
  background-color: var(--cream);
  color: var(--navy);
  font-family: var(--font-nav);
  font-weight: 700;
}

.tsinglan-search-btn:hover,
.wiki-assistant__btn:hover {
  background-color: var(--nav-hover);
  color: var(--navy);
}

.tsinglan-search-status,
.wiki-assistant__status {
  margin: 0.35rem 0 0;
  min-height: 1rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(232, 213, 154, 0.88);
}

.tsinglan-search-status.is-error,
.wiki-assistant__status.is-error {
  color: #ffd2d2;
}

.page-search-highlight {
  background-color: rgba(233, 185, 26, 0.62);
  color: inherit;
  padding: 0.06em 0.18em;
  border-radius: 0.22em;
  box-shadow: 0 0 0 2px rgba(31, 66, 107, 0.22);
}

.wiki-assistant {
  position: fixed;
  right: 5.35rem;
  bottom: 0.95rem;
  z-index: 1075;
  pointer-events: none;
}

.wiki-assistant__toggle,
.wiki-assistant__panel {
  pointer-events: auto;
}

.wiki-assistant__toggle {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(31, 66, 107, 0.28));
  transition: transform 0.22s ease, filter 0.22s ease;
}

.wiki-assistant__toggle:hover {
  transform: translateY(-3px) scale(1.03);
  filter: drop-shadow(0 10px 18px rgba(31, 66, 107, 0.34));
}

.wiki-assistant__toggle:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 4px;
  border-radius: 0.75rem;
}

.wiki-assistant__icon {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
}

.wiki-assistant__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.55rem);
  width: min(16.5rem, calc(100vw - 7rem));
  padding: 0.85rem 0.9rem 0.75rem;
  border: 2px solid var(--navy);
  border-radius: 0.85rem;
  background-color: var(--cream);
  box-shadow: 8px 8px 0 0 var(--navy);
  animation: assistant-panel-in 0.24s ease;
}

.wiki-assistant__panel[hidden] {
  display: none;
}

.wiki-assistant__title {
  margin: 0 0 0.55rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.wiki-assistant__form {
  margin: 0;
}

.wiki-assistant__input {
  background-color: #fff;
  color: var(--ink);
}

.wiki-assistant__status {
  color: var(--muted);
}

.wiki-assistant__status.is-error {
  color: #9b3a3a;
}

.wiki-assistant.is-open .wiki-assistant__toggle {
  transform: translateY(-2px) scale(0.98);
}

@keyframes assistant-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 767.98px) {
  body { padding-top: 58px; }

  .hero { padding: 2.5rem 0 2rem; }

  .hero--banner { padding: 0; }

  .igem-card {
    box-shadow: 7px 7px 0 0 var(--navy);
  }

  .igem-card:hover {
    box-shadow: 9px 9px 0 0 var(--navy);
  }

  .igem-card__body {
    padding: 1.1rem 1.15rem 1.3rem;
  }

  .wave-separator {
    height: 64px;
  }

  .theme-switcher {
    right: 1rem;
    bottom: 1rem;
  }

  .back-to-top {
    right: 1.1rem;
    bottom: 5.15rem;
  }

  .wiki-assistant {
    right: 4.35rem;
    bottom: 0.75rem;
  }

  .wiki-assistant__icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .wiki-assistant__panel {
    width: min(15rem, calc(100vw - 5.5rem));
  }

  .bio-decor--4,
  .bio-decor--7,
  .bio-decor--8,
  .bio-decor--9,
  .bio-decor--10 {
    display: none;
  }

  .bio-decor {
    opacity: 0.58;
  }

  .bio-decor--1 {
    top: 2%;
    left: -2%;
    width: 52px;
  }

  .bio-decor--2 {
    top: 1%;
    right: -2%;
    width: 58px;
  }

  .bio-decor--3 {
    top: auto;
    bottom: 14%;
    left: -3%;
    width: 48px;
  }

  .bio-decor--5 {
    bottom: 8%;
    left: auto;
    right: -2%;
    width: 54px;
  }

  .bio-decor--6 {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bio-decor,
  .igem-card,
  .tsinglan-nav-link,
  .theme-toggle,
  .back-to-top {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   Scroll-driven reveal + parallax (native JS, no external CDN)
   ============================================================ */

.scroll-animate {
  opacity: 0;
  transition:
    opacity 0.65s ease-out,
    transform 0.65s ease-out;
  transition-delay: var(--scroll-delay, 0s);
  will-change: opacity, transform;
}

.scroll-animate.fade-in-up {
  transform: translateY(32px);
}

.scroll-animate.fade-in-down {
  transform: translateY(-28px);
}

.scroll-animate.fade-out-up {
  transform: translateY(18px) scale(0.98);
}

.scroll-animate.slide-in-left {
  transform: translateX(-40px);
}

.scroll-animate.slide-in-right {
  transform: translateX(40px);
}

.scroll-animate.slide-in {
  transform: translateY(28px) translateX(0);
}

.scroll-animate.scale-in {
  transform: translateY(16px) scale(0.92);
}

.scroll-animate.zoom-in {
  transform: scale(0.88);
}

.scroll-animate.fade-in {
  transform: none;
}

.scroll-animate.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Parallax targets */
.hero__banner-img {
  will-change: transform;
}

.has-scroll-effects .bio-decor {
  animation: none;
}

.has-scroll-effects .bio-canvas__pattern {
  will-change: transform;
}

.parallax-layer {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-animate {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero__banner-img,
  .bio-decor,
  .bio-canvas__pattern,
  .parallax-layer {
    transform: none !important;
  }
}
