* {
    box-sizing: border-box;
}

:root {
    --bg: #d9d9d9;
    --panel: #ffffff;
    --line: #d8d8d8;
    --text: #262626;
    --muted: #676767;
    --link: #1565a8;
    --accent: #3a608d;
    --accent-dark: #121e2d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    --button-bg: #3a608d;
    --button-bg-dark: #121e2d;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

.site-shell {
    width: min(1120px, calc(100% - 24px));
    margin: 0 auto;
    padding: 10px 0 24px;
}

.site-header {
    margin-bottom: 12px;
}

.banner {
    position: relative;
    min-height: 280px;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
    background: #8aa0b6;
    box-shadow: var(--shadow);
}

.banner-slides {
    position: relative;
    min-height: 320px;
}

.banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.45s ease;
}

.banner-slide.is-active {
    opacity: 1;
    z-index: 1;
}

.banner-slide img,
.banner-fallback {
    display: block;
    width: 100%;
    height: 320px;
    object-fit: cover;
}

.banner-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 2rem;
    background: linear-gradient(135deg, #638bb5, #304f74);
}

.banner-overlay {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 18px 22px;
    background: linear-gradient(to top, rgba(0,0,0,.5), rgba(0,0,0,.15), rgba(0,0,0,0));
    z-index: 3;
}

.banner-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.banner-site-title {
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    font-weight: 700;
}

.banner-site-tagline {
    font-size: 0.98rem;
    opacity: 0.95;
}

.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    z-index: 4;
    font-size: 1.9rem;
    transition: background .2s ease, transform .2s ease;
}

.banner-arrow:hover {
    background: rgba(0, 0, 0, 0.62);
}

.banner-prev { left: 0; }
.banner-next { right: 0; }

.banner-dots {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 4;
}

.banner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(255,255,255,.55);
    cursor: pointer;
}

.banner-dot.is-active {
    background: #fff;
}

.main-layout {
    display: grid;
    /* grid-template-columns: 220px minmax(0, 1fr); */
    grid-template-columns: 3fr 10fr;
    gap: 14px;
    align-items: start;
    overflow: visible;
}

.sidebar {
    min-width: 0;
}

@media (min-width: 901px) {
    .sidebar {
        position: sticky;
        top: 12px;
        align-self: start;
        height: fit-content;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }

    .sidebar-box {
        position: relative;
    }
}

.menu-toggle,
.menu-backdrop {
    display: none;
}

.sidebar-box,
.page-card {
    background: var(--panel);
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,.05);
}

.sidebar-title {
    padding: 2px 12px;
    background: linear-gradient(var(--accent), var(--accent-dark));
    color: #fff;
    font-weight: 300;
    font-size: 0.85rem;
    border-radius: 4px 4px 0 0;
}

.menu {
    display: flex;
    flex-direction: column;
}

.menu-link {
    display: block;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    color: #4b4b4b;
    font-size: 0.95rem;
    background: linear-gradient(#fafafa, #f1f1f1);
}

.menu-link:hover {
    background: #fff;
    text-decoration: none;
}

.menu-link.is-active {
    color: var(--link);
    font-weight: 700;
    background: #fff;
}

.content-area {
    min-width: 0;
}

.page-card {
    padding: 18px 20px 24px;
}

.notice {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #f0c36d;
    background: #fff7df;
}

.content h1,
.content h2,
.content h3 {
    color: #235f8f;
    margin: 0 0 10px;
}

.content h1 {
    font-size: 1.8rem;
    padding-bottom: 8px;
    border-bottom: 1px dotted #d7d7d7;
}

.content h2 {
    font-size: 1.25rem;
    margin-top: 1.4rem;
}

.content p {
    margin: 0 0 1rem;
}

.content ul,
.content ol {
    margin: 0 0 1rem 1.4rem;
}

.content::after {
    content: '';
    display: block;
    clear: both;
}

.photo-box {
    margin: 1rem 0;
}

.photo-box.left {
    float: left;
    width: min(300px, 48%);
    margin: 0.2rem 1.1rem 1rem 0;
}

.photo-box.right {
    float: right;
    width: min(300px, 48%);
    margin: 0.2rem 0 1rem 1.1rem;
}

.photo-box.center {
    max-width: 440px;
    margin-inline: auto;
}

.thumb,
.gallery-item img {
    display: block;
    width: 100%;
    border: 4px solid #fff;
    border-radius: 4px;
    box-shadow: 0 10px 18px rgba(0,0,0,.16);
}

.photo-box figcaption {
    margin-top: 8px;
    font-size: 0.92rem;
    color: var(--muted);
}

.gallery-block,
.youtube-block {
    margin: 1.35rem 0 1.55rem;
}

.gallery-grid,
.youtube-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.gallery-item {
    display: block;
}

.gallery-item img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .2s ease, box-shadow .2s ease;
}

