/* =====================================================================
   futomi's CGI Café / www.futomi.com — Common Base Design System
   Derived from FutomiCore Admin Design System (Bright Clean Edition)
   ===================================================================== */
:root {
    color-scheme: light;

    /* Canvas & Surfaces */
    --fc-bg: #f6f8fb;
    --fc-surface: #ffffff;
    --fc-surface-soft: #f8fafc;
    --fc-surface-head: #fafcff;
    --fc-surface-nav: #fbfcfe;
    --fc-surface-tint: #eff4f9;

    /* Brand Colors */
    --fc-navy: #0b2942;
    --fc-navy-mid: #16446b;
    --fc-navy-hover: #1f5685;
    --fc-red: #b30b16;
    --fc-red-soft: #fef2f2;

    /* Typography & Borders */
    --fc-ink: #1e2d3b;
    --fc-muted: #5a6b7c;
    --fc-nav-text: #365067;
    --fc-border: #e2e8f0;
    --fc-border-soft: #edf2f7;
    --fc-border-strong: #dce4ee;
    --fc-input-border: #cbd5e1;

    /* Semantic Colors */
    --fc-ok-bg: #ecfdf5;
    --fc-ok-border: #a7f3d0;
    --fc-ok-text: #065f46;
    --fc-warn-bg: #fffbeb;
    --fc-warn-border: #fde68a;
    --fc-warn-text: #92400e;
    --fc-err-bg: #fef2f2;
    --fc-err-border: #fecaca;
    --fc-err-text: #991b1b;
    --fc-info-bg: #eff6ff;
    --fc-info-border: #cfe0f2;
    --fc-neutral-bg: #f1f5f9;
    --fc-neutral-border: #cbd5e1;
    --fc-neutral-text: #64748b;

    /* Radii & Elevation */
    --fc-radius: 6px;
    --fc-radius-md: 8px;
    --fc-radius-card: 10px;
    --fc-shadow: 0 1px 3px rgba(11, 41, 66, 0.06), 0 4px 14px rgba(11, 41, 66, 0.03);
    --fc-shadow-header: 0 2px 8px rgba(11, 41, 66, 0.04);
    --fc-shadow-float: 0 8px 24px rgba(11, 41, 66, 0.16);
    --fc-focus-ring: 0 0 0 3px rgba(22, 68, 107, 0.14);

    /* Layout & Typography */
    --fc-container-max: 72rem;
    --fc-gutter: clamp(1rem, 3.2vw, 2.5rem);
    --fc-font: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
    --fc-mono: ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;

    /* Legacy variable aliases for seamless section compatibility */
    --paper: var(--fc-bg);
    --navy: var(--fc-navy);
    --red: var(--fc-red);
    --ink: var(--fc-ink);
    --rule: var(--fc-border);
    --sans: var(--fc-font);
    --gutter: var(--fc-gutter);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background: var(--fc-bg);
    color: var(--fc-ink);
    font: 400 0.9375rem/1.68 var(--fc-font);
    overflow-wrap: anywhere;
}

h1, h2, h3, p, figure, ul {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--fc-navy-mid);
    outline-offset: 2px;
}

.page-width,
.fc-page-width {
    width: min(calc(100% - var(--fc-gutter) - var(--fc-gutter)), var(--fc-container-max));
    margin-inline: auto;
}

/* Skip Link */
.skip-link {
    position: absolute;
    z-index: 200;
    top: 0.5rem;
    left: var(--fc-gutter);
    padding: 0.5rem 1rem;
    border-radius: var(--fc-radius);
    transform: translateY(-200%);
    background: var(--fc-navy);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--fc-shadow-float);
}

.skip-link:focus {
    transform: none;
    outline: 2px solid var(--fc-red);
    outline-offset: 2px;
}

/* Bright 2-Tier Header: Crisp White Masthead + Light Tab Nav with Navy & Red Accent */
.masthead {
    background: var(--fc-surface);
    border-top: 3px solid var(--fc-navy);
    border-bottom: 1px solid var(--fc-border);
    box-shadow: var(--fc-shadow-header);
}

.masthead-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    padding-block: 0.7rem;
}

.fc-brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
}

.brand img {
    display: block;
    width: clamp(8.75rem, 18vw, 10.75rem);
    max-width: 100%;
    height: auto;
}

.fc-brand-divider {
    width: 1px;
    height: 1.45rem;
    background: #d8e0e8;
}

.site-description {
    color: var(--fc-muted);
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    font-feature-settings: "palt";
}

.masthead-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Common Buttons */
.fc-btn,
.masthead-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    min-height: 2.5rem;
    padding: 0.42rem 1rem;
    border: 1px solid var(--fc-input-border);
    border-radius: var(--fc-radius);
    background: var(--fc-surface);
    color: var(--fc-navy-mid);
    font: 600 0.875rem/1.4 var(--fc-font);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.fc-btn:hover,
