/* ===== Design System: Option D ===== */
:root {
  --bg:           #080E1A;
  --nav-bg:       rgba(8,14,26,0.88);
  --surface:      #0F1825;
  --border:       #1C2E44;
  --accent-solid: #60A5FA;
  --gradient:     linear-gradient(135deg, #818CF8, #60A5FA, #06B6D4);
  --glow:         rgba(96,165,250,0.3);
  --tag-bg:       rgba(96,165,250,0.08);
  --tag-border:   rgba(96,165,250,0.2);
  --text:         #DCE8F5;
  --text-muted:   #5A7A9A;
  --radius:       10px;
  --transition:   0.2s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: #080E1A; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
}

/* ===== Animated Background Glow Canvas ===== */
#bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent-solid); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ===== Shimmer Bar ===== */
.shimmer-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  z-index: 1000;
}
@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* ===== Cursor Sparkle Canvas ===== */
#sparkle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 4px; left: 0; right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo { font-weight: 700; font-size: 1.1rem; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
  margin-left: auto;
}

.nav-link {
  background: none;
  border: none;
  font: inherit;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(96,165,250,0.08);
  text-decoration: none;
}
.nav-link.active { color: var(--accent-solid); }

/* Dropdown */
.has-dropdown { position: relative; }
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  min-width: 230px;
  padding: 0.5rem 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { display: block; }
.dropdown li a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color var(--transition), background var(--transition);
}
.dropdown li a:hover { color: var(--text); background: var(--tag-bg); text-decoration: none; }

/* Amora nav preview — transparent, no box; the 3D dog floats free */
.amora-nav-item { position: relative; }
.amora-nav-preview {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 120px;
  cursor: pointer;
  pointer-events: auto;
}
.amora-nav-item:hover .amora-nav-preview {
  display: block;
  /* She rises up into the nav slot and settles, picking up where the corner dog left off */
  animation: amoraArrive 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes amoraArrive {
  0%   { opacity: 0; transform: translateX(-50%) translateY(34px) scale(0.6); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
}

/* Sparkle trail toggle */
.sparkle-toggle-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  transition: opacity var(--transition), background var(--transition);
  color: inherit;
}
.sparkle-toggle-btn:hover { background: rgba(96,165,250,0.08); }
.sparkle-toggle-btn.trail-off { opacity: 0.3; }
.sparkle-toggle-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  white-space: nowrap;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.sparkle-toggle-btn:hover::after { opacity: 1; }

/* Corner variant — fixed bottom-left, opposite the Amora pet */
.sparkle-toggle-btn--corner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 500;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: opacity var(--transition), background var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform 0.2s ease;
}
.sparkle-toggle-btn--corner:hover {
  background: var(--surface);
  border-color: var(--accent-solid);
  box-shadow: 0 0 18px var(--glow);
  transform: translateY(-2px);
}
/* Tooltip points up and aligns to the left edge so it never clips off-screen */
.sparkle-toggle-btn--corner::after {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  transform: none;
}
@media (max-width: 500px) {
  .sparkle-toggle-btn--corner { width: 42px; height: 42px; font-size: 1.2rem; }
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ===== Layout ===== */
.main-content {
  position: relative;
  z-index: 2;
  padding-top: 80px;
  min-height: calc(100vh - 80px);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Typography ===== */
.grad-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 680px;
}

p { line-height: 1.7; margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

/* ===== Tags / Chips ===== */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--accent-solid);
  border-radius: 100px;
  padding: 0.2rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== Cards / Surface ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Grid texture on visual cards */
.card--grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.12;
  pointer-events: none;
}

