/* === Editorial Mono: Design tokens === */
:root {
    /* Typography */
    --bs-font-sans-serif: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    --bs-font-monospace: 'IBM Plex Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    /* Grayscale palette (AAA-safe ramp on white) */
    --ink:     #0f0f0f; /* primary text, dark sections */
    --paper:   #fafafa; /* off-white background */
    --rule:    #e0e0e0; /* hairlines, card borders */
    --muted:   #595959; /* secondary text (7.0:1 AAA on white) */
    --muted-2: #767676; /* tertiary text (4.5:1 AA on white) */
    /* Accent — wine red drawn from the masthead photo.
       Two-tone: AAA-safe on both white and ink backgrounds. */
    --accent:               #9c243c; /* 7.69:1 on #fff (AAA) */
    --accent-hover:         #6f1929;
    --accent-on-dark:       #f08a9e; /* 8.7:1 on #0f0f0f (AAA) */
    --accent-on-dark-hover: #ffb0bf;
    /* Bootstrap variable overrides */
    --bs-primary:        var(--ink);
    --bs-primary-rgb:    15, 15, 15;
    --bs-secondary:      var(--ink);
    --bs-secondary-rgb:  15, 15, 15;
    --bs-link-color:     var(--accent);
    --bs-link-hover-color: var(--accent-hover);
    --bs-body-color:     var(--ink);
    --bs-body-bg:        #ffffff;
    --bs-border-color:   var(--rule);
}
/* === Responsive safety net (mobile-first base) === */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
img, svg, video { max-width: 100%; height: auto; }
body {
    font-family: var(--bs-font-sans-serif);
    font-weight: 400;
    color: var(--ink);
    background: #ffffff;
    min-width: 320px;
}
/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
h1, h2, h3, h4, h5, h6,
.masthead-heading, .page-section-heading {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink);
}
/* Bootstrap utility class overrides */
.text-primary   { color: var(--ink) !important; }
.text-secondary { color: var(--ink) !important; }
.bg-primary     { background-color: var(--ink) !important; }
.bg-secondary   { background-color: var(--ink) !important; }
.text-white-on-dark, .bg-primary, .bg-secondary, .bg-dark { color: #ffffff; }
/* Accent applied only to body links, button primary, and Award badges */
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
/* Navbar links should remain monochrome (override accent) */
.navbar a, .nav-link, .navbar-brand,
.activity-title a, .footer a, .masthead a,
section#awards a, .copyright a {
    color: inherit;
    text-decoration: none;
}
.activity-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Focus visible — explicit, high-contrast */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}
/* Smooth scroll anchor offset (fixed-top navbar) */
section[id], [id^="page"] { scroll-margin-top: 5rem; }

/* === Masthead (Split Column: photo-left, text-right) === */
.masthead {
    background: #0a0a0a !important;
    color: #ffffff;
    padding: 6rem 0 5rem;
}
.masthead .container { max-width: 1080px; }
.masthead-grid {
    display: grid;
    grid-template-columns: minmax(140px, 38%) 1fr;
    gap: 0;
    align-items: stretch;
    min-height: 260px;
}
.masthead-photo {
    grid-column: 1; grid-row: 1;
    border-right: 1px solid #3a3a3a;
    padding-right: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}
.masthead-photo img {
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center top;
    border-radius: 0 !important;
    border: 0;
    display: block;
}
.masthead-text {
    grid-column: 2; grid-row: 1;
    padding-left: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
    overflow-wrap: anywhere;
}
.masthead-text > * { max-width: 100%; }
.masthead-photo { min-width: 0; }
.masthead-heading {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: clamp(2.25rem, 4.5vw, 3.5rem) !important;
    letter-spacing: -0.01em !important;
    text-transform: none !important;
    line-height: 1.05;
    margin: 0 !important;
}
.masthead-divider {
    width: 2.5rem;
    height: 1px;
    background: #3a3a3a;
    margin: 1.25rem 0;
    border: 0;
}
.masthead-subheading {
    color: #b0b0b0;
    font-family: 'IBM Plex Sans', sans-serif !important;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    margin: 0 0 0.4rem;
    text-align: left;
}
.masthead-tagline {
    color: #787878;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin: 0;
}
.masthead .divider-custom { display: none !important; }

