/* ==========================================================================
   stuartdobson.net — "Night Transit"
   Japanese rail wayfinding at night. The hub is a station; every destination
   is a colour-coded line. Three type roles: a signage grotesk (Zen Kaku
   Gothic New) for display, a pixel face (DotGothic16) for wayfinding
   furniture — eyebrows, badges, the departure board — and the system stack
   for body copy. Swap the tokens in :root to re-theme; nothing past this
   block should hardcode a colour.
   ========================================================================== */

@font-face {
    font-family: 'Zen Kaku Gothic New';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/zenkaku-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Zen Kaku Gothic New';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('/fonts/zenkaku-900.woff2') format('woff2');
}
/* Latin and kana ship as separate subsets so the JP glyphs never block Latin text. */
@font-face {
    font-family: 'DotGothic16';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/dotgothic-latin.woff2') format('woff2');
    unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2026, U+2190-2199, U+25B2-25CF;
}
@font-face {
    font-family: 'DotGothic16';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/dotgothic-kana.woff2') format('woff2');
    unicode-range: U+3000-30FF, U+4E00-9FFF, U+FF00-FFEF;
}

:root {
    /* Palette — night station */
    --night:    #0B0E14;
    --panel:    #141926;
    --panel-2:  #1A2133;
    --line:     #232B3D;
    --sign:     #F2F4F8;
    --muted:    #93A0B8;
    --accent:   #A5C93D;   /* the home line (BL) doubles as the site accent */

    /* Type roles */
    --font-display: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, 'Noto Sans CJK JP', sans-serif;
    --font-pixel: 'DotGothic16', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, 'Noto Sans CJK JP', monospace;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --container-w: 1080px;
    --container-narrow-w: 700px;

    --radius: 4px;
    --radius-panel: 10px;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
body {
    margin: 0;
    background: var(--night);
    color: var(--sign);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    color-scheme: dark;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { padding: 0; margin: 0; list-style: none; }
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--night); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--night);
    padding: 0.75rem 1.25rem;
    z-index: 1000;
    font-weight: 700;
    border-radius: var(--radius);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: var(--container-narrow-w); margin: 0 auto; padding: 0 1.5rem; }

/* Scroll-reveal — see scripts.js. baseof.html ships a <noscript> override
   so this never leaves content invisible when JS is disabled. */
[data-observe] { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
[data-observe].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    [data-observe] { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.4rem;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: var(--font-display);
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--night); }
.btn-primary:hover { background: var(--sign); }
.btn-secondary { background: transparent; color: var(--sign); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   Line badge — the JR-style route mark. Ring takes the line colour via
   --line-color; the code stays sign-white. Used in the nav, the directory,
   and the departure board.
   -------------------------------------------------------------------------- */

.line-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: 3px solid var(--line-color, var(--accent));
    border-radius: 10px;
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: var(--sign);
    background: var(--night);
}
.line-badge--sm { width: 28px; height: 28px; border-width: 2px; font-size: 0.65rem; border-radius: 7px; }
.line-badge--nav { width: 30px; height: 30px; border-width: 2px; font-size: 0.7rem; border-radius: 8px; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--night) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.nav-container {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
}
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a {
    font-family: var(--font-pixel);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover { color: var(--sign); border-color: var(--accent); }
.nav-mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--sign);
    padding: 0.45rem 0.55rem;
    line-height: 0;
}
.nav-close-icon { display: none; }
.nav-links.nav--open ~ .nav-mobile-toggle .nav-hamburger-icon { display: none; }
.nav-links.nav--open ~ .nav-mobile-toggle .nav-close-icon { display: block; }

@media (max-width: 768px) {
    .nav-mobile-toggle { display: inline-flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--panel);
        border-bottom: 1px solid var(--line);
        padding: 0.5rem 0;
    }
    .nav-links.nav--open { display: flex; }
    .nav-links a { padding: 0.85rem 1.5rem; border-bottom: none; }
    .nav-links a:hover { background: var(--panel-2); }
}

/* --------------------------------------------------------------------------
   Hero — the station name board (ekimeihyō)
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    padding: clamp(4rem, 10vh, 7rem) 0 3.5rem;
    overflow: hidden;
    text-align: center;
}
/* Ambient platform light — two faint colour pools, no imagery. */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(600px 320px at 12% 0%, rgba(59, 170, 232, 0.10), transparent 70%),
        radial-gradient(600px 320px at 88% 100%, rgba(165, 201, 61, 0.08), transparent 70%);
}
.hero .container { position: relative; }

