/* ==========================================================================
   CTC — WDIII Tech Vault Stylesheet
   Modern, scalable, component-driven CSS architecture (WCAG AA Compliant)
   ========================================================================== */

/* ==========================================================================
   1. THEME VARIABLES
   ========================================================================== */
:root {
  /* Dark Theme (Default) */
  --td-bg-base: #0f0f0f;
  --td-bg-surface: #1a1a1a;
  --td-bg-surface-elevated: #2d2d2d;
  --td-bg-card: #252525;
  --td-text-primary: #e0e0e0;
  --td-text-secondary: #d0d0d0; /* WCAG AA enhanced contrast (>= 4.5:1) */
  --td-text-muted: #999999;
  --td-border: #333333;
  --td-border-subtle: #444444;
  --td-border-control: #757575;
  --td-success: #4ade80;
  --td-success-bg: #1a2e1f;
  --td-error: #ef4444;
  --td-error-bg: #2e1a1a;
  --td-warning: #fbbf24;
  --td-warning-bg: #3f2f0f;
  --td-info: #60a5fa;
  --td-info-bg: #1a2a3f;
  --td-ai: #a78bfa;
  --td-ai-bg: #2a1f3f;
  --td-pending: #f0a04b;
  --td-pending-bg: #3a2a14;
  --td-ecosystem: #fbbf24;
  --td-ecosystem-bg: #3f2f0f;
  --accent-color: #60a5fa;
}

.light-theme {
  /* Light Theme Overrides */
  --td-bg-base: #f5f5f5;
  --td-bg-surface: #e8e8e8;
  --td-bg-surface-elevated: #d5d5d5;
  --td-bg-card: #ffffff;
  --td-text-primary: #1f2937;
  --td-text-secondary: #4b5563; /* WCAG AA compliant */
  --td-text-muted: #525866;
  --td-border: #cccccc;
  --td-border-subtle: #bbbbbb;
  --td-border-control: #8a8a8a;
  --td-info: #2563eb;
  --td-info-bg: #e3f0ff;
  --td-success: #136f36;
  --td-success-bg: #e8f5e9;
  --td-error: #dc2626;
  --td-error-bg: #ffebee;
  --td-ai: #7c3aed;
  --td-ai-bg: #ede9fe;
  --td-ecosystem: #d97706;
  --td-ecosystem-bg: #fffbeb;
  --td-warning: #d97706;
  --td-warning-bg: #fffbeb;
  --td-pending: #ea580c;
  --td-pending-bg: #fff3e0;
  --accent-color: #2563eb;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

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

body {
  background: var(--td-bg-base);
  color: var(--td-text-primary);
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Accessible Keyboard Navigation (:focus-visible) */
button, a, input, select, textarea {
  outline: none;
}

button:focus-visible, 
a:focus-visible, 
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Soft animated focus ring for the search and contact inputs (inline styles set their borders) */
:is(#searchHome, #searchFodder, #contactName, #contactEmail, #contactMessage) {
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.18s ease, box-shadow 0.18s ease;
}

:is(#searchHome, #searchFodder, #contactName, #contactEmail, #contactMessage):focus-visible {
  outline-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.22);
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

/* Custom Scrollbars */
.td-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.td-scrollbar::-webkit-scrollbar-thumb {
  background: var(--td-border-subtle);
  border-radius: 4px;
}

/* Animations */
@keyframes td-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes td-slide-up {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.td-fade-in {
  animation: td-fade-in 0.25s ease-in-out;
}

.td-slide-up {
  animation: td-slide-up 0.3s ease-in-out;
}

/* Skeleton Loading State */
.skeleton {
  background: linear-gradient(90deg, var(--td-bg-surface-elevated) 25%, var(--td-bg-card) 50%, var(--td-bg-surface-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  border-radius: 0.375rem;
}

.skeleton-line {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.25rem;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   3. LAYOUT & SPA PAGES
   ========================================================================== */
.page {
  display: none;
}

.page.active {
  display: block;
}

.td-page-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */

/* Theme Toggle Button Animation */
#themeToggle, .themeToggleBtn, #themeToggleHome, #themeToggleFodder {
  transition: transform 0.25s ease, background 0.15s ease, border-color 0.15s ease;
}

#themeToggle.toggled, .themeToggleBtn.toggled {
  transform: rotate(360deg);
}

/* Experiment Cards */
.td-experiment {
  margin-bottom: 3rem;
  border: 1px solid var(--td-border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--td-bg-surface);
  scroll-margin-top: 7rem;
}

.td-experiment-header {
  background: var(--td-bg-surface-elevated);
  padding: 1.5rem;
}

.td-experiment-body {
  padding: 2rem;
}

.td-card,
.td-comparison-card,
.td-key-finding,
.td-conclusion,
.td-ranking-row,
.td-insight-card,
.td-queued-card {
  padding: 1.5rem;
}

/* Official Google Sign-In Button Styling */
.gsi-material-button {
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  background-color: #131314;
  background-image: none;
  border: 1px solid #747775;
  border-radius: 4px;
  box-sizing: border-box;
  color: #e3e3e3;
  cursor: pointer;
  font-family: 'Roboto', arial, sans-serif;
  font-size: 14px;
  height: 40px;
  letter-spacing: 0.25px;
  outline: none;
  overflow: hidden;
  padding: 0 16px;
  position: relative;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .218s, border-color .218s, box-shadow .218s;
}

.light-theme .gsi-material-button {
  background-color: #ffffff;
  color: #1f1f1f;
  border: 1px solid #747775;
}

.gsi-material-button:hover {
  box-shadow: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  background-color: #202124;
}

.light-theme .gsi-material-button:hover {
  background-color: #f7f8f8;
}

.gsi-material-button-content-wrapper {
  display: flex;
  align-items: center;
  flex-direction: row;
  height: 100%;
  position: relative;
  width: 100%;
}

.gsi-material-button-icon {
  height: 20px;
  margin-right: 12px;
  min-width: 20px;
  width: 20px;
}

.gsi-material-button-contents {
  font-weight: 500;
}

/* Drive cards & progress */
.drive-file-card {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.drive-file-card:hover {
  border-color: var(--td-info) !important;
  transform: translateY(-2px);
}

/* Home Hero Header */
.home-hero-header {
  background: linear-gradient(to bottom right, var(--td-bg-surface), var(--td-bg-surface-elevated));
  border-bottom: 1px solid var(--td-border);
  padding: 2.75rem 1.5rem 2rem;
  text-align: center;
  box-sizing: border-box;
}

/* WDIII Official Brand & Logo */
.wdiii-logo-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #08111e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  color: #f8fafc;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.wdiii-logo-card img#homeVaultLogo {
  height: 40px;
  width: auto;
  max-width: 100%;
  display: block;
}

.wdiii-card-divider {
  height: 22px;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-block;
  flex-shrink: 0;
}

.wdiii-card-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--td-text-secondary);
  white-space: nowrap;
}

.wdiii-logo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.3);
  border-color: rgba(96, 165, 250, 0.45);
}