/* Stack on phones up to large portrait widths (< 640px) so every
   portrait-oriented device (iPhone SE 375 → Plus/Max 428, narrow
   Androids) gets a single-column hero with the photo on top of
   the text block. */
@media (max-width: 639.98px) {
    .masthead { padding: 5rem 0 3.5rem; }
    .masthead-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
        min-height: 0;
    }
    .masthead-text {
        grid-column: 1;
        grid-row: 1;
        padding-left: 0;
        align-items: center;
        text-align: center;
    }
    .masthead-photo {
        grid-column: 1;
        grid-row: 2;
        border-right: 0;
        border-top: 1px solid #3a3a3a;
        padding: 1.75rem 0 0;
        justify-content: center;
    }
    .masthead-photo img { max-width: min(180px, 55vw); }
    .masthead-divider { margin: 1rem auto; }
    .masthead-subheading, .masthead-tagline { text-align: center; }
}

/* === Responsive overrides (mobile-first refinements) ===
   Breakpoint map (overrides above + below):
     < 480px  : single-column stacks (masthead already handled above)
     480–767  : keep masthead split, tighten paddings, stack timeline rows
     768–991  : comfortable 2-column hero, refine card paddings
     992+     : default desktop styles untouched
   All interactive controls audited to ≥ 44×44px on touch sizes. */

/* ---- 640–767px: small tablets portrait (2-column hero re-enabled) ---- */
@media (min-width: 640px) and (max-width: 767.98px) {
    .masthead { padding: 5.5rem 0 4rem; }
    .masthead-grid {
        grid-template-columns: minmax(0, 32%) 1fr;
        min-height: 220px;
    }
    .masthead-photo { padding-right: clamp(0.75rem, 2vw, 1.5rem); }
    .masthead-photo img { max-width: min(200px, 28vw); }
    .masthead-text { padding-left: clamp(0.75rem, 2vw, 1.5rem); }
    .masthead-heading { font-size: clamp(1.85rem, 5vw, 2.4rem) !important; }
    .masthead-subheading { font-size: 0.92rem; }
    .masthead-tagline { font-size: 0.68rem; letter-spacing: 0.12em; }
    .masthead-divider { margin: 1rem 0; }
}

/* ---- 768–991px: tablets (hero comfortable, cards begin to span) ---- */
@media (min-width: 768px) and (max-width: 991.98px) {
    .masthead { padding: 6rem 0 4.5rem; }
    .masthead-photo img { max-width: 240px; }
    .masthead-heading { font-size: clamp(2rem, 5vw, 2.8rem) !important; }
}

/* ---- < 992px: navbar collapses; tune the mobile menu ---- */
@media (max-width: 991.98px) {
    #mainNav .navbar-toggler {
        padding: 0.55rem 0.85rem;
        min-height: 44px;
        min-width: 44px;
    }
    #mainNav .navbar-collapse {
        margin-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.08);
        padding-top: 0.5rem;
    }
    #mainNav .navbar-nav { align-items: stretch !important; }
    #mainNav .navbar-nav .nav-item { width: 100%; }
    #mainNav .nav-link {
        padding: 0.85rem 0 !important;
        min-height: 44px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    #mainNav .navbar-nav .nav-item:last-child .nav-link,
    #mainNav .navbar-nav .nav-item:last-child { border-bottom: 0; }
    #mainNav .navbar-nav .nav-item:last-child {
        margin: 0.75rem 0 0.25rem !important;
    }
    #mainNav .lang-toggle {
        width: auto;
        min-height: 44px;
        padding: 0.6rem 1rem;
        align-self: flex-start;
    }
}