.hero-board {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 3rem) 0;
    max-width: 820px;
    margin: 0 auto;
    box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.8);
}
.hero-title {
    font-family: var(--font-pixel);
    font-size: clamp(2.4rem, 8vw, 4.6rem);
    line-height: 1.2;
    letter-spacing: 0.06em;
    margin: 0 0 1.4rem;
}
.hero-linestrip {
    display: flex;
    gap: 5px;
    height: 6px;
}
.hero-linestrip span {
    flex: 1;
    border-radius: 3px;
    background: var(--line-color, var(--line));
}
.hero-adjacent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--line);
    margin-top: 1.4rem;
    padding: 0.9rem 0 1rem;
}
.hero-adj {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted);
    transition: color 0.15s ease;
}
.hero-adj:hover { color: var(--sign); }
.hero-adj-arrow { color: var(--accent); font-size: 0.8rem; }
.hero-adj-body { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.hero-adj--next .hero-adj-body { align-items: flex-end; text-align: right; }
.hero-adj-caption { font-family: var(--font-pixel); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; }
.hero-adj-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.2; }
.hero-roles {
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}
@media (max-width: 640px) {
    .hero-adjacent { flex-wrap: wrap; }
    .hero-roles {
        order: 3;
        flex-basis: 100%;
        text-align: center;
        border-top: 1px solid var(--line);
        margin-top: 0.35rem;
        padding-top: 0.9rem;
    }
}
.hero-description {
    max-width: 520px;
    margin: 2rem auto 0;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.6;
}
.hero-down {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--accent);
}
.hero-down:hover { color: var(--sign); }

/* Arrival sequence: board settles in, then the line strip draws itself.
   Everything collapses to nothing under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    .hero-board { animation: board-in 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
    .hero-title { animation: sign-in 0.5s ease both; animation-delay: 0.3s; }
    .hero-linestrip span {
        transform-origin: left center;
        animation: line-draw 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both;
    }
    .hero-linestrip span:nth-child(1) { animation-delay: 0.50s; }
    .hero-linestrip span:nth-child(2) { animation-delay: 0.56s; }
    .hero-linestrip span:nth-child(3) { animation-delay: 0.62s; }
    .hero-linestrip span:nth-child(4) { animation-delay: 0.68s; }
    .hero-linestrip span:nth-child(5) { animation-delay: 0.74s; }
    .hero-linestrip span:nth-child(6) { animation-delay: 0.80s; }
    .hero-linestrip span:nth-child(7) { animation-delay: 0.86s; }
    .hero-linestrip span:nth-child(8) { animation-delay: 0.92s; }
    .hero-adjacent, .hero-description, .hero-down { animation: sign-in 0.5s ease both 0.9s; }
}
@keyframes board-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
@keyframes sign-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes line-draw {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* --------------------------------------------------------------------------
   Section furniture
   -------------------------------------------------------------------------- */

.hero + section { padding-top: 1rem; }
.home-section { padding: 4.5rem 0; }

.section-header { margin-bottom: 2.2rem; max-width: 640px; }
.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.section-eyebrow [lang="ja"] { color: var(--muted); letter-spacing: 0.2em; }
.section-eyebrow::before {
    content: "";
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent);
}
.section-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.15;
    margin-top: 0.5rem;
}
.section-description { color: var(--muted); margin-top: 0.7rem; }

.page-hero { padding: 4rem 0 1rem; }
.page-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    line-height: 1.1;
    margin-top: 0.5rem;
}
.page-description { color: var(--muted); margin-top: 0.7rem; max-width: 620px; }
.page-back { margin-top: 3rem; }

/* --------------------------------------------------------------------------
   Lines directory
   -------------------------------------------------------------------------- */

.lines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.line-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    height: 100%;
    padding: 1.2rem 1.2rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
a.line-card:hover, a.line-card:focus-visible {
    border-color: var(--line-color);
    transform: translateY(-2px);
}
.line-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.line-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
}
.line-ext { color: var(--line-color, var(--accent)); font-size: 0.9em; }
.line-desc { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

/* The track: each card's line runs along its foot and "draws" on hover. */
.line-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--line-color, var(--line));
    transform: scaleX(0.12);
    transform-origin: left center;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}
a.line-card:hover .line-track, a.line-card:focus-visible .line-track { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) {
    .line-card, .line-track { transition: none; }
}

.line-card--planned { border-style: dashed; background: transparent; }
.line-card--planned .line-badge { border-style: dashed; color: var(--muted); }
.line-card--planned .line-name { color: var(--muted); }
.line-track--dashed {
    background: repeating-linear-gradient(90deg,
        var(--line-color) 0 10px, transparent 10px 18px);
    transform: scaleX(1);
    opacity: 0.45;
}
.line-planned-chip {
    display: inline-block;
    vertical-align: 0.15em;
    margin-left: 0.4em;
    padding: 0.1em 0.5em;
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 99px;
}