.light-theme .wdiii-logo-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 14px rgba(12, 35, 64, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  color: #08182b;
}

.light-theme .wdiii-card-divider {
  background: #cbd5e1;
}

.light-theme .wdiii-card-tag {
  color: #475569;
}

.wdiii-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  color: var(--td-text-primary);
  flex-shrink: 0;
}

.wdiii-mini-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border-color: rgba(96, 165, 250, 0.4);
}

.light-theme .wdiii-mini-badge {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0c2340;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Home Update Banner Pill */
.home-update-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  border-radius: 9999px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 0.8rem;
  color: var(--td-info);
  font-weight: 600;
  max-width: 100%;
  box-sizing: border-box;
  line-height: 1.35;
  text-align: center;
}

.home-update-banner-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--td-info);
  flex-shrink: 0;
}

/* Home Subheader Action Bar */
.home-subheader-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1.5rem;
  background: var(--td-bg-surface);
  border-bottom: 1px solid var(--td-border);
  flex-wrap: wrap;
  gap: 0.625rem;
  box-sizing: border-box;
}

.home-subheader-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.82rem;
  color: var(--td-text-muted);
}

.home-subheader-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Fodder Archive Brand Card & Hero */
.fodder-logo-card {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  border-radius: 0.75rem;
  border: 1px solid var(--td-border-subtle);
  background: var(--td-bg-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
}

.fodder-logo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(96, 165, 250, 0.4);
}

.fodder-logo-card img#fodderArchiveHeaderLogo {
  height: 44px;
  width: auto;
  max-width: 100%;
  display: block;
}

.fodder-hero-desc {
  color: var(--td-text-secondary);
  font-size: clamp(0.9rem, 1.8vw + 0.55rem, 1.05rem);
  margin: 0 auto;
  max-width: 580px;
  line-height: 1.5;
}

/* Section Navigation Tabs Container */
.td-sections-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  max-height: min(65vh, 460px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--td-border) transparent;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease;
}

