/* ===== Design tokens ===== */
:root {
  --bg: #f6efe3;
  --text: #1f1a17;
  --accent: #7a1f1f;
  --accent-alt: #263b5e;
  --card: #fffaf0;
  --border: rgba(31, 26, 23, 0.12);
  --shadow: 0 4px 24px rgba(31, 26, 23, 0.08);
  --radius: 12px;
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --header-h: 56px;
  --tap-min: 44px;
}

/* ===== Reset & base (mobile-first) ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(122, 31, 31, 0.04) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231f1a17' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h2 {
  font-size: 1.75rem;
  color: var(--accent);
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent-alt);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent-alt);
  outline-offset: 2px;
}

.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Header & nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 239, 227, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 0 auto;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
}

.site-nav.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 1rem;
}

.site-nav a {
  display: block;
  padding: 0.75rem 1.25rem;
  min-height: var(--tap-min);
  font-size: 1.0625rem;
  text-decoration: none;
  color: var(--text);
}

.site-nav a:hover,
.site-nav a:focus {
  background: var(--card);
  color: var(--accent);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  max-width: 20rem;
}

.btn--primary:hover {
  background: #5e1818;
}

.btn--primary:active {
  transform: scale(0.98);
}

/* ===== Hero ===== */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 1.5rem) 0 3rem;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.hero__portrait {
  margin: 0;
  text-align: center;
  max-width: 280px;
}

.hero__portrait img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid var(--card);
}

.hero__content {
  text-align: center;
}

.hero__eyebrow {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-alt);
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-size: 1.875rem;
  color: var(--text);
}

.hero__subtitle {
  font-size: 1.125rem;
  color: var(--accent);
  font-family: var(--font-serif);
  margin-bottom: 1rem;
}

.hero__thesis {
  font-size: 1.0625rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Sections ===== */
.section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}

.section__lead {
  font-size: 1.0625rem;
  color: rgba(31, 26, 23, 0.85);
  margin-bottom: 2rem;
  max-width: 40rem;
}

.section__subtitle {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--accent-alt);
  margin: -0.25rem 0 0.75rem;
}

/* ===== Biography ===== */
.bio-grid {
  display: grid;
  gap: 1.25rem;
}

.bio-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.bio-card h3 {
  color: var(--accent-alt);
  font-size: 1.25rem;
}

.bio-card__year {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--accent);
}

/* ===== Timeline (vertical on mobile) ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 1.5rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 1.5rem;
}

.timeline-item {
  position: relative;
  list-style: none;
  margin: 0 0 0.75rem;
  padding-left: 0.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.65rem;
  top: 1.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-item__btn {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 1rem 1.25rem;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timeline-item__btn:hover {
  border-color: var(--accent);
}

.timeline-item__btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(122, 31, 31, 0.2);
}

.timeline-item__year {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline-item__title {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

.timeline-detail {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.5rem 1.25rem;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
  position: relative;
}

.timeline-detail[hidden] {
  display: none;
}

.timeline-detail__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: var(--tap-min);
  height: var(--tap-min);
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.timeline-detail__year {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline-detail__media {
  margin: 1rem 0 0;
}

.timeline-detail__media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(60vh, 420px);
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
  object-fit: contain;
}

/* ===== Reforms ===== */
.reforms-grid {
  display: grid;
  gap: 1rem;
}

.reform-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.reform-card__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: 1.25rem;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.reform-card__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.reform-card__icon img {
  width: 48px;
  height: 48px;
}

.reform-card__head-text {
  flex: 1;
}

.reform-card__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--accent-alt);
  margin: 0 0 0.35em;
}

.reform-card__short {
  font-size: 1rem;
  margin: 0;
  color: rgba(31, 26, 23, 0.85);
}

.reform-card__more {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
}

.reform-card__body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.reform-card__body[hidden] {
  display: none;
}

.reform-card__body p {
  margin: 1rem 0 0;
  font-size: 1rem;
}

.reform-card.is-open .reform-card__more::after {
  content: " ↑";
}

.reform-card:not(.is-open) .reform-card__more::after {
  content: " ↓";
}

/* ===== Investigation ===== */
.investigation-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.investigation-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.investigation-card__toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: 1.25rem;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.investigation-card__toggle:disabled {
  cursor: default;
}

.investigation-card__icon-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.investigation-card__icon-wrap img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.investigation-card__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: var(--text);
  margin: 0;
}

.investigation-card__status {
  margin-left: auto;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-alt);
}

.investigation-card.is-open .investigation-card__status {
  color: var(--accent);
}

.investigation-card__content {
  padding: 1.5rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
}

.investigation-card.has-photo .investigation-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  min-height: 320px;
}

.investigation-card__content[hidden] {
  display: none;
}

.investigation-card.has-photo .investigation-card__content[hidden] {
  display: none;
}

.investigation-card__figure {
  margin: 1rem 0 0;
  text-align: center;
}

.investigation-card__content .investigation-card__figure {
  margin-top: 0;
}

.investigation-card__figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(70vh, 480px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.investigation-conclusion {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--accent-alt) 0%, #1a2d4a 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.investigation-conclusion[hidden] {
  display: none;
}

.investigation-conclusion h3 {
  color: #fff;
  margin-bottom: 0.75rem;
}

.investigation-conclusion p {
  margin: 0;
  font-size: 1.0625rem;
}

/* ===== Footer ===== */
.site-footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: rgba(31, 26, 23, 0.65);
  border-top: 1px solid var(--border);
}

/* ===== Tablet ===== */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    border: none;
    background: transparent;
  }

  .site-nav ul {
    display: flex;
    gap: 0.25rem;
    padding: 0;
  }

  .site-nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border-radius: 6px;
  }

  .hero__inner {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 3rem;
  }

  .hero__content {
    text-align: left;
    flex: 1;
  }

  .hero__portrait {
    max-width: 320px;
    flex-shrink: 0;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .btn--primary {
    width: auto;
  }

  .bio-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .reforms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Laptop / projector ===== */
@media (min-width: 1024px) {
  h2 {
    font-size: 2rem;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .reforms-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Сетка таймлайна на десктопе: 5 колонок × 2 ряда */
  .timeline {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0;
    margin-bottom: 1.5rem;
    border-left: none;
    padding-left: 0;
  }

  .timeline-item {
    margin: 0;
    padding: 0;
  }

  .timeline-item::before {
    display: none;
  }

  .timeline-item__btn {
    text-align: center;
    padding: 0.875rem 0.5rem;
    min-height: 5.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
  }

  .timeline-item__year {
    font-size: 1.0625rem;
    margin-bottom: 0.35rem;
  }

  .timeline-item__title {
    font-size: 0.8125rem;
    line-height: 1.35;
  }

  .timeline-detail__media img {
    max-height: 400px;
  }
}

/* ===== Wide screen ===== */
@media (min-width: 1280px) {
  .reforms-grid .reform-card:last-child {
    grid-column: span 1;
  }

  .timeline {
    gap: 1rem;
  }

  .timeline-item__btn {
    min-height: 6rem;
    padding: 1rem 0.625rem;
  }

  .timeline-item__title {
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
