/*
Theme Name: Школа 217
Description: Адаптивная тема для сайта школы № 217.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: school217
*/
:root {
    color-scheme: light;
    --ink: #18313e;
    --muted: #496272;
    --accent: #185c61;
    --border: #dce6e6;
    --surface: #fff;
    --canvas: #edf3f4;
    --radius: 18px;
    --gap: clamp(14px, 1.6vw, 26px);
}
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 16px/1.55 "Segoe UI", Arial, sans-serif;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #087b85; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; inset: 12px auto auto 12px; transform: translateY(-160%); z-index: 100000; background: white; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { transform: none; }
.site-layout {
    --menu-width: clamp(205px, 17vw, 244px);
    --widget-width: clamp(214px, 18vw, 264px);
    display: grid;
    grid-template-columns: minmax(0, var(--menu-width)) minmax(0, 1fr) minmax(0, var(--widget-width));
    grid-template-areas: "sidebar main widgets" ". footer .";
    gap: var(--gap);
    align-items: start;
    max-width: 1680px;
    min-height: 100vh;
    margin-inline: auto;
    padding: var(--gap);
}
.site-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.desktop-menu-label { display: none; }
.desktop-menu-content { display: flex; flex-direction: column; min-height: 0; }
.rail-toggle { display: none; }
.menu-dots { display: none; }
.brand-mark, .custom-logo-link { display: grid; flex: 0 0 42px; width: 42px; place-items: center; }
.brand-mark { height: 42px; border-radius: 12px; background: #17575c; color: white; font-weight: 750; }
.brand-name { color: var(--ink); font-weight: 750; line-height: 1.24; text-decoration: none; overflow-wrap: anywhere; }
.school-menu { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 9px; scrollbar-width: thin; scrollbar-color: #a1bbbd transparent; }
.school-menu ul { list-style: none; margin: 0; padding: 0; }
.school-menu ul ul { margin-left: 10px; padding-left: 6px; border-left: 1px solid var(--border); }
.menu-row { display: flex; align-items: stretch; border-radius: 9px; }
.menu-row:hover { background: #edf5f5; }
.menu-row > a, .menu-row > span { flex: 1; min-width: 0; padding: 9px 8px; font-size: .875rem; line-height: 1.32; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.menu-row > a[aria-current] { color: #14575b; background: #deefea; border-radius: 8px; font-weight: 700; }
.branch-toggle, .mobile-toggle { display: none; cursor: pointer; background: transparent; border: 0; border-radius: 8px; }
.has-school-navigation .branch-toggle { display: grid; width: 36px; flex: 0 0 36px; min-height: 36px; place-items: center; }
.branch-toggle:hover, .mobile-toggle:hover { background: #deefea; }
.branch-toggle span, .mobile-toggle span { width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
:is(.branch-toggle, .mobile-toggle)[aria-expanded="true"] > span { transform: rotate(225deg); }
.site-main { grid-area: main; min-width: 0; }
.school-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 12px clamp(13px, 1.5vw, 22px);
    border-radius: var(--radius);
    background: linear-gradient(118deg, #163b54 14%, #176668);
    color: #fff;
}
.school-hero::after {
    content: "";
    z-index: -1;
    position: absolute;
    width: 320px;
    aspect-ratio: 1;
    right: -72px;
    bottom: -194px;
    border: 1px solid #ffffff2d;
    border-radius: 50%;
    box-shadow: 0 0 0 24px #ffffff13, 0 0 0 48px #ffffff12, 0 0 0 73px #ffffff0d, 0 0 0 98px #ffffff0a;
}
.hero-location { margin: 0 0 3px; color: #def4ed; font-size: .8rem; font-weight: 650; }
.school-hero h1 { margin: 0; font-size: clamp(1.55rem, 2.6vw, 2.35rem); line-height: 1.05; letter-spacing: -.04em; overflow-wrap: anywhere; }
.hero-description { margin: 3px 0 0; color: #edf8f6; font-size: .94rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-links a { display: inline-flex; gap: 6px; align-items: center; padding: 5px 9px; border: 1px solid #ffffff66; border-radius: 30px; color: white; font-size: .8rem; font-weight: 650; text-decoration: none; background: #12384f60; }
.quick-links a:hover { background: white; color: #173f52; }
.school-hero a:focus-visible { outline-color: white; }
.news-section > h1, .news-section > h2 { margin: 0 0 14px; font-size: clamp(1.45rem, 2vw, 1.9rem); letter-spacing: -.025em; }
.school-hero + .news-section { margin-top: 20px; }
.news-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.15vw, 18px); }
.news-card { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: white; }
.news-card:hover { border-color: #78a9a6; box-shadow: 0 3px 14px #1e525510; }
.news-link { display: flex; flex-direction: column; height: 100%; border-radius: inherit; color: var(--ink); text-decoration: none; }
.news-image { position: relative; height: clamp(92px, 9vw, 150px); overflow: hidden; border-radius: 13px 13px 0 0; background: linear-gradient(130deg, #deeee8, #d6e6ef); }
.news-image img { position: absolute; inset: 0; width: 100%; height: 100%; }
.news-image-backdrop { object-fit: cover; filter: blur(14px) brightness(.78); transform: scale(1.18); }
.news-image-picture { object-fit: contain; }
.news-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 13px 13px; }
.news-summary time, .reading-header time { font-size: .82rem; color: var(--muted); }
.news-summary h3 { grid-row: 2; font-size: clamp(.95rem, 1.3vw, 1.13rem); line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.news-arrow { grid-row: 2; color: var(--accent); font-weight: 700; }
.news-link:hover h3 { text-decoration: underline; text-underline-offset: .18em; }
.pagination { margin-top: 18px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.page-numbers { background: white; border: 1px solid var(--border); padding: 6px 11px; border-radius: 8px; }
.page-numbers.current { color: white; background: var(--accent); }
.site-widgets { grid-area: widgets; min-width: 0; display: grid; gap: 8px; }
.widget-panel { display: grid; gap: 12px; min-width: 0; }
.widget-grid { display: grid; gap: 12px; }
.widget-toggle { display: none; }
.announcement-group { border: 1px solid var(--border); border-radius: 14px; background: white; }
.announcement-group h2 { margin: 0; font-size: 1rem; }
.announcement-label { display: block; padding: 11px 13px; }
.announcement-toggle, .announcement-more { display: none; }
.has-school-navigation .announcement-more { display: block; justify-self: start; padding: 3px 8px; border: 1px solid var(--border); border-radius: 7px; background: #edf5f3; color: var(--accent); cursor: pointer; }
.announcement-list { display: grid; gap: 8px; padding: 0 13px 12px; overflow-wrap: anywhere; }
.announcement-extra { display: grid; gap: 8px; }
.announcement-all { font-weight: 700; }
.announcement-list p { margin: 0; color: var(--muted); font-size: .875rem; }
.feedback-art { position: relative; overflow: hidden; margin-bottom: 8px; border-radius: 8px; background: #f8efec; }
.feedback-art img.feedback-logo { position: absolute; top: 0; left: 0; width: 81px; height: auto; padding: 7px 8px; border-radius: 0 0 8px; background: white; }
.widget-card { padding: 13px; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.widget-card h3 { margin: 0 0 8px; font-size: 1.04rem; line-height: 1.28; }
.widget-content { min-width: 0; overflow-wrap: anywhere; }
.widget-content p { margin: 0 0 8px; }
.widget-content > :last-child { margin-bottom: 0; }
.widget-content img { display: block; width: 100%; border-radius: 8px; }
.widget-content iframe { display: block; max-width: 100%; border: 0; }
.widget-action { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 5px 11px; border: 1px solid #a6c4bf; border-radius: 8px; background: #e3f0ed; color: #174b50; font-weight: 650; cursor: pointer; }
.widget-action:hover { background: #cee6e0; }
.reading-card { min-width: 0; overflow-wrap: anywhere; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.reading-header { padding: clamp(18px, 3.2vw, 42px); background: #e2efed; border-radius: 17px 17px 0 0; }
.breadcrumbs { margin-bottom: .65rem; font-size: .8125rem; line-height: 1.5; color: #47645f; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .2em .55em; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: flex; align-items: baseline; gap: .55em; max-width: 100%; }
.breadcrumbs a { color: inherit; text-decoration-color: #92aaa4; overflow-wrap: anywhere; }
.breadcrumbs a:hover, .breadcrumbs a:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.reading-header h1 { font-size: clamp(1.65rem, 3vw, 3.15rem); line-height: 1.13; margin: 0; letter-spacing: -.025em; }
.reading-header time { display: block; margin-bottom: 6px; }
.reading-back { display: inline-block; margin-bottom: 12px; font-weight: 600; }
.entry-content { padding: clamp(16px, 3vw, 38px); overflow-x: auto; }
.entry-content > :first-child { margin-top: 0; }
.entry-content > :last-child { margin-bottom: 0; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin-block: .75em; }
.entry-content table { border-collapse: collapse; max-width: none !important; min-width: min-content; table-layout: auto !important; }
.entry-content :is(td, th), .entry-content :is(td, th) * { overflow-wrap: normal !important; word-break: normal !important; hyphens: none !important; }
.entry-content td, .entry-content th { padding: 8px; border: 1px solid var(--border); vertical-align: top; }
.entry-content tr:nth-child(even) { background: #f1f6f5; }
.entry-content iframe { max-width: 100%; }
.entry-content video { max-width: 100%; height: auto; }
.entry-content :is(.school217-embedded-video, .school217-embedded-file) { display: block; width: 100%; border: 0; border-radius: 10px; }
.entry-content .school217-embedded-video { max-width: 860px; aspect-ratio: 16 / 9; background: #10232d; }
.entry-content iframe.school217-embedded-video { height: auto; }
.entry-content .school217-embedded-file { height: clamp(300px, 65vh, 680px); }
.school217-embed-link { display: inline-block; margin-block: 6px 12px; }
.entry-content figure { max-width: 100%; margin-inline: 0; }
.entry-content pre { overflow: auto; }
#school217-archive-materials li + li { margin-top: .45em; }
#school217-archive-materials time { color: var(--muted); font-size: .85em; white-space: nowrap; }
.legacy-spoiler { margin-block: 10px; border: 1px solid var(--border); border-radius: 12px; background: #f8fbfa; }
.legacy-spoiler > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; color: var(--accent); font-weight: 700; cursor: pointer; list-style: none; }
.entry-content details > summary {
    border-radius: 11px;
    background-color: #edf5f2;
    box-shadow: inset 0 0 0 1px #d5e5df;
}
.legacy-spoiler summary::-webkit-details-marker { display: none; }
.legacy-spoiler summary:hover { background: #e3f0ed; }
.entry-content :where(details, summary) { border-radius: 12px; }
.site-sidebar :is(a, button), .entry-content summary {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}
.brand-row a, .menu-row > a { border-radius: 8px; }
.site-sidebar :is(a, button):active, .entry-content details > summary:active {
    background-color: #d5eae5;
}
.legacy-spoiler summary::after { content: ""; flex: 0 0 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 240ms ease; }
.legacy-spoiler[open]:not([data-expanded="false"]) summary::after { transform: rotate(225deg); }
.spoiler-body { padding-inline: 14px; display: flow-root; }
.site-footer { grid-area: footer; min-width: 0; padding: clamp(16px, 2.4vw, 31px); background: #e0eaed; border: 1px solid #d2e2e5; border-radius: var(--radius); }
.site-footer h2 { font-size: 1.15rem; margin: 0 0 12px; }
.resource-links { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr)); gap: 7px; margin: 0; padding: 0; }
.resource-links a { background: #f8fafb; border-radius: 10px; min-height: 59px; display: flex; height: 100%; align-items: center; gap: 7px; padding: 7px; font-size: .79rem; line-height: 1.23; }
.resource-links img { flex: 0 0 34px; width: 34px; height: 35px; object-fit: contain; }
.resource-links span { min-width: 0; overflow-wrap: anywhere; }
.footer-bottom { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; margin-top: 15px; font-size: .85rem; }
.footer-copy { margin: 0; color: var(--muted); }
@media (min-width: 960px) {
    .site-layout { --panel-top: var(--gap); transition: grid-template-columns 180ms ease-out; }
    .admin-bar .site-layout { --panel-top: calc(var(--gap) + 32px); }
    .site-sidebar, .site-widgets {
        position: sticky;
        top: var(--panel-top);
        height: calc(100dvh - var(--panel-top) - var(--gap));
    }
    .site-sidebar { padding: 5px 5px 5px 0; }
    .site-widgets {
        display: flex;
        flex-direction: column;
    }
    .site-widgets > .widgets-rail-toggle { flex-shrink: 0; }
    .widget-panel { flex: 1; align-content: start; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #a1bbbd transparent; }
    .site-layout.menu-collapsed { --menu-width: 54px; }
    .site-layout.widgets-collapsed { --widget-width: 54px; }
    .has-school-navigation .rail-toggle { display: flex; align-items: center; gap: 7px; min-height: 34px; border: 1px solid var(--border); border-radius: 9px; padding: 3px 8px; background: #f7fbfa; color: var(--accent); font-weight: 650; cursor: pointer; }
    .rail-toggle:hover { background: #e0eeeb; }
    .rail-toggle span { font-size: 1.24rem; line-height: 1; transition: transform 240ms ease; }
    .rail-toggle[aria-expanded="false"] span { transform: rotate(180deg); }
    .brand-row { gap: 7px; padding: 8px 10px; }
    .brand-row > :is(.brand-mark, .custom-logo-link) { flex-basis: 36px; width: 36px; }
    .brand-row > .brand-mark { height: 36px; }
    .brand-row-home > :is(.brand-name, .brand-mark, .custom-logo-link) { display: none; }
    .desktop-menu-label { display: block; font-weight: 750; }
    .menu-rail-toggle { margin-left: auto; justify-content: center; width: 34px; flex-shrink: 0; }
    .menu-collapsed .brand-row { justify-content: center; padding: 5px 0; border-bottom: 0; }
    .menu-collapsed .brand-row > :not(.menu-rail-toggle) { display: none; }
    .menu-collapsed .site-sidebar { background: linear-gradient(155deg, #e3f2f0, #dbe8ef); }
    .menu-collapsed .menu-rail-toggle { margin-left: 0; }
    .menu-dots {
        --dot-size: 6px;
        --dot-color: #669598;
        --current-dot-color: #006765;
        display: flex;
        flex-direction: column;
        align-items: center;
        flex: 1 1 0;
        min-height: 0;
        padding-block: 10px;
    }
    .menu-dot-list {
        position: relative;
        display: grid;
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        grid-template-columns: minmax(0, 42px);
        grid-template-rows: 0;
        grid-auto-rows: 24px;
        justify-content: center;
        align-content: space-between;
        gap: 2px;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        scrollbar-width: none;
    }
    /* Count the gap below the pinned Home link in the grid's space distribution. */
    .menu-dot-list::before { content: ""; }
    .menu-dots:has(> :only-child) { justify-content: center; }
    .menu-dots [data-label] { display: grid; place-items: center; border-radius: 6px; }
    .menu-dots a:hover { background: #ffffff70; }
    .menu-dots a:focus-visible { outline-offset: -2px; }
    .menu-dots [data-label]::before { content: ""; width: var(--dot-size); height: var(--dot-size); border-radius: 50%; background: var(--dot-color); box-shadow: 0 0 4px #579a9b90; }
    .menu-dots .current::before { background: var(--current-dot-color); box-shadow: 0 0 0 2px #fff, 0 0 8px 3px #118a88; }
    .menu-dots > .home-dot { flex: 0 0 24px; width: min(100%, 42px); }
    .menu-dots > .home-dot::before { background: #fff; box-shadow: 0 0 0 1px var(--dot-color), 0 0 4px 4px #fff, 0 0 10px 5px #579a9b85; }
    .menu-dots > .home-dot.current::before { box-shadow: 0 0 0 2px var(--current-dot-color), 0 0 5px 5px #fff, 0 0 11px 6px #579a9ba0; }
    .menu-dots > .home-dot:hover { background: #dcece7; }
    .site-sidebar .menu-dots a:active { background-color: #d5eae5; }
    .menu-dots .section-root::before { background: #2476ba; box-shadow: 0 0 0 2px #fff, 0 0 9px 3px #5da6de; }
    .menu-dot-tooltips { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
    .menu-dot-tooltip { position: absolute; z-index: 1; left: var(--tooltip-left); transform: translateY(-50%); max-width: calc(100% - var(--tooltip-left) - 12px); }
    .menu-dot-halo {
        position: absolute;
        z-index: 0;
        left: calc(var(--tooltip-left) - 46px);
        width: calc(var(--label-width) + 92px);
        height: 72px;
        transform: translateY(-50%);
        background: #edf3f450;
        backdrop-filter: blur(10px);
        mask-image: radial-gradient(ellipse farthest-side, #000 60%, transparent 100%);
    }
    .menu-dot-tooltip > span { position: relative; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 8px; border-radius: 6px; background: var(--ink); color: white; font-size: .78rem; line-height: 16px; box-shadow: 0 2px 8px #18313e38; }
    .home-tooltip > span { background: #fff; color: #006765; }
    .section-root-tooltip > span { background: #38675e; }
    .current-tooltip > span { background: #b6eee1; color: #124c48; font-weight: 650; box-shadow: inset 0 0 0 1px #78bfb1, 0 2px 8px #18313e38; }
    .widgets-collapsed .site-widgets { align-items: center; padding-block: 6px; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(155deg, #f8fcfacc, #c7e3e1aa 65%, #dce9f0cc); backdrop-filter: blur(8px); }
    .widgets-collapsed .widgets-rail-toggle { writing-mode: vertical-rl; padding: 8px 4px; font-size: .86rem; white-space: nowrap; }
    .widgets-collapsed .widgets-rail-toggle span { writing-mode: horizontal-tb; }
}
@media (max-width: 959px) {
    .site-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sidebar" "widgets" "main" "footer"; align-content: start; }
    .brand-row { border-bottom: 0; }
    .has-school-navigation .mobile-toggle { display: inline-flex; align-items: center; gap: 9px; padding: 8px 11px; margin-left: auto; border: 1px solid var(--border); font-weight: 650; }
    .school-menu { max-height: min(55dvh, 440px); border-top: 1px solid var(--border); scrollbar-gutter: stable; }
    .school-menu { overflow-anchor: none; }
    :is(.branch-toggle, .mobile-toggle) > span { transition: transform 280ms ease-in-out; }
    :is(.branch-toggle, .mobile-toggle, .announcement-toggle, .widgets-rail-toggle, .widget-toggle) {
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        user-select: none;
        transition: background-color 140ms ease-out;
    }
    .has-school-navigation :is(.branch-toggle, .mobile-toggle, .announcement-toggle, .widgets-rail-toggle, .widget-toggle):active {
        background-color: #d5eae5;
        transition-duration: 0s;
    }
    .site-widgets { gap: 8px; }
    .widget-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .has-school-navigation .announcement-label { display: none; }
    .has-school-navigation .announcement-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 13px; border: 0; border-radius: 13px; background: transparent; cursor: pointer; font-weight: 700; }
    .announcement-toggle::after { content: ""; width: 8px; height: 8px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 240ms ease; }
    .announcement-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
    .has-school-navigation .widget-toggle { display: block; width: 100%; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--accent); font-weight: 650; cursor: pointer; }
    .has-school-navigation .widgets-rail-toggle { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; width: 100%; min-height: 46px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 14px; background: white; color: var(--ink); cursor: pointer; font-weight: 700; }
    .widgets-rail-toggle span { transform: rotate(-90deg); transition: transform 240ms ease; }
    .widgets-rail-toggle[aria-expanded="false"] span { transform: rotate(90deg); }
    .widget-content { font-size: .88rem; }
    .widget-card h3 { font-size: .93rem; }
    .school-hero { display: none; }
    .school-hero + .news-section { margin-top: 0; }
}
.panel-animating { contain: layout paint; overflow: hidden; overflow-anchor: none; align-content: start; }
.measuring-disclosure { overflow-anchor: none; }
@media (prefers-reduced-motion: reduce) {
    :is(.branch-toggle, .mobile-toggle, .announcement-toggle, .widgets-rail-toggle, .widget-toggle),
    :is(.branch-toggle, .mobile-toggle) > span { transition: none; }
    .site-layout, .legacy-spoiler summary::after, .announcement-toggle::after, .rail-toggle span { transition: none; }
}
@media (max-width: 360px) {
    .site-layout { padding: 9px; }
    .brand-row, .widget-card { padding: 9px; }
    .widget-action { padding: 4px 6px; }
}
@media (max-width: 440px) {
    .news-grid { grid-template-columns: minmax(0, 1fr); }
    .news-image { height: 114px; }
}
