/* ==========================================================
   Стоицизм — стили
   Палитра: мрамор, графит, бронза. Светлая и тёмная темы.
   ========================================================== */

:root {
  --bg: #f7f3ea;
  --bg-alt: #eee7d6;
  --surface: #fffdf8;
  --text: #1f2a37;
  --text-muted: #55606d;
  --accent: #8c6a2f;
  --accent-strong: #6f531f;
  --border: #ddd3bd;
  --btn-bg: #8c6a2f;
  --btn-fg: #ffffff;
  --btn-secondary-bg: #1f2a37;
  --btn-secondary-fg: #f7f3ea;
  --good: #1f7a4d;
  --bad: #b3372f;
  --shadow: 0 10px 30px rgba(31, 42, 55, 0.08);
  --header-bg: rgba(247, 243, 234, 0.88);

  --font-serif: Georgia, "Times New Roman", "Liberation Serif", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a24;
    --bg-alt: #17212d;
    --surface: #1c2837;
    --text: #ece6d8;
    --text-muted: #a9b2bd;
    --accent: #d4b06a;
    --accent-strong: #e6c883;
    --border: #2b394b;
    --btn-bg: #d4b06a;
    --btn-fg: #17212d;
    --btn-secondary-bg: #ece6d8;
    --btn-secondary-fg: #17212d;
    --good: #5fcf98;
    --bad: #ff8a80;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --header-bg: rgba(18, 26, 36, 0.88);
  }
}

:root[data-theme="dark"] {
  --bg: #121a24;
  --bg-alt: #17212d;
  --surface: #1c2837;
  --text: #ece6d8;
  --text-muted: #a9b2bd;
  --accent: #d4b06a;
  --accent-strong: #e6c883;
  --border: #2b394b;
  --btn-bg: #d4b06a;
  --btn-fg: #17212d;
  --btn-secondary-bg: #ece6d8;
  --btn-secondary-fg: #17212d;
  --good: #5fcf98;
  --bad: #ff8a80;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(18, 26, 36, 0.88);
}

/* ---------- База ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.2;
  margin: 0 0 0.6em;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.container.narrow { max-width: 780px; }
.center { text-align: center; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 200;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.2s, color 0.2s;
}

.site-nav a:hover { background: var(--bg-alt); }
.site-nav a.active { color: var(--accent); font-weight: 600; }

.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.icon-btn:hover { background: var(--bg-alt); }

.nav-toggle { display: none; }

/* ---------- Герой ---------- */

.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: flex;
  align-items: center;
  color: #f7f3ea;
  background: #18222f url("images/hero.svg") center bottom / cover no-repeat;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(14, 20, 28, 0.78) 0%, rgba(14, 20, 28, 0.45) 55%, rgba(14, 20, 28, 0.1) 100%);
}

.hero-content {
  position: relative;
  padding-top: 60px;
  padding-bottom: 60px;
}

.hero h1 { max-width: 14em; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e6c883;
  margin-bottom: 1rem;
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  max-width: 36em;
  color: #efe9da;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-block;
  padding: 12px 24px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { color: var(--btn-fg); filter: brightness(1.08); }

.btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-fg); }
.btn-secondary:hover { color: var(--btn-secondary-fg); filter: brightness(1.15); }

.btn-ghost { color: #f7f3ea; border-color: rgba(247, 243, 234, 0.7); background: transparent; }
.btn-ghost:hover { background: rgba(247, 243, 234, 0.14); color: #fff; }

.btn-ghost-dark { color: var(--text); border-color: var(--border); background: transparent; }
.btn-ghost-dark:hover { background: var(--bg-alt); color: var(--text); }

.btn-small { padding: 9px 18px; font-size: 0.95rem; }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Секции ---------- */

.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-alt { background: var(--bg-alt); }

.section-intro {
  max-width: 38em;
  margin: -0.2em auto 2.2rem;
  color: var(--text-muted);
}

.pullquote {
  margin: 2rem 0;
  padding: 1.2rem 1.6rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
}
.pullquote p {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  margin: 0 0 0.4em;
}
.pullquote footer { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- История ---------- */

.history-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  margin-top: 2rem;
}

.history-figure { margin: 0; position: sticky; top: 90px; }
.history-figure img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
}
.history-figure figcaption {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

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

.timeline li { position: relative; padding-bottom: 28px; }
.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: -37px;
  top: 6px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 3px solid var(--bg-alt);
  border-radius: 50%;
}

.timeline-date {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.timeline h3 { margin-bottom: 0.3em; }
.timeline p { margin: 0; color: var(--text-muted); }

/* ---------- Карточки ---------- */

.cards {
  display: grid;
  gap: 22px;
}
.cards-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-4px); }

.card img { margin: 0 auto 16px; }
.card h3 { margin-bottom: 0.25em; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.97rem; }

.greek {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent) !important;
  font-size: 1.05rem !important;
  margin-bottom: 0.7em !important;
}

.dates {
  color: var(--accent) !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  margin-bottom: 0.7em !important;
}

.person img { width: 120px; height: 120px; }

/* ---------- Аккордеон ---------- */

.accordion { display: grid; gap: 12px; }

.idea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.idea summary {
  position: relative;
  padding: 16px 52px 16px 20px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.idea summary::-webkit-details-marker { display: none; }

.idea summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.2s;
}
.idea[open] summary::after { content: "−"; }
.idea summary:hover { background: var(--bg-alt); }

.idea-body { padding: 0 20px 6px; color: var(--text-muted); }

/* ---------- Практика ---------- */

.practice-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.steps li {
  position: relative;
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 18px 68px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: 50%;
}

.tool-column { display: grid; gap: 22px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.panel h3 { margin-bottom: 0.7em; }

.quote-text {
  margin: 0 0 0.4em;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-style: italic;
  min-height: 3.6em;
}
.quote-author { color: var(--accent); font-weight: 600; margin-bottom: 1.1em; }

.note { color: var(--text-muted); font-size: 0.88rem; margin: 14px 0 0; }

.journal-label { display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 0.95rem; }

textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
}

.journal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.status { color: var(--good); font-size: 0.92rem; }

/* ---------- Игра ---------- */

.game {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow);
  text-align: center;
}

.game-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
}
.game-score { color: var(--accent); font-weight: 700; }

.game-question {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  min-height: 2.6em;
  margin-bottom: 1.4rem;
}

.game-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.game-feedback {
  min-height: 3.2em;
  margin: 20px 0 10px;
  font-size: 1rem;
}
.game-feedback.correct { color: var(--good); }
.game-feedback.wrong { color: var(--bad); }

.game-result { margin-top: 12px; }
.game-result p { font-family: var(--font-serif); font-size: 1.3rem; }

/* ---------- Чтение ---------- */

.reading {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 14px;
}
.reading li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
}

/* ---------- Подвал ---------- */

.site-footer {
  padding: 32px 0;
  color: #c9c2b2;
  background: #141c26;
  font-size: 0.95rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: #e6c883; }

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Появление при прокрутке ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Адаптив ---------- */

@media (max-width: 1000px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }

  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    padding: 8px 20px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 12px 8px; }

  .history-grid,
  .practice-grid { grid-template-columns: 1fr; }

  .history-figure { position: static; }

  .hero-overlay {
    background: linear-gradient(to bottom, rgba(14, 20, 28, 0.7), rgba(14, 20, 28, 0.55));
  }
}

@media (max-width: 560px) {
  .cards-4 { grid-template-columns: 1fr; }
  .game-buttons .btn { width: 100%; }
  .hero-buttons .btn { flex: 1 1 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
