/* ==========================================================================
   Differance Lab — main stylesheet
   TCD116-B inspired: white-based minimal, 3-column card grid, generous whitespace.
   Brand: Navy #1c3666 + Gold #c8a45c.
   ========================================================================== */

/* ---------- Custom properties ---------- */
:root {
    /* Brand */
    --color-primary: #1c3666;
    --color-accent:  #c8a45c;

    /* Surface / text */
    --color-bg:       #fefefe;
    --color-text:     #1a1a1a;
    --color-text-sub: #6b6b6b;
    --color-border:   #e5e5e5;
    --color-surface-alt: #f7f7f5;

    /* Category colors */
    --color-cat-philosophy: #6b4f8a;
    --color-cat-physics:    #2e5e7e;
    --color-cat-investing:  #6b3838;
    --color-cat-arts:       #4a6b5d;
    --color-cat-systems:    #3b3b6b;

    /* Typography */
    --font-serif-jp: "Noto Serif JP", "Shippori Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
    --font-sans-jp:  "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    --font-serif-en: "Playfair Display", "EB Garamond", Georgia, serif;
    --font-body:     var(--font-sans-jp);
    --font-heading:  var(--font-serif-jp);
    --font-display:  var(--font-serif-en);

    /* Layout */
    --container-max:    1300px;
    --container-narrow: 760px;
    --gap:    1.5rem;
    --gap-lg: 3rem;
    --header-h: 72px;

    /* Motion */
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.8;
    font-feature-settings: "palt";
}

img,
svg,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .2s var(--ease), opacity .2s var(--ease);
}

a:hover {
    color: var(--color-accent);
}

button {
    font: inherit;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 1em;
}

p {
    margin: 0 0 1em;
}

ul, ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

/* ---------- A11y helpers ---------- */
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 0.5em 1em;
    background: var(--color-primary);
    color: #fff;
}

.skip-link:focus {
    left: 1em;
    top: 1em;
}

/* ---------- Container ---------- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container--narrow {
    max-width: 1000px;
    width: 70%;
}

@media (max-width: 768px) {
    .container--narrow {
        width: 100%;
    }
}

/* Two-pane layout: main column + right sidebar.
 * Used by single / page / archive / search / home / index.
 * Below 1024px the sidebar drops below the main column.
 */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 4em;
    align-items: start;
}

@media (max-width: 1024px) {
    .layout-with-sidebar {
        /* `1fr` alone is `minmax(auto, 1fr)`, where `auto` lets the
         * track grow to fit the widest child (wide tables / pre /
         * KaTeX SVGs / long URLs). That makes the article column
         * width vary by article on mobile. `minmax(0, 1fr)` clamps
         * the minimum to 0 so the grid stays at the container width
         * and overflow is handled per-element instead. */
        grid-template-columns: minmax(0, 1fr);
        gap: 3em;
    }
}

/* Belt-and-suspenders: ensure the content track itself doesn't
 * blow out from a wide descendant (pre with overflow-x: auto can
 * still push min-content if min-width isn't pinned to 0). */
.layout-with-sidebar > .content {
    min-width: 0;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--color-border);
    /* background + backdrop-filter live on ::before so that
     * .site-header is NOT a containing block for fixed descendants
     * (the mobile slide-out nav uses position: fixed and would
     * otherwise be clipped to the 72-pixel header rectangle). */
}

.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(254, 254, 254, 0.96);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    backdrop-filter: saturate(140%) blur(8px);
    z-index: -1;
    pointer-events: none;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    height: var(--header-h);
}

.site-header__logo-text {
    font-family: "Times New Roman", Times, serif;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: var(--color-primary);
    font-weight: 400;
}

.site-header__menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    /* reset user-agent button defaults so the icon centres correctly
     * inside the box on iOS Safari and Chrome. */
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.site-header__menu-toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform .3s var(--ease);
}

/* ---------- Site nav ---------- */
.site-nav__list {
    display: flex;
    gap: 1.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav__link {
    font-size: 0.92rem;
    color: var(--color-text);
    letter-spacing: 0.02em;
}

.site-nav__link:hover {
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .site-header__menu-toggle {
        display: flex;
    }
    .site-nav {
        position: fixed;
        top: var(--header-h);
        right: 0;
        /* no `left`, no `bottom` — width and height both collapse
         * to content; the panel sits anchored to the top-right
         * (under the hamburger). */
        max-height: calc(100vh - var(--header-h));
        background: var(--color-bg);
        padding: 1.5rem 1.75rem 1.75rem;
        border-left: 1px solid var(--color-border);
        border-bottom: 1px solid var(--color-border);
        /* drop-down: hidden above viewport, slides down on open.
         * translate by (own height + header height) so the panel's
         * bottom edge clears the viewport top regardless of how
         * tall the menu is. shadow is animated in only when open
         * so it doesn't peek into the header while collapsed. */
        box-shadow: 0 0 0 transparent;
        transform: translateY(calc(-100% - var(--header-h)));
        transition: transform .3s var(--ease), box-shadow .3s var(--ease);
        overflow-y: auto;
    }
    .site-nav.is-open {
        transform: translateY(0);
        box-shadow: 0 8px 16px -8px rgba(0, 0, 0, 0.12);
    }
    .site-nav__list {
        flex-direction: column;
        gap: 1.25rem;
    }
}

/* ---------- Intro hero (contained navy band — JA front page & /en/) ---------- */
.intro-hero {
    background: var(--color-primary);
    color: #fff;
    padding: 2.6em 0 2.2em;
    margin-bottom: 2.5em;
}

.intro-hero__eyebrow {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0.7;
    margin: 0 0 0.6em;
}

.intro-hero__title {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 3vw, 1.95rem);
    line-height: 1.4;
    margin: 0 0 0.6em;
    color: #fff;
    font-weight: 600;
}

.intro-hero__lead {
    max-width: 50em;
    font-size: 0.92rem;
    line-height: 1.75;
    opacity: 0.9;
    margin: 0;
}

.intro-hero__lead a {
    color: var(--color-accent);
}

/* ---------- Concept-graph hero (front-page) ---------- */
.graph-hero {
    background: var(--color-primary);
    color: #fff;
    padding: 1.6em 0 1.4em;
    margin-bottom: 2.5em;
}

.graph-hero__eyebrow {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0.7;
    margin: 0 0 0.8em;
    text-align: center;
}

.graph-hero__canvas {
    width: 100%;
    height: 560px;
    background: rgba(0, 0, 0, 0.20);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    cursor: grab;
}
.graph-hero__canvas:active { cursor: grabbing; }
.graph-hero__canvas.dlab-graph--error {
    background: rgba(0, 0, 0, 0.25);
}
.graph-hero__canvas.dlab-graph--error::after {
    content: "グラフを読み込めませんでした";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
}

.graph-hero__caption {
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.78);
    margin: 1.0em 0 0;
}
.graph-hero__caption a {
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 164, 92, 0.5);
}
.graph-hero__caption a:hover {
    border-bottom-color: var(--color-accent);
}

.graph-hero__swatch {
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    margin: 0 0.2em 0 0.55em;
    vertical-align: 0.06em;
}
.graph-hero__swatch--philosophy { background: #a8a0d8; }
.graph-hero__swatch--physics    { background: #7fc4c4; }
.graph-hero__swatch--systems    { background: #c8a45c; }
.graph-hero__swatch--investing  { background: #e0b06b; }
.graph-hero__swatch--arts       { background: #d68f8f; }
.graph-hero__swatch--reading    { background: #a8c799; }
.graph-hero__swatch--tag        { background: #d8d8d8; border: 1px solid rgba(255,255,255,0.5); box-sizing: border-box; }

/* force-graph's HTML tooltip container (injected as a child of <body>). */
.graph-tooltip {
    background: rgba(28, 54, 102, 0.96) !important;
    color: #fff !important;
    border: 1px solid rgba(200, 164, 92, 0.4) !important;
    border-radius: 4px !important;
    padding: 0.55em 0.75em !important;
    font-family: var(--font-body) !important;
    font-size: 0.82rem !important;
    line-height: 1.55 !important;
    max-width: 26em !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35) !important;
}
.dlab-graph__tip-title {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 0.35em;
}
.dlab-graph__tip-count {
    color: var(--color-accent);
    font-weight: 400;
    font-size: 0.85em;
}
.dlab-graph__tip-articles {
    list-style: none;
    margin: 0 0 0.5em;
    padding: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.88);
}
.dlab-graph__tip-articles li {
    padding: 0.12em 0 0.12em 0.6em;
    border-left: 2px solid rgba(200, 164, 92, 0.4);
    margin-bottom: 0.18em;
    line-height: 1.45;
}
.dlab-graph__tip-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding-top: 0.2em;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Context menu (right-click on the graph canvas). */
.dlab-graph__menu {
    position: fixed;
    z-index: 9999;
    min-width: 16em;
    background: rgba(28, 54, 102, 0.96);
    color: #fff;
    border: 1px solid rgba(200, 164, 92, 0.4);
    border-radius: 4px;
    padding: 0.3em;
    font-family: var(--font-body);
    font-size: 0.85rem;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    user-select: none;
}
.dlab-graph__menu button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.5em 0.9em;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    border-radius: 3px;
    line-height: 1.4;
}
.dlab-graph__menu button:hover,
.dlab-graph__menu button:focus {
    background: rgba(200, 164, 92, 0.18);
    color: #ffd98a;
    outline: none;
}

@media (max-width: 720px) {
    .graph-hero__canvas { height: 400px; }
    .graph-hero__caption { font-size: 0.78rem; line-height: 2.1; }
}

/* ---------- Pickup (front-page hero-下、横長カード×3) ---------- */
.pickup {
    margin: var(--gap-lg) 0;
}

.pickup__head,
.top-feed__head,
.cat-feed__head,
.spine__head {
    display: flex;
    align-items: center;
    gap: 1.25em;
    margin-bottom: 0;
}

.pickup__title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin: 0;
    color: var(--color-primary);
    flex-shrink: 0;
}

.pickup__rule {
    flex: 1;
    height: 1px;
    background: var(--color-primary);
    opacity: 0.25;
}

.pickup__list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-lg);
}

@media (max-width: 900px) {
    .pickup__list {
        grid-template-columns: 1fr;
    }
}

.pickup-card {
    background: #fff;
    transition: transform .3s var(--ease);
}

.pickup-card:hover {
    transform: translateY(-2px);
}

.pickup-card__link {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 1.1em;
    color: inherit;
    text-decoration: none;
    align-items: center;
}

.pickup-card__thumb {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    background: var(--cat-color, var(--color-primary));
}

.pickup-card__thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    /* tint disabled — pickup thumbs render in original colour for now. */
    background: transparent;
    pointer-events: none;
}

