/* =========================================================================
   Fujimoto Ikuto — Research Homepage
   Design v2: Hi-tech robotics. Deep navy + electric blue + cyan glow.
   Gradients & subtle grid lines, but academic restraint preserved.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
    /* Light surface */
    --c-bg:        #f4f6fb;
    --c-surface:   #ffffff;
    --c-surface-2: #eef2fa;
    --c-rule:      #d9deec;
    --c-rule-soft: #e6eaf3;

    /* Ink / text */
    --c-ink:       #0b1437;   /* deep navy ink */
    --c-ink-soft:  #2a3565;
    --c-ink-mid:   #4a5680;
    --c-muted:     #7a85a8;

    /* Dark / deep navy (hero, footer) */
    --c-deep:      #060b22;
    --c-deep-2:    #0a1230;
    --c-deep-3:    #14225a;
    --c-deep-ink:  #e7ecff;
    --c-deep-mid:  #a8b3d8;
    --c-deep-mute: #6e789c;

    /* Brand & accent */
    --c-blue:      #3b5fe2;   /* primary action blue */
    --c-blue-deep: #1f3aaa;
    --c-blue-soft: #6c8bef;
    --c-cyan:      #22d3ee;   /* hi-tech glow / highlight */
    --c-cyan-soft: #67e8f9;
    --c-violet:    #7c5cff;   /* secondary accent for gradients */

    /* Gradients */
    --g-brand:      linear-gradient(135deg, #3b5fe2 0%, #22d3ee 100%);
    --g-brand-rev:  linear-gradient(135deg, #22d3ee 0%, #3b5fe2 100%);
    --g-deep-hero:  radial-gradient(ellipse at 18% 12%, #1c2e7a 0%, transparent 55%),
                    radial-gradient(ellipse at 82% 88%, #0c2b6b 0%, transparent 55%),
                    linear-gradient(180deg, #060b22 0%, #0a1230 100%);
    --g-text:       linear-gradient(90deg, #3b5fe2, #22d3ee);
    --g-rule:       linear-gradient(90deg, transparent, var(--c-blue) 30%, var(--c-cyan) 70%, transparent);

    /* Typography */
    --f-sans:      "Outfit", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
    --f-mono:      "JetBrains Mono", "Consolas", "Menlo", monospace;

    /* Type scale */
    --t-xs:   0.75rem;
    --t-sm:   0.85rem;
    --t-base: 1rem;
    --t-md:   1.125rem;
    --t-lg:   1.35rem;
    --t-xl:   1.75rem;
    --t-2xl:  2.25rem;
    --t-3xl:  3rem;
    --t-4xl:  clamp(2.75rem, 7.5vw, 5rem);

    /* Spacing */
    --s-1:  0.25rem;
    --s-2:  0.5rem;
    --s-3:  0.75rem;
    --s-4:  1rem;
    --s-5:  1.5rem;
    --s-6:  2rem;
    --s-7:  3rem;
    --s-8:  4.5rem;
    --s-9:  6rem;
    --s-10: 9rem;

    /* Layout */
    --max-w:  74rem;
    --read-w: 44rem;
    --nav-h:  4.25rem;
    --radius: 14px;
    --radius-sm: 8px;

    /* Motion */
    --ease: cubic-bezier(.2,.7,.2,1);

    /* Effects */
    --glow-cyan:  0 0 0 1px rgba(34,211,238,.35), 0 0 24px rgba(34,211,238,.18);
    --glow-blue:  0 0 0 1px rgba(59,95,226,.45), 0 0 28px rgba(59,95,226,.25);
    --shadow-lg:  0 24px 48px -16px rgba(15,28,80,.18), 0 8px 16px -8px rgba(15,28,80,.10);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    /* Anchor links land below the sticky nav, not under it. */
    scroll-padding-top: var(--nav-h);
}
body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: var(--f-sans);
    font-size: var(--t-base);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "palt" 1, "ss01" 1;
}
img, svg { max-width: 100%; display: block; }
ul, ol { padding: 0; margin: 0; list-style: none; }
p { margin: 0; }

a {
    color: var(--c-blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .25s var(--ease), border-color .25s var(--ease);
}
a:hover { color: var(--c-blue-deep); border-bottom-color: var(--c-blue); }

/* External links: inherit the surrounding block's text colour, marked with an underline. */
a[target="_blank"] {
    color: inherit;
    border-bottom: 0;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: text-decoration-color .25s var(--ease), text-decoration-thickness .25s var(--ease);
}
a[target="_blank"]:hover {
    color: inherit;
    border-bottom: 0;
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
}
/* External-link marker icon (inherits text colour via currentColor). */
a[target="_blank"]::after {
    content: "";
    display: inline-block;
    width: 0.74em;
    height: 0.74em;
    margin-left: 0.22em;
    vertical-align: -0.08em;
    background-color: currentColor;
    opacity: .7;
    transition: opacity .25s var(--ease);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4'/%3E%3Cpath d='M14 4h6v6'/%3E%3Cpath d='M20 4l-8 8'/%3E%3C/svg%3E") no-repeat center / contain;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4'/%3E%3Cpath d='M14 4h6v6'/%3E%3Cpath d='M20 4l-8 8'/%3E%3C/svg%3E") no-repeat center / contain;
}
a[target="_blank"]:hover::after { opacity: 1; }

em {
    font-style: normal;
    background: var(--g-text);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    font-weight: 500;
}

abbr[title] {
    text-decoration: none;
    border-bottom: 1px dotted var(--c-muted);
    cursor: help;
}

::selection { background: var(--c-blue); color: #fff; }

/* ---------- Bilingual visibility ---------- */
body[data-lang="ja"] .en,
body[data-lang="en"] .ja { display: none; }

/* ---------- Top navigation ---------- */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-5);
    height: var(--nav-h);
    padding: 0 var(--s-7);
    background: color-mix(in srgb, var(--c-bg) 80%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--c-rule);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    border-bottom: 0;
    color: var(--c-ink);
}
.brand:hover { color: var(--c-blue); border-bottom: 0; }

.brand-mark {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #fff;
    background: var(--g-brand);
    border-radius: 8px;
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 0;
    box-shadow: var(--glow-blue);
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 11px;
    background: var(--g-brand);
    filter: blur(10px);
    opacity: .35;
    z-index: -1;
}

.brand-name {
    font-family: var(--f-sans);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.nav-links {
    display: flex;
    gap: var(--s-6);
    font-size: var(--t-sm);
    font-weight: 500;
    letter-spacing: 0.03em;
}
.nav-links a {
    border-bottom: 0;
    color: var(--c-ink-soft);
    position: relative;
    padding: 0.4rem 0;
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: var(--g-brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease);
}
.nav-links a:hover { color: var(--c-blue); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: 0.42rem 0.85rem;
    background: var(--c-surface);
    border: 1px solid var(--c-rule);
    border-radius: 999px;
    color: var(--c-ink-soft);
    font: inherit;
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: border-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.lang-toggle:hover {
    border-color: var(--c-blue);
    color: var(--c-blue);
    box-shadow: 0 0 0 3px rgba(59,95,226,.08);
}
.lang-opt { color: var(--c-muted); transition: color .25s var(--ease); }
.lang-opt.is-active { color: var(--c-ink); }
.lang-sep { color: var(--c-rule); }

/* ---------- Hamburger (mobile only) ---------- */
.nav-toggle {
    display: none;
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-rule);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.nav-toggle:hover { border-color: var(--c-blue); }
.nav-toggle:focus-visible {
    outline: none;
    border-color: var(--c-blue);
    box-shadow: 0 0 0 3px rgba(59,95,226,.18);
}
.nav-toggle-bar {
    position: absolute;
    left: 50%;
    width: 1.15rem;
    height: 2px;
    margin-left: -0.575rem;
    background: var(--c-ink-soft);
    border-radius: 2px;
    transition: top .3s var(--ease), transform .3s var(--ease), opacity .2s var(--ease);
}
.nav-toggle-bar:nth-child(1) { top: calc(50% - 7px); }
.nav-toggle-bar:nth-child(2) { top: calc(50% - 1px); }
.nav-toggle-bar:nth-child(3) { top: calc(50% + 5px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    top: calc(50% - 1px); transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    top: calc(50% - 1px); transform: rotate(-45deg);
}

/* ---------- Layout container ---------- */
main {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--s-7);
}

/* ============================================================ */
/* HERO — full-width dark navy w/ grid + glow                    */
/* ============================================================ */
.hero {
    position: relative;
    isolation: isolate;
    margin: 0 calc(50% - 50vw);     /* break out to full-width */
    padding: var(--s-10) calc(50vw - 50%) var(--s-9);
    color: var(--c-deep-ink);
    background: var(--g-deep-hero);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    color: rgba(167, 184, 235, 0.07);   /* grid line color */
    pointer-events: none;
}
.hero-grid { width: 100%; height: 100%; }

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    pointer-events: none;
}
.hero-orb-1 {
    width: 460px; height: 460px;
    top: -80px; left: -100px;
    background: radial-gradient(circle, #3b5fe2 0%, transparent 65%);
}
.hero-orb-2 {
    width: 380px; height: 380px;
    bottom: -120px; right: -100px;
    background: radial-gradient(circle, #22d3ee 0%, transparent 60%);
    opacity: 0.40;
}

.hero-inner {
    max-width: 64rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15rem;
    column-gap: var(--s-8);
    align-items: start;
}
.hero-text { order: 1; min-width: 0; }

/* Portrait */
.hero-portrait {
    order: 2;
    position: relative;
    isolation: isolate;
    margin: 0;
    width: 100%;
    max-width: 15rem;
    justify-self: center;
    align-self: start;
}
.hero-portrait img {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(167, 184, 235, 0.30);
    box-shadow: 0 26px 50px -18px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.hero-portrait-ring {
    position: absolute;
    inset: -10px;
    z-index: 0;
    border-radius: 26px;
    background: var(--g-brand);
    opacity: .28;
    filter: blur(22px);
}

/* Hero typography */
.hero-name {
    font-family: var(--f-sans);
    font-weight: 700;
    font-size: var(--t-4xl);
    line-height: 1.0;
    letter-spacing: -0.025em;
    margin: 0 0 var(--s-3);
    color: #fff;
    background: linear-gradient(180deg, #ffffff 0%, #c7d2ff 100%);
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
}
body[data-lang="ja"] .hero-name {
    letter-spacing: 0.02em;
    font-weight: 600;
}

.hero-sub {
    font-family: var(--f-mono);
    font-size: var(--t-lg);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-cyan-soft);
    margin-bottom: var(--s-6);
}
body[data-lang="ja"] .hero-sub {
    font-family: var(--f-mono);
    text-transform: none;
    letter-spacing: 0.1em;
}

.hero-tags-label {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-cyan-soft);
    margin-bottom: var(--s-3);
}
body[data-lang="ja"] .hero-tags-label {
    font-family: var(--f-sans);
    text-transform: none;
    letter-spacing: 0.1em;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin-bottom: var(--s-7);
}
.hero-tags li {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    color: var(--c-deep-mid);
    letter-spacing: 0.12em;
    padding: 0.35rem 0.7rem;
    background: rgba(59,95,226,0.10);
    border: 1px solid rgba(108,139,239,0.25);
    border-radius: 4px;
}

.hero-statement {
    font-size: var(--t-lg);
    line-height: 1.85;
    color: var(--c-deep-ink);
    max-width: var(--read-w);
    margin-bottom: var(--s-7);
}
body[data-lang="en"] .hero-statement { font-size: 1.25rem; }

/* ============================================================ */
/* SECTIONS                                                      */
/* ============================================================ */
.section {
    padding: var(--s-9) 0;
    position: relative;
}
.section + .section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 4rem; right: 4rem;
    height: 1px;
    background: var(--g-rule);
    opacity: .6;
}

.section-head {
    margin-bottom: var(--s-8);
}

.section-title {
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: var(--t-3xl);
    line-height: 1.1;
    margin: 0 0 var(--s-3);
    letter-spacing: -0.015em;
    color: var(--c-ink);
}
.section-title::after {
    content: "";
    display: block;
    width: 64px;
    height: 3px;
    margin-top: var(--s-3);
    background: var(--g-brand);
    border-radius: 4px;
}

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    z-index: 60;
    pointer-events: none;
    background: transparent;
}
.scroll-progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--g-brand);
    box-shadow: 0 0 10px rgba(34,211,238,.55);
    transition: width .12s linear;
}

/* ---------- Active nav state (scroll-spy) ---------- */
.nav-links a.is-current { color: var(--c-blue); }
.nav-links a.is-current::after { transform: scaleX(1); }

/* ---------- Theme blocks (research / activities) ---------- */
.themes { display: flex; flex-direction: column; gap: var(--s-5); }
.theme {
    position: relative;
    padding: var(--s-6);
    padding-left: calc(var(--s-6) + 6px);
    background: var(--c-surface);
    border: 1px solid var(--c-rule);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px -22px rgba(15, 28, 80, .32);
    overflow: hidden;
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.theme::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--g-brand);
}
.theme:hover {
    border-color: var(--c-blue-soft);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.theme-title {
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: var(--t-xl);
    line-height: 1.35;
    color: var(--c-ink);
    letter-spacing: -0.01em;
    margin: 0 0 var(--s-3);
}
.theme-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin: 0 0 var(--s-4);
}
.theme-meta span {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.04em;
    color: var(--c-blue);
    background: var(--c-surface-2);
    border: 1px solid var(--c-rule);
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    line-height: 1.5;
}
body[data-lang="ja"] .theme-meta span { font-family: var(--f-sans); letter-spacing: 0.02em; }
.theme-desc {
    max-width: var(--read-w);
    font-size: var(--t-md);
    line-height: 1.85;
    color: var(--c-ink-soft);
}
.theme-desc strong { color: var(--c-ink); font-weight: 600; }
.theme-media {
    margin-top: var(--s-5);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 18rem));
    gap: var(--s-5);
    justify-content: start;
    align-items: start;
}

