/* Публичная часть школьного сайта.
   Требования ТЗ: контраст не ниже 4.5:1 (TS-17.2), видимый фокус на всех
   интерактивных элементах (TS-17.4), адаптив от 320px (TS-16.1), ноль
   внешних ресурсов — шрифты системные, чтобы страница не зависела от чужих
   серверов и укладывалась в бюджет загрузки (TS-19.1). */

:root {
  --ink: #16202c;
  --ink-soft: #55606e;
  --ink-faint: #7b8695;
  --line: #e3e8ef;
  --line-soft: #eef2f7;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --bg-tint: #eef4fb;
  --white: #fff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(22, 32, 44, .06), 0 2px 8px rgba(22, 32, 44, .04);
  --shadow-md: 0 2px 6px rgba(22, 32, 44, .07), 0 12px 28px rgba(22, 32, 44, .08);
  --wrap: 1180px;
  --gap: 24px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

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

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; }
h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 700; }
h3 { font-size: 20px; font-weight: 650; }

p { margin: 0 0 1em; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent-dark); color: #fff; padding: 12px 18px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

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

.head {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}

.head-top {
  display: flex; align-items: center; gap: var(--gap);
  padding: 14px 20px; flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink); flex: 1 1 auto; min-width: 0;
}

.brand-mark {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; display: grid; place-items: center;
  font-size: 24px; font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.brand-logo { width: 48px; height: 48px; flex: none; border-radius: 12px; object-fit: contain; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 17px; font-weight: 650; line-height: 1.3; }
.brand-text small { color: var(--ink-faint); font-size: 13px; }

.head-tools { display: flex; align-items: center; gap: 12px; flex: none; }

.search { display: flex; gap: 8px; }
.search input {
  width: 220px; max-width: 42vw; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 15px; background: var(--bg-soft);
}
.search input:focus { background: var(--white); }
.search button {
  padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.search button:hover { background: var(--accent-dark); }

.lang {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px;
}
.lang:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---------- Меню ---------- */

.menu { background: var(--white); border-top: 1px solid var(--line-soft); }
.menu .wrap { padding: 0 20px; }

.menu-toggle {
  display: none; margin: 10px 0; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); font: inherit; font-weight: 600; cursor: pointer;
}

.menu-list ul { list-style: none; margin: 0; padding: 0; }
.menu-list > ul { display: flex; flex-wrap: wrap; gap: 2px; }
.menu-list > ul > li { position: relative; }

.menu-list a {
  display: block; padding: 13px 14px; text-decoration: none;
  color: var(--ink); font-weight: 500; font-size: 15.5px;
  border-bottom: 2px solid transparent;
}
.menu-list a:hover { color: var(--accent-dark); border-bottom-color: var(--accent); }
.menu-list a[aria-current="page"] { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 650; }

.menu-list .has-sub > ul {
  position: absolute; left: 0; top: 100%; min-width: 250px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 6px; display: none; z-index: 20;
}
.menu-list .has-sub:hover > ul,
.menu-list .has-sub:focus-within > ul { display: block; }
.menu-list .has-sub > ul a { padding: 9px 12px; border: 0; border-radius: 8px; font-size: 15px; }
.menu-list .has-sub > ul a:hover { background: var(--bg-tint); }

/* ---------- Хлебные крошки ---------- */

.crumbs { background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 12px 20px; }
.crumbs li + li::before { content: "/"; color: var(--ink-faint); margin-right: 8px; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent-dark); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--ink); }

/* ---------- Главная: обложка ---------- */

.hero {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff; border-radius: var(--radius); overflow: hidden;
  padding: clamp(28px, 5vw, 52px); margin: 0 0 32px;
  position: relative;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: .35em; max-width: 22ch; }
.hero p { color: rgba(255, 255, 255, .92); font-size: 18px; max-width: 60ch; margin-bottom: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 22px; font-size: 15.5px; }
.hero-meta span { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, .92); }