.pickup-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    /* desaturation disabled — see .card__img comment. */
}

.pickup-card__marker {
    position: absolute;
    bottom: 0.55em;
    left: 0.7em;
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0.1em;
    font-style: italic;
    z-index: 2;
}

.pickup-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.4em;
}

.pickup-card__category {
    font-family: var(--font-display);
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    color: var(--cat-color, var(--color-primary));
    text-transform: uppercase;
    margin: 0;
}

.pickup-card__title {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    line-height: 1.5;
    margin: 0;
    color: var(--color-text);
    font-weight: 500;
}

.pickup-card:hover .pickup-card__title {
    color: var(--color-primary);
}

.pickup-card__date {
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-style: italic;
    color: var(--color-text-sub);
    letter-spacing: 0.04em;
}

/* ---------- Project spine (front-page: BoK / Engineering, full-bleed band) ---------- */
.spine {
    background: var(--color-surface-alt);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.spine__inner {
    padding-top: clamp(2.5rem, 6vw, 4rem);
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

.spine__title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin: 0;
    line-height: 1;
    color: var(--color-primary);
    flex-shrink: 0;
}

.spine__rule {
    flex: 1;
    height: 1px;
    background: var(--color-primary);
    opacity: 0.25;
}

.spine__more {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    text-decoration: none;
    flex-shrink: 0;
}

.spine__more:hover {
    color: var(--color-accent);
}

.spine__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-lg);
    margin-top: 1.25rem;
}

.spine__card {
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    background: #fff;
    padding: 1.5rem 1.6rem 1.6rem;
}

.spine__card--bok {
    border-top-color: var(--color-cat-philosophy);
}

.spine__card--eng {
    border-top-color: var(--color-cat-systems);
}

.spine__card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
    color: var(--color-primary);
    display: flex;
    align-items: baseline;
    gap: 0.7em;
    flex-wrap: wrap;
}

.spine__card-sub {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--color-text-sub);
}

.spine__card-lead {
    font-size: 0.86rem;
    line-height: 1.7;
    color: var(--color-text);
    margin: 0 0 0.8rem;
}

.spine__links {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.86rem;
    line-height: 1.7;
}

.spine__links > li {
    padding-left: 1em;
    text-indent: -1em;
}

.spine__links > li::before {
    content: "▸ ";
    color: var(--color-accent);
}

.spine__links a {
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.spine__links a:hover {
    border-bottom-color: var(--color-accent);
}

/* Compact variant (EN landing): not a band — a plain divider section
 * with an inline link row, sitting inside the container. */
.spine--compact {
    background: transparent;
    border-top: none;
    border-bottom: none;
    padding: var(--gap-lg) 0 0;
}

.spine--compact .spine__card-lead {
    margin: 1rem 0 0.6rem;
}

.spine__links--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em 1.4em;
}

.spine__links--inline > li {
    padding-left: 0;
    text-indent: 0;
}

@media (max-width: 720px) {
    .spine__grid {
        grid-template-columns: 1fr;
        gap: var(--gap);
    }
}

/* ========== Front page: the system map ========== */
.map {
    padding-top: clamp(2.5rem, 6vw, 4rem);
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

.map-part {
    padding: clamp(2rem, 4.5vw, 3rem) 0;
    border-top: 1px solid var(--color-border);
}

.map-part:first-child {
    border-top: none;
    padding-top: 0;
}

.map-part__head {
    margin-bottom: 1.6rem;
}

.map-part__label {
    margin: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4em 0.9em;
}

.map-part__name {
    font-family: var(--font-heading);
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-primary);
}

.map-part__sub {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 400;
    color: var(--color-text-sub);
}

.map-part__about {
    margin: 0.7rem 0 0;
    font-size: 0.9rem;
    line-height: 1.85;
    color: var(--color-text-sub);
    max-width: 52em;
}

/* TOC-style list of entries — one row per entry, hairline separators. */
.map-part__list {
    display: grid;
    gap: 0;
}

.map-entry {
    display: block;
    padding: 0.95rem 0.2rem 0.95rem 1rem;
    border-top: 1px solid var(--color-border);
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background-color .15s var(--ease), border-left-color .15s var(--ease);
}

.map-part__list .map-entry:first-child {
    border-top: none;
}

.map-entry:hover {
    background: var(--color-surface-alt);
    border-left-color: var(--cat-color, var(--color-primary));
}

.map-entry__title {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--color-text);
}

.map-entry:hover .map-entry__title {
    color: var(--color-primary);
}

.map-entry--page .map-entry__title::after {
    content: ' ↗';
    font-size: 0.78em;
    color: var(--color-text-sub);
    vertical-align: 0.05em;
}

.map-entry__dek {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--color-text-sub);
}

/* ---------- Feed divider (front-page section headers) ---------- */
.feed-divider {
    display: flex;
    align-items: center;
    gap: 1.25em;
    margin: clamp(2rem, 5vw, 3.5rem) 0 0;
    padding-top: clamp(1.5rem, 4vw, 2.5rem);
    border-top: 1px solid var(--color-border);
}

.feed-divider--first {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: none;
}

.feed-divider__title {
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
}

.feed-divider__rule {
    flex: 1;
    height: 1px;
    background: var(--color-primary);
    opacity: 0.25;
}

.feed-divider__more {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    text-decoration: none;
    flex-shrink: 0;
}

.feed-divider__more:hover {
    color: var(--color-accent);
}

/* ---------- Recent list (front-page: compact strip of latest posts) ---------- */
.recent-list {
    list-style: none;
    margin: 1.2rem 0 0;
    padding: 0;
    columns: 2;
    column-gap: var(--gap-lg);
}

.recent-list__item {
    display: flex;
    align-items: baseline;
    gap: 0.8em;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    break-inside: avoid;
}

.recent-list__link {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--color-text);
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.recent-list__link:hover {
    color: var(--color-primary);
}

.recent-list__date {
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-style: italic;
    color: var(--color-text-sub);
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .recent-list {
        columns: 1;
    }
}

/* ---------- Tag list (front-page: 「主題から探す」 / 「カテゴリで絞る」) ---------- */
.tag-list {
    list-style: none;
    margin: 1.2rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.65rem;
}

.tag-list__item a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
    padding: 0.4em 0.85em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    color: var(--color-text);
    text-decoration: none;
    transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease);
}

.tag-list__item a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-surface-alt);
}

.tag-list__count {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-style: italic;
    color: var(--color-text-sub);
}

/* Concept tags read a touch heavier than the category row. */
.tag-list--concept .tag-list__item a {
    border-color: color-mix(in srgb, var(--color-primary) 28%, transparent);
}

.tag-list--category {
    margin-top: 0.9rem;
}

.tag-list--category .tag-list__item a {
    font-size: 0.86rem;
    padding: 0.32em 0.7em;
}

/* The hub list reuses .map-part__list / .map-entry (TOC-row style). */
.hub-list .map-entry {
    border-left-color: transparent;
}

/* ---------- Top feed (front-page latest grid) ---------- */
.top-feed {
    /* Small top margin only — separates the grid from the
     * 「最新の論考」 divider without padding out the cat-feed
     * sections that follow. */
    margin: 1rem 0 0;
}

.top-feed__title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin: 0;
    line-height: 1;
    color: var(--color-primary);
    flex-shrink: 0;
}

.top-feed__rule {
    flex: 1;
    height: 1px;
    background: var(--color-primary);
    opacity: 0.25;
}

/* ---------- Category feed (per-category front-page section) ---------- */
.cat-feed {
    margin: 0.5rem 0 0;
}

.cat-feed__title {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin: 0;
    line-height: 1;
    color: var(--cat-color, var(--color-primary));
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.cat-feed__rule {
    flex: 1;
    height: 1px;
    background: var(--cat-color, var(--color-primary));
    opacity: 0.3;
}

.cat-feed__more,
.archive-tail {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    text-decoration: none;
    flex-shrink: 0;
}

.cat-feed__more:hover {
    color: var(--color-accent);
}

/* ---------- Archive tail (front-page bottom link) ---------- */
.archive-tail {
    display: block;
    text-align: center;
    margin: 0 auto;
    padding: 0.25em 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-primary);
}

.archive-tail:hover {
    color: var(--color-accent);
}

/* ---------- Card grid ---------- */
.card-grid {
    display: grid;
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.card-grid--2col {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap-lg);
}

.card-grid--3col {
    grid-template-columns: repeat(3, 1fr);
    /* row-gap 36px / column-gap 8px. align-items: start lets each
     * card size to its content, eliminating empty white space
     * that grid's default stretch would leave under shorter cards. */
    gap: 36px 0.5rem;
    align-items: start;
}

/* Front-page cards: pack title/date close to the image.
 * The 2-col listings (archive/search/home) keep the roomier
 * default body padding from .card__body. */
.card-grid--3col .card__body {
    padding: 0 0.05em 0;
}

.card-grid--3col .card__meta {
    margin-bottom: 0.15em;
}

@media (max-width: 900px) {
    .card-grid--3col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .card-grid--2col,
    .card-grid--3col {
        grid-template-columns: 1fr;
        gap: var(--gap);
    }
}