/* ---------- Media gallery ---------- */
.media-card {
    margin: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-rule);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 24px -18px rgba(15, 28, 80, .35);
    transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.media-card:hover {
    border-color: var(--c-blue-soft);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Uniform box → equal card heights. object-fit: contain keeps each
   source's own aspect ratio, filling the difference with letterbox padding. */
.media-frame {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #05070f;
}
/* Media fit fully inside the frame (no cropping); aspect-ratio differences
   become letterbox padding. Frame size (16:10) stays uniform. */
.media-frame video,
.media-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* Background shows through any transparent parts of an illustration. */
.media-card.is-illust .media-frame {
    background: radial-gradient(ellipse at 50% 35%, #142a6b 0%, #0a1230 72%);
}
/* A figure rendered on white (e.g. the model diagram) reads best on white. */
.media-card.is-figure .media-frame { background: #ffffff; }

.media-card figcaption {
    padding: var(--s-4) var(--s-5);
    font-size: var(--t-sm);
    line-height: 1.6;
    color: var(--c-ink-soft);
}

/* ---------- Publications ---------- */
.pub-group { margin-bottom: var(--s-8); }
.pub-cat {
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: var(--t-md);
    color: var(--c-ink);
    letter-spacing: 0.01em;
    margin: 0 0 var(--s-4);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--c-rule);
    position: relative;
}
.pub-cat::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 80px;
    height: 2px;
    background: var(--g-brand);
}

/* Numbering uses the native list-item counter; <ol reversed> makes it count
   down the page so the oldest entry is 01 and the newest (top) is highest. */
.pub-item {
    position: relative;
    padding: var(--s-4) 0 var(--s-4) 3.5rem;
    border-top: 1px solid var(--c-rule-soft);
    font-size: var(--t-base);
    line-height: 1.7;
}
.pub-item:first-child { border-top: 0; }
.pub-item::before {
    content: counter(list-item, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: var(--s-4);
    font-family: var(--f-mono);
    font-weight: 500;
    font-size: var(--t-sm);
    color: var(--c-blue);
    letter-spacing: 0.1em;
}
.pub-authors {
    font-size: var(--t-sm);
    color: var(--c-ink-soft);
    line-height: 1.7;
}
.pub-authors strong { color: var(--c-ink); font-weight: 600; }
.pub-title {
    font-size: var(--t-md);
    color: var(--c-ink);
    font-weight: 500;
    margin: var(--s-1) 0;
}
.pub-meta { font-size: var(--t-sm); color: var(--c-muted); font-family: var(--f-mono); letter-spacing: 0.01em; }
body[data-lang="ja"] .pub-meta { font-family: var(--f-sans); }
/* Italicised venue inside a citation */
.pub-meta i { font-style: italic; }

/* Peer-review status badge — inline at the end of the citation line */
.pub-badge {
    display: inline-block;
    margin-left: 0.4em;
    padding: 0.05rem 0.5rem;
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.6;
    vertical-align: 0.08em;
    border-radius: 999px;
    white-space: nowrap;
}
body[data-lang="ja"] .pub-badge { font-family: var(--f-sans); letter-spacing: 0.02em; }
/* Reviewed → soft blue tint (clear, but not shouting) */
.pub-badge--reviewed {
    color: var(--c-blue);
    background: rgba(59,95,226,0.09);
    border: 1px solid rgba(108,139,239,0.30);
}
/* Non-reviewed → muted outline (present but understated) */
.pub-badge--none {
    color: var(--c-muted);
    background: transparent;
    border: 1px solid var(--c-rule);
}

/* ---------- Timeline (CV) ---------- */
.timeline {
    position: relative;
    max-width: 50rem;
}
.tl-item {
    display: grid;
    grid-template-columns: 11rem 1fr;
    column-gap: var(--s-6);
    align-items: baseline;
    padding: var(--s-5) 0;
    border-top: 1px solid var(--c-rule-soft);
    position: relative;
}
.tl-item:first-child { border-top: 0; }
.tl-item::before {
    content: "";
    position: absolute;
    left: 10.4rem;
    top: 0.4rem;
    bottom: -0.4rem;
    width: 1px;
    background: linear-gradient(180deg, var(--c-blue), transparent 90%);
    opacity: .25;
}
.tl-item:last-child::before { display: none; }

.tl-date {
    font-family: var(--f-mono);
    font-size: var(--t-sm);
    color: var(--c-blue);
    letter-spacing: 0.06em;
}
.tl-where {
    font-size: var(--t-sm);
    color: var(--c-ink-soft);
    line-height: 1.7;
}

/* ---------- Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: 9rem 1fr;
    column-gap: var(--s-6);
    row-gap: var(--s-4);
    max-width: 44rem;
    margin: 0;
    padding: var(--s-6);
    background: var(--c-surface);
    border: 1px solid var(--c-rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.contact-grid dt {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    color: var(--c-blue);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding-top: 0.25em;
}
body[data-lang="ja"] .contact-grid dt {
    font-family: var(--f-sans);
    text-transform: none;
    letter-spacing: 0.05em;
    font-size: var(--t-sm);
}
.contact-grid dd {
    margin: 0;
    font-size: var(--t-base);
    color: var(--c-ink);
    line-height: 1.7;
}
.email {
    font-family: var(--f-mono);
    letter-spacing: 0.02em;
    color: var(--c-blue);
    border-bottom: 1px solid var(--c-rule);
}
.email:hover { color: var(--c-blue-deep); border-bottom-color: var(--c-blue); }

/* ---------- Footer ---------- */
.site-foot {
    margin-top: var(--s-9);
    padding: var(--s-7) var(--s-7);
    background: var(--g-deep-hero);
    color: var(--c-deep-mid);
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.1em;
    text-align: center;
    position: relative;
    isolation: isolate;
}
.site-foot::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--g-rule);
}
body[data-lang="ja"] .site-foot { font-family: var(--f-sans); letter-spacing: 0.05em; }