.masthead-search:hover {
    background: var(--fc-surface-tint);
    border-color: #9fb3c8;
    color: var(--fc-navy);
    text-decoration: none;
}

.fc-btn-sm,
.masthead-search {
    min-height: 2.1rem;
    padding: 0.28rem 0.78rem;
    font-size: 0.8125rem;
}

.masthead-search span:last-child {
    text-decoration: none;
}

.masthead-search:hover span:last-child {
    color: inherit;
}

.search-icon {
    width: 0.875rem;
    height: 0.875rem;
    fill: currentColor;
    flex: none;
}

.fc-btn-primary {
    background: var(--fc-navy-mid);
    border-color: var(--fc-navy-mid);
    color: #ffffff;
}

.fc-btn-primary:hover {
    background: var(--fc-navy-hover);
    border-color: var(--fc-navy-hover);
    color: #ffffff;
}

/* Global Navigation (2nd Tier) */
.primary-nav {
    background: var(--fc-surface-nav);
    border-top: 1px solid var(--fc-border-soft);
    color: var(--fc-nav-text);
    font-size: 0.92rem;
    font-weight: 500;
    overflow-x: auto;
    scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
    display: none;
}

.primary-nav-inner {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0 clamp(0.25rem, 1.5vw, 0.85rem);
}

.primary-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.85rem;
    padding: 0.45rem 0.9rem;
    color: var(--fc-nav-text);
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.primary-nav a:hover {
    background: var(--fc-surface-tint);
    color: var(--fc-navy);
    text-decoration: none;
}

.primary-nav a:focus-visible {
    outline: 2px solid var(--fc-navy-mid);
    outline-offset: -2px;
}

.primary-nav a:is([aria-current="page"], [aria-current="location"], .is-active) {
    background: var(--fc-surface);
    color: var(--fc-navy);
    font-weight: 700;
    box-shadow: inset 0 -3px var(--fc-red);
}

/* Common Breadcrumbs */
.lecture-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.6rem;
    margin: 0 0 0.75rem;
    padding: 0;
    color: var(--fc-muted);
    list-style: none;
    font-size: 0.8125rem;
}

.lecture-breadcrumb li + li::before {
    content: "";
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    margin-inline-end: 0.65rem;
    border: solid #94a3b8;
    border-width: 1.5px 1.5px 0 0;
    transform: translateY(-0.12em) rotate(45deg);
}

.lecture-breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    color: var(--fc-navy-mid);
    text-decoration: underline;
    text-underline-offset: 0.22em;
}

.lecture-breadcrumb a:hover {
    color: var(--fc-red);
}

.lecture-breadcrumb [aria-current="page"] {
    color: var(--fc-ink);
    font-weight: 500;
}

/* AdSense Unfilled Slot Collapse */
ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}

/* Light Clean Footer (Colophon) */
.colophon {
    margin-top: auto;
    border-top: 1px solid var(--fc-border);
    background: var(--fc-surface);
    color: var(--fc-muted);
}

.colophon-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem clamp(1rem, 3vw, 2.25rem);
    padding-block: clamp(1.35rem, 2.4vw, 1.85rem);
}

.publisher .brand img {
    width: 8.5rem;
    height: auto;
    opacity: 0.94;
    filter: none;
}

.publisher small {
    display: block;
    margin-top: 0.35rem;
    color: var(--fc-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.utility-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.utility-nav h2 {
    margin-bottom: 0.4rem;
    color: var(--fc-navy);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.utility-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    color: var(--fc-muted);
    font-size: 0.84rem;
    line-height: 1.5;
    transition: color 0.14s;
}

.utility-nav a:hover {
    color: var(--fc-navy);
    text-decoration: underline;
    text-underline-offset: 0.22em;
}

.colophon a:focus-visible {
    outline: 2px solid var(--fc-navy-mid);
    outline-offset: 2px;
}

@media (max-width: 54rem) {
    .colophon-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 1.25rem;
    }
}

@media (max-width: 44rem) {
    .masthead-inner {
        padding-block: 0.55rem;
    }
    .fc-brand-divider {
        display: none;
    }
    .primary-nav {
        font-size: 0.875rem;
    }
    .primary-nav a {
        padding-inline: 0.68rem;
    }
}

@media (max-width: 38.75rem) {
    .site-description {
        display: none;
    }
    .colophon-inner {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    }
    .publisher {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.85rem;
    }
    .publisher small {
        margin-top: 0;
    }
}

@media (max-width: 38.75rem), (pointer: coarse) {
    .utility-nav a {
        min-height: 2.5rem;
    }
}