/* --------------------------------------------------------------------------
   Departure board
   -------------------------------------------------------------------------- */

.dep-board {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    overflow: hidden;
    font-family: var(--font-pixel);
}
.dep-head, .dep-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 44px 130px;
    gap: 1rem;
    align-items: center;
    padding: 0.8rem 1.25rem;
}
.dep-head {
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
}
.dep-row { border-top: 1px solid var(--line); }
.dep-rows:first-of-type .dep-row:first-child { border-top: none; }
.dep-time { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.06em; white-space: nowrap; }
.dep-dest {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--sign);
    overflow-wrap: anywhere;
    transition: color 0.15s ease;
}
.dep-dest:hover { color: var(--line-color, var(--accent)); }
.dep-row .line-badge--sm { justify-self: center; }
.dep-status { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--line-color, var(--accent)); }

/* "Now boarding" marks the newest departure. Pure CSS, so it survives the
   client-side feed refresh re-rendering the rows. */
.dep-rows--wl .dep-row:first-child .dep-status::before { content: "\25AA Now boarding"; }
@media (prefers-reduced-motion: no-preference) {
    .dep-rows--wl .dep-row:first-child .dep-status::before { animation: boarding-blink 1.6s steps(2, jump-none) infinite; }
}
@keyframes boarding-blink {
    0%   { opacity: 1; }
    100% { opacity: 0.35; }
}

/* Rows flicker on like a board waking up, once the section scrolls into
   view. Rows are visible by default — no JS, no reveal, no hidden content. */
@media (prefers-reduced-motion: no-preference) {
    .departures-section.is-visible .dep-row {
        animation: dep-flicker 0.45s steps(3, jump-none) backwards;
    }
    .departures-section.is-visible .dep-row:nth-child(1) { animation-delay: 0.15s; }
    .departures-section.is-visible .dep-row:nth-child(2) { animation-delay: 0.30s; }
    .departures-section.is-visible .dep-rows--blog .dep-row:nth-child(1) { animation-delay: 0.45s; }
    .departures-section.is-visible .dep-rows--blog .dep-row:nth-child(2) { animation-delay: 0.60s; }
}
@keyframes dep-flicker {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.dep-timetables {
    margin-top: 1.2rem;
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.dep-timetables a { color: var(--accent); }
.dep-timetables a:hover { color: var(--sign); }

@media (max-width: 640px) {
    .dep-head, .dep-row { grid-template-columns: 56px minmax(0, 1fr) 34px; gap: 0.75rem; padding: 0.75rem 1rem; }
    .dep-h-status, .dep-status { display: none; }
}

/* --------------------------------------------------------------------------
   About the stationmaster
   -------------------------------------------------------------------------- */

.about-lead {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 2.6vw, 1.45rem);
    line-height: 1.6;
    max-width: 720px;
}
.about-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.9rem;
    margin-top: 2rem;
}
.about-chip {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
}
.about-chip svg { color: var(--accent); }
.about-chip-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; margin-top: 0.25rem; }
.about-chip-sub { font-family: var(--font-pixel); font-size: 0.75rem; letter-spacing: 0.06em; color: var(--muted); }
.about-more { margin-top: 2.2rem; }

/* --------------------------------------------------------------------------
   Photography gallery
   -------------------------------------------------------------------------- */

.gallery-intro { color: var(--muted); max-width: 640px; margin-bottom: 2.2rem; }
.gallery-intro > * + * { margin-top: 1em; }
.gallery-empty { color: var(--muted); font-family: var(--font-pixel); font-size: 0.9rem; letter-spacing: 0.04em; }

/* The mosaic breaks out well past the site's normal 1080px column — the
   gallery is the one place on the site meant to fill the screen. */
.gallery-wide { max-width: 1800px; margin: 2.2rem auto 0; padding: 0 1.5rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: clamp(90px, 11vw, 170px);
    grid-auto-flow: dense;
    gap: 0.6rem;
}
.gallery-item {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 0;
}
.gallery-item:nth-child(6n+2) { transition-delay: 0.06s; }
.gallery-item:nth-child(6n+3) { transition-delay: 0.12s; }
.gallery-item:nth-child(6n+4) { transition-delay: 0.18s; }
.gallery-item:nth-child(6n+5) { transition-delay: 0.24s; }
.gallery-item.gi-big { grid-column: span 4; grid-row: span 2; }
.gallery-item.gi-tall { grid-column: span 2; grid-row: span 2; }
.gallery-item.gi-small { grid-column: span 2; grid-row: span 1; }