/* ===== Stat Cards (home page) ===== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.12;
  pointer-events: none;
}
.stat-card:hover {
  border-color: rgba(96,165,250,0.5);
  transform: translateY(-4px);
  box-shadow: 0 10px 36px var(--glow);
  text-decoration: none;
}
.stat-card__value {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}
.stat-card__unit {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.6;
}
.stat-card__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.4rem;
}
.stat-card__desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 0.5rem;
  flex: 1;
}
.stat-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-solid);
  margin-top: 1.1rem;
}
.stat-card__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.stat-card:hover .stat-card__arrow { transform: translateX(4px); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-accent {
  background: var(--accent-solid);
  color: #000;
}
.btn-accent:hover {
  background: #93C5FD;
  box-shadow: 0 0 16px var(--glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent-solid);
  border: 1px solid var(--tag-border);
}
.btn-outline:hover {
  background: var(--tag-bg);
  border-color: var(--accent-solid);
}

/* ===== Hero (full viewport) ===== */
.hero-full {
  min-height: calc(100vh - 64px); /* 64px = nav height; main-content adds the remaining 16px offset */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0;
}
.hero-full__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
}
.hero-sub {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 600px;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2rem; }

/* Get to Know Me — bouncing anchor link */
.gtkm-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: none;
  border: none;
  color: var(--accent-solid);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
  padding: 0.4rem 0;
  animation: gtkm-bounce 1.5s ease-in-out infinite;
}
/* hover state handled in JS for smooth animation→transition handoff */
.gtkm-link:focus-visible {
  outline: 2px solid var(--accent-solid);
  border-radius: 4px;
}
.gtkm-arrow {
  font-size: 1.1rem;
  line-height: 1;
}

@keyframes gtkm-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* ===== Section spacing ===== */
.section { padding: 4rem 0; }
.section + .section { border-top: 1px solid var(--border); }

/* ===== Comment Section ===== */
.comments-section {
  position: relative;
  z-index: 2;
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* Delete confirmation modal */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.confirm-msg {
  margin: 0 0 1.5rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.confirm-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.confirm-cancel:hover { border-color: var(--text-muted); color: var(--text); }
.confirm-delete {
  background: #ef4444;
  border: 1px solid #ef4444;
  color: #fff;
}
.confirm-delete:hover { background: #dc2626; border-color: #dc2626; }

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.comment-empty { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }

.comment-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.comment-entry { position: relative; }
.comment-username {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-solid);
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
}
.comment-entry p { margin: 0; }
.comment-entry time {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.comment-delete-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  line-height: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, transform 0.1s;
}
.comment-delete-btn { opacity: 0.35; }
.comment-delete-btn:hover { opacity: 1 !important; color: #ef4444; transform: scale(1.2); }
.comment-delete-btn:disabled { opacity: 0.15 !important; cursor: default; transform: none; }

.comment-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.4rem 0.9rem;
  margin-top: 0.75rem;
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.comment-logout-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* Pinned comment */
.comment-pinned {
  border-color: var(--tag-border);
  background: var(--tag-bg);
  margin-bottom: 1rem;
}
.comment-pin-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-solid);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Lock */
.lock-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0 1rem;
}

.lock-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
}
.lock-btn:hover { color: var(--accent-solid); transform: scale(1.05); }

.lock-icon {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--glow));
  transition: filter var(--transition);
}
.lock-btn:hover .lock-icon { filter: drop-shadow(0 0 16px var(--glow)); }

.lock-cta {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.lock-reveal {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Form */
.comment-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 600px; }
.comment-form-wrap { padding-top: 1rem; }

.comment-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  resize: vertical;
  transition: border-color var(--transition);
  width: 100%;
}
.comment-input:focus { outline: none; border-color: var(--accent-solid); }
.comment-input::placeholder { color: var(--text-muted); }

.comment-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.comment-form-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}
.comment-password { flex: 1; resize: none; }

