/* ============================================================
   ROMA AETERNA — общий стиль
   Каменные плиты, бронзовая гравировка, ни одной скруглённой
   карточки. Cinzel для надписей "по камню", Crimson Pro — текст.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Pro:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --stone-light: #ede6d6;
  --stone-mid:   #ddd2b8;
  --ink:         #1b1712;
  --ink-soft:    #332b22;
  --bronze:      #7a8a6f;
  --bronze-dark: #566148;
  --brick:       #9e3a2c;
  --brick-dark:  #7a2c21;
  --gold:        #b08d3e;
  --rule:        rgba(27, 23, 18, 0.18);

  --serif-display: 'Cinzel', 'Trajan Pro', serif;
  --serif-text: 'Crimson Pro', Georgia, serif;

  --max-w: 1120px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, rgba(176,141,62,0.06), transparent 60%),
    var(--stone-light);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* subtle stone texture via layered gradients, no external images required */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(90deg, rgba(27,23,18,0.015) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg, rgba(27,23,18,0.015) 0 1px, transparent 1px 90px);
}

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

a {
  color: var(--brick-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(158,58,44,0.35);
}
a:hover { border-bottom-color: var(--brick-dark); }

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  color: var(--ink);
  line-height: 1.25;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}

h1 { font-weight: 700; }
h2 { font-weight: 600; }

p { max-width: 68ch; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ---------- header / nav ---------- */

.site-header {
  border-bottom: 3px double var(--ink);
  background: linear-gradient(180deg, rgba(237,230,214,0.97), rgba(237,230,214,0.9));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(3px);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 22px 32px 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  border: none;
  white-space: nowrap;
}
.brand span {
  color: var(--brick);
}

nav.primary-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

nav.primary-nav a {
  border: none;
  font-family: var(--serif-display);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 8px 14px;
  position: relative;
}

nav.primary-nav a:hover { color: var(--brick-dark); }

nav.primary-nav a.active {
  color: var(--brick-dark);
}
nav.primary-nav a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--brick);
}

/* ---------- hero ---------- */

.hero {
  border-bottom: 1px solid var(--rule);
  padding: 72px 0 64px;
  position: relative;
}

.hero .eyebrow-plate {
  display: inline-block;
  border: 1px solid var(--bronze-dark);
  color: var(--bronze-dark);
  font-family: var(--serif-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  padding: 5px 12px;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  max-width: 16ch;
}

.hero .lede {
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: 58ch;
  margin-top: 18px;
}

.hero-figure {
  margin-top: 8px;
}

/* reveal-on-load, single orchestrated moment */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-in 0.9s ease-out forwards;
}
.reveal.delay-1 { animation-delay: 0.12s; }
.reveal.delay-2 { animation-delay: 0.26s; }
.reveal.delay-3 { animation-delay: 0.4s; }

@keyframes reveal-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- section scaffolding ---------- */

section {
  padding: 56px 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: none; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}

.section-head h2 { font-size: 1.9rem; margin: 0; }
.section-num {
  font-family: var(--serif-display);
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

/* ---------- stone plate / panel ---------- */

.plate {
  border: 1px solid var(--ink);
  padding: 28px 30px;
  background: rgba(255,255,255,0.28);
}

.plate + .plate { margin-top: 20px; }

/* ---------- grid of plates ---------- */

.grid {
  display: grid;
  gap: 22px;
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 820px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

.plate h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--brick-dark);
}

.plate p:last-child { margin-bottom: 0; }

/* ---------- timeline (sequence -> numbered is correct here) ---------- */

.timeline {
  border-left: 2px solid var(--ink);
  margin-left: 8px;
  padding-left: 0;
}

.timeline-item {
  position: relative;
  padding: 0 0 34px 34px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: attr(data-index);
  position: absolute;
  left: -23px;
  top: -2px;
  width: 42px;
  height: 42px;
  background: var(--stone-light);
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif-display);
  font-size: 0.85rem;
  color: var(--ink);
}

.timeline-item .t-year {
  font-family: var(--serif-display);
  color: var(--brick-dark);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}

.timeline-item h3 { margin-bottom: 8px; font-size: 1.2rem; }

/* ---------- quote / inscription ---------- */

.inscription {
  border-top: 3px double var(--ink);
  border-bottom: 3px double var(--ink);
  padding: 26px 0;
  margin: 48px 0;
  text-align: center;
}
.inscription blockquote {
  margin: 0;
  font-family: var(--serif-display);
  font-size: 1.3rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.inscription cite {
  display: block;
  font-style: normal;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--bronze-dark);
  letter-spacing: 0.06em;
}

/* ---------- stat row ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--ink);
}
.stat {
  padding: 22px 18px;
  text-align: center;
  border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: none; }
.stat .num {
  font-family: var(--serif-display);
  font-size: 2.1rem;
  color: var(--brick-dark);
  display: block;
}
.stat .label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

@media (max-width: 700px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat { border-bottom: 1px solid var(--rule); }
}

/* ---------- legion diagram (army page) ---------- */

.formation {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin: 28px 0;
}
.formation span {
  aspect-ratio: 1;
  border: 1px solid var(--bronze-dark);
  background: var(--stone-mid);
}
.formation span.gap { border: none; background: transparent; }

/* ---------- glossary list ---------- */

.glossary dt {
  font-family: var(--serif-display);
  color: var(--brick-dark);
  font-size: 1rem;
  margin-top: 20px;
}
.glossary dt:first-child { margin-top: 0; }
.glossary dd {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

/* ---------- toggle buttons (interactive bit, scripted) ---------- */

.toggle-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.toggle-btn {
  font-family: var(--serif-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink-soft);
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.toggle-btn:hover { background: rgba(122,138,111,0.15); }
.toggle-btn.active {
  background: var(--ink);
  color: var(--stone-light);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- footer ---------- */

footer.site-footer {
  border-top: 3px double var(--ink);
  padding: 36px 0 44px;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
footer.site-footer .footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
footer.site-footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
footer.site-footer a { border: none; color: var(--ink-soft); }
footer.site-footer a:hover { color: var(--brick-dark); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  body { font-size: 17px; }
  .container { padding: 0 20px; }
  .header-inner { padding: 18px 20px 14px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- focus visibility ---------- */

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--brick);
  outline-offset: 2px;
}