/* ---------- Card (4:3 area above, text stack below) ----------
 * The 4:3 area shows one of three things, in priority order:
 *   - book cover (.card__img) for book posts
 *   - article excerpt (.card__thumb-text) for everything else
 *   - serial marker (.card__thumb-marker) when neither applies
 *
 * Stock / Unsplash imagery is no longer rendered on listings —
 * the excerpt-on-colour block replaces it, so the visual real
 * estate carries information about the article's content. */
.card {
    background: #fff;
    padding: 6px 0;
    transition: transform .3s var(--ease);
}

.card:hover {
    transform: translateY(-2px);
}

.card__link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.card__thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background-color: var(--cat-color, var(--color-primary));
    /* Subtle highlight so the colour block isn't visually flat
     * when no image is layered on top. */
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 60%);
}

.card__thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s var(--ease);
    position: relative;
    z-index: 1;
}

.card__link:hover .card__img {
    transform: scale(1.04);
}

.card__thumb-marker {
    position: absolute;
    bottom: 1.1em;
    left: 1.2em;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0.12em;
    font-style: italic;
    z-index: 2;
}

.card__thumb-text {
    position: absolute;
    inset: auto 0 0 0;
    margin: 0;
    padding: 1.6em 1.2em 1em;
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.82rem;
    line-height: 1.6;
    /* Dark gradient backing so the excerpt reads against any
     * underlying image. The transparent top fades into the image
     * over ~40% of the strip's height. */
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 40%, rgba(0, 0, 0, 0.85) 100%);
    /* 3-line clamp at the bottom of the 4:3 area. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    z-index: 2;
}

.card__body {
    padding: 1.1em 0.1em 0;
}

.card__meta {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
    font-family: var(--font-display);
    font-size: 0.72rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    margin-bottom: 0.3em;
}

.card__category {
    color: var(--cat-color, var(--color-primary));
    text-transform: uppercase;
    letter-spacing: 0.22em;
}

.card__sep {
    color: var(--color-text-sub);
}

.card__date {
    color: var(--color-text-sub);
    font-style: italic;
}

.card__title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    line-height: 1.3;
    color: var(--color-text);
    font-weight: 500;
    margin: 0;
    /* Plain block + fixed 2-line height + overflow: hidden.
     * Avoids -webkit-box quirks; titles longer than two lines get
     * clipped (no ellipsis), but every card gets exactly the same
     * title block height. */
    display: block;
    height: 2.6em;
    overflow: hidden;
}

.card:hover .card__title {
    color: var(--color-primary);
}

/* ---------- Category badge ---------- */
.post-category-badge {
    display: inline-block;
    padding: 0.35em 0.85em;
    background: var(--color-primary);
    color: #fff !important;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    border-radius: 2px;
    text-decoration: none;
}

/* ---------- Archive header / Single / Page ---------- */
.archive-header,
.error-header {
    margin: var(--gap-lg) 0 var(--gap);
    text-align: center;
}

.archive-header__title,
.error-header__title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-primary);
    margin: 0 0 0.5em;
}

.archive-header__desc,
.error-header__desc {
    color: var(--color-text-sub);
}

/* Single post / page article only — NOT cards. WP's post_class()
 * adds .post to every <article>, including grid cards, so we scope
 * this rule to body.single (single post template) to keep cards
 * tight on the front page and archives. */
.single .post,
.page-article {
    padding: var(--gap-lg) 0;
}

.post__header,
.page-article__header {
    text-align: center;
    margin-bottom: var(--gap-lg);
}

.post__title,
.page-article__title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--color-primary);
    margin: 0.5em 0;
}

.post__meta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    color: var(--color-text-sub);
    font-size: 0.85rem;
}

.post__thumb,
.page-article__thumb {
    margin: 0 0 var(--gap-lg);
}

/* Article thumbnails render in full colour — the front-page card grid
 * supplies the unified monochrome treatment, but inside an article the
 * imagery is shown as-is. .page-article__thumb (static pages) keeps
 * the desaturation. */
.page-article__thumb img {
    filter: grayscale(1) contrast(1.04);
}

/* Hero video variant: when an article declares hero_video in its
 * front-matter, the single-post template (template-parts/content-single.php)
 * substitutes a <video> for the featured image inside .post__thumb.
 * The featured image is preserved on archive cards / OGP shares only.
 */
.post__thumb--video {
    text-align: center;
}

/* width:100% + height:auto fills the rendered column, with the actual
 * pixel cap supplied per-video via inline `style="max-width: Npx"` from
 * the template. publish_articles.py derives that cap from intrinsic
 * aspect × VIDEO_HERO_MAX_HEIGHT so portrait/square sources never grow
 * tall enough to dominate the layout. */
.post__thumb--video video {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0 auto;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.post__thumb--video figcaption {
    margin: 0.7em auto 0;
    max-width: 880px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--color-text-sub);
    text-align: left;
}

/* ---------- Book card (affiliate / PR) ---------- */
.book-card {
    position: relative;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    margin: 0 0 var(--gap-lg);
    padding: 1.5rem;
    background: #fafaf6;
    border: 1px solid rgba(28, 54, 102, 0.12);
}

/* Float variant: card sits on the right and body text wraps around it.
 * Compact vertical layout (cover on top, body below) at ~45% width. */
.book-card--float {
    float: right;
    width: 45%;
    max-width: 320px;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin: 0.3em 0 1rem 1.5rem;
    padding: 1.1rem;
    text-align: center;
}

.book-card--float .book-card__cover {
    margin: 0 auto;
    max-width: 140px;
}

.book-card--float .book-card__title {
    font-size: 1rem;
}

.book-card--float .book-card__author,
.book-card--float .book-card__pub {
    font-size: 0.82rem;
}

.book-card--float .book-card__cta {
    align-self: center;
    font-size: 0.78rem;
    padding: 0.5em 0.9em;
}

@media (max-width: 720px) {
    .book-card--float {
        float: none;
        width: 100%;
        max-width: none;
        margin: 0 0 var(--gap);
    }
}

@media (max-width: 560px) {
    .book-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.book-card__label {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: var(--color-text-sub);
}

.book-card__cover {
    display: block;
    line-height: 0;
}

.book-card__cover-img {
    display: block;
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    /* affiliate covers stay in full colour — no grayscale filter */
}

.book-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.book-card__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--color-primary);
    margin: 0 0 0.4em;
    font-weight: 600;
}

.book-card__author,
.book-card__pub {
    font-size: 0.9rem;
    color: var(--color-text);
    margin: 0 0 0.2em;
    line-height: 1.5;
}

.book-card__pub {
    color: var(--color-text-sub);
    font-size: 0.82rem;
}

.book-card__cta {
    display: inline-block;
    margin-top: 0.9em;
    padding: 0.55em 1.1em;
    background: var(--color-primary);
    color: #fff !important;
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-decoration: none;
    align-self: flex-start;
    transition: background .2s var(--ease);
}

@media (max-width: 560px) {
    .book-card__cta {
        align-self: center;
    }
}

.book-card__cta:hover {
    background: var(--color-accent);
    color: #fff;
}

.book-card__disclosure {
    margin: 1em 0 0;
    padding-top: 0.7em;
    border-top: 1px dashed var(--color-border);
    font-size: 0.7rem;
    line-height: 1.55;
    color: var(--color-text-sub);
}

.post__content,
.page-article__content {
    font-size: 1.02rem;
    line-height: 1.75;
    /* establish a new BFC so floated children (e.g. .book-card--float)
     * are contained and the parent box clears properly. */
    display: flow-root;
}


.post__content h2,
.page-article__content h2 {
    margin-top: 2em;
    color: var(--color-primary);
}

.post__content blockquote,
.page-article__content blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-alt);
    color: var(--color-text-sub);
    font-style: italic;
}

/* Tables — horizontal rules only under the header row and after the final body row */
.post__content table,
.page-article__content table {
    margin: 2.5em auto;
    border-collapse: collapse;
    max-width: 100%;
    font-size: 0.95em;
    line-height: 1.55;
    /* width: auto — columns size to their content, no forced 100% stretch */
}

.post__content thead,
.page-article__content thead {
    border-top: 1px solid var(--color-primary);
    border-bottom: 1px solid var(--color-primary);
}

.post__content tbody,
.page-article__content tbody {
    border-bottom: 1px solid var(--color-primary);
}

.post__content th,
.page-article__content th {
    text-align: left;
    padding: 0.5em 1em;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--color-primary);
    background: transparent;
    border: none;
    white-space: nowrap; /* short headers (e.g. 感覚) must not break */
}

.post__content td,
.page-article__content td {
    padding: 0.55em 1em;
    border: none;
    vertical-align: top;
}

/* Leftmost column: centered label */
.post__content th:first-child,
.post__content td:first-child,
.page-article__content th:first-child,
.page-article__content td:first-child {
    text-align: center;
}

@media (max-width: 560px) {
    .post__content table,
    .page-article__content table {
        font-size: 0.88em;
        margin: 1.75em auto;
    }
    .post__content th,
    .post__content td,
    .page-article__content th,
    .page-article__content td {
        padding: 0.55em 0.55em;
    }
}

/* Inline code & code blocks */
.post__content code,
.page-article__content code {
    background: var(--color-surface-alt);
    padding: 0.1em 0.4em;
    border-radius: 2px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
    color: var(--color-primary);
}

.post__content pre,
.page-article__content pre {
    background: var(--color-surface-alt);
    padding: 1em 1.2em;
    border-left: 3px solid var(--color-border);
    overflow-x: auto;
    margin: 1.5em 0;
    line-height: 1.6;
}

.post__content pre code,
.page-article__content pre code {
    background: none;
    padding: 0;
    color: var(--color-text);
    font-size: 0.9em;
}

/* Embedded body media (video / image) — see scripts/publish_articles.py
 * render_body_media(): {{media:KEY}} placeholders are replaced server-side
 * with <figure class="article-figure article-figure--{video|image}"> blocks
 * containing a <video> or <img> plus an optional <figcaption>.
 */
