/*
Theme Name: Mattey Magazine
Version: 0.7.0
Requires PHP: 7.4
Text Domain: mattey-magazine
*/
* { box-sizing: border-box; }
:root { font-family: Roboto, Arial, sans-serif; color: #080808; background: #fff; }
body { margin: 0; }
a { color: inherit; }
a:focus-visible { outline: 2px solid #007a9a; outline-offset: 4px; }
header { background: #050505; color: #fff; box-shadow: 0 4px 18px #0001; }
.bar, main { width: min(1500px, calc(100% - 64px)); margin: auto; }
.bar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 12px; }
.brand { font-family: Georgia, serif; font-size: clamp(20px, 2.3vw, 35px); font-weight: bold; letter-spacing: -.06em; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: clamp(14px, 3vw, 44px); }
nav a { font-weight: bold; text-decoration: none; padding-block: 8px; }
nav a:hover, nav a[aria-current] { border-bottom: 2px solid #00afb9; }
main { padding-block: 42px 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 2vw, 38px); }
.card { background: #f2f2f2; }
.picture { position: relative; display: block; aspect-ratio: 1; background: #e9e9e9; }
img { display: block; width: 100%; }
.picture img { height: 100%; object-fit: cover; }
.stamp { position: absolute; right: 12px; top: 13px; min-width: 50px; padding: 8px; background: white; text-align: center; font-weight: 700; font-size: 14px; }
.stamp b { display: block; font-size: 26px; margin-block: 6px; }
.stamp b::before, .stamp b::after { content: ""; display: block; width: 18px; height: 2px; background: #1974aa; margin-inline: auto; }
.copy { padding: clamp(17px, 2vw, 38px); }
.copy h2 { margin: 0 0 10px; font-size: clamp(20px, 1.5vw, 29px); line-height: 1.32; letter-spacing: .01em; }
.copy a { text-decoration: none; }
.copy a:hover { text-decoration: underline; }
.copy time { font-size: .95rem; }
.copy p { font-size: clamp(16px, 1vw, 19px); line-height: 1.34; margin: 24px 0 18px; }
.more { font-weight: 700; }
.story { max-width: 850px; margin: auto; }
.story time { display: block; margin: 18px 0 8px; }
.story h1 { font-size: clamp(30px, 5vw, 56px); line-height: 1.12; margin: 0 0 24px; }
.story > img { max-height: 600px; object-fit: contain; background: #f2f2f2; }
.body { font: 1.16rem/1.7 Georgia, serif; margin: 28px auto; max-width: 720px; }
.covers, .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 20px; }
.covers img { height: 280px; object-fit: contain; background: #f2f2f2; }
.gallery img { height: 190px; object-fit: cover; }
footer { padding: 24px; text-align: center; border-top: 1px solid #dedede; }
@media (max-width: 1050px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .bar, main { width: calc(100% - 32px); } }
.home header { position: absolute; inset: 0 0 auto; z-index: 2; background: rgb(0 0 0 / 64%); }
.home .bar { min-height: 110px; }
.slider { position: relative; height: clamp(420px, 49vw, 950px); background: #191919; }
.slide { display: block; height: 100%; }
.slide[hidden], .slider-controls[hidden] { display: none; }
.slide img { height: 100%; object-fit: cover; color: white; }
.slide:focus-visible { outline-offset: -5px; }
.slider-controls { position: absolute; inset: 50% clamp(12px, 2vw, 42px) auto; display: flex; justify-content: space-between; transform: translateY(-50%); pointer-events: none; }
.slider-controls button { pointer-events: auto; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 70%); color: white; font: bold 36px/1 Arial, sans-serif; cursor: pointer; }
.slider-controls button:hover { background: #000; }
@media (max-width: 560px) { .home .bar { min-height: 0; gap: 8px; } }
.mobile-menu { display: none; }
@media (max-width: 760px) {
    .desktop-nav { display: none; }
    .mobile-menu { display: block; margin-left: auto; }
    .mobile-menu summary { cursor: pointer; padding: 12px 4px; font-weight: bold; }
    .bar { position: relative; min-height: 64px; gap: 8px; }
    .mobile-menu nav { position: absolute; top: 100%; inset-inline: 0; z-index: 3; display: grid; gap: 0; padding: 8px 16px; background: #050505; }
    .mobile-menu nav a { padding-block: 12px; }
    .home header { position: relative; background: #050505; }
    .home .bar { min-height: 64px; }
    .slider { height: clamp(240px, 58vw, 420px); }
    .slide img { object-position: center; }
    main { padding-top: 24px; }
}
@media (max-width: 360px) {
    .brand { font-size: 17px; }
}
.slider-toggle { position: absolute; bottom: 14px; right: 16px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 4px; color: white; background: #000c; cursor: pointer; font: inherit; }
.bar { position: relative; }
.edition-menu summary { cursor: pointer; font-weight: bold; padding-block: 8px; white-space: nowrap; }
.edition-panel { position: absolute; top: 100%; right: 0; z-index: 4; color: #232323; background: white; width: min(100%, 980px); padding: clamp(14px, 3vw, 36px); box-shadow: 0 8px 24px #0004; max-height: 65vh; overflow: auto; }
.edition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.edition-grid a { display: flex; align-items: center; gap: 10px; text-transform: uppercase; line-height: 1.3; }
.edition-grid img { flex: none; width: 62px; height: 62px; object-fit: cover; }
.edition-panel > a { display: inline-block; margin: 14px 20px 0 0; text-decoration: underline; }
@media (max-width: 760px) {
    .edition-panel { position: static; width: 100%; }
    .edition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .edition-grid a { font-size: .85rem; }
}
@media (max-width: 470px) { .edition-grid { grid-template-columns: 1fr; } }
.site-footer { background: #181a1d; color: #f5f5f5; text-align: left; border: 0; }
.footer-inner { max-width: 1500px; margin-inline: auto; display: flex; gap: 12px 28px; align-items: center; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-brand { font-weight: 700; text-decoration: none; }
.bar nav ul { margin: 0; padding: 0; list-style: none; }
.desktop-nav > ul { display: flex; flex-wrap: wrap; gap: 24px; }
.bar nav li { position: relative; }
.desktop-nav .sub-menu { display: none; position: absolute; z-index: 5; top: 100%; min-width: 210px; background: #080808; padding: 12px; }
.desktop-nav li:hover > .sub-menu, .desktop-nav li:focus-within > .sub-menu { display: block; }
.mobile-menu .sub-menu { padding-left: 16px; }
.custom-logo { width: auto; max-width: min(60vw, 360px); height: auto; max-height: 75px; object-fit: contain; }
.page-numbers { display: inline-block; padding: 12px; }
/* WordPress homepage and editorial cards */
body.home > header { position: relative; }
body.home:has(.slider) > header { position: absolute; }
body.admin-bar.home:has(.slider) > header { top: 32px; }
.slider { height: clamp(390px, 49vw, 850px); }
.slide::after { content: ""; position: absolute; inset: auto 0 0; height: 48%; background: linear-gradient(transparent, #000c); pointer-events: none; }
.slide-title { position: absolute; z-index: 1; bottom: 10%; left: max(8%, calc((100% - 1420px) / 2)); right: 10%; color: white; font-size: clamp(22px, 4vw, 58px); font-weight: 800; line-height: 1.08; }
.slider-controls, .slider-toggle { z-index: 2; }
.slider-toggle { color: white; background: #111; border: 0; border-radius: 4px; padding: 9px 14px; min-height: 44px; }
.grid > .card { display: flex; flex-direction: column; min-width: 0; }
.card .copy { flex: 1; display: flex; flex-direction: column; }
.card .more { margin-top: auto; align-self: flex-start; }
@media (max-width: 760px) {
    body.home:has(.slider) > header { position: relative; }
    body.admin-bar.home:has(.slider) > header { top: auto; }
    .slider { height: clamp(260px, 62vw, 460px); }
    .slide-title { bottom: 22%; }
}

.load-more-row { text-align: center; margin: 48px 0 24px; }
#mattey-load-more { display: inline-block; min-width: min(100%, 220px); padding: 16px 24px; border: 1px solid #ccc; font-weight: 700; text-decoration: none; }
#mattey-load-more:hover { background: #f2f2f2; }

.site-footer .footer-inner { justify-content: center; text-align: center; }
.footer-content { width: 100%; overflow-wrap: anywhere; }
.footer-content p { margin: 0 0 .5em; }
.footer-content p:last-child { margin-bottom: 0; }
.slide-image-only::after { display: none; }

/* Fade between slides while the outgoing image stays underneath. */
.slider { overflow: hidden; }
.slider > .slide { position: absolute; inset: 0; overflow: hidden; }
.slider > .slide-incoming { z-index: 1; }
.slider > .slide img { transform-origin: center; }
.slider > .slider-controls, .slider > .slider-toggle { z-index: 3; }

.slide-heading { display: block; }
.slide-caption { display: block; white-space: pre-line; font-size: clamp(16px, 1.5vw, 24px); line-height: 1.45; font-weight: 400; max-width: 65ch; }
.slide-heading + .slide-caption { margin-top: .65em; }

.news-banner { width: 100%; background: #191919; }
.news-banner img { width: 100%; height: clamp(220px, 30vw, 510px); object-fit: cover; object-position: center; }
.news-main { max-width: 1100px; }
.news-heading { color: #080808; background: transparent; box-shadow: none; max-width: 820px; margin: 0 auto; }
.news-heading h1 { font-size: clamp(30px, 4vw, 54px); line-height: 1.12; margin: 12px 0 24px; }
.news-heading time { color: #626262; }
.news-content { max-width: 820px; overflow-wrap: anywhere; }
.news-content img { max-width: 100%; height: auto; }
.news-content .alignwide { width: auto; max-width: none; margin-inline: -60px; }
.news-content .wp-block-embed iframe { max-width: 100%; }
@media (max-width: 1000px) { .news-content .alignwide { margin-inline: 0; } }

.home-intro { margin-bottom: clamp(36px, 5vw, 72px); overflow-wrap: anywhere; }
.home-intro > .wp-block-image img { width: 100%; height: auto; }
.home-intro h2 { font-size: clamp(26px, 3vw, 44px); margin-top: 28px; }
.home-intro p { line-height: 1.6; }
.home-intro iframe, .home-intro img { max-width: 100%; }
.home-intro .wp-block-column { min-width: 0; overflow: auto; }

.home-bottom { margin-top: 42px; }
.home-bottom img { width: 100%; height: auto; }
.home-bottom .wp-block-image { margin: 0; }

.site-header .bar { display: grid; grid-template-columns: minmax(220px, 360px) 1fr auto; flex-wrap: nowrap; min-height: 90px; gap: 24px; }
.site-header .custom-logo { max-width: 100%; max-height: 86px; width: auto; }
.site-header .desktop-nav { justify-content: center; }
.site-header .desktop-nav > ul { align-items: center; justify-content: center; gap: clamp(18px, 2.4vw, 44px); }
.site-header nav a { display: inline-block; font-size: 18px; line-height: 1.3; }
.site-header .current-menu-item > a, .site-header .current-menu-ancestor > a { border-bottom: 2px solid #00a9b2; }
.header-tools, .social-links { display: flex; align-items: center; gap: 15px; }
.social-links a { color: #bbb; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 44px; font-weight: 700; }
.social-links a:hover { color: white; }
.header-search summary { cursor: pointer; list-style: none; padding: 12px 4px; }
.header-search summary::-webkit-details-marker { display: none; }
.search-panel { position: absolute; right: 0; top: 100%; background: #111; padding: 20px; z-index: 6; width: min(100%, 380px); }
.search-panel input[type="search"] { width: 100%; padding: 10px; }
.search-panel input[type="submit"] { margin-top: 10px; padding: 8px 14px; }
.hamburger { display: block; width: 28px; height: 20px; border-block: 2px solid white; position: relative; }
.hamburger::after { content: ""; position: absolute; inset: 7px 0 auto; border-top: 2px solid white; }
@media (max-width: 1100px) {
    .site-header .bar { grid-template-columns: minmax(0, 1fr) auto auto; min-height: 76px; }
    .site-header .desktop-nav { display: none; }
    .site-header .mobile-menu { display: block; margin: 0; }
    .site-header .mobile-menu summary { list-style: none; padding: 12px 0 12px 12px; }
    .site-header .mobile-menu summary::-webkit-details-marker { display: none; }
    .site-header .mobile-menu nav { position: absolute; inset: 100% 0 auto; z-index: 6; display: block; padding: 18px; background: #080808; max-height: 70vh; overflow: auto; }
    .site-header .mobile-menu nav ul { display: block; }
    .site-header .mobile-menu nav li a { padding: 12px 0; }
    .site-header .mobile-menu .social-links { display: flex; }
    .header-tools > .social-links { display: none; }
    .site-header .custom-logo { max-width: min(65vw, 360px); }
}

/* Keep navigation visible, including when the WordPress admin bar is present. */
body > .site-header,
body.home > .site-header,
body.home:has(.slider) > .site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #050505;
}
body.admin-bar > .site-header,
body.admin-bar.home:has(.slider) > .site-header {
    top: 32px;
}
html { scroll-padding-top: 110px; }
@media (max-width: 782px) {
    body.admin-bar > .site-header,
    body.admin-bar.home:has(.slider) > .site-header { top: 46px; }
}
@media (max-width: 600px) {
    body.admin-bar > .site-header,
    body.admin-bar.home:has(.slider) > .site-header { top: 0; }
}

body > .site-header,
body.home > .site-header,
body.home:has(.slider) > .site-header {
    background: rgba(0, 0, 0, .68);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
/* Place the first slide behind the translucent header on the homepage. */
body.home > .site-header + .slider { margin-top: -110px; }
body.home > .site-header .bar { min-height: 110px; }
@media (max-width: 1100px) {
    body.home > .site-header + .slider { margin-top: -76px; }
    body.home > .site-header .bar { min-height: 76px; }
}

/* The header keeps a stable layout while its painted bar becomes shorter. */
body > .site-header,
body.home > .site-header,
body.home:has(.slider) > .site-header {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    isolation: isolate;
}
.site-header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 100%;
    background: #050505;
    z-index: -1;
    transition: height .3s ease, background-color .3s ease;
}
body.home:has(.slider) > .site-header::before { background: rgba(0, 0, 0, .48); }
body > .site-header.is-scrolled::before { height: 76px; background: #050505; }
.site-header .bar,
body.home > .site-header .bar { height: 110px; min-height: 110px; padding-block: 0; align-items: start; }
.site-header .custom-logo-link { margin-top: 10px; transition: margin-top .3s ease; }
.site-header .custom-logo { max-height: 90px; }
.site-header .desktop-nav,
.site-header .header-tools,
.site-header .mobile-menu { align-self: start; margin-top: 32px; transition: margin-top .3s ease; }
.site-header.is-scrolled .desktop-nav,
.site-header.is-scrolled .header-tools,
.site-header.is-scrolled .mobile-menu { margin-top: 15px; }
.site-header .brand { align-self: start; margin-top: 30px; }
@media (max-width: 1100px) {
    .site-header .bar,
    body.home > .site-header .bar { height: 90px; min-height: 90px; }
    body.home > .site-header + .slider { margin-top: -90px; }
    .site-header .custom-logo { max-height: 76px; }
    .site-header .header-tools,
    .site-header .mobile-menu { margin-top: 17px; }
    body > .site-header.is-scrolled::before { height: 68px; }
    .site-header.is-scrolled .header-tools,
    .site-header.is-scrolled .mobile-menu { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .site-header::before, .site-header .custom-logo-link,
    .site-header .desktop-nav, .site-header .header-tools,
    .site-header .mobile-menu { transition: none; }
}

/* Article layout and native WordPress blocks. */
.news-banner img { height: clamp(230px, 30vw, 520px); }
.news-main { padding-block: clamp(28px, 4vw, 60px); }
.news-heading { border-bottom: 1px solid #dedede; padding-bottom: 20px; }
.news-heading h1 { font-size: clamp(30px, 3.4vw, 56px); letter-spacing: -.025em; line-height: 1.15; margin-bottom: 0; }
.news-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; color: #626262; font-size: 14px; }
.news-content { font: clamp(18px, 1.25vw, 21px)/1.8 Georgia, serif; color: #252525; margin-block: 32px 0; }
.news-content .news-lead { font-size: clamp(21px, 1.7vw, 26px); line-height: 1.6; color: #111; }
.news-content h2, .news-content h3 { font-family: Arial, sans-serif; line-height: 1.25; color: #111; margin-top: 1.6em; }
.news-content h2 { font-size: clamp(25px, 2.1vw, 34px); }
.news-content a { color: #007b89; text-underline-offset: 3px; }
.news-content figure { margin-block: 30px; }
.news-content figcaption { font: 14px/1.5 Arial, sans-serif; color: #626262; text-align: center; }
.news-content blockquote { border-left: 3px solid #009ca6; padding-left: 24px; margin-inline: 0; font-style: italic; }
.news-content .wp-block-gallery { gap: 12px; }
.news-content .wp-block-embed.is-type-video .wp-block-embed__wrapper { position: relative; aspect-ratio: 16 / 9; }
.news-content .wp-block-embed.is-type-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.news-content .wp-block-embed__wrapper::before { display: none; }

.article-neighbors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding-block: 30px; margin-top: 50px; border-block: 1px solid #dedede; }
.article-neighbors a, .related-grid a { display: flex; align-items: start; gap: 18px; text-decoration: none; }
.article-neighbors img { width: 90px; height: 90px; object-fit: cover; flex: none; }
.article-neighbors small { display: block; color: #666; margin-bottom: 8px; text-transform: uppercase; }
.article-neighbors strong { font-size: 19px; line-height: 1.4; }
.article-related { margin-top: 44px; }
.article-related h2 { font-size: 30px; margin-bottom: 28px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; }
.related-grid img { width: 100px; height: 85px; object-fit: cover; flex: none; }
.related-grid .related-title { display: block; font-size: 16px; line-height: 1.5; }
.related-grid time { display: block; margin-top: 10px; color: #666; font-size: 13px; }
.article-neighbors a:hover strong, .related-grid a:hover .related-title { text-decoration: underline; }
@media (max-width: 950px) { .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .article-neighbors, .related-grid { grid-template-columns: 1fr; } }

.wp-block-gallery.is-style-mattey-masonry.has-nested-images {
    display: block;
    columns: 3;
    column-gap: 12px;
}
.wp-block-gallery.is-style-mattey-masonry.has-nested-images figure.wp-block-image {
    display: block;
    width: 100% !important;
    margin: 0 0 12px !important;
    break-inside: avoid;
}
.wp-block-gallery.is-style-mattey-masonry.has-nested-images figure.wp-block-image img {
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: auto;
    object-fit: contain;
}
@media (max-width: 780px) {
    .wp-block-gallery.is-style-mattey-masonry.has-nested-images { columns: 2; }
}
@media (max-width: 480px) {
    .wp-block-gallery.is-style-mattey-masonry.has-nested-images { columns: 1; }
}

.gallery-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.mattey-lightbox { width: min(96vw, 1600px); max-width: 96vw; max-height: 96vh; padding: 48px 52px 20px; border: 0; background: #111; color: white; }
.mattey-lightbox::backdrop { background: #000d; }
.mattey-lightbox figure { margin: 0; text-align: center; }
.mattey-lightbox img { width: auto; max-width: 100%; height: auto; max-height: 78vh; object-fit: contain; margin: auto; }
.mattey-lightbox figcaption { margin-top: 12px; font: 14px/1.5 Arial, sans-serif; }
.mattey-lightbox > button { position: absolute; background: #222; color: white; border: 0; min-width: 44px; min-height: 44px; cursor: pointer; font: 32px/1 Arial, sans-serif; }
.lightbox-close { top: 0; right: 0; }
.lightbox-prev { left: 0; top: 45%; }
.lightbox-next { right: 0; top: 45%; }
@media (max-width: 600px) { .mattey-lightbox { padding-inline: 44px; } }

/* Frame follows the photograph, with navigation over the image. */
.mattey-lightbox {
    width: fit-content;
    max-width: 96vw;
    max-height: 96vh;
    padding: 0;
    background: transparent;
    color: #eee;
    overflow: auto;
}
.mattey-lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.lightbox-photo { position: relative; width: fit-content; margin: auto; }
.mattey-lightbox .lightbox-photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 94vw;
    max-height: 84vh;
    max-height: 84dvh;
    border: 4px solid white;
    border-radius: 3px;
}
.lightbox-photo button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    min-width: 48px;
    min-height: 64px;
    border: 0;
    border-radius: 4px;
    background: rgba(0, 0, 0, .2);
    color: white;
    font: 54px/1 Arial, sans-serif;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease;
    text-shadow: 0 1px 4px #000;
}
.lightbox-photo .lightbox-prev { left: 8px; }
.lightbox-photo .lightbox-next { right: 8px; }
.lightbox-photo:hover button { opacity: .85; }
.lightbox-photo button:hover, .lightbox-photo button:focus-visible { opacity: 1; }
.lightbox-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px; }
.lightbox-counter { padding-left: 4px; font: 14px/1.5 Arial, sans-serif; }
.lightbox-bottom .lightbox-close { position: static; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: #ddd; font: 42px/1 Arial, sans-serif; cursor: pointer; }
@media (hover: none) and (pointer: coarse) { .lightbox-photo button { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .lightbox-photo button { transition: none; } }

.mattey-lightbox {
    max-height: none;
    max-width: calc(100vw - 24px);
    overflow: visible;
    margin: auto;
}
.mattey-lightbox .lightbox-photo img {
    box-sizing: content-box;
    max-width: none;
    max-height: none;
}
.lightbox-photo button:focus:not(:focus-visible) { outline: none; }

.mattey-menu-thumb { flex: none; width: 62px; height: 62px; object-fit: cover; }
.site-header nav .sub-menu a { display: flex; align-items: center; gap: 10px; }
.site-header .desktop-nav > ul > .mattey-mega { position: static; }
.site-header .desktop-nav .mattey-mega > .sub-menu {
    right: 0; left: auto; top: 100%;
    width: min(100%, 1000px); max-height: min(75vh, 850px);
    overflow: auto; background: #fff; color: #343434;
    padding: 28px; box-shadow: 0 5px 18px #0003;
    grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px;
}
.site-header .desktop-nav .mattey-mega:hover > .sub-menu,
.site-header .desktop-nav .mattey-mega:focus-within > .sub-menu { display: grid; }
.site-header .desktop-nav .mattey-mega > .sub-menu > li > a {
    font-size: 16px; line-height: 1.4; text-transform: uppercase;
    border: 0; padding: 6px 0; min-height: 74px;
}
.site-header .desktop-nav .mattey-mega > .sub-menu > li > a:hover { color: #007d89; }
.site-header .mobile-menu .mattey-menu-thumb { width: 48px; height: 48px; }
.site-header .mobile-menu .sub-menu { padding-left: 12px; }

.catalog-main { max-width: 1250px; }
.catalog-main > h1 { font-size: clamp(30px, 4vw, 52px); line-height: 1.15; margin: 0 0 32px; }
.catalog-content { font: 18px/1.6 Arial, sans-serif; overflow-wrap: anywhere; }
.catalog-content > .wp-block-image img { display: block; width: 100%; height: auto; }
.catalog-content > .wp-block-image { margin: 36px 0; }
.catalog-content iframe { max-width: 100%; }

/* Reset cropped-gallery flex rules before laying out linked Masonry images. */
.wp-block-gallery.is-style-mattey-masonry.has-nested-images {
    display: block !important;
    height: auto !important;
    align-items: initial;
}
.wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image {
    display: inline-block !important;
    vertical-align: top;
    height: auto !important;
    min-height: 0 !important;
    max-height: none;
    aspect-ratio: auto !important;
    flex: none !important;
    overflow: hidden;
    position: relative;
}
.wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image > a,
.wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image > button {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    flex: none !important;
    aspect-ratio: auto !important;
}
.wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image img {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
}

/* Explicit item spans avoid column fragmentation and lazy-image placeholder gaps. */
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images {
    display: grid !important;
    columns: auto !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1px;
    gap: 12px;
    align-items: start;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    grid-row-end: span 20;
}
.news-content .wp-block-gallery.is-style-mattey-masonry img {
    content-visibility: visible !important;
    contain-intrinsic-size: none !important;
}
@media (max-width: 780px) {
    .news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images { grid-template-columns: minmax(0, 1fr); }
}

/* Uniform thumbnails keep extensive converted galleries in normal document flow. */
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images {
    display: grid !important;
    columns: auto !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: auto !important;
    gap: 12px !important;
    height: auto !important;
    align-items: start;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image {
    display: block !important;
    grid-row: auto !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    overflow: hidden;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image > a,
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image > button {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 2 !important;
    overflow: hidden;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images > figure.wp-block-image img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 2 !important;
    object-fit: cover !important;
    content-visibility: visible !important;
    contain-intrinsic-size: none !important;
}
@media (max-width: 780px) {
    .news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images { grid-template-columns: minmax(0, 1fr); }
}

/* Natural-proportion Masonry, enhanced after measuring each photograph. */
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images.mattey-masonry-ready {
    position: relative;
    display: block !important;
    columns: auto !important;
    height: var(--mattey-gallery-height) !important;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images.mattey-masonry-ready > figure.wp-block-image {
    position: absolute !important;
    top: var(--mattey-item-top);
    left: var(--mattey-item-left);
    width: var(--mattey-item-width) !important;
    height: auto !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    overflow: visible;
}
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images.mattey-masonry-ready > figure.wp-block-image > a,
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images.mattey-masonry-ready > figure.wp-block-image > button,
.news-content .wp-block-gallery.is-style-mattey-masonry.has-nested-images.mattey-masonry-ready > figure.wp-block-image img {
    aspect-ratio: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Mattey Group portfolio */
.mattey-group-main { width: min(1500px, calc(100% - 40px)); padding-block: 48px; }
.mattey-group-content { max-width: none; width: 100%; margin: 0; }
.is-style-mattey-section { display: flex; align-items: center; gap: 32px; text-align: center; color: #797d82; font: 700 clamp(24px, 3vw, 44px)/1.2 Arial, sans-serif; margin: 64px 0 40px; }
.is-style-mattey-section::before, .is-style-mattey-section::after { content: ""; height: 1px; background: #20bfd2; flex: 1; }
.wp-block-gallery.is-style-mattey-covers, .wp-block-gallery.is-style-mattey-books { display: grid !important; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 12px !important; }
.wp-block-gallery.is-style-mattey-covers > figure.wp-block-image, .wp-block-gallery.is-style-mattey-books > figure.wp-block-image { width: 100% !important; margin: 0 !important; }
.wp-block-gallery.is-style-mattey-covers > figure img { width: 100% !important; height: auto !important; aspect-ratio: 1; object-fit: contain !important; }
.wp-block-gallery.is-style-mattey-books > figure img { width: 100% !important; height: auto !important; aspect-ratio: 2/3; object-fit: contain !important; }
.wp-block-gallery.is-style-mattey-strip { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px !important; padding-bottom: 14px; }
.wp-block-gallery.is-style-mattey-strip > figure.wp-block-image { flex: 0 0 calc((100% - 60px)/6) !important; width: auto !important; margin: 0 !important; scroll-snap-align: start; }
.wp-block-gallery.is-style-mattey-strip > figure img { width: 100% !important; height: auto !important; aspect-ratio: 1; object-fit: cover !important; }
@media(max-width:1100px) { .wp-block-gallery.is-style-mattey-covers, .wp-block-gallery.is-style-mattey-books { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media(max-width:780px) { .wp-block-gallery.is-style-mattey-covers, .wp-block-gallery.is-style-mattey-books { grid-template-columns: repeat(2,minmax(0,1fr)); } .wp-block-gallery.is-style-mattey-strip > figure.wp-block-image { flex-basis: 70% !important; } .is-style-mattey-section { gap: 14px; } }

.mattey-group-content h2.is-style-mattey-section { color: #797d82; font-size: clamp(24px,3vw,44px); margin: 64px 0 40px; }
.mattey-group-content .alignwide { margin-inline: 0; }