.td-sections-nav::-webkit-scrollbar {
  width: 5px;
}

.td-sections-nav::-webkit-scrollbar-track {
  background: transparent;
}

.td-sections-nav::-webkit-scrollbar-thumb {
  background: var(--td-border);
  border-radius: 9999px;
}

.td-sections-nav.is-collapsed {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

/* Section Tab Item */
.td-section-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--td-border-subtle);
  background: var(--td-bg-card);
  color: var(--td-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.td-section-tab:hover {
  border-color: var(--td-border);
  color: var(--td-text-primary);
  background: var(--td-bg-surface-elevated);
}

.td-section-tab.active {
  border-color: var(--td-info);
  background: var(--td-info-bg);
  color: var(--td-info);
}

.td-tab-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.td-tab-content {
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
}

.td-tab-label {
  font-weight: 600;
  line-height: 1.2;
}

.td-tab-sub {
  font-size: 0.72rem;
  color: var(--td-text-muted);
  line-height: 1.2;
  opacity: 0.85;
}

.td-section-tab.active .td-tab-sub {
  color: var(--td-info);
  opacity: 0.85;
}

/* Toast Container & Notification Styles */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 3rem);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.375rem;
  background: var(--td-bg-surface-elevated);
  border: 1px solid var(--td-border);
  color: var(--td-text-primary);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: td-slide-up 0.25s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.toast-success { border-color: var(--td-success); }
.toast-error { border-color: var(--td-error); }
.toast-info { border-color: var(--td-info); }
.toast-warning { border-color: var(--td-warning); }

/* ==========================================================================
   5. UTILITIES & RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Breakpoint 1: Medium devices / Tablets (max-width: 768px) */
@media (max-width: 768px) {
  .td-page-container {
    padding: 1.5rem 1rem;
  }
  .td-experiment {
    margin-bottom: 2rem;
    border-radius: 0.375rem;
  }
  .td-experiment-header {
    padding: 1.25rem 1.25rem !important;
  }
  .td-experiment-body {
    padding: 1.5rem 1.25rem !important;
  }
  .td-card,
  .td-comparison-card,
  .td-key-finding,
  .td-conclusion,
  .td-ranking-row,
  .td-insight-card,
  .td-queued-card {
    padding: 1.25rem 1rem !important;
  }
}

