:root {
  --green-dark: #296e52;
  --green: #0f7258;
  --green-mid: #358b69;
  --green-soft: #dfeee5;
  --green-pale: #edf6f0;
  --cream: #f7f5ef;
  --paper: #fffdf7;
  --paper-2: #fbf8ef;
  --ink: #202428;
  --text: #202428;
  --muted: #5f6862;
  --line: #d5d0c5;
  --line-dark: #9c9587;
  --brown: #6f583f;
  --gold: #d9a928;
  --blue-gray: #4d86a2;
  --warning: #d49b1f;
  --danger: #9d392d;
  --ok: #296e52;
  --resource-marker: #6f583f;
  --milestone-openai: #10a37f;
  --milestone-anthropic: #d97706;
  --milestone-google: #4285f4;
  --milestone-microsoft: #7c3aed;
  --milestone-perplexity: #0891b2;
  --family-tool-marker: #c94f8a;
  --trend-ai: #4d86a2;
  --trend-tools: #c94f8a;
  --trend-presentations: #8a5a2b;
  --shadow: 0 12px 32px rgba(48, 45, 37, 0.12);
  --radius: 12px;
  --font-sans: Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.5;
  background:
    radial-gradient(circle at 85% 12%, rgba(41, 110, 82, 0.08), transparent 21rem),
    linear-gradient(180deg, #f8f6f0 0%, #f2f0e9 100%);
}

a { color: inherit; }

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.ttt-header {
  background: var(--green-dark);
  color: #fff;
}

.ttt-nav {
  min-height: 92px;
  display: flex;
  align-items: stretch;
  gap: 28px;
  padding: 0 28px;
}

.ttt-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  text-decoration: none;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
}

.ttt-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.ttt-logo path,
.ttt-logo circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ttt-logo circle { fill: currentColor; stroke: none; }

.ttt-links {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
}

.ttt-links a {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  min-height: 92px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.18;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.ttt-links a:hover,
.ttt-links a:focus {
  background: rgba(255, 255, 255, 0.09);
  text-decoration: underline;
  outline: none;
}

.development-banner {
  background: var(--green-mid);
  color: #fff;
  text-align: center;
  padding: 10px 18px;
  font-weight: 700;
}

.development-banner a {
  color: #fff;
  font-weight: 900;
}

.site-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 18px 38px 44px;
}

.hero {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: start;
  padding: 6px 0 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
h3 {
  color: var(--ink);
}

h1 {
  margin: 0;
  max-width: none;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 4vw, 4.15rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.hero-copy {
  max-width: 980px;
  margin: 8px 0 0;
  color: #153b2f;
  font-size: clamp(1.05rem, 1.5vw, 1.36rem);
  line-height: 1.5;
}


.hero-help-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  position: relative;
  z-index: 3;
}

.timeline-instructions,
.resource-tips {
  width: auto;
  max-width: none;
  margin: 0;
  position: relative;
}

.timeline-instructions summary,
.resource-tips summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #c6a24e;
  border-radius: 999px;
  background: #f3e4ad;
  color: var(--green-dark);
  padding: 6px 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.timeline-instructions summary::-webkit-details-marker,
.resource-tips summary::-webkit-details-marker {
  display: none;
}

.timeline-instructions summary::after,
.resource-tips summary::after {
  content: "▾";
  font-size: 0.78rem;
  line-height: 1;
  transition: transform 150ms ease;
}

.timeline-instructions[open] summary::after,
.resource-tips[open] summary::after {
  transform: rotate(180deg);
}

.timeline-instructions summary:hover,
.timeline-instructions summary:focus,
.resource-tips summary:hover,
.resource-tips summary:focus {
  border-color: #a88432;
  background: #edd88f;
  outline: 3px solid rgba(198, 162, 78, 0.18);
  outline-offset: 2px;
}

.instructions-popdown,
.resource-tips-popdown {
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 10px 26px rgba(58, 55, 47, 0.1);
  padding: 10px 14px;
}

.instructions-popdown {
  width: min(1550px, calc(100vw - 72px));
  max-width: none;
}

.instructions-popdown ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 28px;
  margin: 0;
  padding-left: 21px;
}

.instructions-popdown li,
.resource-tips-popdown li {
  margin: 0;
  color: #2d332f;
  font-size: 0.84rem;
  line-height: 1.24;
}

.instructions-popdown a {
  color: var(--green-dark);
  font-weight: 900;
}

.resource-tips-popdown {
  width: min(1380px, calc(100vw - 72px));
}

.resource-tips-lead {
  margin: 0 0 8px;
  color: #2d332f;
  font-size: 0.86rem;
  line-height: 1.22;
}

.resource-tips-popdown ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px 24px;
  margin: 0;
  padding-left: 20px;
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.82);
  padding: 17px;
  box-shadow: 0 5px 18px rgba(58, 55, 47, 0.06);
}