/* ---------- Subtle reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .site-nav { padding: 0 var(--s-5); gap: var(--s-3); }
    .nav-links { gap: var(--s-5); }
    main { padding: 0 var(--s-5); }
    .hero { padding-top: var(--s-9); padding-bottom: var(--s-8); }
    .section { padding: var(--s-8) 0; }
    .section + .section::before { left: var(--s-5); right: var(--s-5); }
    .contact-grid { grid-template-columns: 8rem 1fr; }

    /* Hero: stack portrait above the text */
    .hero-inner { grid-template-columns: 1fr; row-gap: var(--s-6); }
    .hero-portrait { order: -1; max-width: 8.5rem; justify-self: start; }
    .hero-text { order: 1; }
    .tl-item { grid-template-columns: 8rem 1fr; column-gap: var(--s-4); }
    .tl-item::before { left: 7.4rem; }
    .hero-orb-1 { width: 320px; height: 320px; }
    .hero-orb-2 { width: 260px; height: 260px; }
}

/* Drawer breakpoint: collapse nav links into a hamburger panel. */
@media (max-width: 720px) {
    :root { --nav-h: 3.75rem; }

    /* Portrait: explicit small square on every phone-sized viewport.
       Belt-and-suspenders: width *and* height on the img, plus
       aspect-ratio on the figure — avoids the tall rendering some
       mobile browsers produce when only aspect-ratio is set. */
    .hero-portrait {
        width: clamp(6.5rem, 32vw, 8rem);
        max-width: 8rem;
        aspect-ratio: 1 / 1;
        margin: 0 auto;
        justify-self: center;
    }
    .hero-portrait img {
        width: 100%;
        height: 100%;
        aspect-ratio: 1 / 1;
        object-fit: cover;
    }
    .hero-portrait-ring { inset: -8px; filter: blur(18px); }

    .nav-toggle { display: inline-flex; }

    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--s-3) var(--s-5) var(--s-5);
        background: color-mix(in srgb, var(--c-bg) 96%, transparent);
        backdrop-filter: saturate(150%) blur(14px);
        -webkit-backdrop-filter: saturate(150%) blur(14px);
        border-bottom: 1px solid var(--c-rule);
        box-shadow: 0 18px 28px -18px rgba(15, 28, 80, .22);
        font-size: var(--t-md);
        max-height: calc(100dvh - var(--nav-h));
        overflow-y: auto;
        transform: translateY(-110%);
        opacity: 0;
        visibility: hidden;
        transition: transform .32s var(--ease), opacity .25s var(--ease), visibility .32s;
    }
    .nav-links.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-links a {
        display: block;
        padding: 0.95rem var(--s-2);
        border-bottom: 1px solid var(--c-rule-soft);
        color: var(--c-ink);
        letter-spacing: 0;
    }
    .nav-links a:last-child { border-bottom: 0; }
    .nav-links a::after { display: none; }
    .nav-links a.is-current { color: var(--c-blue); }
    body.nav-open { overflow: hidden; }
}

