/*
Theme Name: Всё о здоровье
Description: Портальная тема medklnk.ru с редакционной главной, рубриками и правым сайдбаром.
Version: 1.2.1
Requires at least: 6.2
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: medklnk-portal
*/

@font-face {
    font-family: Portal Serif;
    src: url("assets/fonts/serif-regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: Portal Serif;
    src: url("assets/fonts/serif-bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: Portal Sans;
    src: url("assets/fonts/sans-regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: Portal Sans;
    src: url("assets/fonts/sans-semibold.woff2") format("woff2");
    font-weight: 600 700;
    font-display: swap;
}

:root {
    --canvas: #f9faf7;
    --white: #fff;
    --ink: #112b29;
    --body: #283c37;
    --muted: #53655e;
    --green: #175343;
    --sage: #e6eee3;
    --line: #cbd4cc;
    --accent: #963a25;
    --serif: "Portal Serif", Georgia, serif;
    --sans: "Portal Sans", Arial, sans-serif;
    --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: .925rem/1.66 var(--sans);
    overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: var(--green); text-underline-offset: .2em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.13; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #226e59; outline-offset: 4px; }

.screen-reader-text, .skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}
.skip-link:focus {
    position: fixed;
    z-index: 10000;
    inset: 12px auto auto 12px;
    background: var(--white);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: .5rem 1rem;
}

.wrap { width: min(1440px, 100% - 96px); margin-inline: auto; }
.masthead { background: var(--white); }
.masthead__top {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding-block: 8px;
}
.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    color: var(--ink);
    font: 700 clamp(1.55rem, 2.45vw, 2.48rem)/1.05 var(--serif);
    letter-spacing: -.055em;
    text-decoration: none;
}
.wordmark .icon { color: var(--green); width: 48px; height: 48px; }
.wordmark img { max-width: min(300px, 68vw); max-height: 64px; width: auto; }
.icon {
    width: 24px;
    height: 24px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.site-search {
    display: flex;
    width: min(100%, 428px);
    align-items: stretch;
    min-height: 46px;
    border: 1px solid #82958a;
    border-radius: var(--radius);
    background: #f3f6f0;
}
.site-search:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.site-search__submit {
    flex: none;
    display: grid;
    place-items: center;
    width: 54px;
    padding: 0;
    color: var(--green);
    border: 0;
    background: transparent;
}
.site-search__submit:focus-visible, .site-search__input:focus-visible { outline-offset: -4px; }
.site-search__submit .icon { width: 27px; height: 27px; }
.site-search__input { flex: 1; min-width: 0; border: 0; padding: 5px 12px 5px 0; background: transparent; color: var(--ink); }
.site-search__input::placeholder { color: var(--muted); opacity: 1; }

.site-nav { border-block: 1px solid var(--line); }
body .site-nav button.nav-toggle { display: none; }
.nav-list, .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-list { display: flex; flex-wrap: wrap; column-gap: clamp(2px, 1.06vw, 18px); }
.nav-list > li { position: relative; }
.nav-list > li > a, .nav-more, .nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 13px 6px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 600;
}
.nav-list > .current-menu-item > a,
.nav-list > .current-menu-ancestor > a,
.nav-list > .current-category-ancestor > a,
.nav-list > .is-current > a,
.nav-list > li > a[aria-current="page"] {
    border-bottom-color: var(--green);
}
.nav-list a:hover, .nav-more:hover { color: var(--green); background: #f0f4ee; }
.nav-more .icon { width: 16px; height: 16px; }
.nav-list .sub-menu {
    display: none;
    position: absolute;
    z-index: 6;
    inset: 100% auto auto 0;
    min-width: 190px;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 12px 24px #19362e14;
}
.nav-list .sub-menu .sub-menu { position: static; border: 0; box-shadow: none; padding-inline-start: 12px; }
.nav-list .sub-menu a { display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav-list .menu-item-has-children:focus-within > .sub-menu,
.nav-list .nav-dropdown.is-open > .sub-menu { display: block; }
@media (hover: hover) {
    .nav-list .menu-item-has-children:hover > .sub-menu,
    .nav-list .nav-dropdown:not(.is-dismissed):hover > .sub-menu { display: block; }
}

.portal {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
    gap: clamp(25px, 2.6vw, 40px);
    align-items: start;
    margin-top: 30px;
    margin-bottom: 64px;
}
.portal__main, .portal__sidebar { min-width: 0; }
.portal__sidebar { display: grid; gap: 26px; }

.feature {
    display: grid;
    grid-template-columns: 47.5% minmax(0, 1fr);
    min-height: clamp(290px, 21.6vw, 352px);
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--sage);
}
.feature__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(24px, 2.35vw, 38px);
}
.category-label {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: .855rem;
    line-height: 1.35;
    font-weight: 600;
    text-decoration: none;
}
.category-label:hover { text-decoration: underline; }
.feature .category-label { font-size: clamp(.86rem, 1vw, 1rem); margin-bottom: 17px; }
.feature h1 {
    font: 400 clamp(1.68rem, 2.34vw, 2.36rem)/1.19 var(--serif);
    letter-spacing: -.062em;
    margin-bottom: clamp(20px, 2vw, 30px);
    text-wrap: pretty;
}
.feature__link, .text-link { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.feature__link { font-size: clamp(.9rem, 1.11vw, 1.08rem); }
.feature__link .icon, .text-link .icon { width: 18px; height: 18px; }
.feature__media { min-width: 0; position: relative; display: block; }
.feature__media img, .feature__media .media-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--green);
    background: #dce9df;
}
.media-fallback .icon { width: 46px; height: 46px; opacity: .68; }

.section { margin-top: 40px; }
.section--ruled { margin-top: 41px; padding-top: 21px; border-top: 1px solid #98aa9e; }
.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px 18px;
    margin-bottom: 21px;
}
.section__title, .archive-title {
    font: 400 clamp(1.35rem, 1.75vw, 1.78rem)/1.21 var(--serif);
    letter-spacing: -.045em;
}
.text-link { font-size: .87rem; white-space: nowrap; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 33px 22px; }
.story { min-width: 0; }
.story__media { display: block; aspect-ratio: 1.7; border-radius: var(--radius); overflow: hidden; background: #dce9df; }
.story__media img { width: 100%; height: 100%; object-fit: cover; }
.story > .category-label { margin-top: 13px; }
.story__title { margin-top: 6px; font: 400 clamp(1.02rem, 1.27vw, 1.26rem)/1.27 var(--serif); letter-spacing: -.035em; text-wrap: pretty; }
.story__title a, .recommendation a { color: var(--ink); text-decoration: none; }
.story__title a:hover, .recommendation a:hover { color: var(--green); text-decoration: underline; }
.story__meta { display: block; color: var(--muted); font-size: .85rem; margin-top: 7px; }

.quick-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.quick-links__item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 7px 16px;
    border-radius: var(--radius);
    background: var(--sage);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.quick-links__item:hover { background: #d5e6d9; }
.quick-links__item > .icon:first-child { color: var(--green); width: 30px; height: 30px; }
.quick-links__item > .icon:last-child { margin-left: auto; color: var(--green); width: 16px; height: 16px; }

.rail-box {
    padding: 17px clamp(15px, 1.45vw, 23px) 18px;
    background: #fffdfa;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.rail-box__title {
    font: 400 clamp(1.28rem, 1.62vw, 1.6rem)/1.22 var(--serif);
    letter-spacing: -.04em;
    margin-bottom: 16px;
}
.recommendations, .rubrics { list-style: none; margin: 0; padding: 0; }
.recommendation + .recommendation, .rubric + .rubric { border-top: 1px solid var(--line); }
.recommendation a {
    display: grid;
    grid-template-columns: clamp(63px, 5.6vw, 83px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding-block: 11px;
    font: 400 clamp(.92rem, 1.1vw, 1.06rem)/1.3 var(--serif);
    letter-spacing: -.022em;
}
.recommendation:first-child a { padding-top: 0; }
.recommendation:last-child a { padding-bottom: 0; }
.recommendation__image { aspect-ratio: 1.24; overflow: hidden; border-radius: var(--radius); background: var(--sage); }
.recommendation__image img { width: 100%; height: 100%; object-fit: cover; }
.recommendation__image .icon { width: 24px; height: 24px; }
.rubric a {
    display: flex;
    align-items: center;
    min-height: 49px;
    gap: 12px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.rubric a:hover { color: var(--green); text-decoration: underline; }
.rubric .icon { width: 27px; height: 27px; color: var(--green); }
.rubric .icon:last-child { margin-left: auto; width: 15px; height: 15px; }

.archive-heading { padding: 4px 0 24px; }
.archive-title { font-size: clamp(1.65rem, 2.6vw, 2.6rem); }
.archive-description { color: var(--muted); margin-top: 10px; max-width: 65ch; }
.archive-description > :last-child { margin-bottom: 0; }
.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.page-numbers {
    padding: .35em .68em;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
}
.page-numbers.current { color: #fff; background: var(--green); border-color: var(--green); }
.page-numbers.dots { border-color: transparent; }

.entry-header { margin-bottom: 21px; }
.entry-header .category-label { display: inline-block; }
.entry-title {
    font: 400 clamp(1.65rem, 2.65vw, 2.72rem)/1.19 var(--serif);
    letter-spacing: -.05em;
    margin-bottom: 14px;
    text-wrap: pretty;
}
.entry-date { color: var(--muted); font-size: .9rem; }
.entry-cover { margin-bottom: 25px; border-radius: var(--radius); overflow: hidden; aspect-ratio: 2.25; background: var(--sage); }
.entry-cover img { width: 100%; height: 100%; object-fit: cover; }
.entry-content {
    color: var(--body);
    font: 400 clamp(1rem, 1.1vw, 1.05rem)/1.8 var(--sans);
}
.entry-content h2, .entry-content h3, .entry-content h4 {
    color: var(--ink);
    font: 400 1.45em/1.29 var(--serif);
    letter-spacing: -.03em;
    margin-block: 1.52em .64em;
}
.entry-content h3 { font-size: 1.27em; }
.entry-content h4 { font-size: 1.18em; }
.entry-content ul, .entry-content ol { padding-inline-start: 1.45em; }
.entry-content li + li { margin-top: .4em; }
.entry-content img { border-radius: 5px; }
.entry-content .wp-block-image, .entry-content figure, .entry-content .wp-block-embed { margin-block: 1.35em; }
.entry-content figcaption { font-size: .86em; color: var(--muted); }
.entry-content blockquote { margin: 1.45em 0; padding: .85em 1.2em; border-left: 4px solid #629282; background: var(--sage); }
.entry-content blockquote > :last-child { margin-bottom: 0; }
.entry-content aside { max-width: 100%; }
.entry-content details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: .7em 1em; margin-block: .7em; }
.entry-content summary { cursor: pointer; font-weight: 600; color: var(--green); }
.entry-content summary + p { margin: .7em 0 0; }
.entry-content .wp-block-table, .entry-content pre { max-width: 100%; overflow-x: auto; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .94em; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: .55em .75em; text-align: start; vertical-align: top; }
.entry-content th { background: var(--sage); }
.entry-content pre { padding: 14px; background: var(--sage); }
.entry-content iframe { max-width: 100%; }
.entry-content .aligncenter { margin-inline: auto; }
.entry-content .alignleft { float: left; margin-inline-end: 1rem; }
.entry-content .alignright { float: right; margin-inline-start: 1rem; }
.entry-content::after { display: block; content: ""; clear: both; }
.comment-form label { display: block; }
.comment-form input:not([type=checkbox]):not([type=submit]), .comment-form textarea {
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--white);
    padding: .44rem .64rem;
}
.comment-form input[type=submit] { color: var(--white); background: var(--green); border: 0; border-radius: 5px; padding: .5rem .85rem; }

.site-footer { background: var(--sage); border-top: 1px solid var(--line); padding-block: 24px; }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 24px; }
.site-footer__inner small { color: var(--muted); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer .wordmark { font-size: 1.55rem; }
.site-footer .wordmark .icon { width: 26px; height: 26px; }
.widget { overflow-wrap: anywhere; }

@media (max-width: 1150px) {
    .wrap { width: calc(100% - 56px); }
    .nav-list { column-gap: 2px; }
    .nav-list > li > a, .nav-more { padding-inline: 10px; }
}
@media (max-width: 900px) {
    .wrap { width: calc(100% - 40px); }
    .portal { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .portal__sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .nav-list > li > a, .nav-more { font-size: .85rem; padding-inline: 8px; }
    .recommendation a { grid-template-columns: 83px minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .wrap { width: calc(100% - 32px); }
    .masthead__top { flex-wrap: wrap; justify-content: center; gap: 12px; padding-block: 13px; }
    .wordmark { gap: 9px; font-size: clamp(1.45rem, 5.55vw, 1.95rem); }
    .wordmark .icon { width: 35px; height: 35px; }
    .site-search { width: 100%; min-height: 42px; }
    .site-search__submit { width: 45px; }
    .site-search__submit .icon { width: 22px; height: 22px; }
    body .site-nav.nav-enhanced button.nav-toggle { display: inline-flex; gap: 8px; min-height: 44px; padding-inline: 0; }
    .nav-toggle .icon { width: 18px; height: 18px; }
    .nav-enhanced .nav-list:not(.is-expanded) { display: none; }
    .nav-list { display: block; padding-block: 2px 9px; }
    .nav-list > li > a, .nav-more { min-height: 42px; padding-inline: 8px; }
    .nav-list > li > a { border: 0; }
    .nav-list .sub-menu { position: static; margin-inline-start: 10px; border: 0; box-shadow: none; }
    .portal { margin-top: 16px; margin-bottom: 34px; }
    .feature { grid-template-columns: minmax(0, 1fr); }
    .feature__copy { padding: 21px; }
    .feature h1 { font-size: clamp(1.52rem, 6vw, 2.05rem); margin-bottom: 14px; }
    .feature .category-label { margin-bottom: 8px; }
    .feature__media { aspect-ratio: 1.8; }
    .section__head { margin-bottom: 16px; flex-wrap: wrap; }
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px 14px; }
    .story__title { font-size: clamp(1rem, 3.9vw, 1.18rem); }
    .quick-links { grid-template-columns: minmax(0, 1fr); gap: 7px; }
    .quick-links__item { min-height: 49px; }
    .portal__sidebar { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .rail-box { padding: 14px; }
    .entry-cover { aspect-ratio: 1.65; margin-bottom: 16px; }
    .entry-content .alignleft, .entry-content .alignright { float: none; margin-inline: auto; }
}

.directory {
    display: grid;
    gap: 15px;
    padding: clamp(16px, 2vw, 27px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--sage);
}
.directory__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.directory__links a, .topic__links a, .topic__articles a {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
}
.directory__links a {
    justify-content: space-between;
    min-height: 42px;
    padding: 7px 10px;
    background: var(--white);
    border-radius: 5px;
    font-size: .855rem;
}
.directory__links .icon, .topic__links .icon, .topic__articles .icon {
    width: 15px;
    height: 15px;
    color: var(--green);
}
.directory__links a:hover, .topic__links a:hover, .topic__articles a:hover {
    color: var(--green);
    text-decoration: underline;
}
.topic {
    overflow: clip;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
}
.topic__head {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px clamp(14px, 2vw, 28px);
    border-bottom: 1px solid var(--line);
    background: #e6eee3;
}
.topic--health .topic__head { background: #f1e9e2; }
.topic--nutrition .topic__head { background: #f2eee1; }
.topic--lifestyle .topic__head { background: #e6eeef; }
.topic__head > .icon { color: var(--green); }
.topic__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.24fr);
    gap: 18px clamp(16px, 2.4vw, 36px);
    padding: 19px clamp(14px, 2vw, 28px);
}
.topic__body .story__media { aspect-ratio: 1.9; }
.topic__articles { list-style: none; margin: 0; padding: 0; }
.topic__articles li + li { border-top: 1px solid var(--line); }
.topic__articles a {
    justify-content: space-between;
    min-height: 46px;
    padding-block: 9px;
    font: 400 clamp(.97rem, 1.22vw, 1.14rem)/1.39 var(--serif);
}
.topic__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 9px clamp(14px, 2vw, 28px);
    border-top: 1px solid var(--line);
}
.topic__links a {
    min-height: 28px;
    color: var(--green);
    font-size: .88rem;
    font-weight: 600;
}
@media (max-width: 640px) {
    .directory__links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .directory__links a { padding-inline: 7px; font-size: .85rem; }
    .topic__body { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 641px) {
    .card-grid--archive { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .card-grid--archive > .story { grid-column: span 2; }
    .card-grid--archive > .story:nth-child(3n + 1):nth-last-child(2),
    .card-grid--archive > .story:nth-child(3n + 2):last-child { grid-column: span 3; }
    .card-grid--archive > .story:nth-child(3n + 1):last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .card-grid--archive > .story:nth-child(odd):last-child,
    .card-grid:not(.card-grid--archive) > .story:nth-child(odd):last-child { grid-column: 1 / -1; }
}
@media (min-width: 641px) {
    .card-grid--archive > .story:nth-child(3n + 1):last-child {
        display: grid;
        grid-template-columns: minmax(160px, 34%) minmax(0, 1fr);
        gap: 3px 18px;
        align-content: start;
        align-items: start;
    }
    .card-grid--archive > .story:nth-child(3n + 1):last-child > .story__media {
        grid-column: 1;
        grid-row: span 4;
    }
}

.entry-content p { margin-bottom: 1.22em; }
@media (max-width: 640px) {
    .site-search__input { font-size: 16px; }
    .section, .section--ruled { margin-top: 30px; }
}

.portal--overview:has(+ .portal--latest) { margin-bottom: 40px; }
.portal--latest { margin-top: 0; }
.portal--latest > .section { min-width: 0; margin-top: 0; }