.post__content .article-figure,
.page-article__content .article-figure {
    margin: 2.25em 0;
    text-align: center;
}

.post__content .article-figure video,
.post__content .article-figure img,
.page-article__content .article-figure video,
.page-article__content .article-figure img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.post__content .article-figure--video video,
.page-article__content .article-figure--video video {
    /* Per-video pixel cap is supplied inline by render_body_media() in
     * publish_articles.py, derived from intrinsic aspect × VIDEO_BODY_
     * MAX_HEIGHT. This rule just provides a sane default ceiling for
     * the case where dimensions could not be probed. */
    max-width: 880px;
}

.post__content .article-figure figcaption,
.page-article__content .article-figure figcaption {
    margin: 0.75em auto 0;
    max-width: 880px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--color-text-sub);
    text-align: left;
}

/* Footnotes (python-markdown footnotes extension)
 * Article authoring convention: end the markdown body with a
 * `## 参考文献` heading so the auto-placed footnote section sits
 * under it as a styled references list. The auto <hr> is suppressed
 * to avoid a redundant rule under the heading.
 */
.post__content .footnote,
.page-article__content .footnote {
    margin-top: 1em;
    font-size: 0.9em;
    color: var(--color-text-sub);
}

.post__content .footnote > hr,
.page-article__content .footnote > hr {
    display: none;
}

.post__content .footnote ol,
.page-article__content .footnote ol {
    padding-left: 1.5em;
}

.post__content .footnote li,
.page-article__content .footnote li {
    margin-bottom: 0.5em;
    line-height: 1.7;
}

.post__content .footnote-ref,
.page-article__content .footnote-ref {
    text-decoration: none;
    color: var(--color-primary);
    font-size: 0.85em;
    padding: 0 0.15em;
}

.post__content .footnote-backref,
.page-article__content .footnote-backref {
    text-decoration: none;
    color: var(--color-text-sub);
    margin-left: 0.4em;
}

.post__footer {
    margin-top: var(--gap-lg);
    padding-top: var(--gap);
    border-top: 1px solid var(--color-border);
}

.post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.post__tags a {
    color: var(--color-text-sub);
}

.post__tags a:hover {
    color: var(--color-accent);
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    /* sticky activates only when the parent .layout-with-sidebar is taller */
}

@media (max-width: 1024px) {
    .sidebar {
        position: static;
    }
}

.sidebar__widget {
    margin-bottom: 2.5em;
}

.sidebar__widget-title {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    color: var(--color-primary);
    text-transform: uppercase;
    margin: 0 0 1em;
    padding-bottom: 0.55em;
    border-bottom: 1px solid var(--color-primary);
}

.sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar__list li {
    margin-bottom: 0.85em;
    line-height: 1.55;
    font-size: 0.92rem;
}

.sidebar__list a {
    color: var(--color-text);
    text-decoration: none;
    transition: color .2s var(--ease);
}

.sidebar__list a:hover {
    color: var(--color-accent);
}

.sidebar__count {
    color: var(--color-text-sub);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-style: italic;
    margin-left: 0.4em;
}

/* Sidebar category list with colour dot */
.sidebar__list--categories li {
    display: block;
}

.sidebar__list--categories a {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.sidebar__cat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--cat-color, var(--color-primary));
    flex-shrink: 0;
}

.sidebar__cat-name {
    flex: 1;
}

/* Sidebar tag cloud */
.sidebar__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 0.7em;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.82rem;
}

.sidebar__tags a {
    color: var(--color-text-sub);
    text-decoration: none;
    transition: color .2s var(--ease);
}

.sidebar__tags a:hover {
    color: var(--color-accent);
}

/* Search form inside sidebar shrinks to its container */
.sidebar .search-form {
    max-width: none;
    flex-direction: column;
    gap: 0.5em;
}

.sidebar .search-form__submit {
    align-self: flex-start;
}

/* ---------- Search form ---------- */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 0 auto;
    max-width: 480px;
}

.search-form__input {
    flex: 1;
    padding: 0.6em 0.8em;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font: inherit;
}

.search-form__submit {
    padding: 0.6em 1.4em;
    background: var(--color-primary);
    color: #fff;
    transition: background .2s var(--ease);
}

.search-form__submit:hover {
    background: var(--color-accent);
}

/* ---------- Buttons ---------- */
.button {
    display: inline-block;
    padding: 0.6em 1.6em;
    background: var(--color-primary);
    color: #fff !important;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: background .2s var(--ease);
}

.button:hover {
    background: var(--color-accent);
    color: #fff !important;
}

/* ---------- Pagination ---------- */
.pagination,
.nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: var(--gap-lg) 0;
}

.page-numbers {
    padding: 0.5em 0.9em;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.9rem;
}

.page-numbers.current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 5rem;
    padding: 3.5rem 0 1.5rem;
    background: var(--color-surface-alt);
    border-top: 1px solid var(--color-border);
    color: var(--color-text);
}

.site-footer__top {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: var(--gap-lg);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .site-footer__top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.site-footer__logo-text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--color-primary);
    margin: 0 0 0.5rem;
}

.site-footer__tagline {
    font-size: 0.85rem;
    color: var(--color-text-sub);
}

.site-footer__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.site-footer__sns {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.site-footer__sns-link:hover {
    color: var(--color-accent);
}

.site-footer__tags {
    margin: 2rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 0.75em;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
}

.tag-cloud__link {
    color: var(--color-text-sub);
}

.tag-cloud__link:hover {
    color: var(--color-accent);
}

.site-footer__bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.site-footer__copyright {
    font-size: 0.78rem;
    color: var(--color-text-sub);
    margin: 0;
}

/* ---------- RSVP form (event pages) ---------- */
.rsvp {
    width: 80%;
    max-width: 1100px;
    margin: 3rem auto 4rem;
    padding: 0 1rem;
}

@media (max-width: 768px) {
    .rsvp {
        width: 100%;
    }
}

.rsvp__header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.rsvp__eyebrow {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    margin: 0 0 0.5em;
}

.rsvp__eyebrow-expansion {
    margin-left: 0.6em;
    letter-spacing: 0.04em;
    text-transform: none;
    font-size: 0.85em;
    opacity: 0.75;
}

/* ---------- Theme landing (intellectual-production / tool-design / pc-environment) ---------- */
.theme-hero {
    background: var(--color-surface-alt);
    padding: 2.4em 0 1.8em;
    margin-bottom: 2.5em;
    border-bottom: 1px solid var(--color-border);
}

.theme-hero__eyebrow {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    margin: 0 0 0.5em;
}

.theme-hero__title {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    line-height: 1.3;
    margin: 0 0 0.6em;
    color: var(--color-primary);
}

.theme-hero__lead {
    max-width: 48em;
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--color-text-sub);
    margin: 0;
}

.theme-feed {
    margin-bottom: 4em;
}

/* ---------- English landing (page-en.php) — hero uses .intro-hero ---------- */
.en-empty {
    padding: 1.5em 0;
    color: var(--color-text-sub);
    font-size: 0.95rem;
    line-height: 1.7;
}

.en-back {
    text-align: center;
    margin: 4em 0 2em;
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.en-back a {
    color: var(--color-text-sub);
    text-decoration: none;
}

.en-back a:hover {
    color: var(--color-primary);
}

/* ---------- Cross-language toggle on single posts ---------- */
.post-lang-toggle {
    margin: 0.7em 0 0;
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.post-lang-toggle a {
    display: inline-block;
    padding: 0.3em 0.85em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-text-sub);
    text-decoration: none;
    transition: color .2s var(--ease), border-color .2s var(--ease);
}

.post-lang-toggle a:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* ---------- Header language switcher (JA / EN tabs) ----------
 * Both labels are always visible; the current language is non-clickable
 * and highlighted. Stable visual position across JA / EN chrome. */
.site-header__lang-tabs {
    margin-left: 1.2em;
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    align-self: center;
    line-height: 1;
}

.site-header__lang-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.4em 0.65em;
    font-family: var(--font-display);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    color: var(--color-text-sub);
    text-decoration: none;
    background: transparent;
    transition: color .2s var(--ease), background .2s var(--ease);
}

.site-header__lang-tab + .site-header__lang-tab {
    border-left: 1px solid var(--color-border);
}

.site-header__lang-tab.is-active {
    background: var(--color-primary);
    color: #fff;
}

a.site-header__lang-tab:hover {
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .site-header__lang-tabs {
        margin-left: 0.6em;
    }
    .site-header__lang-tab {
        padding: 0.3em 0.5em;
        font-size: 0.68rem;
    }
}

.rsvp__title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: var(--color-primary);
    margin: 0 0 1em;
    line-height: 1.3;
}

.rsvp__meta {
    display: grid;
    gap: 0.6em;
    margin: 0;
}

.rsvp__meta > div {
    display: grid;
    grid-template-columns: 5em 1fr;
    gap: 0.8em;
    font-size: 0.95rem;
    line-height: 1.6;
}

.rsvp__meta dt {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: var(--color-text-sub);
    margin: 0;
    padding-top: 0.2em;
}

.rsvp__meta dd {
    margin: 0;
    color: var(--color-text);
}

.rsvp__address {
    font-size: 0.85em;
    color: var(--color-text-sub);
}

@media (max-width: 560px) {
    .rsvp__meta > div {
        grid-template-columns: 1fr;
        gap: 0.1em;
    }
    .rsvp__meta dt {
        padding-top: 0;
    }
}

.rsvp__notice {
    padding: 1.2em 1.4em;
    background: #f6f1e8;
    border-left: 3px solid var(--color-accent);
    color: var(--color-text);
    font-size: 0.95rem;
}

.rsvp__notice--closed {
    background: #f0eded;
    border-left-color: var(--color-text-sub);
}

.rsvp__form {
    display: flex;
    flex-direction: column;
    gap: 1.2em;
}

.rsvp__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.rsvp__field {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}

.rsvp__field label,
.rsvp__field .rsvp__label {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--color-text);
    font-weight: 500;
}

