/* Ежедневный Толстой — base styles.
   Calm typography, readability-first, mobile-first. Dark-blue / gold brand
   accents. Detailed design (per biographies.media) is refined in later stages. */

:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --paper: #fbfaf7;
  --line: #e4e0d8;
  --brand: #1f3a5f;        /* dark blue */
  --brand-strong: #16293f;
  --accent: #b08a3e;       /* gold */
  --max-width: 44rem;
  --wrap: 62rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", "PT Serif", serif;
  font-size: 1.125rem;
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--brand-strong);
}

h1 { font-size: 2rem; margin: 0 0 0.5rem; }

.muted { color: var(--muted); }

/* --- Header ------------------------------------------------------------- */

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

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--brand-strong);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
}

.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

.header-search { margin-left: auto; }
.header-search input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  width: 10rem;
  max-width: 40vw;
}
.header-search input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.search-form { display: flex; gap: 0.5rem; margin-top: 1rem; max-width: var(--max-width); }
.search-form input[type="search"] {
  font: inherit;
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.search-form button {
  font: inherit;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.search-form button:hover { background: var(--brand-strong); }

.search-results { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.search-item { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.search-item a { text-decoration: none; font-size: 1.05rem; }
.search-item a:hover { text-decoration: underline; }
.search-snippet { margin: 0.3rem 0 0; font-size: 0.92rem; color: #444; }

/* --- Main --------------------------------------------------------------- */

.site-main {
  padding-block: 2.5rem 3.5rem;
}

.lead { max-width: var(--max-width); }

.lead-text {
  font-size: 1.2rem;
  color: #333;
}

.placeholder {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: #fff;
  max-width: var(--max-width);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-block: 1.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-attribution { margin: 0 0 0.5rem; max-width: var(--max-width); }
.footer-meta { margin: 0; }

/* --- Shared page elements ---------------------------------------------- */

.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.page-head, .today-head { max-width: var(--max-width); margin-bottom: 2rem; }
.page-head .lead-text, .lead-text { font-size: 1.15rem; color: #333; }

.block { max-width: var(--max-width); margin-bottom: 3rem; }

.block-title {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.prose { line-height: 1.7; }
.prose p { margin: 0 0 0.9rem; }
.prose p.verse { white-space: normal; font-style: italic; }
.prose h2, .prose h3 { margin: 1.5rem 0 0.6rem; }

.epigraph {
  margin: 0 0 2rem;
  padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 3px solid var(--accent);
  font-size: 1.2rem;
  font-style: italic;
  color: #2a2a2a;
}
.epigraph p { margin: 0 0 0.5rem; }

.reference {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 1rem;
}

.more { margin-top: 1.25rem; font-size: 0.95rem; }

/* --- Thoughts (Круг чтения) --------------------------------------------- */

.thoughts { list-style: none; margin: 0; padding: 0; counter-reset: thought; }

.thought {
  counter-increment: thought;
  position: relative;
  padding: 0 0 1.75rem 2.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.thought:last-child { border-bottom: 0; }

.thought::before {
  content: counter(thought);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
}

.attribution {
  margin: 0.5rem 0 0;
  text-align: right;
  font-style: italic;
  color: var(--brand);
}
.attribution::before { content: "— "; }

.weekly-note { margin-top: 1.5rem; }

/* --- Weekly reading (prominent) ----------------------------------------- */

.weekly-card {
  margin: 2rem 0 0;
  padding: 1.1rem 1.35rem;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
}
.weekly-card .kicker { color: #e8c98a; display: block; margin: 0 0 0.4rem; }
.weekly-card-list { list-style: none; margin: 0; padding: 0; }
.weekly-card-list li { margin: 0.3rem 0; }
.weekly-card-list a {
  color: #fff;
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 600;
}
.weekly-card-list a:hover { color: #e8c98a; }
.weekly-card-list a::after { content: " →"; color: #e8c98a; font-weight: 400; }

.weekly-jump {
  margin-bottom: 1.75rem;
  padding: 0.65rem 0.9rem;
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 0.95rem;
}
.weekly-jump .wk-label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.weekly-jump-list { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.weekly-jump-list li { margin: 0.2rem 0; }
.weekly-jump-list a { font-weight: 600; text-decoration: none; }
.weekly-jump-list a:hover { text-decoration: underline; }
.weekly-jump-list a::after { content: " →"; color: var(--accent); }

.week-siblings {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.week-siblings ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.week-siblings li { margin: 0.35rem 0; }

/* --- Diary entry -------------------------------------------------------- */

.diary-entry { margin-bottom: 2.5rem; }
.diary-entry .entry-date { font-size: 1.25rem; margin: 0 0 1rem; }
.diary-entry .entry-date a { text-decoration: none; }
.diary-entry .entry-date a:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.6rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
}

/* Year chips — "этот день по годам" */
.year-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.year-strip-label { color: var(--muted); font-size: 0.9rem; margin-right: 0.25rem; }
.year-strip a {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  background: #fff;
}
.year-strip a:hover { border-color: var(--accent); color: var(--accent); }
.year-strip a.is-current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --- Calendar (Круг чтения index) --------------------------------------- */

.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.75rem 2rem;
}

.cal-month-name {
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.cal-days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.cal-days a {
  display: block;
  text-align: center;
  padding: 0.35rem 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--brand);
  background: #fff;
}
.cal-days a:hover { border-color: var(--accent); color: var(--accent); }

/* --- Krug day page ------------------------------------------------------ */

.krug-day { max-width: var(--max-width); }

.day-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.day-nav .nav-index { color: var(--muted); }

.weekly {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 2px solid var(--line);
}
.weekly h2 { font-size: 1.5rem; margin: 0 0 1rem; }

/* --- Sections (works, topics, research, pages) -------------------------- */

.page-narrow { max-width: var(--max-width); }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.25rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.filters label { font-size: 0.9rem; color: var(--muted); }
.filters select {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.3rem 0.5rem;
  margin-left: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.work-list, .link-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.work-item {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.work-title { font-size: 1.1rem; text-decoration: none; }
.work-title:hover { text-decoration: underline; }
.work-meta { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.link-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.95rem;
}

.topic-tags { font-size: 0.95rem; color: var(--muted); }

.topic-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
}
.topic-cloud li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.topic-cloud a { text-decoration: none; font-size: 1.05rem; }
.topic-cloud .muted { font-size: 0.8rem; }

.work-text { margin-top: 1.5rem; }

/* Research — detail cover */
.article-cover { max-width: 100%; border-radius: 8px; margin: 1rem 0 1.5rem; }

/* Research — card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.75rem;
  margin-top: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover {
  box-shadow: 0 6px 20px rgba(22, 41, 63, 0.12);
  transform: translateY(-2px);
}

.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--brand);
}
.card-cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8c98a;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--brand-strong), var(--brand));
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.15rem 1.25rem;
}
.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--brand-strong);
}
.card:hover .card-title { color: var(--accent); }
.card-date { font-size: 0.8rem; color: var(--muted); }
.card-lead { font-size: 0.95rem; color: #444; line-height: 1.5; }

/* Author byline & card */
.article-byline a { text-decoration: none; font-weight: 600; }
.article-byline a:hover { text-decoration: underline; }

.author-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.author-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.author-name { margin: 0 0 0.25rem; font-size: 1.05rem; }
.author-name a { text-decoration: none; }
.author-name a:hover { text-decoration: underline; }
.author-bio { margin: 0; color: #444; font-size: 0.95rem; }

/* Author page */
.author-page { }
.author-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: var(--max-width);
  margin-bottom: 2.5rem;
}
.author-photo--lg { width: 120px; height: 120px; }
.author-bio-full { margin-top: 0.75rem; }

@media (max-width: 34rem) {
  .author-header { flex-direction: column; }
}

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

@media (max-width: 34rem) {
  body { font-size: 1.0625rem; }
  h1 { font-size: 1.6rem; }
  .site-header .wrap { padding-block: 0.85rem; }
  .calendar { grid-template-columns: 1fr; }
  .day-nav { flex-wrap: wrap; }
  .filters { flex-direction: column; gap: 0.75rem; }
}