.comment-status {
  font-size: 0.85rem;
  min-height: 1.2em;
}
.comment-status.ok  { color: #4ade80; }
.comment-status.err { color: #f87171; }

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 2;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-muted { margin-top: 0.25rem; font-size: 0.8rem; opacity: 0.6; }

/* ===== Amora Pet ===== */
.amora-pet {
  position: fixed;
  bottom: 0.6rem;
  right: 0.15rem;
  z-index: 500;
  cursor: pointer;
  opacity: 0;                        /* starts invisible; JS fades in after first render */
  animation: bounce 2s ease-in-out infinite;
  user-select: none;
  transform-origin: bottom right;
  /* Springy transform so she leaps up to the nav and settles back into the corner */
  transition: opacity 0.22s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Image is replaced by Three.js canvas — never let it flash */
.amora-pet img { display: none; }

/* Hidden while the nav-bar dog is on screen */
.amora-pet--away {
  opacity: 0 !important;
  /* translate BEFORE scale so the -44px isn't shrunk by the scale; anchor the
     shrink at her feet so she leaps straight up instead of collapsing into the corner */
  transform-origin: center bottom;
  transform: translateY(-44px) scale(0.45);
  pointer-events: none;
}

/* The canvas itself is sized fluidly (clamp on vmin in amora-pet.js), so the
   resting pet no longer needs viewport scale steps. The --away transform is
   relative to that already-scaled canvas, so one value works at every size. */

/* Quip bubble — right-aligned so it grows leftward and never clips off viewport */
.amora-quip {
  position: absolute;
  bottom: calc(100% + 8px);          /* sits just above the pet at any size */
  right: 0;
  left: auto;
  transform: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-size: 0.8rem;
  white-space: nowrap;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.amora-quip.visible { display: block; }

/* Hint bubble — right-aligned, same reason */
.amora-hint {
  position: absolute;
  bottom: calc(100% + 8px);          /* sits just above the pet at any size */
  right: 0;
  left: auto;
  transform: translateY(6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
/* Reveal immediately on hover — no tooltip delay */
.amora-pet:hover .amora-hint { opacity: 1; transform: translateY(0); }
/* One-time attention pulse shortly after load */
.amora-hint--pulse {
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: amoraHintBob 1s ease-in-out infinite;
}
/* Once clicked, the user knows — stop nagging */
.amora-pet--clicked .amora-hint { display: none; }
@keyframes amoraHintBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

/* ===== Page TOC Layout ===== */
.toc-wrapper {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  align-items: start;
}

.toc-content { min-width: 0; }

.page-toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.page-toc::-webkit-scrollbar { width: 4px; }
.page-toc::-webkit-scrollbar-track { background: transparent; }
.page-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.page-toc::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.toc-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item { margin: 0; }

.toc-link {
  display: block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  text-decoration: none;
  line-height: 1.4;
  transition: color var(--transition), border-color var(--transition);
}
.toc-link:hover { color: var(--text); border-left-color: var(--text-muted); text-decoration: none; }
.toc-link.active { color: var(--accent-solid); border-left-color: var(--accent-solid); }

.toc-link--sub {
  font-size: 0.75rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  border-left-color: transparent;
}
.toc-link--sub:hover { color: var(--text); border-left-color: var(--text-muted); }
.toc-link--sub.active { color: var(--accent-solid); border-left-color: var(--accent-solid); }

.toc-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-solid);
}

/* Offset anchor targets so the fixed nav doesn't cover headings */
.toc-content h2,
.toc-content h3,
#comments {
  scroll-margin-top: 90px;
}

/* ===== Module code colour tags (used on assignment-brief page) ===== */
.mod-com7119 { color: #FBBF24; font-weight: 600; }
.mod-com7010 { color: #F472B6; font-weight: 600; }
.mod-com7112 { color: #34D399; font-weight: 600; }
.mod-com7114 { color: #FB923C; font-weight: 600; }
.mod-com7115 { color: #A78BFA; font-weight: 600; }
.mod-com7113 { color: #F87171; font-weight: 600; }
.mod-com7098 { color: #38BDF8; font-weight: 600; }

/* ===== BNU Image Stack & Lightbox ===== */
.bnu-img-stack { display: flex; flex-direction: column; gap: 1.5rem; }

.bnu-figure { margin: 0 auto; }

.bnu-img-wrap {
  position: relative;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bnu-img-wrap img {
  width: 100%;
  display: block;
  transition: filter 0.2s;
}
.bnu-img-wrap:hover img { filter: brightness(0.8); }
.bnu-img-hint {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(8,14,26,0.8);
  color: var(--accent-solid);
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.bnu-img-wrap:hover .bnu-img-hint { opacity: 1; }

.bnu-caption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.25rem 0;
  text-align: center;
}
.bnu-caption strong { font-size: 0.875rem; color: var(--text); }
.bnu-caption span { font-size: 0.82rem; color: var(--text); }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lightbox.open { display: flex; }
.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  pointer-events: none;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  object-fit: contain;
  cursor: zoom-in;
  transform-origin: center center;
  user-select: none;
  pointer-events: all;
  display: block;
}
.lightbox-caption {
  color: var(--text);
  font-size: 0.92rem;
  text-align: center;
  margin: 0;
  padding: 0.35rem 1rem;
  background: rgba(8,14,26,0.6);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 80vw;
  white-space: normal;
  line-height: 1.4;
}
.lightbox-caption.visible { opacity: 1; }
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(8, 14, 26, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 2rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
  z-index: 1001;
}
.lightbox-nav:hover { opacity: 1; background: rgba(96,165,250,0.2); }
.lightbox-nav--prev { left: 1.25rem; }
.lightbox-nav--next { right: 1.25rem; }
.lightbox-nav[hidden] { display: none; }

/* Lightbox video embed */
.lightbox-video {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}
.lightbox-video--landscape { width: min(90vw, 900px); aspect-ratio: 16/9; }
.lightbox-video--portrait  { height: min(80vh, 620px); aspect-ratio: 9/16; }
.lightbox-video iframe { width: 100%; height: 100%; border: none; border-radius: 6px; }

/* ===== PDP Table ===== */
.pdp-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.pdp-summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--accent-solid);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background var(--transition);
}
.pdp-summary::-webkit-details-marker { display: none; }
.pdp-summary::before { content: '▶'; font-size: 0.65rem; transition: transform 0.2s; }
details[open] .pdp-summary::before { transform: rotate(90deg); }
.pdp-summary:hover { background: rgba(96,165,250,0.06); color: var(--text); }
.pdp-summary-hint {
  font-size: 0.75rem;
  color: #4ade80;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

.pdp-inner {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(15,24,37,0.5);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.pdp-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.pdp-key-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.1rem;
}
.pdp-badge {
  font-size: 0.7rem;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--text-muted);
}
.pdp-badge--improved {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
  color: #4ade80;
}

.pdp-filters { display: flex; gap: 0.4rem; }
.pdp-filter {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.pdp-filter:hover { border-color: var(--accent-solid); color: var(--accent-solid); }
.pdp-filter.active {
  background: rgba(96,165,250,0.12);
  border-color: var(--accent-solid);
  color: var(--accent-solid);
}
.pdp-filter-count {
  font-size: 0.68rem;
  opacity: 0.7;
  margin-left: 0.1rem;
}

.pdp-table-wrap { overflow-x: auto; }
.pdp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.pdp-table th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
}
.pdp-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.pdp-table tbody tr:hover td { background: rgba(96,165,250,0.06) !important; }
.pdp-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(28,46,68,0.6);
  color: var(--text);
  vertical-align: top;
  transition: background 0.15s;
}
.pdp-table td:first-child { color: var(--text-muted); width: 2rem; text-align: center; }
.pdp-table td:nth-child(3),
.pdp-table td:nth-child(4) { white-space: nowrap; }
.pdp-table td:last-child { text-align: center; white-space: nowrap; color: var(--text-muted); }
.pdp-row--improved td { background: rgba(34,197,94,0.06); }
.pdp-row--improved td:last-child { color: #4ade80; font-weight: 600; }
.pdp-row--selected td { background: rgba(96,165,250,0.12) !important; }
.pdp-row--selected td:first-child { color: var(--accent-solid); font-weight: 700; }
.pdp-hidden { display: none; }
.pdp-row--total td {
  background: var(--surface);
  border-top: 2px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
}
.pdp-row--total td:last-child { color: #4ade80; font-weight: 700; }

@media (max-width: 900px) {
  .toc-wrapper { grid-template-columns: 1fr; }
  .page-toc { display: none; }
}

/* ===== Module Marks Card ===== */
.marks-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 480px;
}
.marks-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.marks-row:last-child { border-bottom: none; }
.marks-total { background: var(--tag-bg); }
.marks-label { color: var(--text-muted); font-size: 0.9rem; }
.marks-value { font-weight: 700; font-size: 1rem; }

/* ===== Utility ===== */
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent-solid); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }

/* ===== News Watch ===== */
.content-list {
  margin: 1rem 0 1rem 1.25rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.content-list li {
  position: relative;
  padding-left: 1rem;
  color: var(--text);
  line-height: 1.7;
}
.content-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--accent-solid);
}
.content-quote {
  border-left: 3px solid var(--accent-solid);
  background: var(--tag-bg);
  margin: 1.25rem 0;
  padding: 0.85rem 1.25rem;
  border-radius: 0 6px 6px 0;
  color: var(--text);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===== Project Showcase ===== */
.mark-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--accent-solid);
  vertical-align: middle;
  margin-left: 0.5rem;
  letter-spacing: 0.03em;
}

.showcase-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.showcase-gallery--2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.showcase-gallery--mobile {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.showcase-gallery .bnu-figure,
.showcase-gallery--mobile .bnu-figure { margin: 0; }

.showcase-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.showcase-video-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.showcase-video-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.showcase-video {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}
/* ===== Image Carousel ===== */
.img-carousel { position: relative; width: 100%; margin-top: 1rem; }
.img-carousel-viewport {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  background: var(--bg);
}
.img-carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.img-carousel-slide { width: 100%; flex-shrink: 0; height: 100%; display: flex; flex-direction: column; }
.img-carousel-slide .bnu-figure { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.img-carousel-slide .bnu-img-wrap { border-radius: 0; border: none; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.img-carousel-slide .bnu-img-wrap img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.img-carousel-slide .bnu-caption { padding: 0.45rem 0.75rem; background: var(--surface); flex-shrink: 0; }
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.carousel-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.carousel-btn:hover { background: var(--border); border-color: var(--accent-solid); }
.carousel-dots { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.carousel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  border: none; padding: 0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.carousel-dot.active { background: var(--accent-solid); transform: scale(1.4); }

/* ===== Amora Carousel Extensions ===== */
.img-carousel-viewport--tall { aspect-ratio: 4/3; }

.img-carousel--portrait { max-width: 300px; margin-left: auto; margin-right: auto; }
.img-carousel--portrait .img-carousel-viewport { aspect-ratio: 9/16; }

.carousel-slide--video { background: #000; }

.carousel-yt-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.carousel-yt-wrap--landscape .yt-iframe { width: 100%; height: 100%; border: none; }

.carousel-yt-wrap--portrait .yt-iframe {
  height: 100%;
  aspect-ratio: 9/16;
  width: auto;
  border: none;
}

.showcase-video-stack { display: flex; flex-direction: column; gap: 1.5rem; }
.showcase-video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.showcase-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0.25rem;
  }
  .nav-links.open { display: flex; }
  .dropdown { position: static; box-shadow: none; border: none; background: transparent; padding: 0.25rem 0 0.25rem 1rem; }
  .has-dropdown:hover .dropdown { display: none; }
  .has-dropdown.open .dropdown { display: block; }

  .amora-nav-preview { display: none !important; }
  .comment-form-row { flex-direction: column; }
}