@media (max-width: 640px) {
    body { line-height: 1.7; }

    .site-nav { padding: 0 var(--s-4); gap: var(--s-2); }
    .brand-name { display: none; }
    .nav-actions { gap: var(--s-2); }
    .lang-toggle { padding: 0.38rem 0.7rem; }

    main { padding: 0 var(--s-4); }

    .hero {
        padding-top: var(--s-7);
        padding-bottom: var(--s-7);
    }
    .hero-inner { row-gap: var(--s-5); }
    /* portrait sizing handled by the 720px rule above */
    .hero-name {
        font-size: clamp(2.25rem, 9vw, 3rem);
        letter-spacing: -0.02em;
        text-align: center;
    }
    .hero-sub {
        font-size: var(--t-base);
        letter-spacing: 0.1em;
        text-align: center;
        margin-bottom: var(--s-5);
    }
    .hero-tags-label { text-align: center; margin-bottom: var(--s-2); }
    .hero-tags { justify-content: center; margin-bottom: var(--s-5); }
    .hero-tags li { font-size: 0.7rem; padding: 0.28rem 0.55rem; }
    .hero-statement {
        font-size: 1.0625rem;
        line-height: 1.75;
        text-align: center;
        margin-bottom: 0;
    }
    body[data-lang="en"] .hero-statement { font-size: 1.0625rem; }
    .hero-orb-1 { width: 240px; height: 240px; }
    .hero-orb-2 { width: 200px; height: 200px; }

    .section { padding: var(--s-7) 0; }
    .section + .section::before { left: var(--s-4); right: var(--s-4); }
    .section-head { margin-bottom: var(--s-6); }
    .section-title { font-size: 1.75rem; }

    .theme {
        padding: var(--s-5);
        padding-left: calc(var(--s-5) + 5px);
        border-radius: 12px;
    }
    .theme-title { font-size: var(--t-lg); }
    .theme-desc { font-size: var(--t-base); line-height: 1.8; }
    .theme-media {
        grid-template-columns: 1fr;
        gap: var(--s-4);
    }

    .pub-group { margin-bottom: var(--s-7); }
    .pub-item {
        padding: var(--s-4) 0 var(--s-4) 2.25rem;
        font-size: var(--t-sm);
    }
    .pub-item::before { top: var(--s-4); font-size: var(--t-xs); }
    .pub-title { font-size: var(--t-base); }
    .pub-authors, .pub-meta { font-size: var(--t-sm); }

    .timeline { padding: 0; }
    .tl-item {
        grid-template-columns: 1fr;
        padding: var(--s-4) 0;
        row-gap: 0.25rem;
    }
    .tl-item::before { display: none; }
    .tl-date { margin-bottom: var(--s-1); }
    .tl-where { font-size: var(--t-base); }

    .contact-grid {
        grid-template-columns: 1fr;
        padding: var(--s-5);
        row-gap: var(--s-2);
        border-radius: 12px;
    }
    .contact-grid dt { margin-top: var(--s-3); }
    .contact-grid dt:first-of-type { margin-top: 0; }
    .email { word-break: break-all; }

    .site-foot { padding: var(--s-6) var(--s-5); margin-top: var(--s-8); }
}

@media (max-width: 380px) {
    .nav-actions { gap: 0.35rem; }
    .lang-toggle { padding: 0.35rem 0.55rem; letter-spacing: 0.06em; }
    .nav-toggle { width: 2.25rem; height: 2.25rem; }
    .hero-name { font-size: clamp(2rem, 10.5vw, 2.5rem); }
}
