/* Noto Sans (SIL OFL 1.1): latin + cyrillic, локальные woff2, без внешних запросов */
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/noto-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/noto-sans-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Прототип лендинга. Палитра и типографика — из ТЗ «Студия» (часть А, §2.4).
   Шрифты: Noto Sans подключён локально: файлов OFL в проекте пока нет,
   подключён локально: woff2 (latin + cyrillic) в assets/fonts, лицензия OFL.txt рядом. */

:root {
  --paper: #f6f3ec;
  --ink: #1e2a32;
  --accent: #1f3a5f;
  --brass: #8a6430;
  --muted: #5c6b76;
  --line: #d9d2c5;
  --ok: #2f6b4f;
  --err: #a33a2f;
  --radius: 10px;
  --max: 68rem;
}

* { box-sizing: border-box; }

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

body {
  font-family: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 "Golos Text", "Segoe UI", system-ui, sans-serif;
  padding: 0 1.25rem;
}

h1, h2, h3 {
  font-family: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.2;
  margin: 0 0 .6em;
  color: var(--accent);
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; max-width: 70ch; }

a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--brass); }

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

.skip {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: .6em 1em; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

.site-header {
  max-width: var(--max); margin: 0 auto; padding: 1.2rem 0;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.logo { font: 300 1.5rem/1 "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .01em; text-decoration: none; }
.logo span { color: var(--brass); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-header nav a { text-decoration: none; }
.site-header nav a[aria-current="page"] { border-bottom: 2px solid var(--brass); }

main { max-width: var(--max); margin: 0 auto; padding: 2.5rem 0 1rem; }

.hero { padding: 1rem 0 2rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--brass); }

.block { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.block-quiet { background: #efe9dd; border-radius: var(--radius); padding: 1.5rem; margin: 1rem 0; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.card { background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: .8em 1.2em; border-radius: var(--radius); border: 0; font: inherit; cursor: pointer;
}
.btn:hover { background: #16304f; color: #fff; }
.btn-quiet { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .5em; }

.note { color: var(--muted); font-size: .9rem; }

.form { display: grid; gap: 1rem; max-width: 34rem; }
.form label { display: grid; gap: .35rem; font-weight: 600; }
.form input, .form select {
  font: inherit; padding: .6em .7em; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8;
}
.form input[type="checkbox"] { width: 1.2rem; height: 1.2rem; }
.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 400; }

details.block { cursor: pointer; }
details summary { font-weight: 600; font-family: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif; color: var(--accent); }

.site-footer {
  max-width: var(--max); margin: 2rem auto 0; padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem;
}

@media (max-width: 640px) {
  body {
  font-family: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; padding: 0 .9rem; font-size: 16px; }
  .site-header { justify-content: flex-start; }
  .site-header nav { gap: .8rem; }
}

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

/* --- предпросмотр: языки, баннер, доска, события --- */
.lang { font-size: .85rem; letter-spacing: .05em; text-decoration: none; border: 1px solid var(--line); padding: .35em .6em; border-radius: 8px; }
.draft-banner { background: #f3e7cf; border: 1px solid #e2cfa8; color: #6b4d1e; padding: .7em .9em; border-radius: 8px; font-size: .92rem; }

.study { display: grid; gap: 1.2rem; grid-template-columns: minmax(16rem, 28rem) 1fr; align-items: start; }
@media (max-width: 780px) { .study { grid-template-columns: 1fr; } }

.board-wrap { max-width: 28rem; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1 / 1; border: 2px solid var(--accent); border-radius: 6px; overflow: hidden; }
.sq { display: grid; place-items: center; font-size: clamp(18px, 5.2vw, 40px); line-height: 1; }
.sq.light { background: #efe6d2; }
.sq.dark { background: #97abc2; }
.sq.white { color: #fffdf8; text-shadow: 0 0 1px #1e2a32, 0 0 1px #1e2a32; }
.sq.black { color: #1e2a32; }
.move-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.move-list button { font: inherit; padding: .35em .6em; border: 1px solid var(--line); background: #fffdf8; border-radius: 6px; cursor: pointer; }
.move-list button[aria-pressed="true"] { border-color: var(--accent); background: #e7eef6; font-weight: 700; }
.comment { min-height: 3em; color: var(--ink); border-left: 3px solid var(--brass); padding-left: .8em; }
.event-date { font-weight: 700; color: var(--brass); margin: 0 0 .3em; }
/* --- встраивание внешней главы (архив) --- */
#study-embed { max-width: 100%; }

/* --- встраивание внешней главы (архив) --- */
.study-embed { max-width: 100%; }
.study-board { max-width: 520px; margin: 0 auto; }
.study-board .ib-board-host { width: 100%; }
.study-note { margin-top: .45em; }
/* --- уроки: раскладка в три колонки --- */
.lesson-list { list-style: none; padding: 0; display: grid; gap: .35rem; }
.lesson-list a { text-decoration: none; }

.lesson-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  grid-template-areas:
    "chapters board   side"
    "chapters toolbar side"
    "chapters theory  side"
    "chapters meta    side";
  gap: 1rem 1.5rem;
  align-items: start;
}
.lesson-chapters { grid-area: chapters; position: sticky; top: 1rem; }
.lesson-chapters h2 { margin-top: 0; font-size: 1.05rem; }
.lesson-theory { grid-area: theory; background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; white-space: pre-wrap; line-height: 1.55; }
.lesson-theory:empty { display: none; }
.lesson-meta-line { grid-area: meta; margin: 0; }
.lesson-status { grid-area: meta; margin: 0; text-align: right; }

#lesson-board, #lesson-board .ib-body {
  font-family: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; display: contents; }
#lesson-board .ib-board-host { grid-area: board; width: var(--board-size, 560px); max-width: 100%; margin: 0 auto; position: relative; min-width: 0; }
#lesson-board .ib-toolbar { grid-area: toolbar; justify-content: center; margin: .2rem 0 0; position: relative; }
#lesson-board .ib-side { grid-area: side; min-width: 0; }

.chapters { list-style: none; padding: 0; display: grid; gap: .3rem; max-height: calc(100vh - 12rem); overflow: auto; }
.chapters button { width: 100%; text-align: left; font: inherit; padding: .45em .6em; border: 1px solid var(--line); background: #fffdf8; border-radius: 8px; cursor: pointer; }
.chapters button:hover { border-color: var(--accent); }
.chapters button.active { border-color: var(--accent); background: #e7eef6; font-weight: 600; }

.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* координаты вне доски */
.coords-outside { padding: 0 0 1.1rem 1.1rem; }
.coords-files, .coords-ranks { position: absolute; display: flex; color: var(--muted); font-size: .8rem; }
.coords-files { left: 1.1rem; right: 0; bottom: 0; justify-content: space-around; }
.coords-ranks { top: 0; bottom: 1.1rem; left: 0; flex-direction: column; justify-content: space-around; align-items: center; width: 1.1rem; }

/* настройки доски */
.ib-settings { margin-left: .4rem; }
.ib-settings-panel {
  position: absolute; top: 2.4rem; right: 0; z-index: 5;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem .9rem; display: grid; gap: .7rem; min-width: 15rem;
  box-shadow: 0 8px 24px rgba(30, 42, 50, .12);
}
.ib-settings-panel label { display: grid; gap: .3rem; font-size: .9rem; }
.ib-settings-panel input[type="range"] { width: 100%; }

@media (max-width: 1100px) {
  .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "toolbar" "side" "theory" "meta" "chapters";
  }
  .lesson-chapters { position: static; }
  #lesson-board .ib-board-host { width: 100%; max-width: 100%; }
  .chapters { max-height: 40vh; }
  .lesson-status { text-align: left; }
}
/* --- страница урока: широкая сцена и компактная шапка --- */
body.lesson main { max-width: 1600px; padding: 1rem 0 .5rem; }
body.lesson h1 { font-size: clamp(1.25rem, 1.6vw, 1.5rem); margin: 0 0 .15rem; line-height: 1.25; }
body.lesson #lesson-meta { margin: 0 0 .8rem; font-size: .85rem; }
body.lesson .site-header { padding: .7rem 0; }
body.lesson .lesson-layout { grid-template-columns: 260px minmax(0, 1fr) 360px; }
body.lesson #lesson-board .ib-board-host { width: min(var(--board-size, 560px), 100%); }
.ib-settings-panel[hidden] { display: none; }
/* --- телефон: одна колонка поверх настольного правила body.lesson --- */
@media (max-width: 1100px) {
  body.lesson .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "toolbar" "side" "theory" "meta" "chapters";
  }
  body.lesson #lesson-board .ib-board-host { width: 100%; max-width: 100%; }
  body.lesson .lesson-chapters { position: static; }
  body.lesson .lesson-status { text-align: left; }
}
