/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #faf8f5;
  --color-bg-warm: #f5f2ed;
  --color-text: #2d2d2d;
  --color-text-muted: #5a5a5a;
  --color-accent: #8b4a3c;
  --color-accent-hover: #6d3a2f;
  --color-border: #e5e0d8;
  --color-card-bg: #fff;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1120px;
  --content-width: 720px;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === SKIP LINK === */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  top: 0;
}

/* === HEADER === */
.site-header {
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  text-decoration: none;
  color: var(--color-text);
}

.site-logo h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.site-logo span {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 1.75rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.main-nav a:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-text);
}

/* === MAIN === */
main {
  flex: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

/* === HERO (Home) === */
.hero {
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.hero-intro {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 640px;
}

/* === HOME LAYOUT === */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  align-items: start;
}

.home-main {
  min-width: 0;
}

.home-sidebar {
  position: sticky;
  top: 100px;
}

/* === SECTION BLOCKS === */
.section-block {
  margin-bottom: 2.5rem;
}

.section-block h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.section-block p {
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* === NOTICE === */
.notice {
  background: var(--color-bg-warm);
  border-left: 3px solid var(--color-accent);
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 2rem;
}

/* === ARTICLES GRID === */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.article-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.article-card-cover {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.article-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.article-card-category {
  color: var(--color-accent);
  font-weight: 500;
}

.article-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.article-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.article-card h3 a:hover {
  color: var(--color-accent);
}

.article-card h3 a:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.article-card-excerpt {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
}

/* === SIDEBAR === */
.sidebar-block {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.sidebar-block h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.sidebar-block p,
.sidebar-block li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.sidebar-block ul {
  list-style: none;
  padding-left: 0;
}

.sidebar-block li {
  padding: 0.35rem 0;
  padding-left: 1rem;
  position: relative;
}

.sidebar-block li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 4px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 50%;
}

/* === ARTICLE PAGE === */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

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

.breadcrumbs span {
  margin: 0 0.4rem;
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* === TABLE OF CONTENTS === */
.toc {
  background: var(--color-bg-warm);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.toc-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: decimal;
  padding-left: 1.25rem;
}

.toc li {
  padding: 0.25rem 0;
}

.toc a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

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

/* === ARTICLE CONTENT === */
.article-content {
  max-width: var(--content-width);
}

.article-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--color-text);
}

.article-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.article-content p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.article-content strong {
  font-weight: 600;
}

/* === RELATED ARTICLES === */
.related-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.related-articles h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.related-list a {
  color: var(--color-accent);
  text-decoration: none;
  padding: 0.5rem 0;
  display: inline-block;
}

.related-list a:hover {
  text-decoration: underline;
}

/* === PAGE CONTENT (about, contacts, legal) === */
.page-content h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.page-content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.page-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.page-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.page-content ul,
.page-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.page-content li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.page-note {
  background: var(--color-bg-warm);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.contact-info {
  background: var(--color-card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 1.5rem 0;
}

.contact-info p {
  margin-bottom: 0.5rem;
}

.contact-info strong {
  color: var(--color-text);
}

/* === FOOTER === */
.site-footer {
  background: var(--color-card-bg);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  padding: 2rem 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  max-width: 360px;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.age-rating {
  background: var(--color-bg-warm);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }

  .sidebar-block {
    margin-bottom: 0;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .header-inner {
    padding: 0.75rem 1rem;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-card-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    box-shadow: var(--shadow);
  }

  .main-nav.is-open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .main-nav li {
    border-bottom: 1px solid var(--color-border);
  }

  .main-nav li:last-child {
    border-bottom: none;
  }

  .main-nav a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: none;
  }

  .menu-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
}

/* === FOCUS STATES === */
a:focus,
button:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* === PRINT === */
@media print {
  .site-header,
  .site-footer,
  .menu-toggle,
  .toc,
  .related-articles {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