/* ---------- Плитки быстрого доступа ---------- */

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 0 0 36px; }
.quick a {
  display: block; padding: 20px 22px; text-decoration: none; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.quick b { display: block; font-size: 17px; font-weight: 650; margin-bottom: 4px; }
.quick small { color: var(--ink-faint); font-size: 14.5px; line-height: 1.45; display: block; }

/* ---------- Основная область ---------- */

.main { padding: 32px 20px 56px; }
.main > h1 { margin-bottom: .6em; }

.grid { display: grid; gap: 32px; }
.grid.two { grid-template-columns: 1fr 1fr; }

section + section { margin-top: 40px; }

.alert {
  background: #fff7ed; border: 1px solid #fed7aa; border-left: 4px solid #ea580c;
  border-radius: var(--radius-sm); padding: 18px 22px; margin: 0 0 32px;
}
.alert h2 { font-size: 18px; margin-bottom: .4em; color: #9a3412; }
.alert ul { margin: 0; padding-left: 20px; }

/* ---------- Карточки материалов ---------- */

.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin: 0 0 14px;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: #cfdae8; }
.card h3 { margin-bottom: .35em; font-size: 18px; }
.card h3 a { text-decoration: none; color: var(--ink); }
.card h3 a:hover { color: var(--accent-dark); }
.card p { margin-bottom: .4em; color: var(--ink-soft); font-size: 16px; }

.dates, .fmeta { color: var(--ink-faint); font-size: 14px; }
.dates span + span::before { content: "·"; margin: 0 8px; }

.empty {
  color: var(--ink-faint); background: var(--bg-soft);
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 22px; text-align: center;
}

/* Заглушка на месте будущего изображения: ТЗ запрещает выдумывать
   содержимое, поэтому пустое место обозначается явно (TS-1.4). */
.photo-stub {
  display: grid; place-items: center; gap: 6px;
  min-height: 190px; padding: 24px; text-align: center;
  background: repeating-linear-gradient(45deg, var(--bg-soft), var(--bg-soft) 12px, var(--bg-tint) 12px, var(--bg-tint) 24px);
  border: 1px dashed #c3d0e0; border-radius: var(--radius);
  color: var(--ink-faint); font-size: 14.5px;
}
.photo-stub b { color: var(--ink-soft); font-weight: 600; font-size: 15.5px; }

.gallery-stub { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* ---------- Плитки разделов ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; margin-top: 48px; }
.tile-group h2 { font-size: 17px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: .7em; }
.tile-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tile {
  display: block; padding: 11px 14px; text-decoration: none; color: var(--ink);
  border-radius: var(--radius-sm); font-size: 15.5px; border: 1px solid transparent;
}
.tile:hover { background: var(--bg-tint); color: var(--accent-dark); border-color: #d7e3f2; }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.links a { text-decoration: none; font-weight: 550; }
.links a:hover { text-decoration: underline; }

/* ---------- Формы ---------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin: 0 0 26px;
}
.filters label { display: grid; gap: 5px; font-size: 14.5px; color: var(--ink-soft); font-weight: 550; }
.filters input, .filters select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; background: var(--white);
}
.filters button, .btn {
  padding: 10px 20px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.filters button:hover, .btn:hover { background: var(--accent-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--ink); }

form.stack { display: grid; gap: 16px; max-width: 620px; }
form.stack label { display: grid; gap: 6px; font-weight: 550; }
form.stack input, form.stack textarea, form.stack select {
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; width: 100%;
}
form.stack textarea { min-height: 150px; resize: vertical; }

/* ---------- Таблицы ---------- */

.table-wrap { overflow-x: auto; margin: 0 0 20px; border-radius: var(--radius); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th { background: var(--bg-soft); font-weight: 650; font-size: 15px; }
tr:last-child td { border-bottom: 0; }

/* ---------- Пагинация ---------- */

.pager { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 28px 0 0; padding: 0; }
.pager a, .pager span {
  display: block; min-width: 42px; text-align: center;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink);
}
.pager a:hover { border-color: var(--accent); color: var(--accent-dark); }
.pager [aria-current="page"] { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 650; }

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

.foot {
  background: #10192a; color: #c8d2e0; margin-top: 64px;
  padding: 44px 0 32px; font-size: 15.5px;
}
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding: 0 20px; }
.foot-h { color: #fff; font-size: 17px; font-weight: 650; margin-bottom: .7em; }
.foot a { color: #9fc3ee; }
.foot a:hover { color: #fff; }
.foot address { font-style: normal; line-height: 1.75; }
.foot p { margin-bottom: .8em; }

/* ---------- Режим для слабовидящих ---------- */

body.a11y { font-size: 21px; }
body.a11y .head, body.a11y .menu { background: #000; }
body.a11y, body.a11y .card, body.a11y .main { background: #000; color: #ffe600; }
body.a11y a, body.a11y .brand, body.a11y .menu-list a { color: #ffe600; }
body.a11y .card, body.a11y .filters, body.a11y .empty { border-color: #ffe600; background: #000; }
body.a11y .hero { background: #000; border: 2px solid #ffe600; }
body.a11y img { filter: grayscale(1) contrast(1.2); }

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

@media (max-width: 900px) {
  .grid.two { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .head-top { gap: 12px; padding: 12px 16px; }
  .search input { width: 150px; }
  .menu-toggle { display: block; }
  .menu-list { display: none; padding-bottom: 10px; }
  .menu-list.open { display: block; }
  .menu-list > ul { flex-direction: column; gap: 0; }
  .menu-list a { padding: 11px 6px; border-bottom: 1px solid var(--line-soft); }
  .menu-list .has-sub > ul { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 0 16px; }
  .hero { padding: 26px 22px; }
  .main { padding: 24px 16px 44px; }
  .wrap { padding: 0 16px; }
}

@media print {
  .head, .menu, .crumbs, .foot, .filters, .search, .lang, .skip { display: none; }
  body { font-size: 12pt; color: #000; }
  a { text-decoration: underline; }
}
