/* Reserve the fixed header's space before JavaScript measures its exact height. */
body {
    padding-top: 117px;
    padding-top: calc(117px + env(safe-area-inset-top, 0px));
}

.navbar.solid { top: calc(36px + env(safe-area-inset-top, 0px)); }
#hero { scroll-margin-top: calc(117px + env(safe-area-inset-top, 0px)); }

.nl-notice-bar {
    --notice-bg: #fff3d4;
    --notice-ink: #382708;
    --notice-border: #e2b857;
    --notice-label: #5b3b06;
    --notice-label-text: #fff7e0;
}

html.dark .nl-notice-bar {
    --notice-bg: #edce86;
    --notice-ink: #2e200a;
    --notice-border: #a17725;
    --notice-label: #583805;
    --notice-label-text: #fff7e0;
}

.nl-notice-bar {
    background: var(--notice-bg);
    color: var(--notice-ink);
    border-block: 1px solid var(--notice-border);
}

.nl-notice-bar[hidden] { display: none; }

.nl-notice-trigger, .nl-notice-nav, .nl-notice-close {
    font: inherit;
    cursor: pointer;
}

.nl-notice-trigger {
    display: flex;
    align-items: center;
    gap: 13px;
    width: min(100%, 1200px);
    min-height: 54px;
    margin: 0 auto;
    padding: 8px 24px;
    border: 0;
    background: none;
    color: inherit;
    text-align: left;
}

.nl-notice-label, .nl-notice-more {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-weight: 800;
}

.nl-notice-label {
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--notice-label);
    color: var(--notice-label-text);
    font-size: .81rem;
}

.nl-notice-headline {
    flex: 1;
    min-width: 0;
    font-size: .98rem;
    font-weight: 800;
    line-height: 1.4;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.nl-notice-more {
    padding: 4px 10px;
    border: 1px solid var(--notice-border);
    border-radius: 6px;
    font-size: .8rem;
}

.nl-notice-trigger:hover .nl-notice-headline {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nav-links .nl-notice-nav {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: .95rem;
    font-weight: 600;
}

.nav-links .nl-notice-nav:hover { color: var(--accent-secondary); }

.nl-notice-dialog {
    --notice-soft: #f2f5fa;
    --notice-ink: #263655;
    --notice-line: #dce3ee;
    width: min(100% - 32px, 620px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    color: var(--text-primary);
    background: var(--bg-color);
    border: 1px solid var(--notice-line);
    border-radius: 20px;
    box-shadow: 0 22px 72px #090d2350;
}

html.dark .nl-notice-dialog {
    --notice-soft: #151e31;
    --notice-ink: #c9d9ff;
    --notice-line: #2a3953;
}

.nl-notice-dialog::backdrop { background: #090d2394; }
html:has(.nl-notice-dialog[open]) { overflow-y: hidden; }

.nl-notice-panel { padding: 26px; }
.nl-notice-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.nl-notice-header h2 { font-size: 1.65rem; }

.nl-notice-close {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--notice-soft);
    color: inherit;
}

.nl-notice-list { border-top: 1px solid var(--notice-line); }
.nl-notice-entry { border-bottom: 1px solid var(--notice-line); }

.nl-notice-entry summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto 8px;
    align-items: center;
    gap: 12px;
    padding: 14px 6px;
    cursor: pointer;
    list-style: none;
}

.nl-notice-entry summary::-webkit-details-marker { display: none; }

.nl-notice-entry summary::after {
    content: '';
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
}

.nl-notice-entry[open] summary::after { transform: translateY(2px) rotate(225deg); }
.nl-notice-entry summary:hover { background: var(--notice-soft); }
.nl-notice-entry-title { font-size: .95rem; font-weight: 700; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.nl-notice-entry time { color: var(--text-secondary); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nl-notice-badge { padding: 3px 9px; border-radius: 20px; background: var(--notice-soft); color: var(--notice-ink); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.is-important .nl-notice-badge { background: var(--notice-ink); color: var(--notice-soft); }
.nl-notice-body { margin: 0 0 14px; padding: 14px 16px; border-radius: 10px; background: var(--notice-soft); font-size: .92rem; line-height: 1.7; word-break: keep-all; overflow-wrap: anywhere; white-space: pre-wrap; }
.nl-notice-body a { color: var(--notice-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.nl-notice-empty { padding-block: 18px 6px; font-size: .92rem; }

:is(.nl-notice-trigger, .nl-notice-nav, .nl-notice-close, .nl-notice-entry summary):focus-visible {
    outline: 2px solid var(--notice-ink, var(--accent-secondary));
    outline-offset: -3px;
}

@media (max-width: 768px) {
    .nav-links.open li .nl-notice-nav {
        display: block;
        width: 100%;
        padding: 14px 24px;
        text-align: center;
    }
    .nl-notice-trigger { padding-inline: 14px; gap: 9px; }
    .nl-notice-headline { font-size: .9rem; }
    .nl-notice-label, .nl-notice-more { padding-inline: 7px; }
}

@media (max-width: 520px) {
    .nl-notice-panel { padding: 18px; }
    .nl-notice-header h2 { font-size: 1.45rem; }
    .nl-notice-entry summary { grid-template-columns: auto 1fr 9px; gap: 3px 8px; }
    .nl-notice-entry-title { grid-column: 1 / 3; grid-row: 2; }
    .nl-notice-entry summary::after { grid-column: 3; grid-row: 1 / 3; }
}

@media (max-width: 360px) {
    .nl-notice-more span { display: none; }
}