.gallery-item:hover img {
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(0,0,0,.2);
}

.youtube-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: linear-gradient(#fbfbfb, #f3f3f3);
}

.youtube-card.is-playing {
    background: #fff;
}

.youtube-embed-trigger {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.youtube-embed-trigger:hover .youtube-thumb img {
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(0,0,0,.2);
}

.youtube-thumb {
    position: relative;
    display: block;
}

.youtube-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.youtube-play {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,.62);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
}

.youtube-label {
    font-weight: 700;
}

.youtube-player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
    box-shadow: 0 10px 18px rgba(0,0,0,.16);
}

.youtube-player-wrap iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.youtube-fallback-link {
    margin: 0;
}

.site-footer {
    padding: 16px 4px 0;
    color: #666;
    font-size: 0.92rem;
    text-align: right;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(16, 22, 30, 0.72);
    backdrop-filter: blur(10px);
    z-index: 2000;
}

.lightbox-overlay.is-open {
    display: grid;
}

.lightbox-stage {
    position: relative;
    width: min(92vw, 1200px);
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    border-radius: 6px;
    box-shadow: 0 20px 50px rgba(0,0,0,.45);
    background: #fff;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: rgba(0,0,0,.45);
}

.lightbox-close {
    top: -16px;
    right: -16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    font-size: 1.9rem;
}

.lightbox-prev { left: -70px; }
.lightbox-next { right: -70px; }

.lightbox-caption {
    margin-top: 14px;
    text-align: center;
    color: #fff;
    font-size: 0.96rem;
}

body.lightbox-open {
    overflow: hidden;
}

body.mobile-menu-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .site-header {
        padding-top: 0;
    }

    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, calc(100vw - 52px));
        padding: 70px 12px 18px;
        z-index: 1500;
        transform: translateX(calc(-100% - 16px));
        transition: transform .28s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-box {
        box-shadow: 0 18px 34px rgba(0,0,0,.18);
    }

    .menu-toggle {
        position: fixed;
        top: 14px;
        right: 14px;
        left: auto;
        z-index: 1600;
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 48px;
        height: 48px;
        padding: 0 11px;
        border: 1px solid rgba(0,0,0,.14);
        border-radius: 10px;
        background: rgba(255,255,255,.92);
        box-shadow: 0 10px 28px rgba(0,0,0,.18);
        cursor: pointer;
        backdrop-filter: blur(8px);
    }

    .menu-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        border-radius: 999px;
        background: #2c2c2c;
        transition: transform .22s ease, opacity .22s ease;
    }

    .menu-toggle.is-active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .menu-toggle.is-active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1400;
        border: 0;
        padding: 0;
        background: rgba(14, 18, 24, .42);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
    }

    body.mobile-menu-open .menu-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .photo-box.left,
    .photo-box.right {
        float: none;
        width: auto;
        margin: 1rem 0;
    }
}

