/*
 * PZD reading layer v1. Site-specific overrides, loaded after the default theme.
 * Keep all visual adjustments here; the only template change is one <link>.
 */
:root {
    --pzd-ink: #273c43;
    --pzd-accent: #105671;
    --pzd-paper: #f5f3ee;
    --pzd-edge: #dde4e2;
}
body { background: var(--pzd-site-background, var(--pzd-paper)); color: var(--pzd-ink); font-size: 16px; }
#layout {
    width: calc(100% - 48px) !important; max-width: 1280px; min-width: 0 !important;
    height: auto; min-height: 100vh; padding-bottom: 0;
}
#layout, #layout > header, #layout > nav, #body > section, #body > aside, #layout > footer {
    box-sizing: border-box;
}
/* Keep the header in normal flow: no compensating 120/200px nav padding. */
#layout header.header-main {
    position: sticky; top: 0; width: 100%; min-height: 84px; height: auto;
    flex: none; padding: 0; line-height: 1.4; background: #fff;
    box-shadow: 0 2px 12px rgb(26 58 67 / 8%);
}
#layout header #logo { flex: 0 0 100px; box-sizing: border-box; padding: 10px 16px; }
#layout header #logo a, #layout header #logo > span { float: none; height: 64px; width: 100%; }
#layout header .menu-wrapper { flex: 1 1 auto; min-width: 0; }
#layout header .auth-wrapper { flex: 0 1 240px; min-width: 0; padding-right: 14px; margin-top: 0; align-self: center; }
#layout header .menu {
    display: flex; flex-wrap: wrap; align-items: center; height: auto;
    line-height: 1.4; padding-top: 0; float: none;
}
#layout header .auth-wrapper .menu { justify-content: flex-end; }
#layout header .menu > li { float: none; padding-left: 0; }
#layout header .menu > li > a {
    color: var(--pzd-ink); font-size: 14px; line-height: 1.5;
    text-transform: none; padding: 8px 10px;
}
#layout header .menu > li > a:hover { color: var(--pzd-accent); background: #eef4f3; }
#layout header .auth-wrapper .menu > li > a { padding-left: 28px; }
/* User dropdown is a vertical list, independent of the header's horizontal menus. */
#layout header .widget_user_avatar .menu {
    display: block; width: 220px; max-width: calc(100vw - 24px);
    padding: 4px 0; text-align: left;
    background: #fff; border: 1px solid var(--pzd-edge); border-radius: 5px;
    box-shadow: 0 6px 18px rgb(26 58 67 / 16%); opacity: 1;
}
#layout header .widget_user_avatar .menu li {
    display: block; width: 100%; margin: 0; padding: 0;
    text-align: left; background: transparent; border: 0; box-sizing: border-box;
}
#layout header .widget_user_avatar .menu li > a {
    display: block; width: 100%; box-sizing: border-box;
    padding: 9px 14px 9px 34px; text-align: left;
    color: var(--pzd-ink); font-size: 14px; line-height: 1.5;
}
#layout header .widget_user_avatar .menu li > a:hover,
#layout header .widget_user_avatar .menu li > a:focus-visible {
    color: var(--pzd-accent); background-color: #eef4f3;
}
#layout header .widget_user_avatar .menu ul {
    left: auto; right: 100%; top: 0; background: #fff;
}
#layout header .widget_user_avatar:focus-within > .menu { visibility: visible; }

