/* "Kamen i noć" (stone and night): grey limestone in shade with lighter slabs for content,
   a night-dark footer, deep sky blue as the single strong accent, terra rossa for years and
   markers. The palette lives on contrast: dark darks, light slabs, nothing muddy in between. */

:root {
  /* Stone: backgrounds and lines */
  --stone-50: #f5f4f0;
  --stone-100: #e9e7e0;
  --stone-200: #dcd9d0;
  --stone-300: #c9c5ba;
  --stone-600: #3f4341;
  --slab: #f1f0eb;
  --graphite: #161b20;
  --shade: #12181f;

  /* Sky: links, buttons, focus */
  --sky-700: #15507d;
  --sky-500: #2f7ab0;
  --sky-200: #b3d1e8;
  --sky-100: #dfecf6;

  /* Terra rossa: years, markers, selection */
  --terra: #b8432a;
  --terra-text: #983620;
  --terra-100: #f3dfd7;

  /* Maquis: secondary accent */
  --maquis: #56693f;
  --maquis-100: #e1e7d6;

  /* Sun: only in light gradients and footer hover */
  --sun: #f2cf7c;

  --font-text: "Literata", Georgia, serif;
  --font-ui: "Manrope", system-ui, sans-serif;

  --container: 1240px;
  --measure: 44rem;
  --radius: 3px;
  --shadow-sun: 0 1px 2px rgba(0, 0, 0, 0.12), 0 24px 36px -22px rgba(18, 24, 31, 0.6);
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--graphite);
  font-optical-sizing: auto;
  /* Darker stone around the slabs so they stand out instead of blending into white */
  background: #bdbbb3 url("/images/stone.webp") repeat;
  background-blend-mode: multiply;
}

/* Sun glare from the top right and a cool shade towards the bottom left, on a fixed layer behind
   the page: the light stays still while the stone scrolls under it. A fixed-position layer works
   where background-attachment: fixed does not (iOS Safari) and avoids repainting on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70rem 45rem at 88% -12%, rgba(255, 251, 238, 0.55), rgba(255, 251, 238, 0) 65%),
    linear-gradient(160deg, rgba(18, 24, 31, 0) 50%, rgba(18, 24, 31, 0.18) 100%);
}

/* A lighter limestone slab in sunlight, casting a shadow on the stone behind it */
.slab {
  background: var(--slab);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sun);
}

main {
  flex: 1;
  padding: 3.5rem 0 5rem;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-text);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  font-weight: 500;
}

h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 500;
}

h3 {
  font-size: 1.4rem;
}

a {
  color: var(--sky-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--terra-text);
}

:focus-visible {
  outline: 2px solid var(--sky-500);
  outline-offset: 2px;
}

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

.container {
  width: min(var(--container), 100% - 2rem);
  margin-inline: auto;
}

/* Small uppercase label above headings */
.eyebrow {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 0.9rem;
}

.lead {
  font-size: 1.14rem;
  line-height: 1.65;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(246, 245, 241, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 10px 24px -18px rgba(0, 0, 0, 0.5);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding-block: 0.85rem;
}

.site-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
  color: var(--graphite);
  text-decoration: none;
}

.site-title b {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-title span {
  margin-top: 0.3rem;
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--terra);
}

.site-title:hover {
  color: var(--graphite);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
}

.site-nav a {
  color: var(--graphite);
  text-decoration: none;
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--sky-700);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--terra);
}

.nav-toggle {
  display: none;
  background: transparent;
  color: var(--graphite);
  border: 1px solid var(--stone-300);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 960px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    padding-bottom: 0.5rem;
  }
}

/* Footer */

.site-footer {
  position: relative;
  background: var(--shade);
  color: #c2c7cb;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 7rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(18, 24, 31, 0), rgba(18, 24, 31, 0.28));
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  padding-block: 3rem;
}

.site-footer__name {
  color: #fff;
  font-family: var(--font-text);
  font-size: 1.3rem;
  font-weight: 500;
}

.site-footer p {
  margin: 0.6rem 0 0;
}

.site-footer a {
  color: #e4e8ea;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--sun);
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 2;
}

.site-footer__copy {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-block: 1rem 1.5rem;
  font-size: 0.8rem;
  color: #8e969c;
}

@media (max-width: 760px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer__inner > :first-child {
    grid-column: 1 / -1;
  }
}