.hero-card-title {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-grid div {
  border: 1px solid #ddd8cd;
  border-radius: 11px;
  padding: 10px 11px;
  background: #fffdf8;
}

.stat-grid strong {
  display: block;
  color: var(--green-dark);
  font-family: var(--font-serif);
  font-size: 1.55rem;
  line-height: 1;
}

.stat-grid span {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  font-size: 0.82rem;
}

.microcopy {
  margin: 11px 2px 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 18px;
  align-items: start;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.intro-card,
.controls,
.timeline-card,
.results-card,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.intro-card {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
}

.intro-card h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.intro-card p {
  margin: 0;
  max-width: 900px;
  color: #2d332f;
  line-height: 1.45;
}

.intro-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-link,
.ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--green-dark);
  background: var(--green-dark);
  color: #fff;
  border-radius: 7px;
  padding: 10px 15px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-link:hover,
.primary-link:focus,
.ghost-button:hover,
.ghost-button:focus {
  background: #1e5b43;
  border-color: #1e5b43;
  transform: translateY(-1px);
  outline: 3px solid rgba(41, 110, 82, 0.18);
  outline-offset: 2px;
}

.ghost-button {
  color: var(--green-dark);
  background: #fffdf8;
  border-color: #b9c7bd;
}

.ghost-button:hover,
.ghost-button:focus {
  color: #fff;
}

.ghost-button.compact {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.92rem;
}

.controls,
.timeline-card,
.results-card {
  padding: 18px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px 210px;
  gap: 14px;
}

.search-box,
.select-box {
  display: grid;
  gap: 6px;
}

.search-box span,
.select-box span,
.chip-heading {
  color: var(--green-dark);
  font-size: 0.87rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select {
  width: 100%;
  min-height: 48px;
  color: var(--text);
  border: 1px solid #bfc7bf;
  border-radius: 8px;
  background: #fff;
  padding: 0 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 4px rgba(41, 110, 82, 0.16);
}

.chip-section {
  margin-top: 0;
}

.chip-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}

.small-reset {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--green-dark);
  padding: 5px 11px;
  font-weight: 900;
  text-decoration: underline;
}

.small-reset.active {
  background: var(--green-dark);
  color: #fff;
  text-decoration: none;
}

.filter-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  min-width: 0;
}

.filter-by-inline-label {
  color: var(--green-dark);
  font-size: 0.87rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  align-self: center;
}

.year-heading {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 0;
}

.year-heading > span {
  flex: 0 0 auto;
}

.year-chip-row {
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 6px;
}

.filter-mode-section {
  display: grid;
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 2px;
}

.filter-mode-label {
  color: var(--green-dark);
  font-size: 0.87rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-mode-switch {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #c9c4b8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mode-button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #2f372f;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.mode-button:hover,
.mode-button:focus {
  color: var(--green-dark);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}

.mode-button.active {
  color: #fff;
  background: var(--green-dark);
}

.filter-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  margin-left: auto;
}

.reset-filters-inline {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.84rem;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.filter-tag-panel {
  margin-top: 16px;
  border: 1px solid #e0dbd0;
  border-radius: 12px;
  padding: 14px;
  background: rgba(251, 248, 239, 0.72);
}

.active-filter-section {
  min-width: 0;
}

.year-section .chip-row {
  max-width: none;
}

.year-chip-row .chip {
  padding: 6px 10px;
  font-size: 0.88rem;
}

.year-heading .small-reset {
  padding: 4px 7px;
}

.chip {
  cursor: pointer;
  color: #232323;
  border: 1px solid #c9c4b8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 8px 13px;
  font-size: 0.95rem;
  font-weight: 400;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.chip:hover,
.chip:focus {
  border-color: var(--green-dark);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}

.chip.active {
  color: #fff;
  background: var(--green-dark);
  border-color: var(--green-dark);
  font-weight: 400;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  line-height: 1.15;
}

.timeline-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 20px;
}

.timeline-title-copy {
  min-width: 0;
}

#timelineTitle {
  height: 72px;
  max-height: 72px;
  overflow: hidden;
  margin: 0;
  line-height: 1.08;
}

.timeline-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: flex-start;
  justify-content: end;
  gap: 10px 12px;
  position: relative;
}

.timeline-legend {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0;
  min-width: 176px;
  align-content: start;
}

.timeline-legend span {
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 99px;
  margin-right: 5px;
  vertical-align: -1px;
}

.legend-dot.clear { background: var(--resource-marker); }
.legend-dot.family-tool { background: var(--family-tool-marker); }
.legend-dot.backdrop {
  background: conic-gradient(from 90deg, var(--milestone-openai), var(--milestone-anthropic), var(--milestone-google), var(--milestone-microsoft), var(--milestone-perplexity), var(--milestone-openai));
}

.gear-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--green-dark);
  border: 1px solid #bfc7bf;
  border-radius: 8px;
  background: #fffdf8;
  font-size: 1.12rem;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.gear-button:hover,
.gear-button:focus,
.gear-button[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: var(--green-dark);
  background: var(--green-pale);
  outline: 3px solid rgba(41, 110, 82, 0.14);
  outline-offset: 2px;
}

.backdrop-menu-wrap {
  position: relative;
  justify-self: end;
  align-self: start;
}

.backdrop-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(360px, 92vw);
  z-index: 50;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 18px 48px rgba(55, 48, 38, 0.22);
}

.settings-band {
  margin: -16px -16px 14px;
  padding: 9px 14px;
  border-bottom: 1px solid #d7d3ca;
  border-radius: 12px 12px 0 0;
  background: #efede7;
  color: #4f554f;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.menu-title,
.trend-settings-title {
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-title {
  margin-bottom: 10px;
}

.milestone-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 7px;
  padding-bottom: 11px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e3ded1;
}

.milestone-action-button {
  min-height: 31px;
  border: 1px solid #b9c7bd;
  border-radius: 7px;
  background: #fffdf8;
  color: var(--green-dark);
  padding: 5px 9px;
  font-size: 0.82rem;
  line-height: 1.1;
  font-weight: 900;
  white-space: nowrap;
  width: 100%;
  justify-content: center;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.milestone-action-button:hover,
.milestone-action-button:focus {
  transform: translateY(-1px);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}


.milestone-action-button.show-all {
  border-color: var(--blue-gray);
  color: #315f78;
}

.milestone-action-button.show-all:hover,
.milestone-action-button.show-all:focus {
  background: var(--blue-gray);
  color: #fff;
}

.milestone-action-button.clear-all {
  border-color: var(--danger);
  color: var(--danger);
}

.milestone-action-button.clear-all:hover,
.milestone-action-button.clear-all:focus {
  background: var(--danger);
  color: #fff;
}

.milestone-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.platform-option {
  --platform-color: var(--blue-gray);
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.25;
}

.platform-option input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--platform-color);
}

