/* Keep the homepage flush with the navigation without changing other pages or bottom-tab clearance. */
html body #container.ns-content:has(> .ns-site-home) {
    padding-block-start: var(--ns-gap);
    padding-inline: var(--ns-gap);
}
.ns-site-home {
    container: ns-home / inline-size;
    margin: 0;
    min-width: 0;
    color: var(--ns-text);
    font-family: var(--ns-font, system-ui), sans-serif;
}
.ns-site-home * { box-sizing: border-box; }
.ns-site-home :is(.nsh-hero, .nsh-service) {
    min-width: 0;
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-g-radius, 12px);
    background: var(--ns-card-bg);
    box-shadow: var(--ns-glass-shadow);
}
/* Follow the same Glass setting as board content without fading text or images. */
@supports (background-color: color-mix(in srgb, red 80%, transparent)) {
    .ns-site-home :is(.nsh-hero, .nsh-service) {
        background-color: color-mix(in srgb, var(--ns-card-bg) var(--ns-g-card, 100%), transparent);
    }
}
.ns-site-home .nsh-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: center;
    gap: 18px;
    padding: clamp(22px, 3cqw, 46px);
    min-height: clamp(320px, 36cqw, 420px);
}
.ns-site-home .nsh-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse at 80% 48%, rgba(var(--ns-primary-rgb), .15), transparent 58%),
        linear-gradient(var(--ns-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--ns-border) 1px, transparent 1px);
    background-size: auto, 44px 44px, 44px 44px;
    opacity: .42;
    mask-image: linear-gradient(90deg, transparent 15%, #000);
}
.ns-site-home .nsh-hero-copy { z-index: 1; min-width: 0; }
.ns-site-home .nsh-eyebrow {
    margin: 0 0 12px;
    color: var(--ns-text-secondary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: .11em;
}
.ns-site-home .nsh-eyebrow span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-inline-end: 6px;
    border-radius: 2px;
    background: var(--ns-text-secondary);
}
.ns-site-home :is(h1, h2, h3) {
    margin: 0;
    color: var(--ns-text);
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.18;
}
.ns-site-home h1 { font-size: clamp(30px, 5.6cqw, 66px); }
.ns-site-home .nsh-lead {
    margin: 16px 0;
    color: var(--ns-text-secondary);
    font-size: clamp(13px, 1.4cqw, 15px);
    line-height: 1.65;
    word-break: keep-all;
}
.ns-site-home .nsh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ns-site-home .nsh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--ns-border);
    border-radius: 8px;
    background: var(--ns-card-bg);
    color: var(--ns-text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.ns-site-home .nsh-primary {
    border-color: var(--ns-primary);
    background: var(--ns-primary);
    color: var(--ns-on-primary);
}
.ns-site-home .nsh-button:hover { border-color: var(--ns-primary); }
.ns-site-home .nsh-primary:hover { background: var(--ns-primary-hover); color: var(--ns-on-hover); }
.ns-site-home .nsh-visual {
    display: grid;
    place-items: center;
    min-width: 0;
    pointer-events: none;
}
.ns-site-home .nsh-visual img {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    filter: drop-shadow(0 12px 18px #0003);
}
.ns-site-home .nsh-tags {
    z-index: 1;
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 6px;
    list-style: none;
    margin: 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--ns-border);
}
.ns-site-home .nsh-tags li {
    max-inline-size: 100%;
    padding: 3px 8px;
    border: 1px solid var(--ns-border);
    border-radius: 999px;
    background: var(--ns-surface, var(--ns-card-bg));
    color: var(--ns-text);
    font-size: 11px;
    line-height: 1.4;
}
.ns-site-home .nsh-section { margin: clamp(22px, 3cqw, 38px) 0; scroll-margin-top: 60px; }
.ns-site-home .nsh-section-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: end;
    gap: 6px 12px;
    margin-bottom: 12px;
}
.ns-site-home .nsh-section-heading .nsh-eyebrow { margin-bottom: 5px; }
.ns-site-home h2 { font-size: clamp(20px, 2.35cqw, 26px); }
.ns-site-home .nsh-section-heading > p { margin: 0; color: var(--ns-text-secondary); font-size: 12px; }
.ns-site-home .nsh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.ns-site-home .nsh-service {
    --nsh-thumb: min(29%, 132px);
    display: grid;
    grid-template-columns: var(--nsh-thumb) minmax(0, 1fr);
    grid-template-areas: "media copy" "link link";
    grid-template-rows: 1fr auto;
    gap: 10px 12px;
    padding: clamp(10px, 1.35cqw, 16px);
    color: var(--ns-text);
    text-decoration: none;
    transition: border-color .2s;
}
.ns-site-home .nsh-service:hover { border-color: var(--ns-primary); }
.ns-site-home .nsh-service-media {
    grid-area: media;
    position: relative;
    align-self: center;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    background: var(--ns-surface, var(--ns-card-bg));
}
.ns-site-home .nsh-service-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ns-site-home .nsh-service-media > span {
    position: absolute;
    inset: 4px auto auto 4px;
    padding: 2px 4px;
    border: 1px solid #ffffff38;
    border-radius: 4px;
    background: #16181a;
    color: #fff;
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
}
.ns-site-home .nsh-service-body {
    grid-area: copy;
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 4px;
}
.ns-site-home .nsh-service-body p { margin: 0; color: var(--ns-text-secondary); font-size: 12px; line-height: 1.55; }
.ns-site-home .nsh-service-body .nsh-kicker { font-size: 9px; letter-spacing: .07em; font-weight: 800; }
.ns-site-home h3 { font-size: clamp(15px, 1.65cqw, 18px); }
.ns-site-home .nsh-service-link {
    grid-area: link;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--ns-border);
    font-size: 12px;
    font-weight: 700;
}
.ns-site-home a:focus-visible { outline: 2px solid var(--ns-focus-ring, currentColor); outline-offset: 2px; }
.ns-site-home .nsh-hero a:focus-visible { outline-offset: -3px; }