@media (max-width: 640px) {
    .site-shell {
        width: min(100%, calc(100% - 10px));
        padding-top: 5px;
    }

    .site-header {
        padding-top: 0;
    }

    .page-card {
        padding: 14px;
    }

    .banner-slide img,
    .banner-fallback {
        height: 240px;
    }

    .banner-arrow {
        width: 46px;
        height: 46px;
    }

    .menu-toggle {
        top: 10px;
        right: 10px;
        left: auto;
        width: 44px;
        height: 44px;
        padding-inline: 10px;
    }

    .sidebar {
        width: min(300px, calc(100vw - 34px));
        padding-top: 62px;
    }

    .lightbox-overlay {
        padding: 16px;
    }

    .lightbox-prev,
    .lightbox-next {
        top: auto;
        bottom: -64px;
        transform: none;
    }

    .lightbox-prev { left: 0; }
    .lightbox-next { right: 0; }
}

.sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-inner {
    padding: 12px;
}

.sidebar-search-box {
    overflow: visible;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.search-input {
    width: 100%;
    min-width: 0;
    padding: 2px 12px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    font: inherit;
}

.search-submit {
    padding: 2px 12px;
    border: 0;
    border-radius: 6px;
    background: linear-gradient(var(--button-bg), var(--button-bg-dark));
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.search-help {
    margin-top: 8px;
    font-size: 0.84rem;
    color: var(--muted);
}

.search-live-results {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(0,0,0,.08);
    overflow: hidden;
}

.search-live-top {
    padding: 10px 12px;
    background: #f7f7f7;
    color: var(--muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
}

.search-live-list {
    display: flex;
    flex-direction: column;
}

.search-live-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-top: 1px solid #efefef;
}

.search-live-item:first-child {
    border-top: 0;
}

.search-live-item strong {
    color: var(--text);
}

.search-live-item span {
    color: var(--muted);
    font-size: 0.88rem;
}

.search-live-more,
.search-live-empty {
    display: block;
    padding: 10px 12px;
}

.search-live-more {
    border-top: 1px solid var(--line);
    font-weight: 700;
}

.sidebar-taxonomy,
.tag-cloud {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.taxonomy-link,
.tag-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafafa;
    color: var(--text);
}

.tag-cloud {
    flex-direction: row;
    flex-wrap: wrap;
}

.tag-link {
    justify-content: flex-start;
}

.taxonomy-link.is-active,
.tag-link.is-active {
    border-color: rgba(242, 102, 58, .4);
    background: rgba(242, 102, 58, .08);
}

.tag-link span,
.taxonomy-link strong {
    color: var(--muted);
}

.page-hero {
    margin: 0 0 16px;
}

.page-hero img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0,0,0,.12);
}

.page-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.page-chip,
.page-meta-date {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f2f4f6;
    color: #47515c;
    font-size: 0.9rem;
}

.page-chip.section {
    background: rgba(21, 101, 168, .1);
    color: var(--link);
}

.listing-head,
.archive-head {
    margin-bottom: 14px;
}

.listing-head h2,
.archive-head h1 {
    margin: 0 0 6px;
}

.archive-head p,
.archive-count {
    margin: 0;
    color: var(--muted);
}

.archive-count {
    margin-top: 6px;
    font-weight: 700;
}

.page-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.page-teaser-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0,0,0,.05);
}

.page-teaser-image {
    display: block;
    background: #eef3f7;
}

.page-teaser-image img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.page-teaser-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    height: 100%;
}

.page-teaser-meta,
.page-teaser-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-date {
    color: var(--muted);
    font-size: 0.9rem;
}

.page-teaser-card h3 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.3;
}

.page-teaser-card p {
    margin: 0;
    color: #424242;
}

.page-read-more {
    margin-top: auto;
    font-weight: 700;
}

.related-pages,
.archive-results {
    margin-top: 18px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.pagination-link.is-active {
    border-color: rgba(242, 102, 58, .4);
    background: rgba(242, 102, 58, .12);
    font-weight: 700;
}

.live-search-panel {
    margin-bottom: 12px;
}

@media (max-width: 900px) {
    .sidebar-stack {
        gap: 12px;
    }

    .page-card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .search-row {
        grid-template-columns: 1fr;
    }
}