/* Breakpoint 2: Small devices / Standard Mobile (max-width: 640px) */
@media (max-width: 640px) {
  .td-page-container {
    padding: 1rem 0.625rem;
  }
  .td-experiment {
    margin-bottom: 1.5rem;
    border-radius: 0.375rem;
  }
  .td-experiment-header {
    padding: 1rem 0.875rem !important;
  }
  .td-experiment-body {
    padding: 1.125rem 0.75rem !important;
  }
  .td-card,
  .td-comparison-card,
  .td-key-finding,
  .td-conclusion,
  .td-ranking-row,
  .td-insight-card,
  .td-queued-card {
    padding: 0.875rem 0.75rem !important;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }
  .td-experiment-body [style*="grid-template-columns"] {
    gap: 1rem !important;
  }
  .td-scrollbar table th,
  .td-scrollbar table td {
    padding: 0.4rem 0.55rem !important;
    font-size: 0.86rem !important;
  }
  .td-sections-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.4rem !important;
    padding: 0.5rem 0.75rem 0.75rem !important;
    max-height: min(60vh, 390px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
  .home-hero-header {
    padding: 1.5rem 1rem 1.25rem !important;
  }
  .wdiii-logo-card {
    padding: 0.375rem 0.75rem !important;
    gap: 0.5rem !important;
    max-width: calc(100vw - 2rem) !important;
    box-sizing: border-box !important;
  }
  .wdiii-logo-card img#homeVaultLogo {
    height: 30px !important;
    max-width: 140px !important;
    width: auto !important;
  }
  .wdiii-card-divider {
    height: 16px !important;
  }
  .wdiii-card-tag {
    font-size: 0.65rem !important;
    letter-spacing: 0.05em !important;
  }
  .home-update-banner {
    font-size: 0.74rem !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: 0.625rem !important;
    text-align: center !important;
  }
  .home-subheader-bar {
    padding: 0.625rem 0.875rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .home-subheader-title {
    justify-content: center !important;
    text-align: center !important;
    font-size: 0.76rem !important;
  }
  .home-subheader-actions {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 0.45rem !important;
  }
  .home-subheader-actions button,
  .home-subheader-actions .themeToggleBtn {
    padding: 0.35rem 0.7rem !important;
    font-size: 0.8rem !important;
    min-height: 36px !important;
  }
  .td-section-tab {
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    padding: 0.45rem 0.6rem !important;
    border-radius: 0.5rem !important;
    min-height: 48px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .td-tab-icon {
    font-size: 1.1rem !important;
  }
  .td-tab-label {
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .td-tab-sub {
    font-size: 0.68rem !important;
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
  }
  .fodder-logo-card {
    padding: 0.35rem 0.75rem !important;
    max-width: calc(100vw - 2rem) !important;
    box-sizing: border-box !important;
  }
  .fodder-logo-card img#fodderArchiveHeaderLogo {
    height: 32px !important;
    max-width: 155px !important;
    width: auto !important;
  }
  .fodder-hero-desc {
    font-size: 0.88rem !important;
    line-height: 1.4 !important;
    max-width: 100% !important;
  }
  .fa-entry {
    margin-bottom: 1rem !important;
  }
  .fa-summary {
    padding: 0.875rem 0.75rem !important;
  }
  .fa-title {
    font-size: 1.15rem !important;
  }
  .fa-verdict {
    font-size: 0.85rem !important;
  }
  .fa-entry-footer {
    padding: 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .fa-entry-footer .fa-pill {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
  }
}

/* Breakpoint 3: Narrow mobile screens (max-width: 480px) */
@media (max-width: 480px) {
  .wdiii-logo-card img#homeVaultLogo {
    height: 27px !important;
    max-width: 125px !important;
  }
  .wdiii-card-tag {
    font-size: 0.62rem !important;
  }
  .fodder-logo-card img#fodderArchiveHeaderLogo {
    height: 28px !important;
    max-width: 135px !important;
  }
  .td-page-container {
    padding: 0.75rem 0.375rem;
  }
  .td-experiment {
    margin-bottom: 1.25rem;
    border-radius: 0.25rem;
  }
  .td-experiment-header {
    padding: 0.875rem 0.625rem !important;
  }
  .td-experiment-body {
    padding: 0.875rem 0.5rem !important;
  }
  .td-card,
  .td-comparison-card,
  .td-key-finding,
  .td-conclusion,
  .td-ranking-row,
  .td-insight-card,
  .td-queued-card {
    padding: 0.75rem 0.5rem !important;
  }
  .td-scrollbar table th,
  .td-scrollbar table td {
    padding: 0.35rem 0.4rem !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 360px) {
  .td-sections-nav {
    grid-template-columns: 1fr !important;
  }
}

/* =====================================================================
   Fodder Archive: expandable entries
   Built from the main experiment card (.td-experiment); only the open/close
   behaviour and the small controls below are Fodder-specific.
   ===================================================================== */
.fa-entry { margin-bottom: 1.25rem; }
.fa-entry > summary { list-style: none; cursor: pointer; display: block; }
.fa-entry > summary::-webkit-details-marker { display: none; }
.fa-entry > summary:hover { background: var(--td-bg-surface); }
.fa-entry > summary:hover .fa-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.fa-entry > summary:focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }
.fa-title { line-height: 1.25; }
.fa-toggle,
.fa-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: var(--td-bg-card);
  border: 1px solid var(--td-border-subtle);
  color: var(--td-info);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.fa-toggle::before { content: "Read entry \25BE"; }
.fa-entry[open] .fa-toggle::before { content: "Close \25B4"; }
.fa-pill:hover { border-color: var(--td-info); }
.fa-entry-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--td-border-subtle);
  background: var(--td-bg-surface-elevated);
}
.fa-submission-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--td-info);
}
.fa-submission-link:hover { text-decoration: underline; }
/* index.html hard-codes white text inline in many places. In the light theme that is white on a pale background, so it switches to the theme's text colour. Buttons filled with the info blue keep their white text. */
.light-theme [style*="color:#fff"]:not([style*="background:var(--td-info)"]),
.light-theme [style*="color: #fff"]:not([style*="background:var(--td-info)"]) { color: var(--td-text-primary) !important; }

/* Skip link: hidden until focused, then shown without animation or layout shift */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 4000;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  background: var(--td-bg-card);
  color: var(--td-text-primary);
  border: 2px solid var(--accent-color);
}

.skip-link:focus {
  top: 0.5rem;
}

/* The skip link moves focus to the page container; it is not interactive, so no ring */
main.page:focus {
  outline: none;
}

/* Visually hidden but still read by screen readers (route announcer) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
