@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400&family=PT+Sans:wght@400;700&display=swap');

:root {
  --paper: #e9e0c7;
  --paper-deep: #ddd0a9;
  --ink: #241f1b;
  --ink-soft: #4a423a;
  --seal: #7c1f2b;
  --seal-deep: #5c1620;
  --gold: #a9782c;
  --forest: #2c3c2c;
  --line: rgba(36, 31, 27, 0.18);
  --radius: 3px;
  --content-width: 760px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.25), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(0,0,0,0.05), transparent 40%);
  color: var(--ink);
  font-family: 'PT Sans', sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: 'PT Serif', serif; font-weight: 700; color: var(--ink); margin: 0 0 0.4em; }

a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}

.site-header__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-header__title {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.site-header__title a { color: var(--ink); }
.site-header__title a:hover { text-decoration: none; color: var(--seal); }

.site-header__nav { display: flex; gap: 22px; }

.site-header__nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.site-header__nav a:hover { color: var(--seal); border-color: var(--seal); text-decoration: none; }

/* ---------- layout ---------- */
main {
  flex: 1;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- hero ---------- */
.hero {
  padding: 56px 0 36px;
  max-width: var(--content-width);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  margin-bottom: 0.5em;
}

.hero p {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

.hero__rule {
  width: 64px;
  height: 3px;
  background: var(--seal);
  margin: 22px 0 0;
  border-radius: 2px;
}

/* ---------- timeline / accordion ---------- */
.timeline {
  margin-top: 32px;
  border-top: 1px solid var(--line);
}

.period {
  border-bottom: 1px solid var(--line);
}

.period > summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.period > summary::-webkit-details-marker { display: none; }

.period__title {
  font-family: 'PT Serif', serif;
  font-size: 1.25rem;
  color: var(--ink);
}

.period__years {
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.period__marker {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--forest);
  margin-right: 12px;
  position: relative;
  top: -1px;
}

.period[open] > summary .period__marker { background: var(--seal); }

.period__list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0 4px 0 21px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.period__empty {
  padding: 0 4px 22px 21px;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.92rem;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.entry-row:hover { background: rgba(124, 31, 43, 0.06); }

.entry-row__title { color: var(--ink); font-weight: 700; }
.entry-row a.entry-row__title:hover { color: var(--seal); }

.entry-row__meta {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.entry-row__tag {
  font-size: 0.75rem;
  color: var(--forest);
  border: 1px solid var(--forest);
  border-radius: 20px;
  padding: 1px 9px;
  margin-left: auto;
  flex-shrink: 0;
}

.entry-row__tag--person { color: var(--seal); border-color: var(--seal); }

/* ---------- entry page ---------- */
.back-link { display: inline-block; margin-bottom: 26px; font-size: 0.95rem; }

.entry {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  padding-top: 8px;
}

.entry__type {
  font-size: 0.85rem;
  color: var(--seal);
  margin: 0 0 6px;
}

.entry__type--person { color: var(--forest); }

.entry__title { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 4px; }

.entry__date {
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-size: 1rem;
}

.entry__summary {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  max-width: 60ch;
}

.entry__section { margin-bottom: 26px; max-width: 66ch; }

.entry__section h2 {
  font-size: 1.05rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.entry__section ul { margin: 0; padding-left: 20px; }
.entry__section li { margin-bottom: 6px; }
.entry__section p { margin: 0; }

.related-chips { display: flex; flex-wrap: wrap; gap: 10px; }

.related-chip {
  border: 1px solid var(--gold);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  background: rgba(169, 120, 44, 0.08);
}

.related-chip:hover { background: rgba(169, 120, 44, 0.18); text-decoration: none; }

.not-found { padding: 60px 0; text-align: center; color: var(--ink-soft); }

/* ---------- фото / заглушка с годом ---------- */
.photo {
  position: relative;
  overflow: hidden;
  background: #3a2f28;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.photo--thumb { width: 44px; height: 44px; border-radius: 50%; }
.photo--large { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius); }

.photo__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'PT Serif', serif;
  color: var(--paper);
}

.photo--thumb .photo__placeholder { font-size: 0.72rem; }
.photo--large .photo__placeholder { font-size: 2.4rem; letter-spacing: 0.02em; }

.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.photo img.is-loaded { opacity: 1; }

/* ---------- поиск и фильтр ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px 28px;
  margin-top: 8px;
}

.controls__search { flex: 1 1 300px; max-width: 460px; }

.controls__filter { display: flex; flex-direction: column; gap: 6px; }

.controls__label { font-size: 0.9rem; color: var(--ink-soft); }

.filter { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.filter__btn {
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 18px;
  background: #fbf8ef;
  color: var(--ink);
  border: none;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.filter__btn:last-child { border-right: none; }
.filter__btn:hover { background: var(--paper-deep); }
.filter__btn[aria-pressed="true"] { background: var(--forest); color: var(--paper); }

.results-note {
  min-height: 1.4em;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.period__count {
  display: inline-block;
  min-width: 22px;
  margin-left: 10px;
  padding: 0 7px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
}

/* ---------- форма внизу внутренней страницы ---------- */
.entry-feedback {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  max-width: 620px;
}

.entry-feedback h2 { font-size: 1.15rem; }

.field input[readonly] { background: var(--paper-deep); color: var(--ink-soft); }

/* ---------- feedback form ---------- */
.feedback-intro { max-width: 62ch; padding-top: 40px; }

.feedback-form {
  max-width: 520px;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: 0.9rem; color: var(--ink-soft); }

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbf8ef;
  color: var(--ink);
}

.field textarea { min-height: 120px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--seal); }

.submit-btn {
  align-self: flex-start;
  font: inherit;
  font-weight: 700;
  background: var(--seal);
  color: var(--paper);
  border: none;
  padding: 11px 26px;
  border-radius: var(--radius);
  cursor: pointer;
}

.submit-btn:hover { background: var(--seal-deep); }

.form-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.confirmation {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--forest);
  background: rgba(44, 60, 44, 0.06);
  font-size: 0.95rem;
}

.recent-feedback {
  margin-top: 44px;
  max-width: 620px;
}

.recent-feedback h2 {
  font-size: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.feedback-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.feedback-item__meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 4px;
}

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  .entry { grid-template-columns: 1fr; }
  .entry__media { max-width: 200px; }
  .filter__btn { padding: 10px 14px; }
  .site-header__inner { padding: 16px 18px; }
  main { padding: 0 18px 48px; }
}

/* когда настоящее фото загружено — заглушка с годом скрывается */
.photo:has(img.is-loaded) .photo__placeholder { visibility: hidden; }