/* ---- < 992px: stack activity rows earlier; also research/contact/modal refinements ---- */
@media (max-width: 991.98px) {
    /* Section vertical rhythm — shave a touch on mobile */
    section.page-section { padding-top: 4rem; padding-bottom: 4rem; }

    /* Page-heading sizing */
    .page-section-heading { font-size: 0.9rem !important; letter-spacing: 0.18em !important; }

    /* Research / Skills cards: a hair tighter so they sit nicely full-width */
    .research-card { padding: 1.5rem 1.1rem; }
    .skill-card { padding: 1.25rem 0.75rem; }
    .skill-card i { font-size: 2.4rem; }

    /* Activity timeline: 2-row grid — date + badge on row 1, body
       spans row 2. minmax(0, ...) lets columns shrink below their
       min-content, which is what stops the row from forcing a
       horizontal scrollbar on narrow phones (375–428px). */
    .activity-item {
        display: grid;
        grid-template-columns: minmax(0, auto) minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: 0.7rem;
        row-gap: 0.5rem;
        padding: 1.2rem 0;
        align-items: start;
    }
    .activity-date {
        width: auto;
        max-width: 100%;
        min-width: 0;
        padding-top: 0.15rem;
        font-size: 0.75rem;
        grid-column: 1;
        grid-row: 1;
        white-space: nowrap;
    }
    .activity-badge {
        margin-top: 0;
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        white-space: normal;
        word-break: keep-all;
        max-width: 100%;
    }
    .activity-body {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .activity-title { font-size: 0.95rem; }
    .activity-desc { font-size: 0.83rem; }

    /* Awards: keep readable at small widths */
    section#awards h5 { font-size: 1rem; line-height: 1.45; }
    section#awards .award-meta { font-size: 0.7rem; }

    /* Contact buttons: full-width stacks for easy thumb reach */
    #contact .btn-xl {
        display: block;
        width: 100%;
        max-width: 320px;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 1rem 1.5rem !important;
        min-height: 48px;
    }
    #contact .btn-xl + .btn-xl { margin-top: 0.25rem; }

    /* Footer: re-center stacked columns, ensure social buttons hit 44px */
    .footer { padding: 2.75rem 0 !important; }
    .footer h4 { margin-bottom: 0.75rem !important; }
    .footer .btn-outline-light {
        width: 44px;
        height: 44px;
        line-height: 42px;
        margin: 0.25rem 0.25rem !important;
    }

    /* Article modal: tighten body padding for narrow viewports */
    .article-modal .modal-body { padding: 1.5rem 1.25rem; }
    .article-modal .modal-body h1 { font-size: 1.25rem; }
    .article-modal .modal-body h2 { font-size: 1.05rem; margin-top: 1.4rem; }
}

/* ---- < 360px: very narrow phones — last-resort tightening ---- */
@media (max-width: 359.98px) {
    .masthead-heading { font-size: 1.9rem !important; }
    .masthead-photo img { max-width: 150px; }
    .research-card { padding: 1.25rem 1rem; }
    .activity-date { font-size: 0.72rem; }
    .article-modal .modal-body { padding: 1.25rem 1rem; }
}

/* === Language toggle (visible on dark + light backgrounds) === */
.lang-toggle {
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    padding: 0.4rem 0.8rem;
    border-radius: 0;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    transition: background 0.15s, color 0.15s;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lang-toggle:hover {
    background: currentColor;
    color: var(--ink);
}
.navbar .lang-toggle { color: #ffffff; }
.navbar .lang-toggle:hover { background: #ffffff; color: var(--ink); }

/* === Navbar (ink, with subtle ruled bottom) === */
#mainNav {
    background: var(--ink) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
#mainNav .navbar-brand {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ffffff;
    text-transform: none;
}
#mainNav .nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.75) !important;
    transition: color 0.15s;
}
#mainNav .nav-link:hover,
#mainNav .nav-link:focus { color: #ffffff !important; }
/* Suppress the Bootstrap theme's emerald (#1abc9c) accent on
   navbar links and replace the scrollspy active-link "pill" with
   a thin accent underline. */
#mainNav .navbar-nav li.nav-item a.nav-link:hover,
#mainNav .navbar-nav li.nav-item a.nav-link:focus {
    color: #ffffff !important;
    background: transparent !important;
}
#mainNav .navbar-nav li.nav-item a.nav-link.active,
#mainNav .navbar-nav > li.nav-item > a.nav-link.active,
#mainNav .navbar-nav > li.nav-item > a.nav-link.active:active,
#mainNav .navbar-nav > li.nav-item > a.nav-link.active:focus,
#mainNav .navbar-nav > li.nav-item > a.nav-link.active:hover {
    color: #ffffff !important;
    background: transparent !important;
    border-radius: 0 !important;
    text-decoration: underline;
    text-decoration-color: var(--accent-on-dark);
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}
#mainNav .navbar-toggler {
    background: transparent !important;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.4);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
}