.platform-swatch {
  width: 11px;
  height: 11px;
  border-radius: 99px;
  flex: 0 0 auto;
  background: var(--platform-color);
  box-shadow: 0 0 0 1px rgba(50, 45, 35, 0.22);
}

.platform-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.family-tool-settings {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #e3ded1;
}

.family-tool-option {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
}

.family-tool-option input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--family-tool-marker);
}

.family-tool-option a {
  color: var(--green-dark);
  font-weight: 800;
}

.family-tool-swatch {
  width: 11px;
  height: 11px;
  border-radius: 99px;
  flex: 0 0 auto;
  background: var(--family-tool-marker);
  box-shadow: 0 0 0 1px rgba(50, 45, 35, 0.22);
}

.family-tool-pill {
  border-color: color-mix(in srgb, var(--family-tool-marker) 42%, var(--line));
  background: color-mix(in srgb, var(--family-tool-marker) 10%, #fff);
}

.detail-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.secondary-link-button {
  background: #fffdf8;
  color: var(--green-dark);
}

.trend-settings {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #e3ded1;
}

.trend-control-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.trend-control-group {
  min-width: 0;
}

.trend-settings-title {
  margin-bottom: 7px;
}

.trend-radio-grid {
  display: grid;
  gap: 7px;
}

.trend-radio-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.2;
}

.trend-radio-grid input {
  width: 17px;
  min-height: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--green-dark);
}

.trend-count-grid {
  grid-template-columns: 1fr;
  gap: 7px;
}

.trend-swatch {
  width: 18px;
  height: 3px;
  border-radius: 99px;
  flex: 0 0 auto;
}

.trend-swatch-ai { background: var(--trend-ai); }
.trend-swatch-tools { background: var(--trend-tools); }
.trend-swatch-presentations { background: var(--trend-presentations); }

.trend-period-control {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e8e3d8;
}

.trend-period-control select {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.trend-auto-period {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.trend-auto-period.is-disabled { opacity: 0.55; }


.timeline-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -4px 0 12px;
}

.timeline-status-row .timeline-count-label {
  margin: 0;
}

.timeline-status-row .timeline-expand-button {
  margin-left: auto;
  flex: 0 0 auto;
}

.timeline-count-label {
  margin: -4px 0 12px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #d8d1c3;
  border-radius: 999px;
  background: #fffdf8;
  color: #3f473f;
  padding: 7px 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.timeline-count-label[hidden] {
  display: none;
}

.timeline-stage {
  --timeline-base-y: 306px;
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  height: 360px;
  border: 1px solid #d9d3c7;
  border-radius: 12px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.88), rgba(250, 246, 237, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(41, 110, 82, 0.035) 48px, transparent 49px);
}

.timeline-stage::before {
  content: "Tree Tracing Tools";
  position: absolute;
  left: 50%;
  top: 49%;
  width: 88%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
  color: rgba(111, 88, 63, 0.065);
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6.2vw, 5.8rem);
  font-size: clamp(1.9rem, 6.2cqi, 5.8rem);
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1;
}

.timeline-stage.has-trend {
  height: 520px;
}

.timeline-stage.has-trend::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: var(--event-band-top, 220px);
  height: 1px;
  background: rgba(111, 88, 63, 0.22);
  pointer-events: none;
  z-index: 1;
}

.timeline-line {
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  top: var(--timeline-base-y);
  height: 4px;
  background: linear-gradient(90deg, #948a7b, #574532 88%, #574532 100%);
  border-radius: 99px;
}

.timeline-line::before,
.timeline-line::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.timeline-line::before {
  left: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8d806f;
}

.timeline-line::after {
  right: -18px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 16px solid #574532;
}

.timeline-start,
.timeline-end {
  position: absolute;
  display: none;
  top: calc(var(--timeline-base-y) + 24px);
  color: #4e564f;
  font-size: 0.92rem;
  font-weight: 900;
}

.timeline-start { left: 5%; }
.timeline-end { right: 5%; }

.year-tick-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.year-tick {
  --x: 50;
  position: absolute;
  left: calc(var(--x) * 1%);
  transform: translateX(-50%);
  color: #1e241e;
  font-size: 0.92rem;
  font-weight: 900;
}

.year-tick-major {
  top: calc(var(--timeline-base-y) + 20px);
}

.year-tick-major::before {
  content: "";
  display: block;
  width: 2px;
  height: calc(var(--timeline-base-y) - 20px);
  margin: calc(-1 * (var(--timeline-base-y) - 6px)) auto 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(82, 74, 61, 0.28) 12%, rgba(82, 74, 61, 0.72) 100%);
}

.year-tick-major-with-months {
  top: calc(var(--timeline-base-y) + 48px);
  font-size: 0.86rem;
}

.year-tick-major-with-months::before {
  height: calc(var(--timeline-base-y) + 8px);
  margin: calc(-1 * (var(--timeline-base-y) + 22px)) auto 8px;
}


.year-tick-future-boundary {
  color: #4a4034;
}

.year-tick-future-boundary::before {
  background: linear-gradient(180deg, transparent 0%, rgba(82, 74, 61, 0.22) 12%, rgba(82, 74, 61, 0.58) 100%);
}

.month-tick {
  top: calc(var(--timeline-base-y) + 20px);
  color: #5e5548;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.month-tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 28px;
  margin: -28px auto 6px;
  background: rgba(91, 78, 62, 0.52);
}