.rsvp__req {
    display: inline-block;
    margin-left: 0.5em;
    padding: 0.1em 0.45em;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    border-radius: 2px;
    vertical-align: middle;
}

.rsvp__opt {
    display: inline-block;
    margin-left: 0.5em;
    color: var(--color-text-sub);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.rsvp__field input[type="text"],
.rsvp__field input[type="email"],
.rsvp__field input[type="number"],
.rsvp__field select,
.rsvp__field textarea {
    font: inherit;
    width: 100%;
    padding: 0.7em 0.9em;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-text);
    transition: border-color .15s var(--ease);
    box-sizing: border-box;
}

.rsvp__field input:focus,
.rsvp__field select:focus,
.rsvp__field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.rsvp__field textarea {
    resize: vertical;
    min-height: 5em;
}

.rsvp__field--radio {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5em 1.2em;
}

.rsvp__field--radio .rsvp__label {
    flex-basis: 100%;
}

.rsvp__radio {
    font-family: var(--font-body);
    font-size: 0.95rem;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
}

/* ---- Pill-style toggle (independent buttons) ---- */
.rsvp__toggle-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5em;
    background: transparent;
    border: 0;
    width: auto;
    max-width: 100%;
}

.rsvp__toggle {
    margin: 0;
    cursor: pointer;
    position: relative;
    flex: 0 0 auto;
}

.rsvp__toggle input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.rsvp__toggle span {
    display: inline-block;
    padding: 0.35em 1em;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: var(--color-primary);
    text-align: center;
    background: #fff;
    border: 1.5px solid var(--color-primary);
    border-radius: 999px;
    transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
    user-select: none;
    white-space: nowrap;
}

.rsvp__toggle:hover span {
    background: rgba(28, 54, 102, 0.08);
}

.rsvp__toggle input:checked + span {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(28, 54, 102, 0.25);
}

.rsvp__toggle input:focus-visible + span {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.rsvp__hint {
    font-size: 0.78rem;
    color: var(--color-text-sub);
    line-height: 1.5;
}

.rsvp__actions {
    margin-top: 1em;
}

.rsvp__submit {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-family: var(--font-display);
    font-size: 0.92rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 1em 2.4em;
    background: var(--color-primary);
    color: #fff;
    border-radius: 2px;
    transition: background .2s var(--ease);
}

.rsvp__submit:hover {
    background: var(--color-accent);
}

.rsvp__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rsvp__status {
    margin: 0.5em 0 0;
    padding: 0.8em 1em;
    font-size: 0.92rem;
    line-height: 1.5;
    min-height: 1em;
}

.rsvp__status:empty {
    display: none;
}

.rsvp__status--success {
    background: #ecf3ec;
    border-left: 3px solid #4a8454;
    color: #2d4d33;
}

.rsvp__status--error {
    background: #fbeded;
    border-left: 3px solid var(--color-accent);
    color: var(--color-accent);
}

/* ---------- Combined RSVP form additions ---------- */
.rsvp__lead {
    margin: 0.5em 0 0;
    font-size: 0.95rem;
    color: var(--color-text-sub);
    line-height: 1.6;
}

.rsvp__group {
    border: 0;
    margin: 0 0 2em;
    padding: 1.4em 0 0;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.rsvp__group:first-of-type {
    border-top: 0;
    padding-top: 1em;
}

.rsvp__group-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-primary);
    margin: 0 0 0.4em;
    padding: 0;
    line-height: 1.4;
    font-weight: 600;
}

.rsvp__group-sub {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text-sub);
    font-weight: 400;
    margin-left: 0.5em;
}

.rsvp__group--event {
    background: #fafaf6;
    padding: 1.4em 1.4em 1.6em;
    border: 1px solid var(--color-border);
    border-radius: 3px;
}

.rsvp__group--event .rsvp__group-title {
    margin-top: 0;
}

.rsvp__group--event[data-closed] {
    opacity: 0.65;
}

.rsvp__meta--inline {
    margin: 0 0 1em;
    padding: 0.6em 0.9em;
    background: #fff;
    border-left: 2px solid var(--color-primary);
    font-size: 0.88rem;
}

.rsvp__meta--inline > div {
    grid-template-columns: 4em 1fr;
    gap: 0.5em;
}

.rsvp__meta--inline dt {
    font-size: 0.7rem;
    padding-top: 0.15em;
}

.rsvp__conditional {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin-top: 0.5em;
    padding: 1em 1.2em;
    background: #fff;
    border-left: 2px solid var(--color-accent);
}

/* ---------- Combined RSVP: 3-column event grid ---------- */
.rsvp__event-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 0 0 2em;
    align-items: start;
}

@media (max-width: 768px) {
    .rsvp__event-grid {
        grid-template-columns: 1fr;
    }
}

.rsvp__event-card {
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: #fafaf6;
    padding: 0 1.1rem 1.2rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7em;
    overflow: hidden;
}

.rsvp__event-card[data-closed] {
    opacity: 0.55;
}

/* Navy ribbon at the top of each card — date + title together. */
.rsvp__event-card-title {
    margin: 0 -1.1rem;
    padding: 0.75em 1.1rem;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    line-height: 1.3;
}

.rsvp__event-card-date {
    font-family: var(--font-display);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.78);
}

.rsvp__event-card-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: #fff;
    font-weight: 600;
}

.rsvp__event-card-meta {
    margin: 0;
    padding-top: 0.5em;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    font-size: 0.84rem;
    line-height: 1.5;
}

.rsvp__event-card-meta > div {
    display: grid;
    grid-template-columns: 3.2em 1fr;
    gap: 0.5em;
}

.rsvp__event-card-meta dt {
    font-family: var(--font-display);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    color: var(--color-text-sub);
    margin: 0;
    padding-top: 0.25em;
}

.rsvp__event-card-meta dd {
    margin: 0;
    color: var(--color-text);
}

.rsvp__event-card-meta a {
    font-size: 0.78rem;
}

.rsvp__event-card-attendance {
    margin-top: auto;
    padding-top: 0.7em;
    border-top: 1px solid var(--color-border);
}

.rsvp__event-card-note {
    margin: 0;
    padding: 0.3em 0.6em;
    background: transparent;
    color: var(--color-accent);
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: 600;
    border-left: 3px solid var(--color-accent);
    letter-spacing: 0.02em;
}

.rsvp__event-card .rsvp__notice--closed {
    margin: 0;
    padding: 0.5em 0.7em;
    text-align: center;
    font-size: 0.85rem;
}

/* ---------- Attendance status (Notion embed) ---------- */
.attendance-status {
    max-width: 1100px;
    margin: 3rem auto 4rem;
    padding: 0 1rem;
}

.attendance-status__header {
    margin-bottom: 1.5rem;
}

.attendance-status__title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: var(--color-primary);
    margin: 0 0 0.4em;
    line-height: 1.3;
}

.attendance-status__lead {
    margin: 0;
    color: var(--color-text-sub);
    font-size: 0.9rem;
    line-height: 1.6;
}

.attendance-status__embed {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: #fff;
}

.attendance-status__iframe {
    width: 100%;
    height: 78vh;
    min-height: 480px;
    border: 0;
    display: block;
}

.attendance-status__fallback {
    margin-top: 0.8em;
    font-size: 0.85rem;
    color: var(--color-text-sub);
}

/* ---------- Attendance admin dashboard ---------- */
.attendance-admin {
    max-width: 1500px;
    margin: 2rem auto 4rem;
    padding: 0 1.5rem;
}

.attendance-admin__header {
    margin-bottom: 1.5rem;
    padding: 0;
}

.attendance-admin__title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.5vw, 2rem);
    color: var(--color-primary);
    margin: 0 0 0.4em;
    line-height: 1.3;
}

.attendance-admin__lead {
    margin: 0 0 1.2em;
    color: var(--color-text-sub);
    font-size: 0.9rem;
    line-height: 1.6;
}

.attendance-admin__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    margin: 0 0 1.5rem;
}

.attendance-admin__summary-card {
    background: #fafaf6;
    border-left: 3px solid var(--color-primary);
    padding: 0.7em 1em;
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.attendance-admin__summary-card--alert {
    border-left-color: var(--color-accent);
}

.attendance-admin__summary-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--color-text-sub);
}

.attendance-admin__summary-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--color-primary);
    font-weight: 600;
}

.attendance-admin__summary-card--alert .attendance-admin__summary-value {
    color: var(--color-accent);
}

.attendance-admin__summary-card--cash {
    border-left-color: #2f7d32;
}

.attendance-admin__summary-card--cash .attendance-admin__summary-value {
    color: #2f7d32;
    font-variant-numeric: tabular-nums;
}

.attendance-admin__summary-sub {
    font-family: var(--font-display);
    font-size: 0.72rem;
    color: var(--color-text-sub);
    letter-spacing: 0.04em;
}

.attendance-admin__table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: #fff;
}

.attendance-admin__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.4;
    min-width: 1200px;
}

.attendance-admin__table th,
.attendance-admin__table td {
    padding: 0.5em 0.6em;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.attendance-admin__table th {
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-sub);
    background: #fafaf6;
    position: sticky;
    top: 0;
    z-index: 1;
}

.attendance-admin__table tbody tr {
    transition: background-color .15s var(--ease);
}

.attendance-admin__table tbody tr:hover {
    background: #faf7f1;
}

.attendance-admin__name {
    font-weight: 500;
    color: var(--color-primary);
}

.attendance-admin__part {
    font-family: var(--font-display);
    color: var(--color-text-sub);
}