#layout > nav {
    position: relative; z-index: 6;
    padding: 0 !important; height: auto; min-height: 48px; margin: 0 0 14px;
    background: var(--pzd-accent); border-radius: 0 0 5px 5px;
}
#layout > nav .menu {
    display: flex; flex-wrap: wrap; align-items: center; float: none;
    height: auto; min-height: 48px; line-height: 1.5; margin: 0; background: transparent;
}
#layout > nav .menu > li { float: none; }
#layout > nav .menu > li > a { font-size: 15px; font-weight: 400; text-transform: none; padding: 13px 14px; }
#layout > nav .menu > li.chat-button { float: none; margin-left: 0; width: auto; background: transparent; }
#layout > nav .menu ul { width: max-content; min-width: 190px; max-width: calc(100vw - 24px); }
#layout > nav .menu ul a {
    box-sizing: border-box; height: auto; min-height: 0;
    font-size: 14px; line-height: 1.4; padding: 7px 14px;
}
#layout nav .menu li, #layout header .menu li { position: relative; }
/* Hidden fly-outs must not enlarge the page's scrollable width. */
#layout nav .menu ul, #layout header .menu ul { display: none; box-sizing: border-box; }
#layout nav .menu li:hover > ul, #layout header .menu li:hover > ul,
#layout nav .menu li:focus-within > ul, #layout header .menu li:focus-within > ul { display: block; visibility: visible; }
#layout nav .menu .more > ul { left: auto; right: 0; }
#layout nav .menu > .more { position: relative; }
#layout nav .menu .more ul ul { left: auto; right: 100%; }
/* Keep widget editing controls beneath navigation fly-outs. */
#layout .body_wrap { position: relative; z-index: 0; flex: 1 0 auto; min-width: 0; }
#layout #body { gap: 16px; align-items: flex-start; }
#layout #body > section.section_full { flex: 1 1 0; min-width: 0; width: auto !important; }
#layout #body > aside.aside_wrap { flex: 0 0 270px; width: 270px; min-width: 0; margin-left: 0; }
#layout #body > section.full { flex: 0 0 100%; }
#layout #body section article {
    padding: 32px clamp(20px, 4vw, 48px); border: 1px solid var(--pzd-edge); border-radius: 6px;
}
#layout img, #layout video { max-width: 100%; }
#layout input[type="text"], #layout input[type="email"], #layout input[type="password"], #layout textarea {
    max-width: 100%; box-sizing: border-box;
}
#layout h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.3; color: var(--pzd-ink); }
#layout p { line-height: 1.65; }
#layout .content_item .ft_html .value, #layout .content_item .ft_text .value {
    font-size: 18px; line-height: 1.75; max-width: 76ch;
}
#layout .content_item .ft_html .value p, #layout .content_item .ft_text .value p {
    line-height: inherit; margin-bottom: 1em;
}
#layout .content_item .ft_html .value img { height: auto; }
#layout .content_item .info_bar, #layout .content_list_item .info_bar { font-size: 14px; color: #56696f; }
#layout #breadcrumbs { margin-bottom: 22px; background: #f0f4f3; border-radius: 3px; }
#layout #breadcrumbs ul li { font-size: 13px; }
/* Quieter panels and legible dates, without removing any blocks. */
#layout .widget, #layout .widget_tabbed { border: 1px solid var(--pzd-edge); border-radius: 6px; margin-bottom: 16px; }
#layout .widget > .title {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    height: auto; min-height: 48px; line-height: 1.35; padding: 12px 18px;
    background: #fff; color: var(--pzd-accent); border-bottom: 1px solid var(--pzd-edge); font-size: 20px;
}
#layout .widget > .title .links { float: none; margin-left: auto; padding-right: 0; }
#layout .widget > .title .links a { background: #edf3f2; color: var(--pzd-accent); font-size: 13px; padding: 5px 8px; }
#layout .widget > .body { padding: 18px; line-height: 1.6; }
#layout aside .widget > .title { font-size: 16px; padding: 12px 14px; }
#layout #widget_pos_right-center .widget { border: 1px solid var(--pzd-edge); box-shadow: none; }
#layout .widget_content_list .details, #layout .widget_content_list .details a { font-size: 13px; line-height: 1.5; color: #586b70; }
#layout .widget_content_list.tiles-big { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 18px; }
#layout aside .widget_content_list.tiles-big { grid-template-columns: minmax(0, 1fr); }
#layout .widget_content_list.tiles-big > .item { width: auto !important; float: none; clear: none; margin: 0; min-width: 0; }
#layout .widget_content_list.tiles-big .item .image { height: 128px; margin-bottom: 9px; }
#layout .widget_content_list.tiles-big .item .title { font-size: 16px; line-height: 1.5; margin-top: 6px; }
#layout .widget_content_list.tiles-big .item .title a { color: var(--pzd-ink); }
/* Main-page introduction and team stay in their original DOM/tab order. */
#layout #widget_pos_left-bottom > #widget_wrapper_151.welcome { border: 1px solid var(--pzd-edge); background: #edf3f2; }
#layout #widget_wrapper_151 .body { padding: 14px 20px; }
#layout #widget_wrapper_151 .widget_html_block { font-size: 17px; line-height: 1.6; text-align: left; }
#layout #widget_wrapper_151 + .widget_tabbed .tabs ul { display: flex; flex-wrap: wrap; height: auto; min-height: 40px; line-height: 1.4; background: #edf3f2; }
#layout #widget_wrapper_151 + .widget_tabbed .tabs ul li { float: none; height: auto; line-height: 1.4; }
#layout #widget_wrapper_151 + .widget_tabbed .tabs ul li a { height: auto; line-height: 1.4; padding: 11px 12px; font-size: 13px; color: var(--pzd-ink); }
#layout #widget_wrapper_151 + .widget_tabbed .tabs ul li a.active { background: var(--pzd-accent); color: #fff; }
#layout #widget_wrapper_151 + .widget_tabbed .body { padding: 12px; }
#layout #widget_wrapper_151 + .widget_tabbed .widget_profiles_list.tiles { display: flex; flex-wrap: wrap; gap: 4px; }
#layout #widget_wrapper_151 + .widget_tabbed .widget_profiles_list.tiles .item { float: none; margin: 0; }
#layout #widget_wrapper_151 + .widget_tabbed .widget_profiles_list.tiles .image { float: none; margin: 0; }
#layout #widget_wrapper_151 + .widget_tabbed .widget_profiles_list.tiles .image a { display: block; padding: 2px; }
#layout #widget_wrapper_151 + .widget_tabbed .widget_profiles_list.tiles img { display: block; width: 40px; height: 40px; object-fit: cover; border-radius: 50%; }
#layout [id^="marquee_"] { max-width: 100%; min-width: 0; overflow: hidden; background: #eaf0ef !important; color: var(--pzd-accent); }
#layout [id^="marquee_"] a { color: var(--pzd-accent); font-weight: 400; }
#layout [id^="marquee_"]::before, #layout [id^="marquee_"]::after { background: #c6d9d9; }
/* Light footer with the original 88x120 LiveInternet informer. */
#layout footer {
    margin-top: 16px; padding: 18px 24px;
    background: #f4f7f6; color: #52676c;
    border-top: 1px solid #d7e1de; border-radius: 6px;
    font-size: 13px; line-height: 1.65;
}
#layout footer > ul {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    height: auto; gap: 12px 28px; margin: 0; padding: 0;
}
#layout footer li#copyright, #layout footer li#nav {
    float: none; padding: 0; margin: 0; border: 0;
}
#layout footer li#copyright { flex: 1 1 0; min-width: 0; }
#layout footer li#nav { display: block !important; flex: 1 1 0; min-width: 0; }
#layout footer li#info {
    display: block; flex: 0 0 88px; order: 0;
    margin: 0; padding: 0; border: 0;
}
#layout footer #info span.item { padding: 0; border: 0; }
#layout footer #info a { display: inline-flex; flex-direction: column; gap: 3px; }
#layout footer #info img { display: block; width: 88px; height: 120px; }
#layout footer .menu {
    display: flex; flex-wrap: wrap; justify-content: flex-end;
    height: auto; gap: 6px 18px; margin: 0; padding: 0;
}
#layout footer .menu > li {
    float: none; padding: 0; margin: 0; border: 0;
}
#layout footer a { color: #38616b; text-decoration: none; }
#layout footer .menu > li > a { display: inline-block; padding: 3px 0; }
#layout footer a:hover { color: #105671; text-decoration: underline; }
@media (max-width: 700px) {
    #layout footer { padding: 16px; }
    #layout footer li#copyright, #layout footer li#nav { flex-basis: 100%; }
    #layout footer .menu { justify-content: flex-start; }
}
#layout a:focus-visible, #layout button:focus-visible, #layout input:focus-visible, #layout select:focus-visible { outline: 3px solid #b95f2e; outline-offset: 3px; }
@media (max-width: 1100px) {
    #layout header .auth-wrapper { flex-basis: 190px; }
    #layout header .menu > li > a { font-size: 13px; padding: 7px 8px; }
    #layout .widget_content_list.tiles-big { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    #layout { width: calc(100% - 24px) !important; }
    #layout header.header-main { position: relative; flex-wrap: wrap; }
    #layout header .menu-wrapper { flex: 1 1 calc(100% - 100px); }
    #layout header .auth-wrapper { flex: 1 1 100%; padding: 0 12px 10px; }
    #layout header .auth-wrapper .menu { justify-content: flex-start; }
    #layout > nav .menu { display: flex; }
    #layout > nav .menu > li > a { padding: 11px 12px; font-size: 14px; }
    #layout > nav select { display: none; }
    #layout #body > section.section_full { flex: 1 1 100%; width: 100% !important; }
    #layout #body > aside.aside_wrap { flex: 1 1 100%; width: 100%; }
    #layout #body > aside.aside_wrap > .widget_ajax_wrap { max-width: 100%; }
}
@media (max-width: 600px) {
    #layout { width: 100% !important; }
    #layout header #logo { flex-basis: 82px; padding: 8px 12px; }
    #layout header #logo a, #layout header #logo > span { height: 54px; }
    #layout header .menu-wrapper { flex-basis: calc(100% - 82px); }
    #layout header .menu > li > a { font-size: 12px; padding: 6px 8px; }
    #layout > nav .menu > li.chat-button { margin-left: 0; }
    #layout > nav .menu ul { max-width: calc(100vw - 24px); }
    #layout > nav .menu .more > ul { left: auto; right: 0; }
    #layout > nav .menu ul ul { position: static; width: 100%; margin: 0; }
    #layout #body { gap: 12px; }
    #layout #body section article { padding: 22px 16px; }
    #layout .content_item .ft_html .value, #layout .content_item .ft_text .value { font-size: 18px; }
    #layout .widget > .title, #layout .widget > .body { padding: 12px 14px; }
    #layout .widget_content_list.tiles-big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
    #layout .widget_content_list.tiles-big .item .image { height: 118px; }
    #layout .widget_content_list.tiles-big .item .title { font-size: 15px; }
    #layout #user_profile #left_column { float: none; width: 100%; }
    #layout #user_profile #right_column { margin-left: 0; }
    #layout .modal_padding { min-width: 0; }
}