.year-tick-half {
  top: var(--timeline-base-y);
  width: 1px;
  height: 26px;
  overflow: hidden;
  color: transparent;
}

.year-tick-half::before {
  content: "";
  display: block;
  width: 1px;
  height: 26px;
  margin: 0 auto;
  background: rgba(84, 68, 49, 0.52);
}

.trend-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.trend-layer[hidden] { display: none; }

.trend-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.trend-grid-line {
  stroke: rgba(96, 87, 73, 0.20);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.trend-y-axis {
  stroke: rgba(74, 67, 57, 0.55);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.trend-y-label {
  fill: #5f6862;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
}

.trend-axis-title {
  fill: #394139;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 900;
}

.trend-area {
  stroke: none;
  pointer-events: none;
}

.trend-line {
  fill: none;
  stroke-width: 5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.trend-ai .trend-area {
  fill: color-mix(in srgb, var(--trend-ai) 18%, transparent);
}

.trend-ai .trend-line {
  stroke: var(--trend-ai);
}

.trend-ai .trend-hover-point {
  stroke: var(--trend-ai);
  fill: var(--trend-ai);
}

.trend-tools .trend-area {
  fill: color-mix(in srgb, var(--trend-tools) 18%, transparent);
}

.trend-tools .trend-line {
  stroke: var(--trend-tools);
}

.trend-tools .trend-hover-point {
  stroke: var(--trend-tools);
  fill: var(--trend-tools);
}

.trend-presentations .trend-area {
  fill: color-mix(in srgb, var(--trend-presentations) 18%, transparent);
}

.trend-presentations .trend-line {
  stroke: var(--trend-presentations);
}

.trend-presentations .trend-hover-point {
  stroke: var(--trend-presentations);
  fill: var(--trend-presentations);
}

.trend-hover-zone {
  fill: transparent;
  stroke: none;
  pointer-events: all;
  cursor: crosshair;
  outline: none;
}

.trend-hover-zone:focus {
  outline: none;
}

.trend-hover-guide {
  stroke: rgba(74, 67, 57, 0.42);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.trend-hover-point {
  stroke: #fffdf8;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.trend-tooltip {
  position: absolute;
  z-index: 35;
  min-width: 132px;
  max-width: 220px;
  transform: translate(-50%, -100%);
  padding: 8px 10px;
  border: 1px solid #d6d0c4;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(45, 41, 34, 0.16);
  pointer-events: none;
  font-size: 0.8rem;
  line-height: 1.25;
}

.trend-tooltip.below {
  transform: translate(-50%, 8px);
}

.trend-tooltip strong,
.trend-tooltip span {
  display: block;
}

.trend-tooltip span {
  margin-top: 3px;
  color: var(--muted);
}

.trend-selection-warning {
  position: absolute;
  left: 50%;
  z-index: 20;
  width: min(520px, 72%);
  transform: translate(-50%, -50%);
  border: 1px solid #d8d1c3;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.96);
  color: #495149;
  padding: 10px 14px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(48, 45, 37, 0.08);
  pointer-events: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.overflow-branch-rail {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: rgba(87, 69, 50, 0.44);
  box-shadow: 0 1px 0 rgba(255, 253, 248, 0.75);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 3;
}


.marker {
  --x: 50;
  --y: 190;
  --marker-size: 30px;
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1px);
  transform: translate(-50%, -50%);
  width: var(--marker-size);
  height: var(--marker-size);
  min-height: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 4;
  pointer-events: auto;
  transition: transform 150ms ease, filter 150ms ease;
}

.marker::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(87, 69, 50, 0.24), rgba(87, 69, 50, 0.68));
  transform: translateX(-50%);
  z-index: 0;
}

.marker::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(87, 69, 50, 0.78);
  border: 1px solid #fffdf8;
  transform: translateX(-50%);
  z-index: 1;
}

.marker.marker-above::before {
  top: 50%;
  height: calc(var(--baseline-y, 306px) - var(--y) * 1px);
}

.marker.marker-above::after {
  top: calc(var(--baseline-y, 306px) - var(--y) * 1px + 50% - 3.5px);
}

.marker.marker-below::before {
  bottom: 50%;
  height: calc(var(--y) * 1px - 198px);
}

.marker.marker-below::after {
  bottom: calc(var(--y) * 1px - 198px + 50% - 3.5px);
}

.marker-symbol {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--marker-color, var(--resource-marker));
  border: 2.5px solid #fffdf8;
  box-shadow: 0 0 0 1px rgba(70, 65, 54, 0.36), 0 7px 18px rgba(58, 51, 39, 0.16);
  color: transparent;
  font-size: 0;
  line-height: 1;
  font-weight: 900;
}

.marker-label {
  display: none;
}

.marker.is-overflow {
  --marker-size: 32px;
  z-index: 12;
}

.marker.is-overflow::before {
  width: 2px;
  background: linear-gradient(180deg, rgba(87, 69, 50, 0.3), rgba(87, 69, 50, 0.76));
}

.marker.is-overflow .overflow-symbol {
  width: 28px;
  height: 28px;
  border: 2px solid var(--green);
  background: #fffdf8;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 0 0 1px rgba(70, 65, 54, 0.28), 0 8px 20px rgba(58, 51, 39, 0.16);
}

.marker.is-overflow.is-expanded .overflow-symbol {
  background: #eaf3ee;
  box-shadow: 0 0 0 1px rgba(70, 65, 54, 0.3), 0 0 0 6px rgba(41, 110, 82, 0.14), 0 9px 22px rgba(41, 110, 82, 0.22);
}

.marker.is-expanded-branch {
  z-index: 11;
}