/* Shared blocks */

.placeholder {
  padding: 2rem;
  background: var(--slab);
  box-shadow: var(--shadow-sun);
  border-radius: var(--radius);
  color: var(--stone-600);
  font-family: var(--font-ui);
  max-width: var(--measure);
}

/* Photos: archival ones are shown in neutral black and white; the linked original keeps its colors */

.photo {
  margin: 0;
}

.photo__frame {
  display: block;
  padding: 6px;
  background: #faf9f6;
  box-shadow: var(--shadow-sun);
  outline: 1px solid rgba(0, 0, 0, 0.14);
}

.photo--archival img {
  filter: grayscale(1) contrast(1.06) brightness(1.03);
}

.photo figcaption {
  margin-top: 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--stone-600);
}

.photo figcaption .year {
  margin-right: 0.4rem;
  font-weight: 700;
  color: var(--terra);
}

/* Maps */

.map {
  width: 100%;
  height: 420px;
  box-shadow: var(--shadow-sun);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  /* Keeps Leaflet's high z-index panes below the sticky header */
  isolation: isolate;
}

.map-control {
  background: #fff;
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--graphite);
}

.leaflet-container a {
  color: var(--sky-700);
}

.map--home .leaflet-tile-pane {
  filter: saturate(0.7);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  font-family: var(--font-ui);
}

/* Home */

main.home {
  padding: 0;
}

/* Full-bleed photo, shaded towards the bottom so the title stays readable */
.hero {
  display: flex;
  align-items: flex-end;
  min-height: min(80vh, 720px);
  padding-block: 6rem 5.5rem;
  color: #fff;
  /* Photo: the karst slope above Petrovo polje, April 2011 */
  background:
    linear-gradient(180deg, rgba(25, 31, 36, 0) 40%, rgba(25, 31, 36, 0.68) 100%),
    linear-gradient(90deg, rgba(25, 31, 36, 0.3), rgba(25, 31, 36, 0) 55%),
    var(--shade) url("/images/hero.jpg") 50% 42% / cover no-repeat;
}

@media (max-width: 1280px) {
  .hero {
    background-image:
      linear-gradient(180deg, rgba(25, 31, 36, 0) 40%, rgba(25, 31, 36, 0.68) 100%),
      linear-gradient(90deg, rgba(25, 31, 36, 0.3), rgba(25, 31, 36, 0) 55%),
      url("/images/hero-1280.jpg");
  }
}

.hero h1 {
  margin-bottom: 0.2em;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.hero .eyebrow {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.82rem;
}

.hero__sub {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.hero__coords {
  margin-top: 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.home-section {
  padding-block: 3.5rem;
}

.home-section + .home-section {
  padding-top: 0;
}

/* A band in the shade */
.home-section--alt {
  background: linear-gradient(180deg, rgba(43, 49, 55, 0.07), rgba(43, 49, 55, 0.03));
}

.intro {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: 3rem;
  align-items: start;
  padding: 3rem;
}

.intro .photo {
  position: sticky;
  top: 6rem;
}

.intro .photo__frame {
  box-shadow: none;
  outline: 1px solid var(--stone-300);
}

.intro .greeting {
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.intro p {
  margin: 0 0 1.25em;
}

/* Entry cards leading to the main sections */
.entries {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

.entry {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  background: var(--slab);
  box-shadow: 0 1px 2px rgba(34, 39, 43, 0.08), 0 14px 24px -18px rgba(31, 58, 85, 0.4);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.25s ease;
}

.entry:hover {
  color: inherit;
  box-shadow: 0 1px 2px rgba(34, 39, 43, 0.08), 0 26px 36px -22px rgba(31, 58, 85, 0.5);
}

.entry:hover h3 {
  color: var(--sky-700);
}

.entry--wide {
  grid-column: span 8;
}

.entry__img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--stone-200);
}

.entry--wide .entry__img {
  aspect-ratio: 16 / 7.6;
}

.entry__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry__img--archival img {
  filter: grayscale(1) contrast(1.06);
}

.entry__body {
  padding: 1.25rem 1.4rem 1.5rem;
}

.entry__body h3 {
  margin-bottom: 0.35rem;
}

.entry__body p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--stone-600);
}

.map--home {
  height: 380px;
  transition: height 0.3s ease;
}

.map--home.is-expanded {
  height: 620px;
}

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem;
  }

  .intro .photo {
    position: static;
    max-width: 420px;
  }

  .entry,
  .entry--wide {
    grid-column: span 12;
  }

  .home-section {
    padding-block: 2.5rem;
  }

  .hero {
    min-height: 60vh;
    padding-block: 4rem 2.5rem;
  }
}