/* Flex layout needs no legacy clearfix item or trailing widget margins. */
#layout #body::after { display: none; }
#layout #widget_pos_left-bottom > .widget:last-child,
#layout .widget_ajax_wrap_footer > .widget:last-child { margin-bottom: 0; }
/* Local LitRes banner: readable link without a remote image dependency. */
#layout #body .widget:has(> .body.pzd-litres-banner) { background: #fff; border: 1px solid var(--pzd-edge); }
#layout #body .widget > .body.pzd-litres-banner { padding: 0; }
#layout .pzd-litres-link {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 8px 24px; padding: 18px 24px; color: var(--pzd-ink); text-decoration: none;
}
#layout .pzd-litres-link strong { font-size: 24px; color: #d44b29; }
#layout .pzd-litres-link .pzd-litres-cta { color: var(--pzd-accent); text-decoration: underline; }
#layout .pzd-litres-link:hover { background: #f0f4f3; }
#layout .pzd-litres-link:focus-visible { outline: 2px solid var(--pzd-accent); outline-offset: -3px; }

/* Editorial header links, scoped away from account and dropdown menus. */
#layout header .menu-wrapper .menu { justify-content: center; gap: 4px 12px; padding: 0 12px; }
#layout header .menu-wrapper .menu > li > a {
    position: relative; font-size: 17px; line-height: 1.5;
    padding: 12px 8px; white-space: nowrap; background: transparent;
}
#layout header .menu-wrapper .menu > li > a::after {
    content: ""; position: absolute; left: 8px; right: 8px; bottom: 5px;
    height: 2px; background: var(--pzd-accent); transform: scaleX(0);
    transition: transform .15s ease;
}
#layout header .menu-wrapper .menu > li > a:hover,
#layout header .menu-wrapper .menu > li > a:focus-visible { color: var(--pzd-accent); background: transparent; }
#layout header .menu-wrapper .menu > li > a:hover::after,
#layout header .menu-wrapper .menu > li > a:focus-visible::after { transform: scaleX(1); }
@media (min-width: 981px) and (max-width: 1100px) {
    #layout header .menu-wrapper .menu { column-gap: 4px; padding: 0 6px; }
    #layout header .menu-wrapper .menu > li > a { font-size: 16px; }
}
@media (max-width: 600px) {
    #layout header .menu-wrapper .menu { gap: 0 4px; padding: 4px 6px; }
    #layout header .menu-wrapper .menu > li > a { font-size: 15px; padding: 8px 6px; }
    #layout header .menu-wrapper .menu > li > a::after { left: 6px; right: 6px; bottom: 3px; }
}
@media (prefers-reduced-motion: reduce) {
    #layout header .menu-wrapper .menu > li > a::after { transition: none; }
}