.marker.is-expanded-branch::before,
.marker.is-expanded-branch::after {
  display: none;
}

.marker.is-backdrop {
  --marker-color: var(--blue-gray);
}

.marker.is-family-tool {
  --marker-color: var(--family-tool-marker);
}

.marker.is-popup-active,
.marker:hover,
.marker:focus-visible {
  transform: translate(-50%, -50%) scale(1.15);
  outline: none;
  z-index: 30;
}

.marker.is-popup-active .marker-symbol,
.marker:hover .marker-symbol,
.marker:focus-visible .marker-symbol {
  box-shadow: 0 0 0 1px rgba(70, 65, 54, 0.34), 0 0 0 6px rgba(111, 88, 63, 0.18), 0 9px 20px rgba(111, 88, 63, 0.22);
}

.marker.is-backdrop.is-popup-active .marker-symbol,
.marker.is-backdrop:hover .marker-symbol,
.marker.is-backdrop:focus-visible .marker-symbol,
.marker.is-family-tool.is-popup-active .marker-symbol,
.marker.is-family-tool:hover .marker-symbol,
.marker.is-family-tool:focus-visible .marker-symbol {
  box-shadow: 0 0 0 1px rgba(70, 65, 54, 0.34), 0 0 0 6px color-mix(in srgb, var(--marker-color) 22%, transparent), 0 9px 20px rgba(58, 51, 39, 0.18);
}

.marker-tooltip {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(4px);
  width: min(340px, 82vw);
  opacity: 0;
  padding: 12px;
  border: 1px solid #d6d0c4;
  border-radius: 10px;
  background: #fffdf8;
  color: var(--text);
  text-align: left;
  box-shadow: 0 14px 34px rgba(45, 41, 34, 0.18);
  transition: opacity 130ms ease, transform 130ms ease;
  z-index: 200;
}

.marker.marker-above .marker-tooltip { bottom: calc(100% + 14px); }
.marker.marker-below .marker-tooltip { bottom: auto; top: calc(100% + 14px); }

.marker:hover .marker-tooltip,
.marker:focus-visible .marker-tooltip,
.marker.is-popup-active .marker-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.marker-tooltip strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.25;
  margin-bottom: 6px;
}

.marker-tooltip span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.timeline-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, 84%);
  padding: 22px;
  border: 1px dashed #bcb4a8;
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.88);
  color: #394139;
  text-align: center;
  line-height: 1.45;
}

.timeline-message[hidden] { display: none; }

.timeline-expand-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #b9c7bd;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--green-dark);
  padding: 7px 11px;
  font-size: 0.88rem;
  font-weight: 900;
}

.timeline-expand-button:hover,
.timeline-expand-button:focus {
  border-color: var(--green-dark);
  background: var(--green-pale);
  outline: 3px solid rgba(41, 110, 82, 0.14);
  outline-offset: 2px;
}

.timeline-expand-icon {
  font-size: 1.05rem;
  line-height: 1;
}

body.timeline-overlay-open {
  overflow: hidden;
}

#aiTimelineApp.is-timeline-expanded::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 998;
  background: #f2f0e9;
}

#aiTimelineApp.is-timeline-expanded .controls {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 406px;
  z-index: 1002;
  max-height: none;
  overflow: visible;
  padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(48, 45, 37, 0.16);
}

#aiTimelineApp.is-timeline-expanded .controls .search-row {
  grid-template-columns: minmax(240px, 1fr) 160px 190px;
  gap: 10px;
}

#aiTimelineApp.is-timeline-expanded .controls input,
#aiTimelineApp.is-timeline-expanded .controls select {
  min-height: 40px;
}

#aiTimelineApp.is-timeline-expanded .controls .filter-toolbar {
  margin-top: 10px;
  grid-template-columns: auto minmax(330px, auto) minmax(360px, 1fr) auto;
  column-gap: 14px;
  row-gap: 8px;
}

#aiTimelineApp.is-timeline-expanded .controls .filter-tag-panel {
  margin-top: 10px;
  padding: 10px 12px;
  max-height: none;
  overflow: visible;
}

#aiTimelineApp.is-timeline-expanded .timeline-card {
  position: fixed;
  top: var(--expanded-timeline-top, 286px);
  left: 16px;
  right: 406px;
  bottom: 16px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fffdf7;
  box-shadow: 0 14px 38px rgba(48, 45, 37, 0.18);
}

#aiTimelineApp.is-timeline-expanded .timeline-card .section-heading {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

#aiTimelineApp.is-timeline-expanded .timeline-status-row {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

#aiTimelineApp.is-timeline-expanded .timeline-count-label {
  flex: 0 0 auto;
  margin: 0;
}

#aiTimelineApp.is-timeline-expanded .timeline-stage {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

#aiTimelineApp.is-timeline-expanded .timeline-stage.has-trend {
  min-height: 0;
}

#aiTimelineApp.is-timeline-expanded .detail-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 370px;
  z-index: 1003;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  background: #fffdf7;
  box-shadow: 0 14px 38px rgba(48, 45, 37, 0.18);
}

.results-card { margin-bottom: 16px; }

.resource-list {
  display: grid;
  gap: 10px;
}

.resource-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  border: 1px solid #dcd6ca;
  border-radius: 10px;
  background: #fffdf8;
  color: var(--text);
  padding: 13px 14px;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.resource-row:hover,
.resource-row:focus,
.resource-row.active {
  transform: translateY(-1px);
  border-color: var(--green-dark);
  background: var(--green-pale);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}

.row-date {
  color: var(--green-dark);
  font-weight: 900;
  font-size: 0.92rem;
}

.row-title {
  display: block;
  font-weight: 900;
  line-height: 1.25;
}

