@font-face { font-family: "Cormorant SC"; src: url("/fonts/CormorantSC-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/EBGaramond-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/EBGaramond-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/EBGaramond-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --night: #170e2b;
  --glass: #2b1b4e;
  --moon: #e9e0f5;
  --haze: #b8a9d1;
  --parchment: #ecd2a0;
  --ink: #47290d;
  --ink-soft: #6d4a24;
  --gold: #ffd659;
  --display: "Cormorant SC", "Iowan Old Style", Georgia, serif;
  --text: "EB Garamond", "Iowan Old Style", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font: 400 1.25rem/1.55 var(--text); background: var(--night); color: var(--moon); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; text-wrap: balance; }
a { color: var(--gold); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
ul, ol { list-style: none; }

/* Шапка лежит поверх сцены */
.top { position: absolute; inset: 0 0 auto; z-index: 3; display: flex; align-items: center; gap: .4rem 1.5rem; flex-wrap: wrap; padding: .8rem 1.25rem; font-size: 1.05rem; }
.brand { display: flex; align-items: center; gap: .55rem; font: 700 1.35rem var(--display); color: var(--moon); text-decoration: none; margin-right: auto; }
.brand img { border-radius: 7px; }
.top-nav { display: flex; gap: 1.1rem; }
.top a:not(.brand) { color: var(--moon); text-decoration: none; }
.top a:not(.brand):hover { color: var(--gold); }
.langs { display: flex; gap: .7rem; font-size: .95rem; }
.top .langs a[aria-current] { color: var(--gold); }

/* Сцена: пергамент с рецептом и котёл, который наполняется по этому рецепту */
.stage { background: var(--night) url("/img/classroom.webp") center bottom / cover no-repeat; padding: 5rem 1.25rem 2.5rem; }
.stage-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 3rem; align-items: end; }
.recipe { background: url("/img/parchment.webp") center / 100% 100% no-repeat; color: var(--ink); padding: 3.4rem 2.9rem 3rem; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .55)); }
.recipe h1 { font-size: clamp(2.3rem, 4.2vw, 3.3rem); }
.tagline { margin-top: .8rem; font-size: 1.2rem; line-height: 1.4; }
.recipe-name { margin-top: 1.1rem; font: 700 1.5rem var(--display); }
.recipe-parts { display: flex; flex-wrap: wrap; gap: .1rem 1rem; font-size: 1.05rem; }
.recipe-parts li { display: flex; align-items: center; gap: .15rem; }
.cta-wrap { margin-top: 1.2rem; }
.cta-note { font-size: 1.05rem; margin-top: .4rem; font-style: italic; }
.cta { display: inline-block; min-width: 19rem; max-width: 100%; padding: 1.15rem 2.6rem; background: url("/img/scroll.webp") center / 100% 100% no-repeat; color: var(--ink); font: 700 1.4rem/1.1 var(--display); text-align: center; text-decoration: none; border: 0; cursor: pointer; transition: transform .15s; }
.cta:hover { transform: scale(1.03); }

.bench { position: relative; aspect-ratio: 1; width: min(100%, 560px); justify-self: center; }
.pot { position: absolute; inset: 12% 8% 0; width: 84%; }
.fire { position: absolute; left: -9%; bottom: 0; width: 52%; }
/* Окно котла: координаты из images.py в системе .bench, маска совпадает с прозрачной областью чугуна */
.liquid { position: absolute; left: 20.7%; right: 20.8%; top: 35.9%; bottom: 23.9%; overflow: hidden; display: flex; flex-direction: column-reverse; -webkit-mask: url("/img/cauldron-window.png") center / 100% 100% no-repeat; mask: url("/img/cauldron-window.png") center / 100% 100% no-repeat; }
.liquid i { display: block; height: var(--h); background-size: 170px; animation: rise 1.5s ease-in-out var(--d) both; }
.l-e { --h: 54%; --d: .5s; background-image: url("/img/liquid-e.webp"); }
.l-b { --h: 27%; --d: 2.3s; background-image: url("/img/liquid-b.webp"); }
.l-a { --h: 9%; --d: 4.1s; background-image: url("/img/liquid-a.webp"); }
@keyframes rise { from { height: 0; } }
.pour { position: absolute; left: 44%; top: 0; width: 30%; opacity: 0; animation: pour 1.8s linear var(--d) both; }
.pour img { transform: rotate(-118deg); }
.pour i { position: absolute; left: 4%; top: 72%; width: 9%; height: 130%; border-radius: 4px; background-size: 120px; }
.pour-e { --d: .3s; } .pour-e i { background-image: url("/img/liquid-e.webp"); }
.pour-b { --d: 2.1s; } .pour-b i { background-image: url("/img/liquid-b.webp"); }
.pour-a { --d: 3.9s; } .pour-a i { background-image: url("/img/liquid-a.webp"); }
@keyframes pour { 0%, 100% { opacity: 0; } 10%, 85% { opacity: 1; } }

main > section:not(.stage) { max-width: 1120px; margin: 0 auto; padding: 4rem 1.25rem 0; }
main h2 { font-size: clamp(2rem, 3.4vw, 2.7rem); margin-bottom: .8rem; }
.about { text-align: center; }
.about p { max-width: 62ch; margin: 0 auto; }