/* Gallery: photos keep their own proportions, laid out in columns */

.gallery {
  columns: 4 230px;
  column-gap: 1.25rem;
}

.gallery figure {
  break-inside: avoid;
  margin: 0 0 1.5rem;
}

.gallery figure > a {
  display: block;
  padding: 6px;
  background: #faf9f6;
  box-shadow: var(--shadow-sun);
  outline: 1px solid rgba(0, 0, 0, 0.14);
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

.gallery figure > a:hover {
  transform: translateY(-3px);
}

/* Parcels */

.parcels {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 3fr;
  gap: 1.25rem;
  align-items: start;
  font-family: var(--font-ui);
}

.parcels .map {
  height: 640px;
}

.owners-panel {
  background: var(--slab);
  box-shadow: var(--shadow-sun);
  border-radius: var(--radius);
  padding: 1rem;
}

.owners-panel input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: var(--radius);
}

.owners-list {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  margin: 0.75rem 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius);
  font-size: 0.86rem;
}

.owners-list label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--stone-100);
  cursor: pointer;
}

.owners-list input[type="checkbox"] {
  accent-color: var(--terra);
}

.owners-list hr {
  border: 0;
  border-top: 1px solid var(--stone-300);
}

.owners-selected {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.86rem;
}

.owners-selected[hidden] {
  display: none;
}

.owner-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.6rem;
  color: var(--terra);
  font-weight: 700;
  background: var(--terra-100);
  border-radius: var(--radius);
}

.owner-tag button {
  background: none;
  border: none;
  color: var(--terra);
  font-size: 1.1rem;
  cursor: pointer;
}

.owners-actions {
  display: flex;
  gap: 0.5rem;
}

.button {
  padding: 0.55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--sky-700);
  border: 1px solid var(--sky-700);
  border-radius: var(--radius);
  cursor: pointer;
}

.button:hover {
  background: #0f3d61;
}

.button--secondary {
  color: var(--sky-700);
  background: transparent;
}

.button--secondary:hover {
  color: #fff;
  background: var(--sky-700);
}

.status {
  font-size: 0.85rem;
  color: var(--stone-600);
}

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

  .parcels .map {
    height: 480px;
  }
}

/* Memoir and other long-form pages */

.epigraph {
  margin: -0.5rem 0 2.5rem;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--stone-600);
}

.memoir-head {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding: 2.25rem 2.5rem;
  border-top: 4px solid var(--sky-700);
}

.memoir-head .photo__frame { box-shadow: none; outline: 1px solid var(--stone-300); }
.memoir-head h2 { margin-bottom: 0.2rem; }
.memoir-head p { max-width: var(--measure); margin: 0 0 1em; }

.memoir-head__years {
  margin-bottom: 1.2rem;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--terra);
}

.memoir-head__meta {
  margin: 0 !important;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--stone-600);
}

.chapters {
  margin-top: 1.5rem;
  padding: 0.75rem 2.5rem;
}

.chapter {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--stone-200);
  color: inherit;
  text-decoration: none;
}

.chapter:last-child { border-bottom: 0; }
.chapter:hover { color: inherit; }
.chapter:hover h3 { color: var(--sky-700); }
.chapter__n { font-size: 2.4rem; font-weight: 300; line-height: 1; color: var(--sky-500); }
.chapter h3 { margin: 0 0 0.35rem; }
.chapter__lead { margin: 0 0 0.4rem; max-width: var(--measure); color: #2d343a; }
.chapter__meta { margin: 0; font-family: var(--font-ui); font-size: 0.8rem; color: var(--stone-600); }

/* Reading layout: chapter list on the left, the text column on a slab */
.story {
  --article-pad: clamp(1.25rem, 4vw, 3.5rem);
  display: grid;
  grid-template-columns: 13rem minmax(0, calc(var(--measure) + 2 * var(--article-pad)));
  gap: 3rem;
  align-items: start;
  justify-content: center;
}

.toc {
  position: sticky;
  top: 6rem;
  font-family: var(--font-ui);
  font-size: 0.86rem;
}

.toc__title {
  margin-bottom: 0.8rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toc__title a { color: var(--stone-600); text-decoration: none; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--stone-300); }

.toc li a {
  display: block;
  margin-left: -1px;
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 2px solid transparent;
  color: var(--stone-600);
  text-decoration: none;
  line-height: 1.4;
}

.toc li a:hover { color: var(--graphite); }
.toc li a.is-active { color: var(--graphite); font-weight: 700; border-left-color: var(--terra); }

.article {
  padding: 2.75rem var(--article-pad, 2rem) 2.5rem;
}

.article > * { max-width: var(--measure); }
.article h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); margin-bottom: 0.4em; }
.article h2 { margin-top: 2em; font-size: clamp(1.35rem, 2vw, 1.6rem); }
.article p { margin: 0 0 1.25em; }
.article ul { padding-left: 1.2rem; }
.article li { margin-bottom: 0.3em; }