/* Guest sign-in links share one aligned column; account dropdowns are untouched. */
#layout header .auth-wrapper > .menu-header {
    display: grid; grid-template-columns: max-content;
    justify-content: end; gap: 0; padding: 0;
}
#layout header .auth-wrapper > .menu-header > li { width: 100%; text-align: left; }
#layout header .auth-wrapper > .menu-header > li > a {
    display: block; box-sizing: border-box; width: 100%; text-align: left;
    padding: 8px 10px 8px 28px; background-position: 5px center;
}
@media (max-width: 980px) {
    #layout header .auth-wrapper > .menu-header {
        grid-template-columns: repeat(2, max-content); justify-content: start; column-gap: 12px;
    }
}

/* Compact workshop navigation on a solid surface instead of large framed tiles. */
#layout #body .widget.master_class { background: #fff; border: 1px solid var(--pzd-edge); }
#layout #body .widget.master_class > .body { padding: 10px; }
#layout .master_class .widget_content_tree > ul {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
    margin: 0; padding: 0;
}
#layout .master_class .widget_content_tree > ul > li {
    width: auto; margin: 0; padding: 0; border: 0; border-radius: 4px;
    background: #edf3f2; color: var(--pzd-ink); text-align: center;
}
#layout .master_class .widget_content_tree > ul > li > a {
    display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; min-height: 56px;
    padding: 10px 14px; font-size: 15px; line-height: 1.4;
    color: var(--pzd-accent); text-decoration: none; background: transparent;
}
#layout .master_class .widget_content_tree > ul > li > a:hover,
#layout .master_class .widget_content_tree > ul > li > a:focus-visible {
    background: #dce9e7; color: #083e53; text-decoration: underline;
}
@media (max-width: 980px) {
    #layout .master_class .widget_content_tree > ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    #layout .master_class .widget_content_tree > ul { grid-template-columns: 1fr; gap: 6px; }
    #layout .master_class .widget_content_tree > ul > li > a { min-height: 44px; padding: 10px 12px; }
}