.attendance-admin__paypay,
.attendance-admin__allergy {
    font-size: 0.8rem;
    color: var(--color-text-sub);
    max-width: 12em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendance-admin__select,
.attendance-admin__date,
.attendance-admin__text {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.25em 0.4em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: #fff;
    color: var(--color-text);
    width: 100%;
    box-sizing: border-box;
}

.attendance-admin__date { min-width: 7em; }
.attendance-admin__text { min-width: 6em; }

.attendance-admin__select:focus,
.attendance-admin__date:focus,
.attendance-admin__text:focus {
    outline: none;
    border-color: var(--color-primary);
}

.attendance-admin__action {
    white-space: nowrap;
    text-align: center;
    min-width: 8em;
}

.attendance-admin__save {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    padding: 0.4em 1em;
    border-radius: 2px;
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}

.attendance-admin__save:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.attendance-admin__save:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.attendance-admin__row-status {
    display: block;
    font-size: 0.72rem;
    margin-top: 0.4em;
    color: var(--color-text-sub);
    line-height: 1.3;
    min-height: 1em;
}

.attendance-admin__row-status.is-saving {
    color: var(--color-primary);
}

.attendance-admin__row-status.is-success {
    color: #2d6b3a;
    font-weight: 500;
}

.attendance-admin__row-status.is-error {
    color: var(--color-accent);
    font-weight: 500;
}

.attendance-admin__empty {
    text-align: center;
    color: var(--color-text-sub);
    padding: 2em !important;
}

.attendance-admin__footnote {
    margin-top: 1em;
    font-size: 0.78rem;
    color: var(--color-text-sub);
    text-align: right;
}

/* ---- Mobile: card layout ---- */
@media (max-width: 768px) {
    .attendance-admin {
        padding: 0 0.8rem;
    }
    .attendance-admin__table-wrap {
        border: 0;
        background: transparent;
        overflow: visible;
    }
    .attendance-admin__table {
        min-width: 0;
        display: block;
    }
    .attendance-admin__table thead {
        display: none;
    }
    .attendance-admin__table tbody {
        display: block;
    }
    .attendance-admin__table tbody tr {
        display: block;
        margin: 0 0 1em;
        border: 1px solid var(--color-border);
        border-radius: 3px;
        background: #fff;
        padding: 0.7em 0.9em;
    }
    .attendance-admin__table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1em;
        padding: 0.4em 0;
        border-bottom: 1px solid #f1eee7;
        white-space: normal;
    }
    .attendance-admin__table tbody td:last-child {
        border-bottom: 0;
    }
    .attendance-admin__table tbody td::before {
        content: attr(data-col);
        flex: 0 0 7em;
        font-family: var(--font-display);
        font-size: 0.7rem;
        letter-spacing: 0.08em;
        color: var(--color-text-sub);
        text-transform: uppercase;
    }
    .attendance-admin__table .attendance-admin__select,
    .attendance-admin__table .attendance-admin__date,
    .attendance-admin__table .attendance-admin__text {
        flex: 1 1 auto;
        max-width: 60%;
    }
    .attendance-admin__action {
        text-align: right;
    }
    .attendance-admin__action::before {
        flex: 0 0 0;
        content: '';
    }
    .attendance-admin__action .attendance-admin__save {
        flex: 0 0 auto;
        padding: 0.5em 1.2em;
    }
}

/* ---- Filters ---- */
.attendance-admin__filter-bar {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-bottom: 0.6em;
    font-size: 0.85rem;
    color: var(--color-text-sub);
}

.attendance-admin__filter-count {
    font-family: var(--font-display);
    letter-spacing: 0.05em;
}

.attendance-admin__filter-clear,
.attendance-admin__log-toggle,
.attendance-admin__export-btn,
.attendance-admin__log-close {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font: inherit;
    font-size: 0.78rem;
    padding: 0.3em 0.8em;
    border-radius: 2px;
    cursor: pointer;
    transition: background .15s var(--ease);
}

.attendance-admin__filter-clear:hover,
.attendance-admin__log-toggle:hover,
.attendance-admin__export-btn:hover {
    background: #f6f1e8;
}

.attendance-admin__export-btn {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.attendance-admin__export-btn:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.attendance-admin__export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Edit history panel ---- */
.attendance-admin__log-panel {
    margin: 0 0 1em;
    border: 1px solid var(--color-border);
    background: #fff;
    border-radius: 3px;
    max-height: 50vh;
    overflow-y: auto;
}

.attendance-admin__log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6em 1em;
    background: #fafaf6;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
}

.attendance-admin__log-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-primary);
}

.attendance-admin__log-close {
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.1em 0.5em;
}

.attendance-admin__log-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.attendance-admin__log-entry {
    padding: 0.6em 1em;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
    line-height: 1.5;
}

.attendance-admin__log-entry:last-child {
    border-bottom: 0;
}

.attendance-admin__log-time {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.72rem;
    color: var(--color-text-sub);
    margin-right: 0.5em;
}

.attendance-admin__log-fields {
    color: var(--color-text-sub);
}

.attendance-admin__log-loading,
.attendance-admin__log-empty {
    padding: 1em;
    text-align: center;
    color: var(--color-text-sub);
    font-size: 0.85rem;
}

.attendance-admin__filter-row th {
    background: #f4efe6;
    padding: 0.3em 0.4em;
    border-bottom: 2px solid var(--color-border);
    position: sticky;
    top: 2.2em;
    z-index: 1;
}

.attendance-admin__filter-row input,
.attendance-admin__filter-row select {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 0.78rem;
    padding: 0.2em 0.35em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: #fff;
}

.attendance-admin__filter-row input:focus,
.attendance-admin__filter-row select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* =========================================================
 * Camp Poll — Waldhorn Project の合宿日程アンケート
 * 候補日 × (出欠 + 食事 3) のマトリクス入力。
 * ========================================================= */

/* The article wrapper widens to 1280 so the live-state board can
 * stretch out (18 candidate dates × N respondents needs the room).
 * Header and form keep an 880-cap for readable line lengths — they
 * centre themselves inside the wider article. */
.camp-poll {
    max-width: 1280px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
}

/* On mobile, eat the parent .container's 1.5rem padding via negative
 * margin and re-apply a tighter 10px so the wide tables can use
 * almost the full screen width. Also tighten cell widths so more
 * columns fit before horizontal scroll kicks in. */
@media (max-width: 768px) {
    .camp-poll {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        padding-left: 15px;
        padding-right: 15px;
    }
    /* On mobile the fixed-100% layout would collapse 31 columns to
     * ~9px each — unusable. Revert to content sizing so the table
     * grows past the viewport and the wrapper scrolls horizontally. */
    .camp-poll-board__table--calendar {
        table-layout: auto;
        width: auto;
    }
    .camp-poll-board__table--calendar .col-name {
        width: auto;
        min-width: 4.5em;
        font-size: 0.76rem;
        padding-left: 0.3em;
    }
    .camp-poll-board__table--calendar .col-day,
    .camp-poll-board__table--calendar .cell--edit,
    .camp-poll-board__table--calendar .cell--nontarget,
    .camp-poll-board__table--calendar .cell--noday,
    .camp-poll-board__table--calendar .col-day--noday,
    .camp-poll-board__table--calendar .col-day--nontarget {
        min-width: 1.6em;
        width: 1.6em;
        font-size: 0.72rem;
        padding-left: 1px;
        padding-right: 1px;
    }
    .camp-poll-bar-chart {
        gap: 14px;
    }
    .camp-poll-bar-chart__group {
        gap: 3px;
    }
    .camp-poll-bar-chart__col {
        min-width: 1.8em;
    }
    .camp-poll-board__hint {
        font-size: 0.78rem;
    }
}

/* All children of .camp-poll inherit the same outer width (1280px
 * via the article wrapper) so the page reads as one column. Inputs
 * inside .camp-poll__field cap their own visible width via the
 * input-element rules below — wide containers don't mean wide form
 * controls. */
.camp-poll__header {
    margin: 0 0 2rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
}
.camp-poll__form {
    margin: 0;
}
/* The intro paragraph reads better at narrower line lengths even when
 * the surrounding column is wide. */
.camp-poll__intro {
    max-width: 880px;
}

.camp-poll__eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--color-text-sub);
    text-transform: uppercase;
}

.camp-poll__eyebrow-expansion {
    text-transform: none;
    letter-spacing: 0.05em;
    margin-left: 0.6em;
}

.camp-poll__title {
    margin: 0 0 0.4em;
    font-size: 1.7rem;
    line-height: 1.4;
    color: var(--color-primary);
}

.camp-poll__subtitle {
    margin: 0 0 1.2em;
    color: var(--color-text-sub);
}

.camp-poll__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.4rem 1.5rem;
    margin: 0 0 1rem;
    font-size: 0.92rem;
}

.camp-poll__meta > div { display: flex; gap: 0.6em; }
.camp-poll__meta dt   { color: var(--color-text-sub); margin: 0; }
.camp-poll__meta dd   { margin: 0; }

.camp-poll__intro {
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-surface-alt);
    padding: 1rem 1.2rem;
    border-left: 3px solid var(--color-primary);
}

.camp-poll__form { display: block; }

.camp-poll__hp {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
}