.article__meta {
  margin-bottom: 2.25rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--stone-600);
}

.article__photo { max-width: 46rem; margin: 2.5rem 0; }
.article__photo .photo__frame { box-shadow: none; outline: 1px solid var(--stone-300); }

/* A digression the author wandered into: kept, but folded away from the main story */
.aside {
  margin: 1.75rem 0;
  padding: 0.9rem 1.2rem;
  background: var(--stone-100);
  border-left: 3px solid var(--stone-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.aside summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--stone-600);
}

.aside[open] summary { margin-bottom: 0.9rem; }
.aside p:last-child { margin-bottom: 0; }

.editor-note {
  padding-left: 1rem;
  border-left: 2px solid var(--sky-500);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--stone-600);
}

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--stone-300);
  font-family: var(--font-text);
  font-size: 1.1rem;
  font-weight: 600;
}

.chapter-nav a { text-decoration: none; }
.chapter-nav__next { text-align: right; }

.chapter-nav span {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone-600);
}

@media (max-width: 900px) {
  .story { grid-template-columns: 1fr; gap: 1.5rem; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; border-left: 0; }
  .toc li a { padding: 0.2rem 0; border-left: 0; }
  .toc li a.is-active { border-bottom: 2px solid var(--terra); }
  .memoir-head { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem; }
  .memoir-head .photo { max-width: 180px; }
  .chapters { padding: 0.5rem 1.5rem; }
  .article { padding: 2rem 1.25rem; }
}

/* Claims that rest on oral tradition or lack confirmation, marked inside the text */
.claim {
  text-decoration: underline dotted var(--terra);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.claim::after {
  content: attr(data-kind);
  margin-left: 0.35rem;
  padding: 0.08rem 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 0.15em;
  color: var(--terra-text);
  background: var(--terra-100);
  border-radius: 2px;
}

.claim[data-kind="predanje"] { text-decoration-color: var(--maquis); }
.claim[data-kind="predanje"]::after { color: #4b5b39; background: var(--maquis-100); }

.timeline {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  border-left: 2px solid var(--stone-300);
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 0.45rem 0 0.45rem 1.25rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 1rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--slab);
  border: 2px solid var(--terra);
}

.timeline__year {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--terra);
  padding-top: 0.15rem;
}

.article .map { max-width: none; margin: 2rem 0; }

@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}

/* Family trees */

.tree-intro {
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.tree-search-wrap {
  position: relative;
  max-width: 28rem;
  margin-bottom: 2rem;
  font-family: var(--font-ui);
}

.tree-search-wrap input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: var(--radius);
}

.tree-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  max-height: 22rem;
  overflow-y: auto;
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sun);
  font-size: 0.9rem;
}

.tree-results li {
  padding: 0.4rem 0.9rem;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.tree-results a {
  text-decoration: none;
  font-weight: 600;
}

.tree-results__tree {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--stone-600);
}

.trees {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.tree-card {
  --tree: var(--sky-700);
  display: block;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--slab);
  border-top: 4px solid var(--tree);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sun);
  color: inherit;
  text-decoration: none;
}

.tree-card--klancani { --tree: var(--sky-700); }
.tree-card--strancani { --tree: var(--maquis); }
.tree-card--dosli { --tree: var(--terra); }