.row-meta {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  font-size: 0.9rem;
  line-height: 1.3;
}

.row-topic {
  color: var(--green-dark);
  border: 1px solid #c5d3c9;
  background: #f3faf5;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.empty-state {
  border: 1px dashed #bbb4a8;
  border-radius: 12px;
  padding: 26px;
  color: var(--muted);
  text-align: center;
  background: #fffdf8;
}

.detail-panel {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  min-height: min(580px, calc(100vh - 36px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.panel-kicker {
  flex: 0 0 auto;
  padding: 16px 18px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--green-dark);
}

.detail-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.detail-content h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  line-height: 1.16;
}

.detail-content h3 {
  margin: 22px 0 7px;
  color: var(--green-dark);
  font-size: 0.96rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-content p {
  color: #2d332f;
  line-height: 1.55;
}

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 13px 0 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f5f1e8;
  color: #2d332f;
  border: 1px solid #ded7c8;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.warn {
  color: #65440c;
  background: #fff4cf;
  border-color: #e7cc76;
}

.pill.ok {
  color: var(--green-dark);
  background: var(--green-pale);
  border-color: #b9cec2;
}

.pill.review {
  color: #713b18;
  background: #fff3e8;
  border-color: #e6c0a2;
}

.detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.detail-list li {
  color: #2d332f;
  line-height: 1.45;
}

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

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  border-radius: 7px;
  border: 1px solid var(--green-dark);
  background: var(--green-dark);
  padding: 10px 13px;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.link-button:hover,
.link-button:focus {
  background: #1e5b43;
  outline: 3px solid rgba(41, 110, 82, 0.16);
  outline-offset: 2px;
}

.citation {
  border-left: 4px solid var(--green-dark);
  padding-left: 13px;
  color: #2d332f;
  font-size: 0.94rem;
  line-height: 1.45;
}


@media (max-width: 1350px) {
  #aiTimelineApp.is-timeline-expanded .controls {
    left: 16px;
    right: 16px;
  }

  #aiTimelineApp.is-timeline-expanded .timeline-card {
    left: 16px;
    right: 16px;
    bottom: 286px;
  }

  #aiTimelineApp.is-timeline-expanded .detail-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
    height: 254px;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }
}

@media (max-width: 1500px) and (min-width: 1251px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
    gap: 16px;
  }

  h1 {
    white-space: normal;
    font-size: clamp(2.65rem, 4.2vw, 3.8rem);
  }

  .app-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 16px;
  }

  .filter-toolbar {
    gap: 7px;
  }

  .year-heading {
    gap: 4px;
  }

  .year-chip-row {
    gap: 4px;
  }

  .year-chip-row .chip {
    padding: 5px 8px;
    font-size: 0.84rem;
  }

  .mode-button {
    padding: 5px 8px;
    font-size: 0.84rem;
  }

  .reset-filters-inline {
    padding: 5px 8px;
    font-size: 0.8rem;
  }
}

@media (max-width: 1250px) {
  .ttt-nav { flex-direction: column; gap: 0; padding: 12px 20px 0; }
  .ttt-brand { min-width: auto; }
  .ttt-links a { min-height: auto; padding: 10px 12px 14px 0; }
  .hero-grid,
  .app-layout { grid-template-columns: 1fr; }
  .compact-collection { justify-self: stretch; }
  h1 { white-space: normal; font-size: clamp(2.6rem, 7vw, 4rem); }
  .detail-panel { position: relative; top: auto; min-height: auto; max-height: none; overflow: visible; }
  .detail-panel .detail-content { overflow: visible; }
  .search-row { grid-template-columns: 1fr; }
  .filter-toolbar { flex-wrap: wrap; align-items: stretch; gap: 10px; }
  .filter-by-inline-label { margin-bottom: -4px; }
  .year-heading { flex-wrap: wrap; }
  .year-chip-row { flex-wrap: wrap; }
  .filter-mode-section { margin-left: 0; }
  .filter-toolbar-actions { justify-content: flex-start; margin-left: 0; }
  .hero-help-row { width: 100%; }
  .timeline-instructions,
  .resource-tips { width: auto; }
  .instructions-popdown,
  .resource-tips-popdown { width: calc(100vw - 76px); }
  .instructions-popdown ol,
  .resource-tips-popdown ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .site-shell { padding: 18px 14px 32px; }
  .filter-toolbar { flex-wrap: wrap; gap: 12px; }
  .filter-mode-section { margin-left: 0; }
  .filter-mode-switch { width: 100%; }
  .mode-button { flex: 1 1 0; white-space: normal; }
  .section-heading { flex-direction: column; }
  .timeline-heading { grid-template-columns: 1fr; }
  #timelineTitle {
    height: auto;
    max-height: none;
    overflow: visible;
    font-size: 1.65rem !important;
  }
  .timeline-tools {
    grid-template-columns: 1fr;
    justify-content: flex-start;
    width: 100%;
  }
  .timeline-legend { min-width: 0; }
  .backdrop-menu-wrap { justify-self: start; }
  .timeline-status-row {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .timeline-status-row .timeline-expand-button {
    margin-left: auto;
  }
  .timeline-stage { height: 390px; overflow-x: auto; }
  .timeline-stage.has-trend { height: 520px; }
  .marker { width: 34px; }
  .resource-row { grid-template-columns: 1fr; }
  .row-topic { justify-self: start; }
  .year-chip-row { flex-basis: 100%; }
  .month-tick { font-size: 0.66rem; }
  .instructions-popdown ol,
  .resource-tips-popdown ol { grid-template-columns: 1fr; }
  .resource-tips summary { white-space: normal; }
  #aiTimelineApp.is-timeline-expanded .controls {
    left: 16px;
    right: 16px;
    max-height: none;
    overflow: visible;
  }
  #aiTimelineApp.is-timeline-expanded .timeline-card {
    top: var(--expanded-timeline-top, 266px);
    left: 16px;
    right: 16px;
    bottom: 266px;
  }
  #aiTimelineApp.is-timeline-expanded .detail-panel {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    height: 234px;
  }
  h1 { font-size: 2.45rem; }
}