.gallery-thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    overflow: hidden;
    cursor: zoom-in;
    transition: border-color 0.2s ease;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.gallery-thumb:hover, .gallery-thumb:focus-visible { border-color: var(--accent); }
.gallery-thumb:hover img, .gallery-thumb:focus-visible img { transform: scale(1.06); }

.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(11, 14, 20, 0) 55%, rgba(11, 14, 20, 0.85) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.gallery-thumb:hover .gallery-overlay, .gallery-thumb:focus-visible .gallery-overlay { opacity: 1; }
.gallery-overlay-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 0.6rem;
    flex-shrink: 0;
    border: 1px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-size: 1rem;
    line-height: 1;
}
.gallery-overlay-text {
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: var(--sign);
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-thumb, .gallery-thumb img, .gallery-overlay { transition: none; }
}

/* Lightbox — a native <dialog>, centred and sized by hand rather than relying
   on the browser's default UA centring, which varies across engines. */
dialog.lightbox {
    position: fixed;
    inset: 0;
    margin: auto;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--sign);
}
dialog.lightbox[open] { display: flex; align-items: center; justify-content: center; }
dialog.lightbox::backdrop { background: rgba(11, 14, 20, 0.94); }
.lightbox-figure {
    margin: 0;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}
.lightbox-img { max-width: 92vw; max-height: 78vh; width: auto; height: auto; border-radius: var(--radius); }
.lightbox-caption { font-family: var(--font-pixel); font-size: 0.85rem; color: var(--muted); text-align: center; }
.lightbox-caption:empty { display: none; }
.lightbox-count { font-family: var(--font-pixel); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--muted); text-align: center; margin: 0; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: fixed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--sign);
    line-height: 1;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { color: var(--accent); border-color: var(--accent); }
.lightbox-close { top: 1.2rem; right: 1.2rem; width: 44px; height: 44px; font-size: 1.6rem; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 1.7rem; }
.lightbox-prev { left: 1.2rem; }
.lightbox-next { right: 1.2rem; }
@media (max-width: 900px) {
    .gallery-grid { grid-template-columns: repeat(4, 1fr); }
    .gallery-item.gi-big { grid-column: span 4; grid-row: span 2; }
    .gallery-item.gi-tall, .gallery-item.gi-small { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 640px) {
    .gallery-wide { padding: 0 1rem; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: clamp(150px, 42vw, 220px); gap: 0.5rem; }
    .gallery-item, .gallery-item.gi-big, .gallery-item.gi-tall, .gallery-item.gi-small { grid-column: span 1; grid-row: span 1; }
    .gallery-overlay { opacity: 1; padding: 0.7rem; background: linear-gradient(180deg, rgba(11, 14, 20, 0) 65%, rgba(11, 14, 20, 0.85) 100%); }
    .gallery-overlay-icon { display: none; }
    .lightbox-close { top: 0.7rem; right: 0.7rem; width: 38px; height: 38px; }
    .lightbox-prev, .lightbox-next { width: 40px; height: 40px; }
    .lightbox-prev { left: 0.7rem; }
    .lightbox-next { right: 0.7rem; }
}

/* --------------------------------------------------------------------------
   Blog list
   -------------------------------------------------------------------------- */

.article-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.article-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    grid-template-areas:
        ".     meta"
        "thumb body";
    column-gap: 1.2rem;
    row-gap: 0.5rem;
    align-items: start;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 1.1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.article-row > .article-row-meta { grid-area: meta; }
.article-row > .article-row-thumb { grid-area: thumb; }
.article-row > .article-row-body { grid-area: body; }
.article-row:hover { border-color: var(--accent); box-shadow: 0 0 18px rgba(165, 201, 61, 0.08); }

.article-row-thumb {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
}
.article-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.article-row:hover .article-row-thumb img { transform: scale(1.05); }
.article-row-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(140px 90px at 80% 20%, rgba(165, 201, 61, 0.15), transparent 70%),
        var(--panel-2);
    font-family: var(--font-pixel);
    font-size: 1.4rem;
    letter-spacing: 0.15em;
    color: var(--muted);
}

.article-row-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.article-row-body { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.article-date { font-family: var(--font-pixel); font-size: 0.8rem; letter-spacing: 0.06em; color: var(--muted); }
.article-row-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.3; }
.article-row-title a:hover { color: var(--accent); }
.article-row-desc { color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.article-row-link { font-family: var(--font-pixel); font-size: 0.8rem; letter-spacing: 0.06em; color: var(--accent); }
.article-row:hover .article-row-link { color: var(--sign); }

@media (max-width: 640px) {
    .article-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "thumb"
            "meta"
            "body";
    }
    .article-row-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
}