.tree-card .eyebrow { color: var(--tree); }
.tree-card h2 { font-size: 1.5rem; margin: 0 0 0.4rem; }
.tree-card p { margin: 0; font-size: 0.92rem; color: var(--stone-600); line-height: 1.55; }
.tree-card__meta { margin-top: 0.8rem !important; font-family: var(--font-ui); font-size: 0.8rem !important; }
.tree-card:hover { color: inherit; outline: 2px solid var(--tree); outline-offset: -2px; }
.tree-card.is-active { outline: 2px solid var(--tree); outline-offset: -2px; }

.tree-view {
  margin-top: 3rem;
  padding: 2rem 2.25rem 2.5rem;
  background: var(--slab);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sun);
}

.tree-view__head h2 { margin-bottom: 0.4rem; }

.crumbs {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  color: var(--stone-600);
  margin-bottom: 0.25rem;
}

.crumbs a { text-decoration: none; font-weight: 600; }
.crumb-sep { margin: 0 0.5rem; color: var(--stone-300); }

/* Rows: a small indent per generation; vertical guide lines (one per level) show the hierarchy */
.tree-rows {
  --indent: 1.4rem;
  --shift: 0; /* generations hidden behind the left margin while scrolling, set by tree.js */
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

/* A row is two columns: the text (indented by generation) and the lifespan bar on the year axis */
.trow {
  --left: 50%;
  display: flex;
  align-items: stretch;
  border-radius: var(--radius);
}

.trow__main {
  flex: 0 0 var(--left);
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.55rem;
  line-height: 1.35;
  padding: 0.18rem 0.5rem 0.18rem calc(max(var(--d) - var(--shift), 0) * var(--indent));
  background: repeating-linear-gradient(to right, var(--stone-300) 0 1px, transparent 1px var(--indent)) 0 0 / calc(max(var(--d) - var(--shift), 0) * var(--indent)) 100% no-repeat;
  transition: padding-left 0.3s ease, background-size 0.3s ease;
}

.trow__life {
  flex: 1;
  position: relative;
  min-height: 1.45rem;
  background:
    linear-gradient(to right, var(--stone-300) 0 1px, transparent 1px) var(--century-offset, 0) 0 / var(--century, 50%) 100% repeat-x,
    linear-gradient(to right, var(--stone-200) 0 1px, transparent 1px) 0 0 / var(--tick, 10%) 100% repeat-x;
}

.bar {
  --color: var(--stone-600);
  position: absolute;
  top: 0.45rem;
  height: 8px;
  border-radius: 4px;
  background: var(--color);
}

.bar--spouse { height: 5px; top: 0.4rem; opacity: 0.55; }
.bar--est { background: transparent; border: 2px dashed var(--color); height: 4px; opacity: 0.8; }
.bar--spouse.bar--est { height: 2px; }
.bar--open { background: linear-gradient(90deg, var(--color) 70%, transparent); }
.bar--fade { background: linear-gradient(90deg, var(--color) 30%, transparent); }
.bar--est.bar--open, .bar--est.bar--fade { background: transparent; border-right: 0; }

/* Men and women: slate blue and wine red, in names and in the bars of every tree */
.tree-rows {
  --m: #3b6e8f;
  --f: #8a2f3a;
}

.is-m { --color: var(--m); }
.is-f { --color: var(--f); }

.legend { display: inline-flex; gap: 0.9rem; align-items: center; font-weight: 600; text-transform: none; letter-spacing: 0; }
.legend i { display: inline-block; width: 14px; height: 6px; margin-right: 0.35rem; border-radius: 3px; vertical-align: middle; }
.legend__m { background: #3b6e8f; }
.legend__f { background: #8a2f3a; }
.legend__est { border: 2px dashed var(--stone-600); height: 2px !important; }

/* Year axis, sticky under the site header while the rows scroll */
.axis {
  position: sticky;
  top: var(--header-h, 0px);
  z-index: 5;
  display: flex;
  margin-top: 1.5rem;
  padding-top: 0.4rem;
  background: var(--slab);
  border-bottom: 1px solid var(--stone-300);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--stone-600);
}

.axis__left { flex: 0 0 50%; }
.axis__scale { flex: 1; position: relative; height: 1.6rem; }
.axis__tick { position: absolute; bottom: 0.25rem; transform: translateX(-50%); white-space: nowrap; }
.axis__tick--century { color: var(--graphite); }
.axis__tick:first-child { transform: none; }
.axis__tick--end { transform: translateX(-100%); }

.trow:hover { background-color: rgba(31, 90, 133, 0.05); }
.trow.is-current { background-color: var(--sky-100); }

.trow__toggle {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.3rem;
  padding: 0;
  font: inherit;
  line-height: 1;
  align-self: center;
  color: var(--stone-600);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: center;
}

.trow__toggle svg {
  width: 13px;
  height: 13px;
  fill: var(--graphite);
  transition: transform 0.15s ease;
}

.trow__toggle.is-open svg { transform: rotate(90deg); }
.trow__toggle:hover svg { fill: var(--sky-700); }

.trow__toggle--leaf { cursor: default; color: var(--stone-300); }

.trow__name { font-family: var(--font-text); font-size: 1.02rem; font-weight: 600; }
.trow__name a { color: var(--color, var(--graphite)); text-decoration: none; }
.trow__name a:hover { color: var(--sky-700); }
.trow__name--bio a { border-bottom: 1px dotted currentColor; }
.trow__nick { font-weight: 400; font-style: italic; }
.trow__surname { font-weight: 400; opacity: 0.75; }
.trow__years { font-size: 0.8rem; color: var(--stone-600); font-weight: 600; letter-spacing: 0.02em; }
.trow__line { margin-left: 0.3rem; font-size: 0.78rem; font-weight: 700; color: var(--sky-700) !important; }
.crumb-line { font-style: italic; }
.tbio__line { margin: 1rem 0 0; font-family: var(--font-ui); font-size: 0.88rem; }
.tbio__line a { font-weight: 700; text-decoration: none; }

/* Spouse row: same indent as the person, marked with ⚭ and a role label */
.trow--spouse { margin-top: -0.15rem; }
.trow--spouse .trow__main { padding-top: 0; padding-bottom: 0.1rem; }
.trow--spouse .trow__life { min-height: 1.2rem; }
.trow--spouse .trow__toggle { height: 1rem; }
.trow--spouse .trow__name { font-size: 0.92rem; font-weight: 500; }
.trow--spouse .trow__name a { opacity: 0.85; }
.trow__role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone-600);
}
.trow__name--unknown { font-style: italic; color: var(--stone-600); font-weight: 400; }
.trow--more a { font-weight: 700; text-decoration: none; }
.trow--more .trow__main::before { content: ""; width: 1.4rem; }