/* Quiet literary illustration, served locally; keep navigation text on a light surface. */
#layout header.header-main {
    background-color: #fff;
    background-image: linear-gradient(90deg, rgb(255 255 255 / 48%), rgb(255 255 255 / 12%) 24%, rgb(255 255 255 / 12%) 72%, rgb(255 255 255 / 48%)), url('../images/pzd-writing-header-v3.webp');
    background-size: cover;
    background-position: center 52%;
    background-repeat: no-repeat;
}
@media (max-width: 980px) {
    #layout header.header-main { background-size: auto 310px; background-position: center; }
}

/* Preserve the original logo artwork: white blends into the illustrated header. */
#layout header.header-main { isolation: isolate; }
#layout header #logo { padding: 0; align-self: stretch; }
#layout header #logo a, #layout header #logo > span {
    height: 84px; background-position: center; mix-blend-mode: multiply;
}
@media (max-width: 600px) {
    #layout header #logo { flex-basis: 90px; padding: 0; }
    #layout header .menu-wrapper { flex-basis: calc(100% - 90px); }
}

/* Session notices occupy a full row above the content and sidebar. */
#layout #body > .sess_messages {
    flex: 0 0 100%; min-width: 0; max-width: 100%; margin-bottom: 0;
    overflow-wrap: anywhere;
}

/* Keep the message composer inside the modal instead of clipping its send button. */
#pm_window.modal-messages > .layout { height: min(700px, calc(100dvh - 100px)); }
#pm_window.modal-messages #pm_contact { display: flex; flex-direction: column; }
#pm_window.modal-messages #pm_contact > .overview { flex: 0 0 50px; }
#pm_window.modal-messages #pm_contact > .chat { flex: 1 1 0; height: auto; min-height: 0; }
#pm_window.modal-messages #pm_contact > .composer {
    flex: 0 0 auto; height: min(240px, 45dvh); min-height: 0;
}
#pm_window.modal-messages .composer form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#pm_window.modal-messages .composer .editor { flex: 1 1 0; min-height: 0; overflow: auto; }
#pm_window.modal-messages .composer .buttons { flex: 0 0 auto; }

/* Match message content width to the modal limits on tablet and phone screens. */
#pm_window.modal-messages { width: min(960px, calc(90vw - 100px)); max-width: 100%; }
@media (max-width: 640px) {
    #pm_window.modal-messages { width: calc(100vw - 48px); }
}

/* Keep formatting tools visible while scrolling a long message draft. */
#pm_window.modal-messages .composer .redactor_toolbar {
    position: sticky; top: 0; z-index: 4; background: #fff;
}