/* === Awards (single dark "emphasis" zone) === */
section#awards {
    background: var(--ink) !important;
    color: #ffffff;
}
section#awards .page-section-heading,
section#awards h5 { color: #ffffff !important; }
section#awards .award-meta {
    color: #a8a8a8; /* 4.55:1 on #0f0f0f — AA */
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
section#awards a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255,255,255,0.4);
}
section#awards a:hover { text-decoration-color: #ffffff; }

/* === Section dividers (short ruled lines, replacing star ornament) === */
.divider-custom {
    width: 2.5rem;
    height: 2px;
    background: var(--ink);
    margin: 1rem auto 2.5rem;
    display: block;
    opacity: 1;
}
.divider-custom .divider-custom-line,
.divider-custom .divider-custom-icon { display: none !important; }
.divider-custom.divider-light { background: #ffffff; }
/* === Research cards (flat, ruled) === */
.research-card {
    padding: 1.75rem 1.25rem;
    height: 100%;
    border: 1px solid var(--rule);
    border-radius: 0;
    background: #ffffff;
    transition: border-color 0.15s;
    contain: layout style;
    overflow-wrap: anywhere;
}
.research-card:hover {
    box-shadow: none;
    border-color: var(--ink);
}
.research-card h5 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
}
.research-card i { color: var(--ink) !important; }
.research-card p { color: var(--muted); font-size: 0.9rem; }

/* === Skill cards (flat, monochrome icons) === */
.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 1.5rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 0;
    background: #ffffff;
    transition: border-color 0.15s;
    contain: layout style;
}
.skill-card:hover {
    box-shadow: none;
    transform: none;
    border-color: var(--ink);
}
.skill-card i,
.skill-card img {
    font-size: 2.8rem;
    line-height: 1;
    filter: grayscale(1) brightness(0.4);
    transition: filter 0.15s;
}
.skill-card img {
    width: 2.8rem;
    height: 2.8rem;
    object-fit: contain;
    display: block;
}
.skill-card:hover i,
.skill-card:hover img { filter: grayscale(1) brightness(0); }
.skill-card span {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
}