/* In the two-column grid, reverse the middle row without changing link order. */
@container ns-home (min-width: 580px) {
    @media (min-width: 768px) {
        html:not(.ns-mobile) .ns-site-home .nsh-service:is(:nth-child(3), :nth-child(4)) {
            grid-template-columns: minmax(0, 1fr) var(--nsh-thumb);
            grid-template-areas: "copy media" "link link";
        }
    }
}
@container ns-home (max-width: 579.98px) {
    .ns-site-home .nsh-grid { grid-template-columns: minmax(0, 1fr); }
    .ns-site-home .nsh-service:nth-child(even) {
        grid-template-columns: minmax(0, 1fr) var(--nsh-thumb);
        grid-template-areas: "copy media" "link link";
    }
    .ns-site-home .nsh-hero {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        min-height: 0;
        padding: 20px clamp(12px, 3.6cqw, 20px) 15px;
        gap: 12px;
    }
    .ns-site-home .nsh-visual {
        position: absolute;
        inset: 25px 0 auto auto;
        width: clamp(104px, 36cqw, 168px);
        opacity: .22;
        mask-image: linear-gradient(90deg, transparent, #000 40%);
    }
    html[data-ns-mode="dark"] .ns-site-home .nsh-visual { opacity: .30; }
    .ns-site-home h1 { font-size: clamp(29px, 7.7cqw, 45px); }
    .ns-site-home .nsh-lead { margin: 12px 0; }
    .ns-site-home .nsh-lead br { display: none; }
    .ns-site-home .nsh-eyebrow { font-size: 10px; }
    .ns-site-home .nsh-grid { gap: 8px; }
}
/* Also keep one column on phones in landscape when GNUBOARD serves the mobile skin. */
html.ns-mobile .ns-site-home .nsh-grid { grid-template-columns: minmax(0, 1fr); }
html.ns-mobile .ns-site-home .nsh-service:nth-child(even) {
    grid-template-columns: minmax(0, 1fr) var(--nsh-thumb);
    grid-template-areas: "copy media" "link link";
}
html.ns-mobile .ns-site-home .nsh-visual img { max-width: 168px; }
@media (max-width: 767px) {
    .ns-site-home .nsh-grid { grid-template-columns: minmax(0, 1fr); }
    .ns-site-home .nsh-service:nth-child(even) {
        grid-template-columns: minmax(0, 1fr) var(--nsh-thumb);
        grid-template-areas: "copy media" "link link";
    }
}
@media (max-width: 1199px) {
    /* Give the eyebrow room next to the existing floating menu controls. */
    body:has(#ns-mobile-config[data-rail="0"]) .ns-site-home .nsh-hero-copy .nsh-eyebrow,
    body:has(#ns-right-config[data-mobile="1"]) .ns-site-home .nsh-hero-copy .nsh-eyebrow {
        max-inline-size: calc(100% - 46px);
    }
    body:has(#ns-mobile-config[data-rail="0"]):has(#ns-right-config[data-mobile="1"]) .ns-site-home .nsh-hero-copy .nsh-eyebrow {
        max-inline-size: calc(100% - 96px);
    }
}
@media (prefers-reduced-motion: reduce) {
    .ns-site-home .nsh-service { transition: none; }
}
