/* ========================================
   Manap Ailesi Soy Agaci — Minimalist CSS
   ======================================== */

:root {
  --bg: #faf9f7;
  --bg-alt: #f0eeeb;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #8b5e3c;
  --accent-light: #c49a6c;
  --accent-bg: #f5ede4;
  --border: #e0dcd6;
  --white: #ffffff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* ---- Typography ---- */

h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 600;
}

h1 { font-family: var(--serif); font-weight: 700; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-light); }

/* ---- Layout ---- */

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

.section {
  padding: 5rem 0;
}

.section-tight {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-family: var(--serif);
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.section-intro {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 700px;
  margin-bottom: 2.5rem;
}

.subsection-title {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

/* ---- Navigation ---- */

#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(250, 249, 247, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

#nav.scrolled {
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--accent-bg);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all var(--transition);
}

/* ---- Hero ---- */

#hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 1.5rem 3rem;
  position: relative;
  background: linear-gradient(180deg, var(--bg) 0%, var(--accent-bg) 100%);
}

.hero-eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

#hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  margin-bottom: 1.5rem;
  color: var(--text);
}

#hero h1 span {
  display: block;
  font-weight: 400;
  font-style: italic;
  font-size: 0.6em;
  color: var(--accent);
}

.hero-subtitle {
  max-width: 600px;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: var(--white);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  transition: all var(--transition);
}

.hero-cta:hover {
  background: var(--accent-light);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ---- Map ---- */

#map {
  padding-bottom: 0;
}

.map-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.origin {
  background: var(--accent);
}

.legend-dot.settlement {
  background: #5a8f7b;
}

.legend-dot.reference {
  background: #456b92;
}

.legend-line {
  width: 24px;
  height: 2px;
  background: var(--accent-light);
  border-radius: 1px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.map-layer-toggle {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.layer-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.layer-toggle.is-active {
  background: var(--accent);
  color: var(--white);
}

.map-layer-note {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 42rem;
}

.map-shell {
  position: relative;
}

#mapContainer {
  width: 100%;
  height: 520px;
  border-top: 1px solid var(--border);
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font) !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-size: 0.9rem !important;
  line-height: 1.6 !important;
}

.leaflet-popup-content h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--accent);
}

.leaflet-popup-content p {
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.map-popup-link {
  display: inline-flex;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.ottoman-tile {
  filter: sepia(0.7) saturate(0.8) hue-rotate(-12deg) brightness(0.96) contrast(1.04);
}

.ottoman-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(250, 245, 235, 0.9);
  border: 1px solid rgba(139, 94, 60, 0.28);
  color: #7b5634;
  font-family: var(--serif);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 18px rgba(84, 61, 41, 0.08);
  white-space: nowrap;
}

.ottoman-label.is-major {
  background: rgba(246, 237, 220, 0.94);
  border-color: rgba(123, 86, 52, 0.34);
  color: #6f4e31;
  font-size: 0.82rem;
  padding: 0.24rem 0.72rem;
}

.ottoman-label.is-place {
  background: rgba(255, 250, 242, 0.92);
  border-color: rgba(123, 86, 52, 0.22);
  color: #806246;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---- Search ---- */

.search-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 2rem;
  align-items: start;
}

.search-eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.search-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.search-input-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input-wrap input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.9rem 1rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
}

.search-input-wrap input:focus {
  outline: 2px solid rgba(139, 94, 60, 0.15);
  border-color: var(--accent-light);
}

.search-clear,
.search-jump,
.tree-reset,
.gallery-step {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font: inherit;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-clear:hover,
.search-jump:hover,
.tree-reset:hover,
.gallery-step:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: var(--accent-bg);
}

.search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
}

.search-meta p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.search-result {
  width: 100%;
  text-align: left;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.search-result:hover {
  border-color: var(--accent-light);
  transform: translateY(-1px);
}

.search-result-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.search-result-title {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.search-result-snippet {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.search-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 1rem 0.35rem 0;
}

.search-match {
  box-shadow: 0 0 0 2px rgba(196, 154, 108, 0.35);
  border-color: rgba(196, 154, 108, 0.8) !important;
}

.search-dimmed {
  opacity: 0.45;
  transition: opacity var(--transition), box-shadow var(--transition);
}

.search-result mark {
  background: rgba(196, 154, 108, 0.28);
  color: inherit;
  padding: 0 0.2em;
  border-radius: 0.25em;
}

/* ---- Tree ---- */

.tree-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.75fr);
  gap: 1.5rem;
  align-items: stretch;
}

.tree-frame,
.tree-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow);
}

.tree-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1rem 0;
}

.tree-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 0;
}

.tree-canvas {
  height: 640px;
  overflow: hidden;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: none;
}

.tree-canvas:active {
  cursor: grabbing;
}