.tag {
    display: inline-block;
    padding: 0.15em 0.6em;
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 99px;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tag:hover { color: var(--accent); border-color: var(--accent); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* --------------------------------------------------------------------------
   Blog post
   -------------------------------------------------------------------------- */

.article-post { padding: 3.5rem 0 4.5rem; }
.article-post-back {
    display: inline-block;
    margin-bottom: 2rem;
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.article-post-back:hover { color: var(--accent); }
.article-post-meta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.article-post-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.9rem, 5vw, 2.9rem);
    line-height: 1.15;
}
.article-post-lead { color: var(--muted); font-size: 1.25rem; line-height: 1.55; margin-top: 0.9rem; }

.article-post-content { margin-top: 2.2rem; font-size: 1.05rem; line-height: 1.75; }
.article-post-content > * + * { margin-top: 1.1em; }
.article-post-content h2, .article-post-content h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    margin-top: 1.8em;
}
.article-post-content h2 { font-size: 1.5rem; }
.article-post-content h3 { font-size: 1.2rem; }
.article-post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-post-content a:hover { color: var(--sign); }
.article-post-content strong { color: var(--sign); }
.article-post-content blockquote {
    margin: 1.4em 0;
    padding: 0.2em 0 0.2em 1.2em;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}
.article-post-content ul, .article-post-content ol { padding-left: 1.4em; }
.article-post-content ul { list-style: disc; }
.article-post-content ol { list-style: decimal; }
.article-post-content li + li { margin-top: 0.4em; }
.article-post-content img, .article-post-content figure { border-radius: var(--radius-panel); margin: 1.6em auto; }
.article-post-content figcaption { font-size: 0.85rem; color: var(--muted); text-align: center; margin-top: 0.6em; }
.article-post-content code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}
.article-post-content pre {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 1.1rem 1.3rem;
    overflow-x: auto;
}
.article-post-content pre code { background: none; border: none; padding: 0; }

.article-post-footer { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.share-text { font-family: var(--font-pixel); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.share-links { display: flex; gap: 0.6rem; }
.share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    transition: color 0.15s ease, border-color 0.15s ease;
}
.share-link:hover { color: var(--accent); border-color: var(--accent); }

.article-post-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.article-nav-link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.2rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    transition: border-color 0.15s ease;
}
.article-nav-link:hover { border-color: var(--accent); }
.article-nav-next { text-align: right; align-items: flex-end; grid-column: 2; }
.article-nav-label { font-family: var(--font-pixel); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.article-nav-title { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
@media (max-width: 560px) {
    .article-post-navigation { grid-template-columns: 1fr; }
    .article-nav-next { grid-column: 1; }
}

/* --------------------------------------------------------------------------
   Breadcrumb, pagination, static pages
   -------------------------------------------------------------------------- */

.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-pixel); font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--line); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: 3rem; font-family: var(--font-pixel); font-size: 0.85rem; color: var(--muted); }
.pagination-link { color: var(--accent); }
.pagination-link:hover { color: var(--sign); }

.content-page { padding-bottom: 4.5rem; }

.not-found { padding: 6rem 0; text-align: center; }
.not-found-code {
    font-family: var(--font-pixel);
    font-size: clamp(4rem, 14vw, 7rem);
    line-height: 1;
    color: var(--accent);
}
.not-found-kana { font-family: var(--font-pixel); letter-spacing: 0.3em; color: var(--muted); margin-top: 1rem; }
.not-found-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(1.6rem, 5vw, 2.4rem); margin-top: 0.8rem; }
.not-found-text { color: var(--muted); max-width: 420px; margin: 0.8rem auto 2rem; }

.view-all { margin-top: 2.5rem; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); background: var(--panel); margin-top: 3rem; }
.footer-inner { padding-top: 2.8rem; padding-bottom: 2rem; }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer-tagline { font-family: var(--font-display); font-weight: 700; }
.footer-links { display: flex; gap: 1.3rem; flex-wrap: wrap; }
.footer-links a { font-family: var(--font-pixel); font-size: 0.8rem; letter-spacing: 0.06em; color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 0.6rem; }
.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    transition: color 0.15s ease, border-color 0.15s ease;
}
.footer-social-link:hover { color: var(--accent); border-color: var(--accent); }
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    padding-top: 1.4rem;
}
.footer-text { color: var(--muted); font-size: 0.85rem; }
.footer-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-pixel);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.footer-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
    .footer-status-dot { animation: boarding-blink 2.2s steps(2, jump-none) infinite; }
}