/* Biography panel: full width regardless of the row's depth */
.tbio {
  margin: 0.5rem 0 1.25rem;
  padding: 1.5rem 1.75rem;
  background: #faf9f6;
  border-left: 3px solid var(--terra);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sun);
}

.tbio__head { display: flex; gap: 1.5rem; align-items: flex-start; }
.tbio__head > div { flex: 1; }
.tbio__head h3 { margin: 0 0 0.6rem; }
.tbio__photo { width: 140px; flex: 0 0 140px; padding: 4px; background: #faf9f6; outline: 1px solid var(--stone-300); }
.tbio__fact { font-size: 0.88rem; margin-bottom: 0.2rem; }
.tbio__fact b { font-weight: 700; color: var(--stone-600); margin-right: 0.3rem; }
.tbio__fact a { text-decoration: none; font-weight: 600; }
.tbio__close {
  flex: 0 0 auto;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--stone-600);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.tbio__text {
  max-width: var(--measure);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--stone-200);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.7;
}

.tbio__text p { margin: 0 0 1em; }
.tbio__text h4 { margin: 1.2em 0 0.4em; }
.tbio__note { font-family: var(--font-ui); font-size: 0.85rem; color: var(--stone-600); }

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

@media (max-width: 700px) {
  .tree-view { padding: 1.25rem 1rem 1.5rem; margin-inline: -1rem; border-radius: 0; }
  .tree-rows { --indent: 0.85rem; font-size: 0.9rem; }
  .trow { flex-wrap: wrap; }
  .trow__main { flex-basis: 100%; padding-right: 0; }
  .trow__life { flex-basis: 100%; min-height: 1.1rem; }
  .bar { top: 0.25rem; height: 6px; }
  .bar--spouse { height: 3px; }
  .axis__left { display: none; }
  .axis { font-size: 0.62rem; }
  .trow__name { font-size: 1rem; }
  .tbio { padding: 1.1rem 1rem; }
  .tbio__head { flex-wrap: wrap; }
  .tbio__photo { width: 100px; flex-basis: 100px; }
}