#familyTreeSvg {
  display: block;
  width: 100%;
  height: 100%;
}

.tree-link {
  fill: none;
  stroke: rgba(139, 94, 60, 0.32);
  stroke-width: 2px;
}

.tree-node {
  cursor: pointer;
}

.tree-node circle {
  fill: var(--white);
  stroke: var(--accent);
  stroke-width: 2px;
  transition: transform var(--transition), fill var(--transition), stroke var(--transition);
}

.tree-node text {
  font-family: var(--font);
  fill: var(--text);
}

.tree-node-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.tree-node-meta {
  font-size: 0.74rem;
  fill: var(--text-muted);
}

.tree-node:hover circle,
.tree-node.is-active circle {
  fill: var(--accent-bg);
  transform: scale(1.08);
}

.tree-node.is-match circle {
  stroke: var(--accent-light);
  stroke-width: 3px;
}

.tree-node.is-dimmed {
  opacity: 0.28;
}

.tree-panel {
  padding: 1.25rem;
}

.tree-panel-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.tree-panel h3 {
  margin-bottom: 0.75rem;
}

.tree-panel p {
  color: var(--text-muted);
}

.tree-meta {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.tree-meta li {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---- Gallery ---- */

.gallery-collections {
  display: grid;
  gap: 2rem;
}

.gallery-group {
  display: grid;
  gap: 1rem;
}

.gallery-group-head {
  display: grid;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(139, 94, 60, 0.12);
}

.gallery-group-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.gallery-group-head h3 {
  font-size: 1.3rem;
}

.gallery-group-head p {
  color: var(--text-muted);
  max-width: 760px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.gallery-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.gallery-card button {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

.gallery-card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-alt);
}

.gallery-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.gallery-card:hover .gallery-card-media img {
  transform: scale(1.04);
}

.gallery-card-copy {
  padding: 1rem 1rem 1.1rem;
}

.gallery-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.gallery-card-eyebrow {
  display: inline-block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.gallery-card-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(139, 94, 60, 0.24);
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.18rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.gallery-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

.gallery-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}

.gallery-card-credit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.gallery-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.gallery-card-count {
  flex-shrink: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
}

.gallery-modal[hidden] {
  display: none;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 18, 17, 0.72);
  backdrop-filter: blur(4px);
}

.gallery-dialog {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100vw - 2rem));
  margin: 4vh auto;
  background: var(--white);
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  min-height: min(720px, 92vh);
  box-shadow: var(--shadow-lg);
}

.gallery-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-modal-media {
  background: #111;
}

.gallery-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-modal-copy {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gallery-modal-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

.gallery-modal-copy p {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.gallery-modal-credit {
  font-size: 0.86rem;
  margin-top: 1rem;
}

.gallery-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.gallery-modal-actions a {
  font-weight: 600;
}

/* ---- Branch Cards ---- */

.branches-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.branch-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.branch-card:hover {
  box-shadow: var(--shadow);
}

.branch-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
}

.branch-number {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-light);
  min-width: 2.5rem;
}

.branch-header > div {
  flex: 1;
  min-width: 0;
}

.branch-header h3 {
  flex: 1;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.branch-location {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.branch-toggle {
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: transform var(--transition);
  font-weight: 300;
  line-height: 1;
  flex-shrink: 0;
}

.branch-card.open .branch-toggle {
  transform: rotate(45deg);
}

.branch-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.branch-card.open .branch-body {
  max-height: 800px;
}

.branch-body > * {
  padding: 0 1.5rem;
}

.branch-body > *:first-child {
  padding-top: 0.5rem;
}

.branch-body > *:last-child {
  padding-bottom: 1.5rem;
}

.branch-detail {
  background: var(--accent-bg);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem !important;
  margin: 1rem 1.5rem 0 !important;
}

.branch-detail h4 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.branch-detail ul {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.branch-detail li {
  margin-bottom: 0.3rem;
}

.branch-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
}

/* ---- Timeline ---- */

.timeline {
  position: relative;
  padding-left: 3rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-light) 50%, var(--border) 100%);
}

.timeline-item {
  position: relative;
  padding-bottom: 3rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-marker {
  position: absolute;
  left: -3rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-alt);
  z-index: 1;
  transition: transform var(--transition);
}

.timeline-item:hover .timeline-marker {
  transform: scale(1.4);
}

.timeline-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow var(--transition);
}

.timeline-item:hover .timeline-content {
  box-shadow: var(--shadow);
}

.timeline-date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.timeline-content h3 {
  margin-bottom: 0.4rem;
}

.timeline-location {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-style: italic;
}

.timeline-events {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.event-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 100px;
}

/* ---- Archive Blocks ---- */

.archive-block {
  margin-bottom: 3rem;
}

.archive-block h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.archive-list {
  padding-left: 1.5rem;
}