.steps h2 { text-align: center; margin-bottom: 1.6rem; }
.steps ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; counter-reset: step; }
.steps li { counter-increment: step; }
.steps img { border-radius: 10px; }
.steps h3 { font-size: 1.6rem; margin: .9rem 0 .3rem; }
.steps h3::before { content: counter(step) ". "; color: var(--gold); }
.steps p { font-size: 1.15rem; }

/* Страница книги рецептов и лист статьи */
.sheet { background: var(--parchment) url("/img/parchment-tile.webp") center top / 864px; color: var(--ink); border-radius: 6px; padding: 2.6rem clamp(1.25rem, 5vw, 3.4rem); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.sheet a { color: #7c2d12; }
.potions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem 3rem; margin-top: 1.4rem; }
.potions li { display: flex; gap: .9rem; align-items: center; }
.potions img { flex: none; width: 80px; }
.potions div:last-of-type { flex: 1; min-width: 0; }
.potions h3 { font-size: 1.45rem; }
.parts { display: flex; height: 12px; margin: .3rem 0; border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(71, 41, 13, .55); }
.potions p { font-size: 1.02rem; line-height: 1.3; }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: center; }
.split img { border-radius: 10px; }
.split.flip > div { order: 2; }
.medals { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: 1rem; }
.medals img { width: 64px; }

.faq details { border-top: 1px solid rgba(184, 169, 209, .3); padding: .75rem 0; }
.faq summary { cursor: pointer; font-weight: 500; font-size: 1.3rem; }
.faq details p { margin-top: .4rem; }
.sheet .faq details { border-color: rgba(71, 41, 13, .3); }
main > .faq { max-width: 780px; }

.guides li { padding: .7rem 0; }
.guides a { font-size: 1.35rem; font-weight: 500; }
.guides p { font-size: 1.1rem; }
main > .more { max-width: 780px; }

.bottom-cta { text-align: center; padding-bottom: 2rem; }
main > .bottom-cta { padding-top: 3rem; }
.sheet .bottom-cta { margin-top: 2rem; padding-bottom: 0; }

/* Статьи: лист пергамента на тёмном столе */
.article { max-width: 860px; margin: 0 auto; padding: 5.2rem 1rem 3rem; }
.article h1 { font-size: clamp(2.3rem, 5vw, 3.2rem); margin-bottom: 1rem; }
.article .sheet h2 { font-size: 1.9rem; margin: 2.2rem 0 .5rem; }
.article p + p { margin-top: .7rem; }
.lead { font-size: 1.32rem; line-height: 1.45; }
.note { margin-top: 1.1rem; padding-left: 1rem; border-left: 3px solid var(--ink-soft); font-style: italic; }
.game { margin-top: 2.2rem; }
.game .cta { margin-top: .4rem; }
.games .game h2 { margin: 0; }
.game-meta { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; font-size: 1.05rem; color: var(--ink-soft); margin: .2rem 0 .6rem; }
.game img { border-radius: 8px; margin: .6rem 0 .8rem; }
.checked { margin-top: 2rem; font-size: 1.05rem; color: var(--ink-soft); }
.table { overflow-x: auto; margin-top: 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: 1.1rem; line-height: 1.3; }
th, td { text-align: left; vertical-align: top; padding: .5rem .8rem .5rem 0; border-bottom: 1px solid rgba(71, 41, 13, .3); }
thead th { font-family: var(--display); font-size: 1.15rem; }
tbody th { font-weight: 500; }
.legal h1 { margin-bottom: .6rem; }
.legal h2 { font-size: 1.6rem !important; }
.legal ul { list-style: disc; padding-left: 1.3rem; }

.support label { display: block; margin-top: 1.2rem; font-weight: 500; }
.support input, .support textarea { width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; color: var(--ink); background: rgba(255, 248, 230, .75); border: 1px solid var(--ink-soft); border-radius: 4px; }
.support button { margin-top: 1.4rem; }
.fail { margin-top: 1rem; color: #8f1d12; }

footer { max-width: 1120px; margin: 3rem auto 0; padding: 1.5rem 1.25rem 2.5rem; border-top: 1px solid rgba(184, 169, 209, .25); font-size: 1rem; color: var(--haze); }
.links { display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; margin-bottom: .6rem; }
.disclaimer { max-width: 70ch; margin-bottom: .6rem; }

@media (max-width: 860px) {
  body { font-size: 1.15rem; }
  .top { position: static; background: var(--night); padding: .6rem 1rem; }
  .stage { padding: 1.5rem 1rem 1.5rem; }
  .stage-in { grid-template-columns: minmax(0, 1fr); }
  .recipe { padding: 2.6rem 1.9rem 3.4rem; }
  .bench { width: min(84%, 420px); }
  .steps ol, .split, .potions { grid-template-columns: minmax(0, 1fr); }
  .split.flip > div { order: 0; }
  .article { padding-top: 1.5rem; }
  .cta { min-width: 0; width: 100%; padding: 1.05rem 1.5rem; font-size: 1.12rem; }
}

@media (max-width: 600px) {
  thead { display: none; }
  table, tbody, tr, th, td { display: block; }
  tr { padding: .6rem 0; border-bottom: 1px solid rgba(71, 41, 13, .3); }
  th, td { border: 0; padding: .1rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .liquid i { animation: none; }
  .pour { animation: none; }
  .cta { transition: none; }
}