.camp-poll__field { margin: 1.2rem 0 1.6rem; }
.camp-poll__field label { display: block; font-weight: 500; margin-bottom: 0.3rem; }
.camp-poll__req { color: #c0392b; font-size: 0.78rem; margin-left: 0.4em; }
.camp-poll__opt { color: var(--color-text-sub); font-size: 0.78rem; margin-left: 0.4em; }
.camp-poll__hint {
    font-size: 0.82rem;
    color: var(--color-text-sub);
    margin: 0.3em 0 0;
    line-height: 1.5;
}
.camp-poll__lookup-status {
    margin: 0.45em 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    min-height: 1.4em;          /* reserve space so layout doesn't jump */
    transition: color .15s;
}
.camp-poll__lookup-status--pending { color: var(--color-text-sub); }
.camp-poll__lookup-status--new     { color: #1c66a8; }
.camp-poll__lookup-status--ok      { color: #2f7d32; font-weight: 500; }
.camp-poll__lookup-status--error   { color: #c0392b; }
.camp-poll__field input[type="text"],
.camp-poll__field textarea {
    width: 100%;
    padding: 0.6em 0.8em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
/* Cap individual form controls so they don't span the full 1280px
 * column. The label / hint above them still spans the column for
 * visual unity. */
.camp-poll__field input[type="text"] { max-width: 28em; }
.camp-poll__field textarea           { max-width: 56em; }
.camp-poll__field input[type="text"]:focus,
.camp-poll__field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Name input that lives directly above the calendar matrix: tinted
 * background to mark it as part of the matrix-edit workflow. */
.camp-poll__field--namebar {
    background: rgba(28, 102, 168, 0.05);
    border-left: 3px solid var(--color-primary);
    padding: 0.8em 1em;
    margin: 1.2em 0 1em;
}
.camp-poll__field--namebar label { font-weight: 500; }

.camp-poll__matrix {
    border: none;
    margin: 1.5rem 0;
    padding: 0;
}
.camp-poll__matrix legend {
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: var(--color-primary);
}

.camp-poll__month {
    margin: 1.2rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.05rem;
    color: var(--color-primary);
    font-weight: 500;
}

.camp-poll__month-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.camp-poll__row {
    display: grid;
    grid-template-columns: 7em 1fr;
    grid-template-areas:
        "date attendance"
        "date meals";
    column-gap: 1rem;
    row-gap: 0.4rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border);
    background: #fff;
    transition: background-color 0.15s;
}
.camp-poll__row:hover { background: var(--color-surface-alt); }

.camp-poll__row-date {
    grid-area: date;
    align-self: center;
    font-size: 0.95rem;
    line-height: 1.3;
}
.camp-poll__row-day { font-weight: 500; font-size: 1.1rem; margin-right: 0.3em; }
.camp-poll__row-weekday { font-size: 0.82rem; color: var(--color-text-sub); }
.camp-poll__row-weekday.is-saturday { color: #1c66a8; }
.camp-poll__row-weekday.is-sunday   { color: #c0392b; }
.camp-poll__row-holiday {
    display: block;
    font-size: 0.74rem;
    color: var(--color-text-sub);
    margin-top: 0.1em;
}

.camp-poll__row-attendance {
    grid-area: attendance;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.camp-poll__att-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3em 0.9em;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: background-color 0.12s, border-color 0.12s;
    font-size: 0.88rem;
}
.camp-poll__att-pill input { position: absolute; opacity: 0; pointer-events: none; }
.camp-poll__att-pill:hover { border-color: var(--color-primary); }
.camp-poll__att-pill:has(input:checked) { color: #fff; }
.camp-poll__att-pill--attend:has(input:checked)  { background: #2f7d32; border-color: #2f7d32; }
.camp-poll__att-pill--absent:has(input:checked)  { background: #888;    border-color: #888; }
.camp-poll__att-pill--unknown:has(input:checked) { background: #b08900; border-color: #b08900; }

.camp-poll__row-meals {
    grid-area: meals;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 0.1rem;
}
.camp-poll__row-meals[data-meals-disabled="true"] { opacity: 0.45; }
.camp-poll__row-meals-label {
    font-size: 0.82rem;
    color: var(--color-text-sub);
}
.camp-poll__meal-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.2em 0.7em;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}
.camp-poll__meal-pill input { margin: 0 0.15em 0 0; }
.camp-poll__meal-pill:has(input:checked) {
    background: #fff8d6;
    border-color: #b08900;
}
.camp-poll__meal-pill input:disabled + span { color: var(--color-text-sub); }

.camp-poll__actions {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.camp-poll__submit {
    padding: 0.8em 2.2em;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 2px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.15s;
}
.camp-poll__submit:disabled { opacity: 0.5; cursor: not-allowed; }
.camp-poll__submit:hover:not(:disabled) { opacity: 0.85; }

.camp-poll__status {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}
.camp-poll__status--pending { color: var(--color-text-sub); }
.camp-poll__status--ok      { color: #2f7d32; }
.camp-poll__status--error   { color: #c0392b; }

@media (max-width: 540px) {
    .camp-poll__row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "date"
            "attendance"
            "meals";
    }
}

/* =========================================================
 * Camp Poll Admin — 集計ダッシュボード
 * ========================================================= */

.camp-poll-board {
    max-width: 1280px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
}

.camp-poll-board__header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.camp-poll-board__title {
    font-size: 1.5rem;
    margin: 0 0 0.3em;
    color: var(--color-primary);
}

.camp-poll-board__subtitle {
    margin: 0 0 1em;
    color: var(--color-text-sub);
}

.camp-poll-board__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.4rem 1.5rem;
    margin: 0;
    font-size: 0.9rem;
}
.camp-poll-board__meta > div { display: flex; gap: 0.5em; }
.camp-poll-board__meta dt   { color: var(--color-text-sub); margin: 0; }
.camp-poll-board__meta dd   { margin: 0; }

.camp-poll-board__notice {
    background: var(--color-surface-alt);
    padding: 1rem 1.2rem;
    border-left: 3px solid var(--color-primary);
    color: var(--color-text-sub);
}

.camp-poll-board__section { margin: 2.5rem 0; }
.camp-poll-board__section h2 {
    font-size: 1.1rem;
    color: var(--color-primary);
    margin: 0 0 0.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3rem;
}
.camp-poll-board__hint {
    font-size: 0.82rem;
    color: var(--color-text-sub);
    margin: 0.3em 0 1em;
    line-height: 1.6;
}

.camp-poll-board__table-wrap { overflow-x: auto; }

.camp-poll-board__table {
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0;
    min-width: 100%;
}
.camp-poll-board__table th,
.camp-poll-board__table td {
    padding: 0.45em 0.7em;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
    vertical-align: middle;
}
.camp-poll-board__table thead th {
    background: var(--color-surface-alt);
    font-weight: 500;
    color: var(--color-primary);
    font-family: var(--font-heading);
}

/* summary table */
.camp-poll-board__table--summary .col-date { text-align: left; padding-left: 1em; }
.camp-poll-board__table--summary .col-num  { text-align: right; padding-right: 1em; font-variant-numeric: tabular-nums; }
.camp-poll-board__table--summary .col-num--attend { color: #2f7d32; font-weight: 500; }
.camp-poll-board__table--summary .col-num--muted  { color: var(--color-text-sub); }
.camp-poll-board__table--summary tr.is-hot    { background: rgba(47, 125, 50, 0.06); }
.camp-poll-board__table--summary tr.is-hot td { font-weight: 500; }

/* matrix table */
.camp-poll-board__table--matrix { font-size: 0.84rem; }
.camp-poll-board__table--matrix .col-name {
    text-align: left;
    padding-left: 0.8em;
    white-space: nowrap;
    background: var(--color-surface-alt);
    position: sticky;
    left: 0;
    z-index: 1;
}
.camp-poll-board__table--matrix .col-date-short {
    width: 2.5em;
    font-size: 0.78rem;
    line-height: 1.2;
    padding: 0.4em 0.2em;
}
.camp-poll-board__table--matrix .col-date-short .weekday { font-size: 0.72rem; color: var(--color-text-sub); }
.camp-poll-board__table--matrix .col-date-short .weekday.is-saturday { color: #1c66a8; }
.camp-poll-board__table--matrix .col-date-short .weekday.is-sunday   { color: #c0392b; }
.camp-poll-board__table--matrix .col-comment {
    text-align: left;
    font-size: 0.82rem;
    color: var(--color-text-sub);
    min-width: 14em;
    max-width: 32em;
    padding: 0.4em 0.6em;
}
.camp-poll-board__table--matrix .cell { padding: 0.3em 0.2em; }
.camp-poll-board__table--matrix .cell--attend  { color: #2f7d32; font-weight: 500; }
.camp-poll-board__table--matrix .cell--absent  { color: #888;    }
.camp-poll-board__table--matrix .cell--unknown { color: #b08900; }
.camp-poll-board__table--matrix .cell--empty   { background: rgba(0,0,0,0.04); }
.camp-poll-board__table--matrix .cell sup { font-size: 0.65em; margin-left: 0.1em; color: var(--color-text-sub); }

/* Editable "あなたの回答" row: sits at the bottom of tbody just above
 * tfoot. Two-row cell layout — attendance button up top, three small
 * meal toggles beneath that only become interactive when 出席. The
 * dashed border around the empty state nudges the user that this is
 * where they click. */
.camp-poll-board__table--matrix .cell-row-edit {
    background: rgba(28, 102, 168, 0.05);
    border-top: 2px dashed var(--color-primary);
}
.camp-poll-board__table--matrix .cell-row-edit .col-name--edit {
    background: rgba(28, 102, 168, 0.1);
    color: var(--color-primary);
    font-weight: 500;
}
.camp-poll-board__table--matrix .cell-row-edit__badge {
    display: inline-block;
    margin-left: 0.5em;
    padding: 0.05em 0.5em;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.7rem;
    border-radius: 999px;
    font-weight: 400;
}
.camp-poll-board__table--matrix .cell--edit {
    padding: 0.25em 0.15em;
    vertical-align: top;
    min-width: 2.6em;
}
/* Editable cell button: must read as "clickable toggle" at first
 * glance. Empty state shows a faint cycle icon (↻) in the corner so
 * users see "this is something I can change". Solid 1px border +
 * subtle tinted background gives it button affordance even before
 * hover. Hover lifts with shadow; active states fill solid colour
 * matching the symbol. */
.cell-edit__att {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 1.85em;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: linear-gradient(180deg, #fdfdfd 0%, #f3f3f3 100%);
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    border-radius: 3px;
    position: relative;
    font-family: inherit;
    color: rgba(0, 0, 0, 0.45);
    transition: border-color 0.12s, background-color 0.12s, color 0.12s, transform 0.08s, box-shadow 0.12s;
}
.cell-edit__att:hover {
    border-color: var(--color-primary);
    background: linear-gradient(180deg, #ffffff 0%, rgba(28, 102, 168, 0.12) 100%);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.cell-edit__att:active { transform: translateY(0); box-shadow: none; }
.cell-edit__att:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* Cycle hint: shown on every state (empty + 出席/欠席/未定) so the
 * user always sees that the cell is re-clickable. Inherits text
 * colour with reduced opacity — dark gray on empty (light bg) and
 * white-ish on the solid filled states. */
.cell-edit__att::after {
    content: '↻';
    position: absolute;
    top: -1px;
    right: 2px;
    font-size: 0.55rem;
    color: currentColor;
    opacity: 0.55;
    pointer-events: none;
    line-height: 1;
}
.cell-edit__att:hover::after { opacity: 0.85; }

/* Selected states: solid fill instead of outline, so the picked
 * value reads as definitely "set". */
.cell-edit__att--attend  {
    color: #fff; background: #2f7d32; border-color: #2f7d32; font-weight: 500;
}
.cell-edit__att--attend:hover  { background: #266727; border-color: #266727; color: #fff; }
.cell-edit__att--absent  {
    color: #fff; background: #888; border-color: #888;
}
.cell-edit__att--absent:hover  { background: #6a6a6a; border-color: #6a6a6a; color: #fff; }
.cell-edit__att--unknown {
    color: #fff; background: #b08900; border-color: #b08900;
}
.cell-edit__att--unknown:hover { background: #8c6d00; border-color: #8c6d00; color: #fff; }

/* ========== Bar chart for 候補日サマリー ==========
 * Pure-CSS stacked column chart. Each bar = 出席 (solid) + 未定 (light
 * shade above) so the total bar height shows "potential attendance"
 * while the solid portion shows confirmed. Groups are visually
 * clustered: tight intra-gap, wide inter-gap. No per-group footer
 * — the bar height itself is the decision metric. */
.camp-poll-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 22px;
    padding: 0.4rem 0 0.3rem;
    margin: 0.6rem 0 0;
    overflow-x: auto;
}
.camp-poll-bar-chart__group {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}
.camp-poll-bar-chart__col {
    flex: 1 1 0;
    min-width: 2.4em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.camp-poll-bar-chart__value {
    font-size: 0.78rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-sub);
    margin-bottom: 3px;
    text-align: center;
}
.camp-poll-bar-chart__value strong {
    font-weight: 500;
    color: var(--color-text);
}
.camp-poll-bar-chart__value-unknown {
    color: rgba(176, 137, 0, 0.85);
    margin-left: 0.15em;
    font-size: 0.92em;
}
.camp-poll-bar-chart__col.is-hot .camp-poll-bar-chart__value strong {
    color: #2f7d32;
    font-weight: 600;
}

/* Stacked bar: 未定 segment sits on top of 出席 segment. Both
 * heights derive from the parent --max and segment-local --n. The
 * stack itself shows a 2px sliver background so a 0/0 day is still
 * visible at the baseline. */
.camp-poll-bar-chart__bar-stack {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 2px 2px 0 0;
    overflow: hidden;
    min-height: 2px;
    transition: transform 0.12s;
}
.camp-poll-bar-chart__col:hover .camp-poll-bar-chart__bar-stack {
    transform: scaleY(1.04);
    transform-origin: bottom;
}
.camp-poll-bar-chart__seg {
    width: 100%;
    height: calc(var(--n, 0) / var(--max, 1) * 150px);
    min-height: 0;
    transition: background-color 0.12s;
}
.camp-poll-bar-chart__seg--attend  { background: rgba(0, 0, 0, 0.30); }
.camp-poll-bar-chart__seg--unknown { background: rgba(176, 137, 0, 0.50); }
.camp-poll-bar-chart__col.is-hot .camp-poll-bar-chart__seg--attend  { background: #2f7d32; }
.camp-poll-bar-chart__col.is-hot .camp-poll-bar-chart__seg--unknown { background: rgba(47, 125, 50, 0.45); }
/* Fixed label area so all bar baselines line up regardless of
 * whether a date carries a 祝 chip. The min-height fits "10/12" +
 * "(土)祝" on two lines comfortably. */
.camp-poll-bar-chart__label {
    margin-top: 5px;
    font-size: 0.72rem;
    line-height: 1.25;
    text-align: center;
    color: var(--color-text-sub);
    min-height: 2.6em;
    white-space: nowrap;
}
.camp-poll-bar-chart__label .is-saturday { color: #1c66a8; }
.camp-poll-bar-chart__label .is-sunday   { color: #c0392b; }
.camp-poll-bar-chart__holiday {
    display: inline-block;
    margin-left: 0.15em;
    padding: 0 0.25em;
    font-size: 0.6rem;
    background: rgba(192, 57, 43, 0.14);
    color: #c0392b;
    border-radius: 2px;
    line-height: 1.3;
    vertical-align: middle;
}
.camp-poll-bar-chart__legend {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    margin: 0 0.4em 0 0;
}
.camp-poll-bar-chart__legend-swatch {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border-radius: 2px;
    vertical-align: middle;
}
.camp-poll-bar-chart__legend-swatch.is-attend  { background: rgba(0, 0, 0, 0.30); }
.camp-poll-bar-chart__legend-swatch.is-unknown { background: rgba(176, 137, 0, 0.50); }
.camp-poll-bar-chart__legend-swatch.is-hot     { background: #2f7d32; }

/* Month heading between the per-month tables. Provides visual breathing
 * room when the matrix is split into 9月 / 10月 sections. */
.camp-poll-board__month-heading {
    margin: 1.5rem 0 0.4rem;
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
    padding-left: 0.6em;
    line-height: 1.4;
}
.camp-poll-board__month-count {
    font-size: 0.78rem;
    color: var(--color-text-sub);
    font-weight: 400;
    margin-left: 0.3em;
}

/* Full-month calendar matrix variant: each table renders 31 day
 * columns (1..31). On desktop the table is `table-layout: fixed;
 * width: 100%` so the columns auto-distribute across the container
 * — no overflow at the 1280px max width. The row-label column gets
 * a fixed 5em; the 31 day columns share what's left (~38px each at
 * 1280). On mobile (≤768px, see the media block above) the table
 * reverts to content sizing + min-widths so it overflows and
 * scrolls instead of collapsing to unreadable slivers. */
.camp-poll-board__table--calendar {
    table-layout: fixed;
    width: 100%;
}
.camp-poll-board__table--calendar .col-name {
    width: 5em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.camp-poll-board__table--calendar .col-day,
.camp-poll-board__table--calendar td.cell,
.camp-poll-board__table--calendar td.cell--edit {
    /* No explicit width — fixed layout shares the remaining space
     * equally among these columns. */
    width: auto;
    font-size: 0.74rem;
    line-height: 1.15;
    padding: 0.3em 1px;
    vertical-align: bottom;
    overflow: hidden;
}
.camp-poll-board__table--calendar .col-day .weekday {
    font-size: 0.68rem;
    color: var(--color-text-sub);
}
.camp-poll-board__table--calendar .col-day__holiday {
    display: inline-block;
    margin-left: 0.05em;
    padding: 0 0.2em;
    font-size: 0.55rem;
    background: rgba(192, 57, 43, 0.14);
    color: #c0392b;
    border-radius: 2px;
    line-height: 1.3;
    vertical-align: middle;
}
.camp-poll-board__table--calendar .col-day.is-saturday  .weekday,
.camp-poll-board__table--calendar .col-day.is-saturday  { color: #1c66a8; }
.camp-poll-board__table--calendar .col-day.is-sunday    .weekday,
.camp-poll-board__table--calendar .col-day.is-sunday    { color: #c0392b; }
.camp-poll-board__table--calendar .col-day.is-nontarget {
    color: rgba(0, 0, 0, 0.28);
    background: rgba(0, 0, 0, 0.03);
}
.camp-poll-board__table--calendar .col-day.is-nontarget .weekday {
    color: rgba(0, 0, 0, 0.22);
}
.camp-poll-board__table--calendar .col-day--noday {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Inert non-target body cell: gray with diagonal hatching, no
 * pointer events so click-through never fires. The hatch tells the
 * user "you can't enter anything here". */
.camp-poll-board__table--calendar .cell--nontarget {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.05) 0,
        rgba(0, 0, 0, 0.05) 3px,
        rgba(0, 0, 0, 0.10) 3px,
        rgba(0, 0, 0, 0.10) 6px
    );
    pointer-events: none;
    cursor: not-allowed;
    border-color: rgba(0, 0, 0, 0.06);
}
/* Day-out-of-month cell (e.g. 9/31): leave blank, no border. */
.camp-poll-board__table--calendar .cell--noday {
    background: transparent;
    border: none;
    box-shadow: none;
}
/* tfoot mirror cells for non-existent / non-target days. */
.camp-poll-board__table--calendar tfoot .col-day--noday,
.camp-poll-board__table--calendar tfoot .col-day--nontarget {
    background: transparent;
    color: transparent;
}

/* The comment cell on the edit row mirrors the textarea below — show
 * a soft placeholder when empty so the column doesn't look truncated. */
.camp-poll-board__table--matrix .col-comment--edit {
    background: rgba(28, 102, 168, 0.05);
    font-style: italic;
    color: var(--color-text-sub);
}
.camp-poll-board__table--matrix .col-comment--edit:empty::before {
    content: '(下のフォームでコメントを入力)';
    color: rgba(0, 0, 0, 0.3);
}

/* Bottom totals row: lets organisers scan attendance count vertically.
 * Background lifts the row away from the body, accent border separates
 * it as a summary; .is-hot tints the cell when that date is a strong
 * candidate (≥ 70% of respondents attending). */
.camp-poll-board__table--matrix tfoot tr {
    border-top: 2px solid var(--color-primary);
}
.camp-poll-board__table--matrix tfoot td {
    font-weight: 500;
    background: var(--color-surface-alt);
    padding: 0.55em 0.2em;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}
.camp-poll-board__table--matrix tfoot .col-name {
    text-align: left;
    padding-left: 0.8em;
    /* Sticky-left already applied via the global .col-name rule above. */
}
.camp-poll-board__table--matrix tfoot .is-hot {
    background: rgba(47, 125, 50, 0.18);
    color: #2f7d32;
}

