:root {
    --nrm-color-bg: var(--wp--preset--color--base, #2c3e50);
    --nrm-color-accent: var(--wp--preset--color--contrast, #ffffff);
    --nrm-color-accent-hover: var(--wp--preset--color--hover, rgba(255,255,255,0.6));
    --nrm-color-primary: var(--wp--preset--color--contrast, #ffffff);
    --nrm-color-text: var(--wp--preset--color--contrast, #ffffff);
    --nrm-color-text-muted: rgba(255,255,255,0.9);
    --nrm-color-border: var(--wp--preset--color--contrast, #ffffff);
    --nrm-color-surface: var(--wp--preset--color--surface, #1e3244);
    --nrm-color-header-border: var(--wp--preset--color--contrast, #ffffff);
    --nrm-page-bg: var(--wp--preset--color--base, #2c3e50);
    --nrm-content-width: 720px;
    --nrm-font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --nrm-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --nrm-font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    --nrm-lh-tight: 1.25;
    --nrm-lh-normal: 1.6;
    --nrm-radius: 6px;
    --nrm-radius-lg: 12px;
    --nrm-space-xs: 0.25rem;
    --nrm-space-sm: 0.5rem;
    --nrm-space-md: 1rem;
    --nrm-space-lg: 1.5rem;
    --nrm-space-xl: 2rem;
    --nrm-space-3xl: 4rem;
    --nrm-transition: 0.2s ease;
    --nrm-heading-weight: 400;
}

* { box-sizing: border-box; }
/* Gutter holds width when the menu sets overflow:hidden on html.
   html bg is the page color so the reserved lane is not a hole. */
html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    background: var(--nrm-page-bg, var(--wp--preset--color--base));
}
html:has(.wp-block-navigation__responsive-container.is-menu-open) { background: color-mix(in srgb, var(--nrm-page-bg, var(--wp--preset--color--base)) 40%, #000); }
body {
    margin: 0;
    font-family: var(--nrm-font-body);
    /* mono body size, else the settings base size */
    font-size: var(--nrm-font-size-body, var(--wp--preset--font-size--medium));
    line-height: var(--nrm-lh-normal);
    color: var(--nrm-color-text);
    background: var(--nrm-page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Same color as type: line at rest is the a11y signal. Quiet, then full on hover.
   Nav, titles, headings already drop the line. */
a {
    color: var(--nrm-color-accent);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    transition: color var(--nrm-transition), text-decoration-color var(--nrm-transition);
}
a:hover,
a:active {
    color: var(--wp--preset--color--hover-link, var(--nrm-color-accent));
    text-decoration: underline;
    text-decoration-color: currentColor;
}
img { max-width: 100%; height: auto; display: block; }
/* Unit-test posts are classic markup. A bare alignleft stays float:none,
   and a caption's inline width (1200px) ignores the column. */
.wp-block-post-content::after {
    content: "";
    display: table;
    clear: both;
}
.wp-block-post-content .alignleft,
.wp-block-post-content img.alignleft,
.wp-caption.alignleft {
    float: left;
    margin: 0.25em 1.5em 0.5em 0;
}
.wp-block-post-content .alignright,
.wp-block-post-content img.alignright,
.wp-caption.alignright {
    float: right;
    margin: 0.25em 0 0.5em 1.5em;
}
.wp-block-post-content .aligncenter,
.wp-block-post-content img.aligncenter,
.wp-caption.aligncenter {
    display: block;
    float: none;
    margin-left: auto;
    margin-right: auto;
}
.wp-block-post-content .wp-caption,
.wp-block-post-content figure.wp-caption {
    width: auto !important;
    max-width: 100%;
    height: auto;
}
.wp-caption img {
    max-width: 100%;
    height: auto;
}
/* Old posts often ship a raw iframe with a fixed width. Keep it inside
   the column. Do not set height: auto - that squashes the player. */
iframe, embed, object, video { max-width: 100%; }

/* nav, titles, headings: underline sweeps in on hover only */
.wp-block-navigation .wp-block-navigation-item__content,
.wp-block-site-title a,
.wp-block-post-title a,
.nrny-header-cta,
.wp-block-heading a {
    text-decoration: none !important;
}
.wp-block-site-title a,
.wp-block-post-title a,
.wp-block-heading a,
.wp-block-navigation .wp-block-navigation-item__label {
    background: linear-gradient(currentColor, currentColor) bottom left / 0% 0.06em no-repeat;
    padding-bottom: 0.15em;
    transition: background-size 0.2s ease;
}

/* sweep + link hover color (palette default is rest color, so invisible unless changed) */
.wp-block-site-title a:hover,
.wp-block-post-title a:hover,
.wp-block-heading a:hover,
.wp-block-navigation .wp-block-navigation-item__content:hover .wp-block-navigation-item__label {
    color: var(--wp--preset--color--hover-link, inherit);
    background-size: 100% 0.06em;
}
/* iPhone paints the line on tap. iPad plays the 0.2s sweep, then
   the next page cuts it. Overlay only; mouse keeps the sweep. */
@media (pointer: coarse) {
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__label {
        transition: none;
    }
}

/* Accordion: plus is the affordance. Core underlines the title. */
.wp-block-accordion-heading__toggle {
    transition: color var(--nrm-transition);
}
.wp-block-accordion-heading__toggle:hover {
    color: var(--nrm-color-accent-hover);
}
.wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
    text-decoration: none !important;
}

/* Submenu: core defaults to white, we need page bg */
@media (min-width: 601px) {
    .wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container {
        background-color: var(--nrm-page-bg) !important;
        color: var(--nrm-color-text) !important;
    }
    .wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
        color: var(--nrm-color-text) !important;
    }
    /* Core floors an open submenu at 200px. A right-side cluster
       then paints a long child into the scrollbar. */
    .nrm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation .has-child:not(.open-on-click):hover > .wp-block-navigation__submenu-container,
    .nrm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation .has-child:not(.open-on-click):not(.open-on-hover-click):focus-within > .wp-block-navigation__submenu-container,
    .nrm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true] ~ .wp-block-navigation__submenu-container {
        min-width: 0;
    }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--nrm-font-heading);
    font-weight: var(--nrm-heading-weight);
    line-height: var(--nrm-lh-tight);
    color: var(--nrm-color-text);
}
/* Display titles wrap. The shared 1.25 opens a hole between the lines. */
h1 { line-height: 1.05; }
p { margin: 0 0 var(--nrm-space-md); }
/* Constrained layout sets margin-left: auto. Indent has to be padding
   or outside markers hang left of the column. */
ul, ol {
    margin: 0 0 var(--nrm-space-md);
    padding-inline-start: var(--nrm-space-lg);
}
li { margin-bottom: var(--nrm-space-xs); }

/* Query Loop and comments render as ul. The list indent above
   would shove them off the page-title edge and off-center on a phone. */
.wp-block-post-template,
.wp-block-comment-template,
.wp-block-latest-posts {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    padding-inline-start: 0;
    list-style: none;
}

/* Long URLs in a comment are one unbreakable word. Flex nowrap
   rows also refuse to shrink (min-width: auto). Either one
   pushes the page wider than a phone, same as a raw iframe.
   Do not set max-width: 100% on the comments wrapper: that
   fills the parent and comments go as wide as the page.
   anywhere sizes a table column to one letter, and a linked
   name still breaks: Saddington becomes saddinto / n.
   break-word wraps a URL that does not fit. It does not shrink
   the column. */
.wp-block-comments,
.wp-block-comment-template,
.wp-block-comment-template .wp-block-group {
    min-width: 0;
}
.wp-block-comment-content a {
    overflow-wrap: break-word;
}
/* A name in a comment table is a link. anywhere and break-word
   both split it: John / saddinto / n. nowrap keeps the name. */
.wp-block-comment-content table a {
    overflow-wrap: normal;
    white-space: nowrap;
}

blockquote {
    margin: var(--nrm-space-lg) 0;
    padding: var(--nrm-space-md) var(--nrm-space-lg);
    border-left: 4px solid var(--nrm-color-accent);
    background: var(--nrm-color-surface);
    border-radius: var(--nrm-radius-lg);
    font-style: italic;
    color: var(--nrm-color-text);
}

pre {
    background: var(--nrm-color-surface);
    padding: var(--nrm-space-md);
    border-radius: var(--nrm-radius-lg);
    margin: var(--nrm-space-lg) 0;
    max-width: 100%;
    overflow-x: auto;
    /* Unit-test pre keeps one line long on purpose. The page must not scroll. The box does. */
    white-space: pre;
}
code { font-family: var(--nrm-font-mono); font-size: var(--wp--preset--font-size--small); background: var(--nrm-color-surface); padding: 0.2rem 0.4rem; border-radius: 4px; }
pre code { background: none; padding: 0; }

hr { border: none; height: 1px; background: var(--nrm-color-border); margin: var(--nrm-space-xl) 0; }

.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal; }
.screen-reader-text:focus { background: var(--nrm-color-bg); border-radius: 3px; box-shadow: 0 0 2px 2px rgba(0,0,0,.6); clip: auto; color: var(--nrm-color-primary); display: block; font-size: var(--wp--preset--font-size--small); font-weight: 600; height: auto; left: 5px; line-height: normal; padding: 15px 23px 14px; text-decoration: none; top: 5px; width: auto; z-index: 100000; }

.wp-block-heading { color: var(--nrm-color-text); }

.wp-element-button,
.wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--wp--preset--font-size--small);
    padding: 0.7rem 1.5rem;
    border: 1px solid var(--nrm-color-header-border);
    border-radius: var(--nrm-radius);
    background: transparent;
    color: var(--nrm-color-text);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
/* Universal button hover: ghost at rest, solid white + base text on hover/focus */
.wp-element-button:hover,
.wp-element-button:focus-visible,
.wp-block-button__link:hover,
.wp-block-button__link:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff);
    color: var(--wp--preset--color--base, #000000);
    border-color: var(--wp--preset--color--contrast, #ffffff);
    text-decoration: none !important;
}

/* Invert well is light. White hover would vanish. */
.is-style-invert .wp-element-button:hover,
.is-style-invert .wp-element-button:focus-visible,
.is-style-invert .wp-block-button__link:hover,
.is-style-invert .wp-block-button__link:focus-visible {
    background: var(--wp--preset--color--base);
    color: var(--wp--preset--color--contrast);
    border-color: var(--wp--preset--color--base);
}

.wp-block-separator {
    border-color: var(--nrm-color-border);
    opacity: 1;
}
.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { max-width: 100px; }
.wp-block-separator.is-style-wide { max-width: none; }

.wp-block-quote {
    border-left: 3px solid var(--nrm-color-primary);
    padding-left: 1.5rem;
    font-style: italic;
}
.wp-block-quote cite { font-style: normal; font-size: var(--wp--preset--font-size--small); color: var(--nrm-color-text-muted); }

.wp-block-pullquote {
    border-top: 3px solid var(--nrm-color-primary);
    border-bottom: 3px solid var(--nrm-color-primary);
    padding: 2rem 0;
}
.wp-block-pullquote blockquote { border: none; padding: 0; }

.wp-block-columns { gap: 2rem; }

/* Standalone image captions. Gallery thumbs and the lightbox have their own rules. */
.wp-block-image figcaption { font-size: var(--wp--preset--font-size--small); color: var(--nrm-color-text-muted); text-align: left; margin-top: 0.5rem; }

.wp-block-gallery { gap: 1rem; }
.wp-block-gallery .wp-block-image { overflow: hidden; }

.is-style-nrm-corner-round img { border-radius: 8px; }

.wp-block-table { border-collapse: collapse; }
.wp-block-table td, .wp-block-table th { border: 1px solid var(--nrm-color-border); padding: 0.6rem 0.8rem; }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--nrm-color-surface); }

.wp-block-code { background: var(--nrm-color-surface); border-radius: 4px; padding: 1.5rem; font-family: var(--nrm-font-mono); font-size: var(--wp--preset--font-size--small); max-width: 100%; overflow-x: auto; white-space: pre; }
.wp-block-preformatted { font-family: var(--nrm-font-mono); font-size: var(--wp--preset--font-size--small); background: var(--nrm-color-surface); padding: 1.5rem; border-radius: 4px; max-width: 100%; overflow-x: auto; white-space: pre; }

.wp-block-latest-posts { padding: 0; list-style: none; }
.wp-block-latest-posts li { margin-bottom: 1rem; }
.wp-block-latest-posts__post-title { font-family: var(--nrm-font-heading); font-weight: 600; color: var(--nrm-color-primary); }
.wp-block-latest-posts__post-date { font-size: var(--wp--preset--font-size--small); color: var(--nrm-color-text-muted); }

/* date never wraps mid-string - keeps "March 29, 2026" on one line */
.wp-block-post-date { white-space: nowrap; }

.wp-block-search__inside-wrapper { align-items: center; }
.wp-block-search__button {
    background: transparent;
    color: var(--nrm-color-text);
    border: 1px solid var(--nrm-color-header-border);
    border-radius: var(--nrm-radius);
    padding: 0.45rem 1.1rem;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--nrm-transition), border-color var(--nrm-transition);
}
.wp-block-search__button:hover,
.wp-block-search__button:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff);
    color: var(--wp--preset--color--base, #000000);
    border-color: var(--wp--preset--color--contrast, #ffffff);
}
.wp-block-search__input { background: var(--nrm-color-surface, #1e3244); color: var(--nrm-color-text, var(--wp--preset--color--contrast, #ffffff)); border: none; border-radius: 4px; padding: 0.6rem 0.8rem; }
.wp-block-search__input::placeholder { color: rgba(255,255,255,0.5); }

/* Clear button (little X) - white, dims on hover */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M1 1l12 12M13 1L1 13' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.2s ease;
}
input[type="search"]::-webkit-search-cancel-button:hover {
    opacity: 0.6;
}

.nrny-header-search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nrm-color-text);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.nrny-header-search-trigger:focus {
    outline: none;
}
.nrny-header-search-trigger:focus-visible {
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 3px;
}
.nrny-header-search-trigger:hover {
    color: var(--nrm-color-accent-hover);
}
.nrny-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--nrm-page-bg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* lvh does not shrink when the keyboard opens. inset:0 would,
       and flex-center would then jump the field. */
    height: 100vh;
    height: 100lvh;
    overflow: hidden;
    /* Extra bottom pad pulls the bar up a bit. Chrome's toolbar
       makes dead-center look low; Safari and Brave barely move. */
    padding-bottom: 10vh;
    gap: 1.5rem;
    /* Safari still hit-tests visibility:hidden + fixed. Out of the
       document until .active. Fade is a snap, same as the menu. */
    pointer-events: none;
}
.nrny-search-overlay.active {
    display: flex;
    pointer-events: auto;
}
/* iPhone pans the page under the overlay when the keyboard opens.
   Pin only on phones. iPad is coarse too; pin + scrollTo slams
   the page on close. */
html.nrm-search-open,
html.nrm-search-open body {
    overflow: hidden;
    height: 100%;
}
html.nrm-search-open body {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
}
.nrny-search-overlay:focus {
    outline: none;
}
.nrny-search-overlay-close {
    position: fixed;
    z-index: 10000;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nrm-color-text, var(--wp--preset--color--contrast));
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}
.nrny-search-overlay-close:focus {
    outline: none;
}
.nrny-search-overlay-close svg {
    display: none;
}
/* same X as the hamburger - the two must match */
.nrny-search-overlay-close::before,
.nrny-search-overlay-close::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 19px;
    width: 28px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transform-origin: center;
}
.nrny-search-overlay-close::before {
    transform: rotate(45deg);
}
.nrny-search-overlay-close::after {
    transform: rotate(-45deg);
}
.nrny-search-overlay-close:hover {
    color: var(--nrm-color-accent-hover);
}
.nrny-search-overlay-close:focus-visible {
    outline: 2px solid var(--nrm-color-text, var(--wp--preset--color--contrast));
    outline-offset: 3px;
}
.nrny-search-overlay-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 80%;
    max-width: 700px;
    min-width: 0;
}
.nrny-search-overlay-field {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: var(--nrm-radius);
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    caret-color: var(--nrm-color-text, #ffffff);
    padding: 1rem 1.25rem;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    line-height: 1.25;
    font-family: var(--nrm-font-body);
}
.nrny-search-overlay-field::-webkit-search-decoration,
.nrny-search-overlay-field::-webkit-search-results-button,
.nrny-search-overlay-field::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}
.nrny-search-overlay-field::placeholder {
    color: rgba(255,255,255,0.5);
}
.nrny-search-overlay-field::-webkit-search-cancel-button {
    -webkit-appearance: none;
    cursor: pointer;
    width: 1.5em;
    height: 1.5em;
    background: none;
    position: relative;
}
.nrny-search-overlay-field::-webkit-search-cancel-button::before,
.nrny-search-overlay-field::-webkit-search-cancel-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.2em;
    height: 2px;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%) rotate(45deg);
}
.nrny-search-overlay-field::-webkit-search-cancel-button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.nrny-search-overlay-field:focus {
    outline: 2px solid var(--nrm-color-text, var(--wp--preset--color--contrast));
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-page-bg, var(--nrm-color-bg)), 0 0 0 3px var(--nrm-color-text, var(--wp--preset--color--contrast));
}
.nrny-search-overlay-submit {
    flex: 0 0 auto;
    background: transparent;
    color: var(--nrm-color-text, var(--wp--preset--color--contrast, #ffffff));
    border: 2px solid var(--nrm-color-header-border, var(--wp--preset--color--contrast, #ffffff));
    border-radius: var(--nrm-radius);
    padding: 1rem 1.5rem;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
}
/* Universal button hover - solid white + base text */
.nrny-search-overlay-submit:hover,
.nrny-search-overlay-submit:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff);
    color: var(--wp--preset--color--base, #000000);
    border-color: var(--wp--preset--color--contrast, #ffffff);
}

/* space-between spreads items out - margin-left:auto is what groups
   nav, search, CTA. order flips per breakpoint. */
.nrm-site-header .wp-block-navigation {
    margin-left: auto;
    order: 1;
}
.nrny-header-search-trigger {
    order: 2;
}
.nrny-header-cta {
    order: 3;
}
body.nrm-nav-hamburger .nrny-header-search-trigger {
    order: 1;
    margin-left: auto;
}
body.nrm-nav-hamburger .nrny-header-cta {
    order: 2;
    margin-left: 0;
}
body.nrm-nav-hamburger:not(:has(.nrny-header-search-trigger)) .nrny-header-cta {
    margin-left: auto;
}
body.nrm-nav-hamburger .nrm-site-header .wp-block-navigation {
    order: 3;
    margin-left: 0;
}
body.nrm-nav-hamburger:not(:has(.nrny-header-search-trigger)):not(:has(.nrny-header-cta)) .nrm-site-header .wp-block-navigation {
    margin-left: auto;
}

/* Site logo sizing only. The title swap (logo replaces title) is
   opt-in via Settings and injected through theme.json - see
   inc/dynamic-css.php. Default is the core way: both show. */
.wp-block-site-logo {
    flex-shrink: 0;
    /* Ceiling lives on the block, not the img: the img follows its
       container (max-width: 100%), so a tight row can compress the
       logo instead of crushing the menu. */
    max-width: min(340px, 60vw);
}
.wp-block-site-logo img,
.wp-block-site-logo.is-default-size img {
    max-height: 48px;
    width: auto !important;
    max-width: 100%;
    display: block;
}
/* WooCommerce's Block Hooks append its cart and account blocks to this
   row as siblings of the nav. They carry no order, so they sorted with
   the title (order 0) and sat glued to it. On wide screens they go to
   the far right, after search. In the two hamburger regimes they must
   sort BEFORE the nav (order 3), because the lightbox X and the
   menu-close X are both positioned over the burger, which only reads
   right when the burger is the flush-right element. */
.nrm-site-header .wp-block-woocommerce-mini-cart,
.nrm-site-header .wp-block-woocommerce-customer-account {
    order: 4;
}
body.nrm-nav-hamburger .nrm-site-header .wp-block-woocommerce-mini-cart,
body.nrm-nav-hamburger .nrm-site-header .wp-block-woocommerce-customer-account {
    order: 2;
}
/* Same dim as search and the burger. Woo underlines the login
   link; cart SVG fill follows currentColor. */
.nrm-site-header .wc-block-mini-cart__button:hover:not([disabled]),
.nrm-site-header .wc-block-customer-account__link:hover,
.nrm-site-header .wc-block-customer-account__toggle:hover {
    color: var(--nrm-color-accent-hover);
    text-decoration: none;
}

.nrny-header-cta {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.45rem 1.1rem;
    background: transparent;
    color: var(--nrm-color-text) !important;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    border-radius: var(--nrm-radius);
    border: 1px solid var(--nrm-color-header-border);
    transition: color var(--nrm-transition), border-color var(--nrm-transition), background var(--nrm-transition);
}
.nrny-header-cta:hover,
.nrny-header-cta:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff);
    color: var(--wp--preset--color--base, #000000) !important;
    border-color: var(--wp--preset--color--contrast, #ffffff);
}

/* Blog Home: List. Thumb left, uncropped. */

.wp-block-post-template.nrm-blog-list .wp-block-post .wp-block-post-featured-image {
    float: left;
    max-width: 200px;
    margin: 0 var(--nrm-space-lg) var(--nrm-space-sm) 0;
}
/* Float would let the border strip slip under the thumb */
.wp-block-post-template.nrm-blog-list .wp-block-post > .wp-block-group {
    border-bottom: none !important;
}
.wp-block-post-template.nrm-blog-list .wp-block-post .wp-block-post-featured-image img {
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.wp-block-post-template.nrm-blog-list .wp-block-post {
    overflow: auto;
}

/* Blog Home: Masonry. CSS columns. Core has no masonry Query layout. */

.wp-block-post-template.nrm-blog-masonry {
    columns: 3;
    column-gap: var(--nrm-space-lg);
    list-style: none;
    padding: 0;
}
.wp-block-post-template.nrm-blog-masonry > .wp-block-post {
    break-inside: avoid;
    margin-bottom: var(--nrm-space-lg);
    padding-top: 0;
    border-top: none;
}

@media (max-width: 768px) {
    .wp-block-post-template.nrm-blog-masonry { columns: 1; }
}

/* Previous / next on a single post. After tags, before comments. */
.nrm-post-nav {
    width: 100%;
    gap: var(--nrm-space-lg);
}
.nrm-post-nav .wp-block-post-navigation-link:empty {
    display: none;
}
.nrm-post-nav .post-navigation-link-next {
    margin-left: auto;
}
.nrm-post-nav .post-navigation-link__label {
    display: block;
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.nrm-post-nav .wp-block-post-navigation-link a {
    text-decoration: none;
}
.nrm-post-nav .wp-block-post-navigation-link a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .nrm-post-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .nrm-post-nav .post-navigation-link-next {
        margin-left: 0;
        text-align: left;
    }
}

/* Featured sidebar: same width, natural height. No crop. */
.wp-block-post-template.nrm-blog-featured-aside .wp-block-post-featured-image {
    flex: 0 0 88px;
    width: 88px;
    max-width: 88px;
    margin: 0;
}
.wp-block-post-template.nrm-blog-featured-aside .wp-block-post-featured-image img {
    display: block;
    width: 88px;
    max-width: 88px;
    height: auto;
    object-fit: contain;
}

/* Locked titles are a sentence. has-xx-large-font-size forces the size. */
.post-password-required .wp-block-post-title,
body:has(.wp-block-post-content .post-password-form) .wp-block-post-title {
	font-size: var(--wp--preset--font-size--x-large) !important;
	overflow-wrap: anywhere;
}
/* Core's password form is a bare input plus the big button class.
   Same field and button as search, or it is a white box and a giant Enter.
   nowrap: wrap drops Enter under the field once the column is under ~340px. */
.post-password-form p:last-of-type {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
}
.post-password-form label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1 1 auto;
    min-width: 0;
}
.post-password-form input[type="password"] {
    flex: 1 1 8rem;
    min-width: 0;
    width: auto;
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, var(--wp--preset--color--contrast, #ffffff));
    caret-color: var(--nrm-color-text, var(--wp--preset--color--contrast, #ffffff));
    border: none;
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    font-size: var(--wp--preset--font-size--small);
    line-height: 1.6;
}
.post-password-form input[type="password"]:-webkit-autofill {
    -webkit-text-fill-color: var(--nrm-color-text, #ffffff);
    caret-color: var(--nrm-color-text, #ffffff);
    box-shadow: 0 0 0 1000px var(--nrm-color-surface, #1e3244) inset;
}
.post-password-form input[type="password"]:focus-visible {
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
}
.post-password-form .wp-block-button {
    margin: 0;
    flex: 0 0 auto;
}
.post-password-form .wp-block-button__link {
    padding: 0.45rem 1.1rem;
}
.nrny-sticky-label {
    margin: 0 0 0.35em;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wp--preset--color--muted);
}
.related-posts { max-width: var(--nrm-content-width); margin: var(--nrm-space-3xl) auto 0; }
.related-posts .section-label { font-size: var(--wp--preset--font-size--small); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--nrm-space-md); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--nrm-space-md); }
.related-grid .entry-thumb { border-radius: var(--nrm-radius-lg); overflow: hidden; margin-bottom: var(--nrm-space-sm); }
.related-grid .entry-thumb img { width: 100%; height: auto; }
.related-grid .entry-title { font-size: var(--wp--preset--font-size--medium); font-weight: 600; }
.related-grid .entry-title a { color: var(--nrm-color-text); }
.related-grid .entry-title a:hover { color: var(--nrm-color-accent-hover); text-decoration: underline; }

/* Menu wraps. nowrap spills a long page list off the viewport. */
.nrm-site-header .wp-block-navigation.is-layout-flex { flex-wrap: wrap !important; --navigation-layout-wrap: wrap !important; }
.nrm-site-header .wp-block-navigation .wp-block-navigation__container { flex-wrap: wrap !important; --navigation-layout-wrap: wrap !important; }
.wp-block-navigation .wp-block-navigation-item__content { white-space: nowrap; }
.nrm-site-header .wp-block-navigation__responsive-container-content { flex-wrap: wrap !important; }

.nrm-site-header .is-content-justification-space-between.is-layout-flex { flex-wrap: nowrap !important; }
.nrm-site-header .wp-block-site-title { white-space: nowrap; flex-shrink: 0; }
.nrm-site-header .wp-block-navigation { flex-shrink: 1; min-width: 0; overflow: visible; }

/* Footer menu stays a wrapping list. Header hamburger stays on the header. */
.wp-block-template-part footer .wp-block-navigation.is-layout-flex {
    flex-wrap: wrap;
    --navigation-layout-wrap: wrap;
}

@media (max-width: 600px) {
    /* Wide wordmark + Woo's icons + burger is a lot of row for a phone.
       Tighten the gutters and floor the logo so it shrinks first but
       never to a speck. The icons and burger keep their size - the
       close X alignment depends on the burger being whole. */
    .nrm-site-header:has(.wp-block-site-logo img) .wp-block-group.is-content-justification-space-between {
        gap: 12px !important;
    }
    .nrm-site-header .wp-block-site-logo {
        min-width: 64px;
    }
    /* Phone row only. Hamburger-always on a tablet still has room. */
    .nrm-site-header:has(.wp-block-site-logo img) .wp-block-site-title { display: none; }
}

@media (max-width: 1100px) {
    .nrm-site-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex !important; }
    .nrm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open):not(.hidden-by-default) { display: none !important; }
    .nrm-site-header .wp-block-site-title { flex: 1 1 auto; min-width: 0; }
    /* Shrink on a tight row. Do not grow: the 340px cap stops the mark
       soaking leftover, and space-between then fans search / account /
       cart / burger across the rest of the bar. */
    .nrm-site-header:has(.wp-block-site-logo img) .wp-block-site-logo { flex: 0 1 auto; min-width: 0; }
    /* A wide wordmark plus every icon overflows a phone row. The logo
       is the one flexible thing: it soaks the squeeze. The icons and
       the burger stay their natural size - a clipped burger would
       break the close X alignment. */
    .nrm-site-header .nrny-header-search-trigger,
    .nrm-site-header .wp-block-woocommerce-mini-cart,
    .nrm-site-header .wp-block-woocommerce-customer-account,
    .nrm-site-header .wp-block-navigation { flex-shrink: 0; }
    /* Reorder: search → CTA → hamburger (nav last). auto on the first
       right-side control packs the cluster; the burger stays flush
       right for the lightbox X. */
    .nrm-site-header .nrny-header-search-trigger { order: 1; margin-left: auto; }
    .nrny-header-cta { order: 2; }
    .nrm-site-header:not(:has(.nrny-header-search-trigger)) .nrny-header-cta { margin-left: auto; }
    .nrm-site-header:not(:has(.nrny-header-search-trigger)):not(:has(.nrny-header-cta)) .wp-block-woocommerce-customer-account { margin-left: auto; }
    .nrm-site-header:not(:has(.nrny-header-search-trigger)):not(:has(.nrny-header-cta)):not(:has(.wp-block-woocommerce-customer-account)) .wp-block-woocommerce-mini-cart { margin-left: auto; }
    .nrm-site-header .wp-block-navigation { order: 3; margin-left: 0; }
    /* The hamburger must stay the flush-right element: the lightbox X
       and the menu-close X are positioned to sit on top of it. The
       order rules above already sequence the theme's own items, so the
       one thing left is to keep Woo's injected icons from sorting past
       the nav. 2 sits them before it. */
    .nrm-site-header .wp-block-woocommerce-mini-cart,
    .nrm-site-header .wp-block-woocommerce-customer-account {
        order: 2;
    }
}

body.nrm-nav-hamburger .nrm-site-header .wp-block-navigation__responsive-container-open { display: flex !important; }
body.nrm-nav-hamburger .nrm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }

.wp-block-navigation__responsive-container.is-menu-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    max-height: 85vh;
    /* core's nav CSS overrides padding - keep ours */
    padding: 0 var(--wp--style--root--padding-right, 1.5rem) 2rem !important;
    /* menu matches the page - the page dims behind it */
    background-color: var(--nrm-page-bg) !important;
    color: var(--wp--preset--color--contrast, #ffffff) !important;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    overflow-y: auto;
    /* hide internal scrollbar: it eats 15px, shifts close wrapper off
     * center relative to header content. Still scrolls. */
    scrollbar-width: none;
    --navigation-layout-justification-setting: center !important;
    --navigation-layout-align: center !important;
    --navigation-layout-justify: center !important;
}
.wp-block-navigation__responsive-container.is-menu-open::-webkit-scrollbar {
    display: none;
}

/* Dim page content behind mobile menu. Fade in, snap off (menu has no exit anim). */
body:has(.wp-block-navigation__responsive-container.is-menu-open) main {
    pointer-events: none;
    position: relative;
}
main::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 419;
    pointer-events: none;
    opacity: 0;
}
body:has(.wp-block-navigation__responsive-container.is-menu-open) main::after {
    opacity: 1;
    transition: opacity 0.25s ease;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
    align-items: center !important;
    justify-content: center !important;
    gap: 1.5rem;
    padding: 2rem 1rem;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item {
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    font-family: var(--wp--preset--font-family--heading, inherit);
    text-align: center;
    color: var(--wp--preset--color--contrast, #ffffff);
    text-decoration: none;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    align-items: center !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 600;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

/* solid - core's own 0.1s fade/slide would animate here */
.wp-block-navigation__responsive-container.is-menu-open {
    animation: none;
}

/* close wrapper: match header content width */
.has-modal-open .wp-block-navigation__responsive-close {
    position: relative;
    max-width: 1340px !important;
}

/* close button: absolute inside close wrapper, OS-independent */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
    position: absolute;
    right: 0;
    top: calc(var(--wp--preset--spacing--30, 1rem) + 0.34rem);
    z-index: 100001;
    padding: 0;
    color: var(--nrm-color-text);
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--nrm-transition);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close:hover {
    color: var(--nrm-color-accent-hover);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg {
    display: none;
}

/* close button X - same 0.25s fold as the hamburger, two lines into the X */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close::before,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close::after {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 28px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transform-origin: center;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close::before {
    transform: rotate(45deg);
    animation: nrm-menu-x-a 0.25s ease;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close::after {
    transform: rotate(-45deg);
    animation: nrm-menu-x-b 0.25s ease;
}
@keyframes nrm-menu-x-a {
    from { top: 6px; transform: rotate(0deg); }
    to { top: 10px; transform: rotate(45deg); }
}
@keyframes nrm-menu-x-b {
    from { top: 14px; transform: rotate(0deg); }
    to { top: 10px; transform: rotate(-45deg); }
}

.wp-block-navigation__responsive-container-overlay { background: rgba(0,0,0,0.7) !important; }

/* hamburger: two lines, fold to X on open (same geometry as the close button) */
.wp-block-navigation__responsive-container-open {
    position: relative;
    width: 28px;
    height: 22px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    color: var(--nrm-color-text);
    transition: color var(--nrm-transition);
}
.wp-block-navigation__responsive-container-open:hover {
    color: var(--nrm-color-accent-hover);
}
.wp-block-navigation__responsive-container-open svg {
    display: none;
}
.wp-block-navigation__responsive-container-open::before,
.wp-block-navigation__responsive-container-open::after {
    content: "";
    position: absolute;
    left: 0;
    width: 28px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transform-origin: center;
    transition: transform 0.25s ease, top 0.25s ease;
}
.wp-block-navigation__responsive-container-open::before {
    top: 6px;
    transform: rotate(0deg);
}
.wp-block-navigation__responsive-container-open::after {
    top: 14px;
    transform: rotate(0deg);
}

/* open state: fold into the same X as the close button */
body:has(.wp-block-navigation__responsive-container.is-menu-open) .wp-block-navigation__responsive-container-open::before {
    top: 10px;
    transform: rotate(45deg);
}
body:has(.wp-block-navigation__responsive-container.is-menu-open) .wp-block-navigation__responsive-container-open::after {
    top: 10px;
    transform: rotate(-45deg);
}

/* Gallery: masonry via CSS columns when not cropped */

.wp-block-gallery:not(.is-cropped) {
    display: block !important;
    column-gap: var(--wp--preset--spacing--20, 1rem);
}
.wp-block-gallery:not(.is-cropped).columns-1 { columns: 1; }
.wp-block-gallery:not(.is-cropped).columns-2 { columns: 2; }
.wp-block-gallery:not(.is-cropped).columns-3 { columns: 3; }
.wp-block-gallery:not(.is-cropped).columns-4 { columns: 4; }
.wp-block-gallery:not(.is-cropped).columns-5 { columns: 5; }
.wp-block-gallery:not(.is-cropped).columns-6 { columns: 6; }
.wp-block-gallery:not(.is-cropped).columns-7 { columns: 7; }
.wp-block-gallery:not(.is-cropped).columns-8 { columns: 8; }
.wp-block-gallery:not(.is-cropped).columns-default { columns: 3; }
.wp-block-gallery:not(.is-cropped) .wp-block-image {
    break-inside: avoid;
    margin: 0 0 var(--wp--preset--spacing--20, 1rem) 0 !important;
    display: block !important;
    width: 100% !important;
    flex: none !important;
}
.wp-block-gallery:not(.is-cropped) .wp-block-image img {
    width: 100% !important;
    height: auto !important;
    display: block;
    object-fit: cover;
}
@media (max-width: 960px) {
    .wp-block-gallery:not(.is-cropped).columns-4,
    .wp-block-gallery:not(.is-cropped).columns-5,
    .wp-block-gallery:not(.is-cropped).columns-6,
    .wp-block-gallery:not(.is-cropped).columns-7,
    .wp-block-gallery:not(.is-cropped).columns-8,
    .wp-block-gallery:not(.is-cropped).columns-default { columns: 2; }
}
@media (max-width: 600px) {
    .wp-block-gallery:not(.is-cropped) { columns: 1 !important; }
}

/* Lightbox navigation: large arrows, 50% opacity, big hit targets.
   Core sets 40px buttons and 1.5em icons - too small for full-screen. */

.wp-lightbox-overlay .wp-lightbox-navigation-button-prev,
.wp-lightbox-overlay .wp-lightbox-navigation-button-next,
.wp-lightbox-overlay .wp-lightbox-close-button {
    color: #f5f5f5 !important;
    font-size: 1.1rem !important;
    min-width: 64px !important;
    min-height: 64px !important;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}
.wp-lightbox-overlay .wp-lightbox-navigation-button-prev:hover,
.wp-lightbox-overlay .wp-lightbox-navigation-button-next:hover,
.wp-lightbox-overlay .wp-lightbox-close-button:hover {
    opacity: 0.6;
}
.wp-lightbox-overlay .wp-lightbox-navigation-button-prev:focus,
.wp-lightbox-overlay .wp-lightbox-navigation-button-next:focus,
.wp-lightbox-overlay .wp-lightbox-close-button:focus {
    opacity: 0.6;
}
.wp-lightbox-overlay .wp-lightbox-navigation-button-prev:focus-visible,
.wp-lightbox-overlay .wp-lightbox-navigation-button-next:focus-visible,
.wp-lightbox-overlay .wp-lightbox-close-button:focus-visible {
    outline: 2px solid #f5f5f5;
    outline-offset: 3px;
    opacity: 0.6;
}
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-prev:focus-visible,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-next:focus-visible,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-close-button:focus-visible {
    outline-color: #1a1a1a;
}
.wp-lightbox-overlay .wp-lightbox-navigation-button-prev .wp-lightbox-navigation-icon svg,
.wp-lightbox-overlay .wp-lightbox-navigation-button-next .wp-lightbox-navigation-icon svg {
    width: 5em !important;
    height: 5em !important;
    fill: #f5f5f5 !important;
}
.wp-lightbox-overlay .wp-lightbox-close-icon svg {
    width: 2.5em !important;
    height: 2.5em !important;
    fill: #f5f5f5 !important;
}

/* Arrows sit a bit above true center. Core's 50% reads too high
   next to the fitted photo. Left and right stay. The X stays. */
@media (min-width: 960px) {
    .wp-lightbox-overlay .wp-lightbox-navigation-button-prev,
    .wp-lightbox-overlay .wp-lightbox-navigation-button-next {
        bottom: calc(50% - 48px);
        transform: translateY(-50%);
    }
}

/* X is 64px, hamburger is 28 by 22. Shift so the middle sits
   on the hamburger - same content edge as the menu close.
   Desktop puts the X at the top of the forward arrow's column. */
.wp-lightbox-overlay .wp-lightbox-close-button {
    top: max(
        env(safe-area-inset-top),
        calc(env(safe-area-inset-top) + var(--wp--preset--spacing--30, 1rem) + 0.34rem - 21px)
    );
    right: max(
        env(safe-area-inset-right),
        calc(
            max(
                var(--wp--style--root--padding-right, 1.5rem),
                calc((100vw - var(--wp--style--global--wide-size, 1340px)) / 2)
            ) - 18px
        )
    );
}

/* Content-edge X sits on wide photos. The forward arrow's column
   is in the side gutter, so the X uses that column at the top.
   Phones and iPads keep the hamburger alignment. */
@media (pointer: fine) and (min-width: 960px) {
    .wp-lightbox-overlay .wp-lightbox-close-button {
        top: calc(env(safe-area-inset-top) + 16px);
        right: calc(env(safe-area-inset-right) + 16px);
        bottom: auto;
        width: calc(5.5rem + 16px);
        min-width: calc(5.5rem + 16px);
        padding: 0 8px;
        box-sizing: border-box;
        transform: none;
    }
}

.wp-lightbox-overlay,
.wp-lightbox-overlay .scrim {
    background: #1a1a1a !important;
}

/* Touch: swipe. iPad is coarse but taller/wider than a phone, so
   width-or-short-height left desktop arrows on a tablet. Mouse keeps them. */
@media (pointer: coarse) {
    .wp-lightbox-overlay .wp-lightbox-navigation-button-prev,
    .wp-lightbox-overlay .wp-lightbox-navigation-button-next {
        display: none !important;
    }
}

/* Thumbnail captions: hidden when setting is off.
   Core paints a blur on :has(figcaption)::before. display:none
   on the caption leaves that overlay. */
.nrm-hide-thumbnail-captions .wp-block-gallery figcaption {
    display: none !important;
}
.nrm-hide-thumbnail-captions .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before {
    content: none;
}

.nrm-lightbox-caption {
    position: absolute;
    color: #f5f5f5;
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 3000001;
    pointer-events: none;
    text-align: left;
    visibility: hidden;
}
/* Overlay visibility does not hide this node. Tie it to active. */
.wp-lightbox-overlay.active .nrm-lightbox-caption.is-placed {
    visibility: visible;
}
.wp-lightbox-overlay:not(.active) .nrm-lightbox-caption {
    visibility: hidden;
}

/* Light lightbox. Off by default. Body class inverts overlay,
   arrows, X, and captions. Same opacity. Not the page color. */
.nrm-lightbox-light .wp-lightbox-overlay,
.nrm-lightbox-light .wp-lightbox-overlay .scrim {
    background: #f5f5f5 !important;
}
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-prev,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-next,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-close-button {
    color: #1a1a1a !important;
}
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-prev .wp-lightbox-navigation-icon svg,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-navigation-button-next .wp-lightbox-navigation-icon svg,
.nrm-lightbox-light .wp-lightbox-overlay .wp-lightbox-close-icon svg {
    fill: #1a1a1a !important;
}
.nrm-lightbox-light .nrm-lightbox-caption {
    color: #1a1a1a;
}

/* Comment form. Product reviews use the same #commentform
   markup, just not inside .wp-block-comments, so they stay
   browser-white unless listed here. */

.wp-block-comments input[type="text"],
.wp-block-comments input[type="email"],
.wp-block-comments input[type="url"],
.wp-block-comments textarea,
.woocommerce-Reviews input[type="text"],
.woocommerce-Reviews input[type="email"],
.woocommerce-Reviews input[type="url"],
.woocommerce-Reviews textarea,
.wp-block-woocommerce-product-review-form input[type="text"],
.wp-block-woocommerce-product-review-form input[type="email"],
.wp-block-woocommerce-product-review-form input[type="url"],
.wp-block-woocommerce-product-review-form textarea {
    background: var(--nrm-color-surface);
    color: var(--nrm-color-text);
    caret-color: var(--nrm-color-text);
    border: none;
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    width: 100%;
}

.wp-block-comments textarea,
.woocommerce-Reviews textarea,
.wp-block-woocommerce-product-review-form textarea {
    resize: vertical;
    min-height: 120px;
}

.wp-block-comments input:focus,
.wp-block-comments textarea:focus,
.woocommerce-Reviews input:focus,
.woocommerce-Reviews textarea:focus,
.wp-block-woocommerce-product-review-form input:focus,
.wp-block-woocommerce-product-review-form textarea:focus {
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}

.wp-block-comments input[type="checkbox"],
.woocommerce-Reviews input[type="checkbox"],
.wp-block-woocommerce-product-review-form input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--nrm-color-text);
}

.wp-block-comments label,
.woocommerce-Reviews label,
.wp-block-woocommerce-product-review-form label {
    color: var(--nrm-color-text);
}

.wp-block-comments .wp-block-button__link,
.wp-block-comments button[type="submit"] {
    background: transparent;
    color: var(--nrm-color-text);
    border: 1px solid var(--nrm-color-header-border);
    border-radius: var(--nrm-radius);
    padding: 0.45rem 1.1rem;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--nrm-transition), border-color var(--nrm-transition);
}
.wp-block-comments .wp-block-button__link:hover,
.wp-block-comments .wp-block-button__link:focus-visible,
.wp-block-comments button[type="submit"]:hover,
.wp-block-comments button[type="submit"]:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff);
    color: var(--wp--preset--color--base, #000000);
    border-color: var(--wp--preset--color--contrast, #ffffff);
}

/* Login/account .form-row fields. Same as comments: surface,
   no rest border, focus ring. Woo's own rule is a hairline. */

.woocommerce form .form-row .input-text,
.woocommerce-page form .form-row .input-text,
.woocommerce form .form-row textarea.input-text,
.woocommerce-page form .form-row textarea.input-text,
.woocommerce form .form-row select,
.woocommerce-page form .form-row select {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    font-size: inherit;
}
.woocommerce form .form-row .input-text:focus,
.woocommerce-page form .form-row .input-text:focus,
.woocommerce form .form-row textarea.input-text:focus,
.woocommerce-page form .form-row textarea.input-text:focus,
.woocommerce form .form-row select:focus,
.woocommerce-page form .form-row select:focus {
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}
.woocommerce .quantity .qty {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    min-width: 60px;
    text-align: center;
}

/* Block checkout/cart fields are not .form-row. Woo hardcodes
   #fff plus a hairline. Same comment look as login. */
.wc-block-components-form .wc-block-components-text-input input[type="email"],
.wc-block-components-form .wc-block-components-text-input input[type="number"],
.wc-block-components-form .wc-block-components-text-input input[type="password"],
.wc-block-components-form .wc-block-components-text-input input[type="tel"],
.wc-block-components-form .wc-block-components-text-input input[type="text"],
.wc-block-components-form .wc-block-components-text-input input[type="url"],
.wc-block-components-text-input input[type="email"],
.wc-block-components-text-input input[type="number"],
.wc-block-components-text-input input[type="password"],
.wc-block-components-text-input input[type="tel"],
.wc-block-components-text-input input[type="text"],
.wc-block-components-text-input input[type="url"] {
    background-color: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
}
.wc-block-components-form .wc-block-components-text-input input[type="email"]:focus,
.wc-block-components-form .wc-block-components-text-input input[type="number"]:focus,
.wc-block-components-form .wc-block-components-text-input input[type="password"]:focus,
.wc-block-components-form .wc-block-components-text-input input[type="tel"]:focus,
.wc-block-components-form .wc-block-components-text-input input[type="text"]:focus,
.wc-block-components-form .wc-block-components-text-input input[type="url"]:focus,
.wc-block-components-text-input input[type="email"]:focus,
.wc-block-components-text-input input[type="number"]:focus,
.wc-block-components-text-input input[type="password"]:focus,
.wc-block-components-text-input input[type="tel"]:focus,
.wc-block-components-text-input input[type="text"]:focus,
.wc-block-components-text-input input[type="url"]:focus {
    background-color: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}
.wc-block-components-text-input label {
    color: var(--nrm-color-text, #ffffff);
}
/* Woo's #cc1818 is for white fields. */
.wc-block-components-form .wc-block-components-text-input.has-error label,
.wc-block-components-text-input.has-error label,
.wc-block-components-validation-error,
.has-error .wc-blocks-components-select .wc-blocks-components-select__select,
.has-error .wc-blocks-components-select .wc-blocks-components-select__label {
    color: #f18c8c;
}
.wc-blocks-components-select .wc-blocks-components-select__container {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
}
.wc-blocks-components-select .wc-blocks-components-select__select {
    color: var(--nrm-color-text, #ffffff);
    border: none;
}
.wc-blocks-components-select .wc-blocks-components-select__select:focus {
    color: var(--nrm-color-text, #ffffff);
    border: none;
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}
.wc-block-components-textarea,
.wc-block-components-textarea:not(:placeholder-shown) {
    background-color: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
}
.wc-block-components-textarea:focus {
    background-color: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}

/* Woo checkout-header is title + cart. Logo is injected as a sibling,
   so space-between would fan three items. Cart stays flush right. */
body.woocommerce-checkout header.wp-block-group .is-content-justification-space-between.is-layout-flex {
    justify-content: flex-start;
    gap: var(--wp--preset--spacing--30, 1rem);
}
body.woocommerce-checkout header.wp-block-group .wp-block-woocommerce-cart-link {
    margin-left: auto;
}

.woocommerce form .show-password-input,
.woocommerce-page form .show-password-input {
    color: var(--nrm-color-text, #ffffff);
    transition: opacity 0.2s ease;
}
.woocommerce form .show-password-input:hover,
.woocommerce-page form .show-password-input:hover {
    opacity: 0.6;
}
.woocommerce form .show-password-input::before,
.woocommerce-page form .show-password-input::before {
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M10 4C4 4 1 10 1 10C1 10 4 16 10 16C16 16 19 10 19 10C19 10 16 4 10 4Z'/><circle cx='10' cy='10' r='3'/></svg>");
}
.woocommerce form .show-password-input.display-password::before,
.woocommerce-page form .show-password-input.display-password::before {
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M10 4C4 4 1 10 1 10C1 10 4 16 10 16C16 16 19 10 19 10C19 10 16 4 10 4Z'/><circle cx='10' cy='10' r='3'/><line x1='3' y1='3' x2='17' y2='17'/></svg>");
}

.woocommerce .button,
.woocommerce .button.alt {
    background: transparent !important;
    color: var(--nrm-color-text, #ffffff) !important;
    border: 1px solid var(--nrm-color-header-border, #ffffff) !important;
    border-radius: var(--nrm-radius);
    padding: 0.45rem 1.1rem !important;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.woocommerce .button:hover,
.woocommerce .button:focus-visible,
.woocommerce .button.alt:hover,
.woocommerce .button.alt:focus-visible {
    background: var(--wp--preset--color--contrast, #ffffff) !important;
    color: var(--wp--preset--color--base, #000000) !important;
    border-color: var(--wp--preset--color--contrast, #ffffff) !important;
    opacity: 1;
    text-decoration: none !important;
}

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    background: var(--nrm-color-surface, #1e3244) !important;
    color: var(--nrm-color-text, #ffffff) !important;
    border: none !important;
    border-radius: 4px;
    padding: 1rem 1.5rem !important;
    border-left: 4px solid;
}
.woocommerce-message { border-left-color: #66bb6a; }
.woocommerce-info    { border-left-color: #42a5f5; }
.woocommerce-error   { border-left-color: #ef5350; }
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before { display: none; }

.woocommerce-store-notice {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border-bottom: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
}

/* Classic cart table. Hairline stays: this is a table, not a field. */
.woocommerce table.shop_table {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
    border-radius: 4px;
}
.woocommerce table.shop_table th,
.woocommerce table.shop_table td {
    border-top: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
    color: var(--nrm-color-text, #ffffff);
}
.woocommerce table.shop_table tfoot th,
.woocommerce table.shop_table tfoot td {
    font-weight: 600;
}

/* Classic checkout Select2. Closed field matches comments;
   the open menu keeps a hairline so the list doesn't vanish. */
.select2-container--default .select2-selection--single {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: none;
    border-radius: 4px;
    height: auto;
    padding: 0.5rem 0.8rem;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    outline: 2px solid var(--nrm-color-text);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nrm-color-bg), 0 0 0 3px var(--nrm-color-text);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--nrm-color-text, #ffffff);
    line-height: inherit;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0.5rem;
    right: 0.5rem;
}
.select2-dropdown {
    background: var(--nrm-color-surface, #1e3244);
    color: var(--nrm-color-text, #ffffff);
    border: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
}
.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--nrm-color-accent-hover, rgba(255,255,255,0.6));
    color: #000;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background: rgba(0,0,0,0.2);
    border: none;
    border-radius: 4px;
    color: var(--nrm-color-text, #ffffff);
}

/* Woo's product card pads the cell. Zero it so the image
   sits on the column edge like the rest of the grid. */
.wc-block-grid__product {
    padding: 0;
}
.wc-block-grid__product .wc-block-grid__product-title {
    font-family: var(--wp--preset--font-family--heading);
    font-size: var(--wp--preset--font-size--medium);
    margin: 0.75rem 0 0.25rem;
}
.wc-block-grid__product .wc-block-grid__product-price {
    font-size: var(--wp--preset--font-size--small);
    color: var(--nrm-color-muted, rgba(255,255,255,0.9));
    margin: 0 0 0.75rem;
}
.wc-block-grid__product .wp-block-button__link {
    font-size: var(--wp--preset--font-size--small);
}

.woocommerce nav.woocommerce-pagination ul {
    border: none;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
}
.woocommerce nav.woocommerce-pagination ul li {
    border: none;
}
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
    border-radius: 4px;
    background: transparent;
    color: var(--nrm-color-text, #ffffff);
    font-size: var(--wp--preset--font-size--small);
    text-decoration: none;
}
.woocommerce nav.woocommerce-pagination ul li a:hover,
.woocommerce nav.woocommerce-pagination ul li span.current {
    border-color: var(--nrm-color-accent-hover, rgba(255,255,255,0.6));
    color: var(--nrm-color-accent-hover, rgba(255,255,255,0.6));
}

/* Numbered lists only. Blog stays Previous / Next.
   Core flings those numbers to the edges with auto margins. */
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers),
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) {
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers).is-content-justification-space-between > .wp-block-query-pagination-next:last-of-type,
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers).is-content-justification-space-between > .wp-block-query-pagination-previous:first-child,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers).is-content-justification-space-between > .wp-block-comments-pagination-next:last-of-type,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers).is-content-justification-space-between > .wp-block-comments-pagination-previous:first-child {
    margin-inline: 0;
}
.wp-block-query-pagination-numbers,
.wp-block-comments-pagination-numbers {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers) .page-numbers,
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers) .wp-block-query-pagination-previous,
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers) .wp-block-query-pagination-next,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) .page-numbers,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) .wp-block-comments-pagination-previous,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) .wp-block-comments-pagination-next {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--wp--preset--color--border, rgba(255,255,255,0.24));
    border-radius: 4px;
    background: transparent;
    color: var(--nrm-color-text, #ffffff);
    font-size: var(--wp--preset--font-size--small);
    text-decoration: none;
    line-height: 1.2;
}
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers) a:hover,
.wp-block-query-pagination:has(.wp-block-query-pagination-numbers) .page-numbers.current,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) a:hover,
.wp-block-comments-pagination:has(.wp-block-comments-pagination-numbers) .page-numbers.current {
    border-color: var(--nrm-color-accent-hover, rgba(255,255,255,0.6));
    color: var(--nrm-color-accent-hover, rgba(255,255,255,0.6));
    text-decoration: none;
}
.wp-block-query-pagination .page-numbers.dots,
.wp-block-comments-pagination .page-numbers.dots {
    border: none;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

/* Reduced motion: instant underline, no sweep */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    main::after { transition: none; }
    .wp-block-navigation__responsive-container-open::before,
    .wp-block-navigation__responsive-container-open::after,
    .wp-block-navigation__responsive-container-close::before,
    .wp-block-navigation__responsive-container-close::after {
        transition: none;
        animation: none;
    }

    /* Underline sweeps become plain underlines. The hamburger icon is not
       included here: its lines are background-drawn, so clearing the
       background would erase the icon itself, which is not a motion effect. */

    .wp-block-site-title a,
    .wp-block-post-title a,
    .wp-block-heading a,
    .wp-block-navigation .wp-block-navigation-item__label {
        background: none !important;
        padding-bottom: 0;
    }
    .wp-block-site-title a:hover,
    .wp-block-post-title a:hover,
    .wp-block-heading a:hover,
    .wp-block-navigation .wp-block-navigation-item__content:hover .wp-block-navigation-item__label {
        text-decoration: underline !important;
    }
}

/* Image + linked heading in a Group. Class on the Group. Heading sits
   over the photo; ::before on the <a> makes the whole tile the hit so
   the underline stays on the words. */
.nrm-image-title {
    position: relative;
}
.nrm-image-title .wp-block-heading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    z-index: 1;
    text-align: center;
}
.nrm-image-title .wp-block-heading a::before {
    content: "";
    position: absolute;
    inset: 0;
}

/* Lightbox zoom.
   Core replays its zoom-in animation on the image container every time the
   image changes. Fine for the entrance. On Next it starts from the next
   thumbnail and crops mid-flight. After the open zoom finishes, JS flags
   the overlay and these rules drop the container animation. Touch sizing
   rules below still apply. */

.wp-lightbox-overlay.nrm-nav-zoom-off.zoom.active .lightbox-image-container {
	animation: none !important;
}

/* After Next, hide the leftover thumbnail. First open keeps both
   boxes so core can fly the photo. Close still flies the full photo. */
.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container:first-of-type {
	visibility: hidden;
}

/* After Next, core still rewrites the box from the next thumbnail
   and paints object-fit: cover inside overflow: hidden. Animation
   can be off and a square-to-portrait swap still crops. Keep the
   fitted stage and contain the next photo. First open stays core.
   Phones already contain via the coarse rules below. */
@media (pointer: fine) {
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container {
		width: auto !important;
		height: auto !important;
		max-width: calc(100vw - 80px);
		max-height: calc(100vh - 160px);
		overflow: visible !important;
		top: 50% !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
	}
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container .wp-block-image {
		width: auto !important;
		height: auto !important;
		max-width: 100%;
		max-height: inherit;
	}
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container img,
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container .wp-block-image img {
		min-width: 0 !important;
		min-height: 0 !important;
		width: auto !important;
		height: auto !important;
		max-width: calc(100vw - 80px) !important;
		max-height: calc(100vh - 160px) !important;
		object-fit: contain !important;
	}
}
/* 120, not core's 80: 40px above a landscape shot sits under our 64px X.
   Still centered. X and arrows stay. First open stays core's fly. */
@media (pointer: fine) and (min-width: 960px) {
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container {
		max-width: calc(100vw - 320px);
		max-height: calc(100vh - 120px);
	}
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container img,
	.wp-lightbox-overlay.nrm-lightbox-fitted.zoom.active .lightbox-image-container .wp-block-image img {
		max-width: calc(100vw - 320px) !important;
		max-height: calc(100vh - 120px) !important;
	}
}

@media (pointer: coarse) {
	/* Phones skip the open zoom, so both boxes paint at once.
	   Hide the leftover thumbnail without waiting on the desktop flag. */
	.wp-lightbox-overlay.zoom.active .lightbox-image-container:first-of-type {
		visibility: hidden;
	}
	.wp-lightbox-overlay.zoom.active .lightbox-image-container,
	.wp-lightbox-overlay.zoom.show-closing-animation:not(.active) .lightbox-image-container {
		animation: none !important;
		width: calc(100vw - 24px) !important;
		height: auto !important;
		overflow: visible !important;
		/* Chrome Android: a fixed overlay extends under the URL bar, so
		   50% of the overlay sits below the visible center. Center on the
		   small viewport height (what's actually visible) instead. */
		top: 50% !important;
		top: 50svh !important;
		transform: translate(-50%, -50%) !important;
	}
	/* Let the image box size to its content instead of a fixed height, and
	   center it in the full viewport box. The caption floats below it. */
	.wp-lightbox-overlay .lightbox-image-container .wp-block-image {
		width: 100%;
		height: auto !important;
		margin: 0 auto;
	}
	.wp-lightbox-overlay .lightbox-image-container img,
	.wp-lightbox-overlay .lightbox-image-container .wp-block-image img {
		min-width: 0 !important;
		min-height: 0 !important;
		/* width:auto let a short max-height pull the sides in.
		   Screen width stays. 88px is the 64px X plus one caption line. */
		width: calc(100vw - 24px) !important;
		height: auto !important;
		max-width: calc(100vw - 24px) !important;
		max-height: calc(100vh - 88px) !important;
		max-height: calc(100dvh - 88px) !important;
		max-height: calc(100svh - env(safe-area-inset-top, 0px) - 88px) !important;
		object-fit: contain !important;
		margin: 0 auto;
	}
	/* Landscape phone: ~390px tall. Centering + a big pad made
	   the photo a strip and the caption clamp pushed it behind the
	   picture. Park the photo just under the X, leave a fixed
	   strip below for the caption. */
	@media (orientation: landscape) {
		.wp-lightbox-overlay.zoom.active .lightbox-image-container,
		.wp-lightbox-overlay.zoom.show-closing-animation:not(.active) .lightbox-image-container {
			top: calc(env(safe-area-inset-top, 0px) + 44px) !important;
			transform: translate(-50%, 0) !important;
		}
		.wp-lightbox-overlay .lightbox-image-container img,
		.wp-lightbox-overlay .lightbox-image-container .wp-block-image img {
			/* Short screen: height leads, or a wide photo becomes a strip. */
			width: auto !important;
			max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px) !important;
			max-height: calc(100vh - 100px) !important;
			max-height: calc(100dvh - 100px) !important;
			max-height: calc(100svh - env(safe-area-inset-top, 0px) - 100px) !important;
		}
		.nrm-lightbox-caption {
			font-size: 0.85rem;
			line-height: 1.35;
		}
	}
	.wp-lightbox-overlay {
		touch-action: manipulation;
		/* Pin to all four edges. No height or width units. vh / dvh / svh
		   follow iOS Safari's URL-bar viewport and come up short. top /
		   right / bottom / left on a fixed overlay always covers the
		   screen, whatever the bar is doing. */
		top: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		left: 0 !important;
		width: auto !important;
		height: auto !important;
		/* A firm press on the photo summons iOS's magnifier, Live Text and
		   callout machinery, which interrupts the touch stream mid-gesture
		   and leaves core's lightbox in a half-pressed state. Inside the
		   lightbox those system affordances are unwanted, so strip them. */
		-webkit-touch-callout: none;
		-webkit-user-select: none;
		user-select: none;
		-webkit-user-drag: none;
	}
}

/* Lightbox trigger, touch only.
   Core shows the tiny Enlarge button on hover. Phones have no hover, so
   the first tap only reveals it and a second tap opens. Two taps to look
   at a photo. On touch, stretch the invisible trigger over the whole
   image so one tap anywhere opens it. Desktop stays as core left it. */
@media (pointer: coarse) {
	.wp-lightbox-container button.lightbox-trigger {
		width: 100%;
		height: 100%;
		top: 0;
		right: 0;
		border-radius: 0;
		opacity: 0;
		background: transparent;
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
}