/* Flask integration adjustments: keep base.html intact while giving the AI page room. */
main.container:has(#aiTimelineApp) {
  max-width: 1680px;
}

#aiTimelineApp.site-shell {
  padding: 18px 0 44px;
}

.info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
  padding: 20px;
}

.info-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 1.45rem;
}

.info-card p {
  margin: 0;
  color: #2d332f;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.step-grid > div {
  border: 1px solid #dcd6ca;
  border-radius: 12px;
  background: #fffdf8;
  padding: 16px;
}

.step-grid strong {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
  margin-bottom: 8px;
}

.step-grid h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 1.05rem;
}

.step-grid p {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 900px) {
  .step-grid { grid-template-columns: 1fr; }
}

/* Allow the AI timeline page to use the Tree Tracing Tools base template while staying wide enough for the timeline + detail panel. */
@media (min-width: 1200px) {
  body:has(#aiTimelineApp) main.container {
    max-width: 1680px;
  }
}

.timeline-breadcrumb {
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.timeline-breadcrumb a {
  color: var(--green-dark);
  font-weight: 800;
}

/* Compact collection summary and presenter directory */
.compact-collection {
  width: 100%;
  max-width: 360px;
  justify-self: end;
  padding: 13px 15px;
}

.compact-collection .hero-card-title {
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.collection-summary {
  margin: 0;
  color: #27312b;
  font-size: clamp(0.95rem, 1.05vw, 1.08rem);
  line-height: 1.34;
}

.collection-summary strong {
  color: var(--green-dark);
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.55vw, 1.65rem);
  line-height: 1;
  white-space: nowrap;
}

.collection-summary a {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.collection-summary a:hover,
.collection-summary a:focus,
.presenter-link:hover,
.presenter-link:focus {
  color: #1e5b43;
  outline: none;
  text-decoration-thickness: 2px;
}

.presenter-link {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-meta .presenter-link {
  font-weight: 800;
}

.presenter-page.site-shell {
  width: min(1320px, 100%);
}

.presenter-hero {
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.presenter-hero-text h1 {
  white-space: normal;
}

.presenter-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.presenter-index-card,
.presenter-resources-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.presenter-index-card {
  position: sticky;
  top: 18px;
}

.presenter-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.presenter-card-heading h2,
.presenter-detail h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 2.8vw, 2.25rem);
  line-height: 1.08;
}

.presenter-stat-line,
.presenter-selected-count,
.presenter-affiliation {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.presenter-search {
  margin-bottom: 16px;
}

.presenter-list {
  display: grid;
  gap: 7px;
}

.presenter-letter {
  margin: 12px 0 2px;
  color: var(--green-dark);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 900;
  border-bottom: 1px solid #e0dbd0;
}

.presenter-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border: 1px solid #d8d1c4;
  border-radius: 9px;
  background: #fffdf8;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.presenter-button:hover,
.presenter-button:focus,
.presenter-button.active {
  border-color: var(--green-dark);
  background: var(--green-pale);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}

.presenter-name {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.15;
}

.presenter-count {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.presenter-detail > p:not(.eyebrow):not(.presenter-selected-count):not(.presenter-affiliation) {
  max-width: 760px;
  color: #2d332f;
  line-height: 1.45;
}

.presenter-affiliation {
  margin-top: 6px;
}

.presenter-selected-count {
  margin: 10px 0 18px;
  font-weight: 800;
}

.presenter-resource-list {
  display: grid;
  gap: 12px;
}

.presenter-resource-card {
  border: 1px solid #dcd6ca;
  border-radius: 12px;
  background: #fffdf8;
  padding: 16px;
}

.presenter-resource-card h3 {
  margin: 8px 0 8px;
  color: var(--green-dark);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.12;
}

.presenter-resource-card p {
  margin: 0 0 12px;
  color: #2d332f;
  line-height: 1.45;
}

.presenter-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.presenter-card-meta span {
  border: 1px solid #d9d3c7;
  border-radius: 999px;
  background: #fbf8ef;
  padding: 4px 8px;
}

.presenter-resource-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.presenter-card-topic {
  color: var(--green-dark);
  border: 1px solid #c5d3c9;
  background: #f3faf5;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.compact-link {
  margin-top: 0;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.presenter-empty {
  border: 1px dashed #bbb4a8;
  border-radius: 12px;
  padding: 22px;
  color: var(--muted);
  background: #fffdf8;
  text-align: center;
}

main.container:has(#aiPresentersApp) {
  max-width: 1320px;
}

@media (max-width: 980px) {
  .presenter-workspace {
    grid-template-columns: 1fr;
  }

  .presenter-index-card {
    position: relative;
    top: auto;
  }
}

@media (max-width: 640px) {
  .collection-summary strong {
    font-size: 1.3rem;
  }

  .presenter-card-heading,
  .presenter-button,
  .presenter-resource-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .presenter-count {
    white-space: normal;
  }
}

/* Presenter directory scaling update */
.presenter-card-heading.compact-heading {
  align-items: flex-start;
}

.presenter-featured,
.presenter-all {
  margin-top: 18px;
}

.presenter-featured h3,
.presenter-all h3,
.presenter-section-heading h3 {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.presenter-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.featured-presenter-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.featured-presenter-button {
  display: grid;
  gap: 4px;
  min-height: 74px;
  border: 1px solid #cfc8ba;
  border-top: 4px solid var(--green-dark);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
}

.featured-presenter-button:hover,
.featured-presenter-button:focus,
.featured-presenter-button.active {
  border-color: var(--green-dark);
  background: var(--green-pale);
  outline: 3px solid rgba(41, 110, 82, 0.13);
  outline-offset: 2px;
}

.letter-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 12px;
}

.letter-filter-button {
  min-width: 31px;
  min-height: 31px;
  border: 1px solid #d8d1c4;
  border-radius: 999px;
  background: #fffdf8;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}

.letter-filter-button:hover,
.letter-filter-button:focus,
.letter-filter-button.active {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: #fff;
  outline: none;
}

.compact-presenter-list {
  gap: 5px;
}

.compact-presenter-list .presenter-button {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
}

.compact-presenter-list .presenter-name {
  font-size: 0.96rem;
}

.selected-presenter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.presenter-timeline-link {
  flex: 0 0 auto;
  margin-top: 4px;
  white-space: nowrap;
}

.presenter-filter-notice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  border: 1px solid #c5d3c9;
  border-left: 5px solid var(--green-dark);
  border-radius: 12px;
  background: var(--green-pale);
  color: #183c2f;
  padding: 12px 14px;
}

.presenter-filter-notice strong {
  color: var(--green-dark);
}

@media (max-width: 1180px) {
  .featured-presenter-list {
    grid-template-columns: 1fr;
  }

  .selected-presenter-header {
    flex-direction: column;
  }

  .presenter-timeline-link {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .presenter-filter-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .trend-control-columns {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* Narrow / split-screen expanded timeline: use one normal scrolling column. */
@media (max-width: 1120px) {
  #aiTimelineApp.is-timeline-expanded {
    position: fixed;
    inset: 0;
    z-index: 999;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 12px !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: #f2f0e9;
  }

  #aiTimelineApp.is-timeline-expanded::before {
    display: none;
  }

  #aiTimelineApp.is-timeline-expanded .hero,
  #aiTimelineApp.is-timeline-expanded .results-card,
  #aiTimelineApp.is-timeline-expanded .info-card {
    display: none;
  }

  #aiTimelineApp.is-timeline-expanded .app-layout,
  #aiTimelineApp.is-timeline-expanded .workspace {
    display: block;
    width: 100%;
  }

  #aiTimelineApp.is-timeline-expanded .controls,
  #aiTimelineApp.is-timeline-expanded .timeline-card,
  #aiTimelineApp.is-timeline-expanded .detail-panel {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0 0 12px;
  }

  #aiTimelineApp.is-timeline-expanded .controls {
    max-height: none;
    overflow: visible;
    padding: 14px 16px;
  }

  #aiTimelineApp.is-timeline-expanded .controls .search-row {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 150px) minmax(155px, 180px);
    gap: 10px;
  }

  #aiTimelineApp.is-timeline-expanded .controls .filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 10px;
  }

  #aiTimelineApp.is-timeline-expanded .filter-by-inline-label {
    flex: 0 0 auto;
    margin: 0;
  }

  #aiTimelineApp.is-timeline-expanded .year-section {
    flex: 0 1 auto;
    min-width: 0;
  }

  #aiTimelineApp.is-timeline-expanded .year-heading {
    flex-wrap: wrap;
    gap: 8px;
  }

  #aiTimelineApp.is-timeline-expanded .filter-mode-section {
    flex: 0 0 auto;
    min-width: 0;
    margin-left: 8px;
  }

  #aiTimelineApp.is-timeline-expanded .filter-mode-switch {
    width: auto;
    max-width: 100%;
  }

  #aiTimelineApp.is-timeline-expanded .mode-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 13px;
    white-space: nowrap;
  }

  #aiTimelineApp.is-timeline-expanded .filter-toolbar-actions {
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  #aiTimelineApp.is-timeline-expanded .controls .filter-tag-panel {
    max-height: none;
    overflow: visible;
  }

  #aiTimelineApp.is-timeline-expanded .timeline-card {
    display: block;
    overflow: visible;
    background: #fffdf7;
  }

  #aiTimelineApp.is-timeline-expanded .timeline-stage {
    height: 390px;
    min-height: 390px;
    overflow: visible;
  }

  #aiTimelineApp.is-timeline-expanded .timeline-stage.has-trend {
    height: 520px;
    min-height: 520px;
  }

  #aiTimelineApp.is-timeline-expanded .detail-panel {
    max-height: none;
    overflow: visible;
    background: #fffdf7;
    box-shadow: 0 10px 28px rgba(48, 45, 37, 0.14);
  }

  #aiTimelineApp.is-timeline-expanded .detail-panel .detail-content {
    overflow: visible;
  }
}

@media (max-width: 720px) {
  #aiTimelineApp.is-timeline-expanded {
    padding: 8px !important;
  }

  #aiTimelineApp.is-timeline-expanded .controls .search-row {
    grid-template-columns: 1fr;
  }

  #aiTimelineApp.is-timeline-expanded .controls .filter-toolbar {
    align-items: flex-start;
  }

  #aiTimelineApp.is-timeline-expanded .year-section,
  #aiTimelineApp.is-timeline-expanded .filter-mode-section,
  #aiTimelineApp.is-timeline-expanded .filter-toolbar-actions {
    flex-basis: 100%;
    margin-left: 0;
  }

  #aiTimelineApp.is-timeline-expanded .filter-mode-switch {
    width: fit-content;
  }

  #aiTimelineApp.is-timeline-expanded .mode-button {
    white-space: normal;
  }
}