.archive-list li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* ---- Methodology Steps ---- */

.methodology-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.method-step {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}

.method-step:hover {
  box-shadow: var(--shadow);
}

.step-number {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.method-step h4 {
  margin-bottom: 0.3rem;
  color: var(--accent);
}

.method-step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Tables ---- */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--accent-bg);
}

th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(139, 94, 60, 0.03);
}

/* ---- Context Blocks (Balkans) ---- */

.context-block {
  margin-bottom: 3rem;
}

.context-block h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.context-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.context-card {
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.context-card h4 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.context-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---- Stats Row ---- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat {
  text-align: center;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-number {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- Names ---- */

.names-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.names-block {
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.names-block h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.names-block p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---- Manap Etymology ---- */

.manap-etymology {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--accent-light);
}

.manap-etymology h4 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ---- Conclusion ---- */

.conclusion-content {
  max-width: 800px;
}

.conclusion-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.conclusion-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}

.conclusion-item:hover {
  box-shadow: var(--shadow);
}

.conclusion-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.conclusion-item p {
  font-size: 0.95rem;
}

.conclusion-quote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-muted);
  background: var(--white);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- References ---- */

.references-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.ref-group h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.ref-list {
  padding-left: 1.5rem;
}

.ref-list li {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- Footer ---- */

footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Scroll Animations ---- */

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(250, 249, 247, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
    max-height: calc(100svh - 56px);
    overflow-y: auto;
    gap: 0.15rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .section {
    padding: 3rem 0;
  }

  .section-tight {
    padding: 2.75rem 0;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .section-intro {
    font-size: 0.95rem;
  }

  .search-shell,
  .tree-layout,
  .gallery-dialog {
    grid-template-columns: 1fr;
  }

  .search-input-wrap,
  .search-meta,
  .map-toolbar,
  .tree-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .map-layer-note,
  .tree-hint {
    max-width: none;
  }

  .map-layer-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .layer-toggle {
    flex: 1;
    text-align: center;
  }

  .tree-canvas {
    height: 540px;
  }

  .gallery-dialog {
    width: min(100vw - 1rem, 1000px);
    margin: 2vh auto;
    min-height: auto;
    max-height: 92vh;
    overflow-y: auto;
  }

  .gallery-modal-media {
    max-height: 46vh;
  }

  .gallery-modal-copy {
    padding: 1.5rem;
  }

  .gallery-group-head {
    gap: 0.65rem;
  }

  .gallery-card-meta,
  .gallery-card-footer {
    flex-wrap: wrap;
  }

  #hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    padding: 0 0.5rem;
  }

  #mapContainer {
    height: 380px;
  }

  .ottoman-label.is-place {
    display: none;
  }

  .timeline {
    padding-left: 2.5rem;
  }

  .timeline::before {
    left: 11px;
  }

  .timeline-marker {
    left: -2.5rem;
  }

  .timeline-events {
    gap: 0.35rem;
  }

  .event-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .stat-number {
    font-size: 2rem;
  }

  .context-detail {
    grid-template-columns: 1fr;
  }

  .names-grid {
    grid-template-columns: 1fr;
  }

  .references-columns {
    grid-template-columns: 1fr;
  }

  .table-wrapper {
    font-size: 0.82rem;
  }

  .search-dimmed {
    opacity: 0.6;
  }

  th, td {
    padding: 0.5rem 0.65rem;
  }

  .conclusion-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .manap-etymology .names-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 1rem;
  }

  .branch-header {
    padding: 1rem;
  }

  .search-panel,
  .tree-panel,
  .gallery-card-copy {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .branch-number {
    display: none;
  }

  .branch-body > * {
    padding: 0 1rem;
  }

  .branch-detail {
    margin: 1rem 1rem 0 !important;
    padding: 1rem !important;
  }

  .method-step {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-inner {
    padding: 0 1rem;
  }

  .nav-links a {
    padding: 0.7rem 0.8rem;
  }

  #mapContainer {
    height: 300px;
  }

  .tree-canvas {
    height: 460px;
  }

  .gallery-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-card-meta,
  .gallery-card-footer,
  .gallery-group-head {
    gap: 0.5rem;
  }

  .gallery-card-meta,
  .gallery-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-dialog {
    width: calc(100vw - 0.5rem);
    margin: 1vh auto;
    border-radius: 18px;
  }

  .gallery-modal-media {
    max-height: 36vh;
  }

  .gallery-modal-copy {
    padding: 1.1rem;
  }

  .gallery-close {
    top: 0.75rem;
    right: 0.75rem;
  }

  .hero-eyebrow {
    font-size: 0.75rem;
  }

  #hero h1 {
    font-size: 1.8rem;
  }

  .hero-scroll-hint,
  .ottoman-label.is-major {
    display: none;
  }
}