/* === Career timeline (dot-style horizontal history graph) === */
.career-timeline-wrap {
    position: relative;
    padding: 0.5rem 0;
}
.career-timeline {
    position: relative;
    display: flex;
    align-items: flex-start;
}
.career-timeline::before {
    content: '';
    position: absolute;
    left: calc(50% / var(--n, 4));
    right: calc(50% / var(--n, 4));
    top: 5.25rem;
    height: 1px;
    background: var(--rule);
    z-index: 0;
}
.career-milestone {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.25rem;
    text-align: center;
}
.career-caption {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.career-caption.above {
    min-height: 5.25rem;
    flex-direction: column-reverse;
    padding-bottom: 0.7rem;
}
.career-caption.below {
    flex-direction: column;
    padding-top: 0.7rem;
}
.career-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 4px var(--accent);
    flex-shrink: 0;
    margin-top: -6px;
}
.career-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.career-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.career-venue {
    font-size: 0.7rem;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
@media (max-width: 575.98px) {
    .career-date  { font-size: 0.62rem; letter-spacing: 0; }
    .career-label { font-size: 0.72rem; }
    .career-venue { font-size: 0.58rem; }
    .career-milestone { padding: 0 0.15rem; }
    .career-caption { gap: 0.4rem; }
    .career-caption.above { min-height: 4.5rem; }
    .career-timeline::before { top: 4.5rem; }
}

/* === Activity timeline === */
.activity-list {
    list-style: none;
    padding: 0;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    contain: layout style;
}
.activity-item {
    display: flex;
    gap: 1.2rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: flex-start;
    min-width: 0;
}
.activity-item:last-child { border-bottom: none; }
.activity-date {
    flex-shrink: 0;
    width: 6.5rem;
    max-width: 6.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    padding-top: 0.15rem;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.02em;
    overflow-wrap: break-word;
}
/* Badge: shape-based differentiation (color-blind safe per WCAG 1.4.1) */
.activity-badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.1rem;
    white-space: nowrap;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    border-radius: 0;
    line-height: 1.4;
}
/* Blog: solid filled (most common type) */
.badge-blog    { background: var(--ink); color: #ffffff; border-color: var(--ink); }
/* Article: outlined (distinct from blog by absence of fill) */
.badge-article { background: transparent; color: var(--ink); }
/* Award: accent color (single use of accent, signals importance) */
.badge-award   { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.activity-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-title {
    font-size: 0.97rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    line-height: 1.4;
    color: var(--ink);
}
.activity-title a { color: var(--ink); text-decoration: none; }
.activity-title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.activity-desc {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

/* === Publications list (mirrors the activity list) === */
.publication-list {
    list-style: none;
    padding: 0;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    contain: layout style;
}
.pub-item {
    display: flex;
    gap: 1.2rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: flex-start;
    min-width: 0;
}
.pub-item:last-child { border-bottom: none; }
.pub-year {
    flex-shrink: 0;
    width: 3.2rem;
    max-width: 3.2rem;
    font-size: 0.85rem;
    color: var(--muted);
    padding-top: 0.15rem;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.02em;
}
/* Badge meaning is carried by its text (WCAG 1.4.1); color is enhancement only. */
.pub-badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.1rem;
    white-space: nowrap;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    line-height: 1.4;
}
.pub-journal { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.pub-intl    { background: var(--ink);    color: #ffffff; border-color: var(--ink); }
.pub-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pub-title {
    font-size: 0.97rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    line-height: 1.45;
    color: var(--ink);
}
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.pub-authors {
    font-size: 0.85rem;
    color: var(--ink);
    margin: 0 0 0.15rem;
    line-height: 1.5;
}
.pub-authors strong { font-weight: 700; }
.pub-venue {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
    font-style: italic;
}
@media (max-width: 991.98px) {
    .pub-item {
        display: grid;
        grid-template-columns: minmax(0, auto) minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: 0.7rem;
        row-gap: 0.5rem;
        padding: 1.2rem 0;
        align-items: start;
    }
    .pub-year  { grid-column: 1; grid-row: 1; width: auto; max-width: 100%; font-size: 0.78rem; white-space: nowrap; }
    .pub-badge { grid-column: 2; grid-row: 1; margin-top: 0; justify-self: start; white-space: normal; word-break: keep-all; max-width: 100%; }
    .pub-body  { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
    .pub-title { font-size: 0.95rem; }
    .pub-authors, .pub-venue { font-size: 0.82rem; }
}

/* === Products card grid (image-free, editorial) === */
.product-card {
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.product-card:hover {
    border-color: var(--ink);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}
.product-name { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; line-height: 1.4; color: var(--ink); }
.product-name a { color: var(--ink); text-decoration: none; }
.product-name a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.product-desc { font-size: 0.88rem; color: var(--muted); margin: 0 0 0.9rem; line-height: 1.6; }
.product-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.product-tag {
    font-size: 0.7rem;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--muted);
}
.product-links { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: auto; }
.product-link {
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.12s ease;
}
.product-link:hover { color: var(--accent); }
.product-link i { font-size: 0.85em; }

/* Article modal */
.article-modal .modal-body { padding: 2rem 2.5rem; line-height: 1.8; }
.article-modal .modal-body h1 { font-size: 1.5rem; }
.article-modal .modal-body h2 { font-size: 1.2rem; margin-top: 1.8rem; }
.article-modal .modal-content { border-radius: 0; border: 1px solid var(--ink); }

/* === Buttons (monochrome with shape hierarchy) === */
.btn-primary, .btn-secondary {
    background: var(--ink) !important;
    border: 1px solid var(--ink) !important;
    color: #ffffff !important;
    border-radius: 0 !important;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    box-shadow: none !important;
    transition: background 0.15s, color 0.15s;
}
.btn-primary:hover, .btn-primary:focus,
.btn-secondary:hover, .btn-secondary:focus {
    background: #ffffff !important;
    color: var(--ink) !important;
    border-color: var(--ink) !important;
}
/* Outline variant for the secondary contact button (GitHub) */
.btn.btn-secondary[href*="github"] {
    background: transparent !important;
    color: var(--ink) !important;
}
.btn.btn-secondary[href*="github"]:hover {
    background: var(--ink) !important;
    color: #ffffff !important;
}
.btn-xl {
    padding: 0.9rem 1.8rem !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase;
}

/* === Section background rhythm (flat — remove bg-light tinting) === */
section.bg-light { background: #ffffff !important; }
/* Section separators (subtle hairline between sections) */
section.page-section + section.page-section { border-top: 1px solid var(--rule); }
section#awards { border-top: 0 !important; border-bottom: 0; }

/* === Footer (ink) === */
.footer {
    background: var(--ink) !important;
    color: #ffffff;
    padding: 3.5rem 0 !important;
}
.footer h4 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    color: #ffffff !important;
    margin-bottom: 1rem !important;
}
.footer .lead { font-size: 0.95rem; line-height: 1.6; }
.footer a { color: #ffffff; text-decoration: none; }
.footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer .btn-outline-light {
    border-radius: 0 !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
    color: #ffffff !important;
    width: 44px;
    height: 44px;
    line-height: 1;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.footer .btn-outline-light:hover {
    background: #ffffff !important;
    color: var(--ink) !important;
    border-color: #ffffff !important;
}
/* Copyright bar (already bg-dark; reinforce) */
.copyright {
    background: #050505 !important;
    color: rgba(255,255,255,0.6) !important;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
}

/* Page section heading: smaller, label-like (Editorial Mono) */
.page-section-heading {
    font-size: 1rem !important;
    font-family: 'IBM Plex Mono', monospace !important;
    font-weight: 600 !important;
    letter-spacing: 0.2em !important;
    color: var(--ink) !important;
}
section#awards .page-section-heading { color: #ffffff !important; }
.lead { color: var(--muted); font-size: 1rem; line-height: 1.7; }

/* === Long-form text safety: prevent overflow on narrow viewports ===
   Japanese text does not always break at whitespace; without
   overflow-wrap, a centered <p> renders at max-content width and
   spills past the viewport on both sides. Apply broadly to text
   nodes so every section stays inside its container. */
p, h1, h2, h3, h4, h5, h6,
.lead, .masthead-heading, .masthead-subheading, .masthead-tagline,
.masthead-text > *,
.research-card p, .research-card h5,
section#awards h5,
section#awards .award-meta,
section#awards a,
.activity-title,
.activity-desc,
.pub-title,
.pub-authors,
.pub-venue,
.product-name,
.product-desc,
.product-tag,
.modal-title {
    overflow-wrap: anywhere;
    word-break: normal;
    max-width: 100%;
}
.masthead-text, .research-card, .activity-body, .pub-body, .product-card, .skill-card {
    min-width: 0;
}

/* Page section heading: fluid sizing so it never gets too cramped */
@media (max-width: 767.98px) {
    .page-section-heading {
        font-size: clamp(0.82rem, 2.6vw, 1rem) !important;
        letter-spacing: 0.16em !important;
    }
}

/* ---- < 600px: portrait phones — extra tightening for activity rows ---- */
@media (max-width: 599.98px) {
    .activity-item {
        grid-template-columns: minmax(0, 5rem) minmax(0, 1fr);
        column-gap: 0.55rem;
    }
    .activity-date { font-size: 0.72rem; letter-spacing: 0; }
    .activity-badge { font-size: 0.62rem; padding: 0.18rem 0.45rem; letter-spacing: 0.08em; }
    .masthead-tagline {
        font-size: 0.65rem;
        letter-spacing: 0.1em;
        overflow-wrap: anywhere;
    }
}
