/* ============================================================
   REDESIGN (Oct 2026) — layered over styles.css, loaded after it.
   Calmer, bigger, more editorial: a top bar instead of the icon
   rail on desktop, a cinematic hero, one big quote card, a bento
   of image-led project cards, and the logs as a photo-card blog.
   Content, section colors, live cards, the multilingual name and
   both themes all carry over.

   Everything new is v2-*. .v2-dark marks surfaces that stay dark in
   light mode too, so their text is forced light against the
   theme-light rules in styles.css (which force section text dark).

   Sizes: html has zoom: 0.8 at 1051px+, so px values there render
   at 80%; --v2-vh is a viewport-height unit that undoes that.
   ============================================================ */

:root {
    --v2-sans: "Geist", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    /* The site's own palette (styles.css :root): ink and cream. */
    --v2-ink: var(--km-ink, #172229);
    --v2-paper: var(--km-cream, #F7F1EA);
    --v2-gutter: clamp(20px, 4vw, 64px);
    --v2-radius: 28px;
    --v2-vh: 1vh;
}

@media (min-width: 1051px) {
    :root {
        --v2-vh: 1.25vh;
        --v2-gutter: clamp(40px, 4vw, 80px);
        --v2-radius: 34px;
    }
}

body {
    font-family: var(--v2-sans);
}

/* Forced-light text on dark surfaces, in both themes. */
body .content-section .v2-dark :is(h1, h2, h3, h4, p, li, span, strong, em, small, blockquote, figcaption, a),
body .content-section.v2-dark :is(h1, h2, h3, h4, p, li, span, strong, em, small, blockquote, figcaption, a),
body.theme-light .content-section .v2-dark :is(h1, h2, h3, h4, p, li, span, strong, em, small, blockquote, figcaption, a),
body.theme-light .content-section.v2-dark :is(h1, h2, h3, h4, p, li, span, strong, em, small, blockquote, figcaption, a) {
    color: inherit !important;
    text-decoration: none;
}

.v2-dark,
body .content-section.v2-dark,
body.theme-light .content-section.v2-dark,
body.theme-light .content-section .v2-dark {
    color: var(--v2-paper) !important;
}

.v2-eyebrow {
    font-family: var(--v2-sans);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.62;
    margin: 0;
}

.v2-wrap {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--v2-gutter);
    box-sizing: border-box;
}

/* ---------- Top bar (desktop) ---------- */
.nav-label {
    display: none;
}

@media (min-width: 1051px) {
    .page-layout {
        margin-left: 0 !important;
    }

    #sidebar.sidebar {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        width: auto !important;
        height: 72px !important;
        min-height: 0 !important;
        flex-direction: row;
        align-items: center;
        padding: 0 var(--v2-gutter) !important;
        border-right: 0;
        border-bottom: 1px solid transparent;
        overflow: visible !important;
        background: transparent;
        transition: background-color 0.4s ease, border-color 0.4s ease, color var(--bg-fade-duration) ease;
    }

    body.v2-scrolled #sidebar.sidebar {
        background: rgba(23, 34, 41, 0.6);
        border-bottom-color: rgba(255, 255, 255, 0.08);
        -webkit-backdrop-filter: saturate(1.6) blur(20px);
        backdrop-filter: saturate(1.6) blur(20px);
    }

    /* Over the hero the bar sits on dark glass in both themes. */
    body.theme-light:not(.v2-scrolled) #sidebar,
    body.theme-light:not(.v2-scrolled) #sidebar * {
        color: var(--v2-paper) !important;
    }

    body.theme-light:not(.v2-scrolled) #sidebar :is(.translate-quick-btn, .theme-toggle) {
        background: rgba(244, 239, 234, 0.1) !important;
        border-color: rgba(244, 239, 234, 0.3) !important;
    }

    body.v2-scrolled.dark-foreground #sidebar.sidebar {
        background: rgba(255, 255, 255, 0.6);
        border-bottom-color: rgba(23, 34, 41, 0.08);
    }

    #sidebar .sidebar-name {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 0;
        text-align: left;
    }

    #sidebar .sidebar-name h1 {
        margin: 0;
        font-size: 1rem;
    }

    #sidebar .typed-name {
        font-family: var(--v2-sans);
        font-size: 20px;
        font-weight: 600;
        letter-spacing: -0.02em;
        white-space: nowrap;
    }

    #sidebar .sidebar-name h4 {
        margin: 0;
    }

    #sidebar .greeting,
    #sidebar .sidebar-location {
        display: none;
    }

    #sidebar .typed-flags {
        font-size: 16px;
        margin: 0;
    }

    #sidebar .sidebar-nav {
        display: contents;
    }

    #sidebar .sidebar-nav .nav-link {
        width: auto;
        margin: 0 15px;
        padding: 10px 0 !important;
        opacity: 0.66;
        transform: none;
    }

    #sidebar .sidebar-nav .nav-link:hover,
    #sidebar .sidebar-nav .nav-link.active {
        opacity: 1;
        transform: none;
    }

    #sidebar .nav-link .nav-icon {
        display: none;
    }

    #sidebar .nav-label {
        display: inline;
        font-family: var(--v2-sans);
        font-size: 16px;
        font-weight: 500;
        letter-spacing: -0.005em;
    }

    #sidebar .nav-link[href="#home"],
    #sidebar .nav-link[href="#goals"],
    #sidebar .nav-link[href="#projects"],
    #sidebar .sidebar-section .section-title-small {
        display: none !important;
    }

    #sidebar .sidebar-section {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        width: auto;
        padding: 0 !important;
    }

    /* Desktop bar shows the theme + language controls; the socials live
       on the profile card and in the contact section. */
    #sidebar .social-links {
        display: none !important;
    }

    #sidebar .v2-bar-controls .home-controls-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
    }

    #sidebar .social-links {
        flex-direction: row !important;
        justify-content: flex-end;
        gap: 22px !important;
        width: auto;
    }

    #sidebar .social-link {
        width: auto;
    }

    #sidebar .social-link svg {
        width: 21px;
        height: 21px;
    }

    /* The hero runs under the bar; everything else starts below it. */
    #home {
        padding-top: 4rem !important;
    }
}

/* ---------- Hero ---------- */
.content-section.v2-hero {
    position: relative;
    display: flex !important;
    flex-direction: row;
    align-items: flex-end;
    min-height: calc(var(--v2-vh) * 74) !important;
    padding: 0 !important;
    overflow: hidden;
    background: var(--v2-ink);
    isolation: isolate;
    contain: paint;
}

.v2-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(60% 70% at 72% 40%, rgba(70, 98, 110, 0.55), transparent 70%),
        radial-gradient(45% 55% at 15% 100%, rgba(169, 123, 78, 0.3), transparent 70%);
}

.v2-hero::after {
    /* Fade into whatever color the next section brings. */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10%;
    z-index: 1;
    background: linear-gradient(to bottom, transparent, rgba(23, 34, 41, 0.5));
    pointer-events: none;
}

.v2-hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    /* The photo's left edge, sky to sea, row by row: where the photo
       doesn't reach (wide screens, below it on phones) the scene simply
       carries on instead of going dark. */
    background: linear-gradient(to bottom, #D9E7EE 0%, #E0EBEB 10%, #E7EAE4 20%, #F1F1E6 26%, #D3D8D6 28%, #A2B1BB 30%, #7F92A2 35%, #718596 45%, #687A89 60%, #566975 75%, #485C62 90%, #42545A 100%);
}

/* The wide photo fills the hero's height, with the face (49.4% across the
   image) placed at 68% across the hero; the scenery runs off both sides
   at any window shape, so the head is never cropped. */
.v2-hero-media img {
    position: absolute;
    top: 0;
    left: 68%;
    height: 100%;
    width: auto;
    max-width: none;
    translate: -49.4% 0;
    display: block;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 14%);
    mask-image: linear-gradient(to right, transparent 0%, #000 14%);
    animation: v2HeroSettle 2.2s var(--ease-out, ease-out) both;
}

/* Just enough shade for white text over a bright photo: along the top
   for the bar and buttons, and behind the copy on the left. The rest of
   the photo stays as bright as it was taken. */
.v2-hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(23, 34, 41, 0.35), transparent 18%),
        linear-gradient(to right, rgba(23, 34, 41, 0.6) 0%, rgba(23, 34, 41, 0.3) 32%, transparent 55%);
}

.v2-hero-controls {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
}

/* On the dark hero, keep the controls light in both themes. */
body .v2-hero-controls :is(.theme-toggle, .translate-quick-btn),
body .v2-hero-controls .theme-toggle * {
    color: var(--v2-paper) !important;
}

body .v2-hero-controls :is(.theme-toggle, .translate-quick-btn) {
    background: rgba(244, 239, 234, 0.1) !important;
    border-color: rgba(244, 239, 234, 0.3) !important;
}

.v2-hero-controls:empty,
.v2-bar-controls:empty {
    display: none;
}

.v2-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    padding: 0 var(--v2-gutter) clamp(56px, calc(var(--v2-vh) * 9), 120px);
    box-sizing: border-box;
}

.v2-hero-copy > * {
    animation: v2Rise 1.1s var(--ease-out, ease-out) both;
}

.v2-hero-copy > :nth-child(2) { animation-delay: 0.08s; }
.v2-hero-copy > :nth-child(3) { animation-delay: 0.18s; }
.v2-hero-copy > :nth-child(4) { animation-delay: 0.28s; }
.v2-hero-copy > :nth-child(5) { animation-delay: 0.38s; }

/* The live date and time from the old home header, in its mono face. */
body .content-section.v2-dark .v2-hero-time {
    margin: 0 0 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: rgba(244, 239, 234, 0.6) !important;
}

.v2-hero-time:empty {
    display: none;
}

.v2-hero .v2-hero-name {
    font-family: var(--v2-sans);
    font-size: clamp(64px, 10vw, 184px);
    font-weight: 600;
    line-height: 0.92;
    letter-spacing: -0.05em;
    margin: 18px 0 26px -0.04em;
    color: var(--v2-paper) !important;
    border: 0;
    padding: 0;
}

.v2-hero .v2-hero-name {
    display: flex;
    align-items: baseline;
    height: 1.02em;
    white-space: nowrap;
}

.v2-typed[data-lang="ja"] {
    font-family: "Shippori Mincho", serif;
    font-weight: 700;
    font-size: 0.6em;
    letter-spacing: 0;
}

.v2-typed[data-lang="zh"] {
    font-family: "Ma Shan Zheng", "Shippori Mincho", serif;
    font-weight: 400;
    font-size: 0.86em;
    letter-spacing: 0.02em;
}

.v2-caret {
    display: inline-block;
    width: 0.06em;
    height: 0.78em;
    margin-left: 0.08em;
    align-self: center;
    background: currentColor;
    opacity: 0.7;
    animation: v2Blink 1.05s steps(1) infinite;
}

@keyframes v2Blink {
    50% { opacity: 0; }
}

.v2-hero .v2-hero-line {
    font-size: clamp(18px, 1.6vw, 24px);
    line-height: 1.45;
    max-width: 28ch;
    opacity: 0.76;
    margin: 0 0 34px;
}

.v2-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.v2-btn {
    display: inline-flex;
    align-items: center;
    height: 48px;
    padding: 0 24px;
    border-radius: 999px;
    border: 1px solid rgba(244, 239, 234, 0.28);
    font-family: var(--v2-sans);
    font-size: 16px;
    font-weight: 500;
    color: var(--v2-paper) !important;
    text-decoration: none !important;
    transition: background-color 0.25s ease, border-color 0.25s ease, scale 0.2s ease;
}

.v2-btn:hover {
    background: rgba(244, 239, 234, 0.1);
    border-color: rgba(244, 239, 234, 0.5);
}

.v2-btn:active {
    scale: 0.97;
}

body .content-section.v2-dark a.v2-btn--solid,
body.theme-light .content-section.v2-dark a.v2-btn--solid {
    background: var(--v2-paper);
    border-color: var(--v2-paper);
    color: var(--v2-ink) !important;
}

.v2-btn--solid:hover {
    background: #fff !important;
}

.v2-scroll-cue {
    position: absolute;
    right: var(--v2-gutter);
    bottom: clamp(56px, calc(var(--v2-vh) * 9), 120px);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(244, 239, 234, 0.28);
    /* Glass, so it reads over the bright cliffs. */
    background: rgba(23, 34, 41, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--v2-paper) !important;
    animation: v2Nudge 2.4s ease-in-out 1.6s infinite;
}

@keyframes v2Rise {
    from { opacity: 0; transform: translateY(24px); }
}

@keyframes v2HeroSettle {
    from { opacity: 0; transform: scale(1.08); }
}

@keyframes v2Nudge {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 6px; }
}

@supports (animation-timeline: view()) {
    .v2-hero-media {
        animation: v2HeroDrift linear both;
        animation-timeline: view();
        animation-range: exit 0% exit 100%;
    }

    .v2-hero-copy {
        animation: v2HeroFade linear both;
        animation-timeline: view();
        animation-range: exit 0% exit 80%;
    }

    @keyframes v2HeroDrift {
        to { translate: 0 12%; }
    }

    @keyframes v2HeroFade {
        to { opacity: 0; translate: 0 -40px; }
    }
}

@media (max-width: 1050px) {
    /* Full-bleed: cancel main's phone/tablet padding (styles.css). */
    .content-section.v2-hero {
        min-height: 80svh !important;
        margin: -5rem -2rem 0;
        width: calc(100% + 4rem) !important;
        max-width: none !important;
        /* Keeps the copy clear of the menu and language buttons when the
           screen is too short for it (a phone on its side). */
        padding-top: 96px !important;
    }

    /* Portrait screens: the face centered, the copy below it. */
    .v2-hero-media img {
        left: 50%;
    }

    .v2-hero-media::after {
        background:
            linear-gradient(to bottom, rgba(23, 34, 41, 0.35), transparent 18%),
            linear-gradient(to top, rgba(23, 34, 41, 0.6) 0%, rgba(23, 34, 41, 0.25) 40%, transparent 60%);
    }

    .v2-hero-copy {
        padding-bottom: 56px;
    }

    .v2-scroll-cue {
        display: none;
    }

    .v2-hero .v2-eyebrow {
        font-size: 11px;
        letter-spacing: 0.1em;
    }
}

@media (max-width: 600px) {
    .content-section.v2-hero {
        margin: -4.5rem -1.25rem 0;
        width: calc(100% + 2.5rem) !important;
    }
}

/* Smaller windows that aren't phone-shaped (a shrunk desktop browser, a
   tablet either way up): keep the desktop layout, face to the right of
   the copy, rather than a full-width crop of forehead. */
@media (max-width: 1050px) and (min-aspect-ratio: 2 / 3) {
    .v2-hero-media::after {
        background:
            linear-gradient(to bottom, rgba(23, 34, 41, 0.35), transparent 18%),
            linear-gradient(to right, rgba(23, 34, 41, 0.6) 0%, rgba(23, 34, 41, 0.3) 32%, transparent 55%);
    }

    .v2-hero-media img {
        left: 70%;
    }
}

/* Portrait screens (phones, tablets upright): at full hero height the
   head fills the screen, so the photo takes the top ~70% and blends into
   the sea below it, behind the copy. */
@media (max-aspect-ratio: 1 / 1) {
    .v2-hero-media img {
        height: 70%;
        -webkit-mask-image: linear-gradient(to top, transparent 0%, #000 35%);
        mask-image: linear-gradient(to top, transparent 0%, #000 35%);
    }
}

/* ---------- Section titles ---------- */
.experience-section-header .experience-title,
.work-section > .v2-section-title,
#logs .v2-section-title,
.v2-now-title {
    font-family: var(--v2-sans) !important;
    font-size: clamp(36px, 4.2vw, 64px) !important;
    font-weight: 600 !important;
    letter-spacing: -0.04em !important;
    line-height: 1.02 !important;
    text-transform: none !important;
    text-align: left !important;
    /* .experience-title is flex in styles.css, which pins the icon to the
       top of the line; block keeps it on the text like the other titles. */
    display: block !important;
    opacity: 1 !important;
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 0 clamp(20px, 2.4vw, 36px) !important;
}

.v2-title-icon {
    display: inline-flex;
    width: 0.62em;
    height: 0.62em;
    margin-left: 0.3em;
    vertical-align: -0.02em;
    opacity: 0.8;
}

.v2-title-icon svg {
    width: 100%;
    height: 100%;
}

/* The UCSD and Kyoto logos are navy on transparent, which disappears on
   the dark sections; show them in white there (light mode keeps navy). */
body:not(.theme-light) img[src*="logos/ucsd.png"],
body:not(.theme-light) img[src*="logos/kyoto_university.png"] {
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

/* Wide wordmark logos get a wider box than the square logos (NASA, TQT...),
   or their small print is unreadable. */
:is(#about, #education) .experience-logo:has(img[src*="logos/ucsd.png"], img[src*="logos/kyoto_university.png"], img[src*="logos/evc.png"]) {
    width: min(280px, 80vw) !important;
    height: auto !important;
    max-width: 100% !important;
}

:is(#about, #education) .experience-logo :is(img[src*="logos/ucsd.png"], img[src*="logos/kyoto_university.png"], img[src*="logos/evc.png"]) {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
}

.cert-badge--logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cert-badge--logo img {
    width: 62%;
    height: 62%;
    object-fit: contain;
    display: block;
}

/* The NASA insignia is a full circle; let it fill more of the badge. */
.cert-badge--logo img[src*="certs/nasa"] {
    width: 82%;
    height: 82%;
}

/* Phones and tablets center their section text (styles.css), so the
   titles follow; phones also drop the project sections' own side
   padding, since main already has a 20px edge. */
@media (max-width: 1050px) {
    .experience-section-header .experience-title,
    .work-section > .v2-section-title,
    #logs .v2-section-title,
    #logs .logs-subtitle,
    .v2-now-title {
        text-align: center !important;
        justify-content: center !important;
    }
}

@media (max-width: 600px) {
    .content-section .work-section {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* These two sit outside main's padded column on phones. */
    #projects .work-section,
    #logs .work-section {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .v2-wrap {
        padding: 0;
    }
}

#logs .logs-header,
#logs .v2-section-title + p {
    text-align: left;
}

.content-section h3,
.experience-role,
.work-title {
    font-family: var(--v2-sans);
    letter-spacing: -0.015em;
}

/* ---------- Quote card ---------- */
#message {
    padding: clamp(48px, 7vw, 120px) 0 !important;
}

.v2-quote-card {
    position: relative;
    margin: 0;
    padding: clamp(40px, 7vw, 120px) clamp(28px, 7vw, 120px);
    border-radius: var(--v2-radius);
    background:
        radial-gradient(70% 90% at 100% 0%, rgba(169, 123, 78, 0.45), transparent 70%),
        radial-gradient(60% 80% at 0% 100%, rgba(44, 78, 87, 0.4), transparent 70%),
        var(--v2-ink);
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.v2-quote-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
}

.v2-quote-card .v2-photo-credit {
    position: absolute;
    right: 20px;
    bottom: 14px;
    font-size: 11px;
    opacity: 0.45;
    text-decoration: none !important;
    transition: opacity 0.2s ease;
}

.v2-quote-card .v2-photo-credit:hover {
    opacity: 0.85;
}

.v2-quote-art {
    justify-self: center;
    width: 100%;
    max-width: 440px;
    max-height: 560px;
    object-fit: contain;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55)) brightness(1.15) contrast(1.05);
}

/* Phones: the statue sits faded behind the bottom-right of the text
   instead of stacking above it (which made the card two screens tall). */
@media (max-width: 800px) {
    .v2-quote-card {
        display: block;
        padding-bottom: 64px;
    }

    .v2-quote-text {
        position: relative;
        z-index: 1;
    }

    .v2-quote-art {
        position: absolute;
        right: -6%;
        bottom: 0;
        width: 52%;
        max-width: 260px;
        opacity: 0.32;
        filter: none;
    }
}

.v2-quote {
    margin: 26px 0 0;
    padding: 0;
    border: 0;
}

.v2-quote p:first-child {
    max-width: 21ch;
}

.v2-quote p {
    font-family: var(--v2-sans);
    font-size: clamp(30px, 4.4vw, 72px);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.035em;
    margin: 0 0 0.5em;
}

.v2-quote p + p {
    font-size: clamp(20px, 2vw, 32px);
    line-height: 1.3;
    letter-spacing: -0.02em;
    max-width: 30ch;
    margin: 0;
}

/* Words start dim and light up as the card scrolls through (redesign.js). */
body .content-section .v2-dark .v2-quote .w {
    color: rgba(244, 239, 234, 0.24) !important;
    transition: color 0.35s ease;
}

body .content-section .v2-dark .v2-quote .w.lit {
    color: var(--v2-paper) !important;
}

/* ---------- Right now (below the hero) ----------
   Welcome + latest logs, the live schedule, video of the week, and the
   Letterboxd / Last.fm cards, as one set of tiles. These are new class
   names on purpose: the old #home rules in styles.css (lots of
   !important) target the previous markup. */
#home {
    color: var(--v2-paper);
}

.v2-now {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 24px);
}

.v2-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: clamp(22px, 2.4vw, 36px);
    box-sizing: border-box;
    border-radius: var(--v2-radius);
    background:
        radial-gradient(90% 80% at 100% 0%, var(--glow, rgba(169, 123, 78, 0.28)), transparent 70%),
        #1F2C33;
    border: 1px solid rgba(244, 239, 234, 0.06);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    text-decoration: none !important;
}

.v2-tile-label {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.55;
}

.v2-tile--intro { grid-column: span 8; }
.v2-tile--schedule { grid-column: span 4; --glow: rgba(44, 78, 87, 0.4); }
.v2-tile--video { grid-column: span 7; --glow: rgba(110, 74, 50, 0.25); }

/* Joke stats, set like a scoreboard: three columns of label over value. */
.v2-tile--scores {
    grid-column: 1 / -1;
    --glow: rgba(242, 166, 90, 0.14);
}

.v2-scores {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 24px);
    margin: 0;
}

.v2-score {
    padding-top: 16px;
    border-top: 1px solid rgba(244, 239, 234, 0.12);
}

body .content-section .v2-score dt {
    margin: 0 0 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(244, 239, 234, 0.55) !important;
}

body .content-section .v2-score dd {
    margin: 0;
    font-family: var(--v2-sans);
    font-size: clamp(26px, 2.6vw, 40px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--v2-paper) !important;
}

body .content-section .v2-score .v2-score-sub {
    margin-left: 6px;
    font-size: 0.5em;
    font-weight: 500;
    letter-spacing: 0;
    color: rgba(244, 239, 234, 0.6) !important;
}

.v2-score-sub:empty {
    display: none;
}

.v2-now-side {
    grid-column: span 5;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: clamp(14px, 1.6vw, 24px);
}

body .content-section .v2-tile .v2-intro {
    margin: 0 0 30px;
    font-size: clamp(18px, 1.45vw, 23px);
    line-height: 1.5;
    letter-spacing: -0.01em;
}

body .content-section .v2-tile .v2-intro a {
    text-decoration: underline !important;
    text-underline-offset: 4px;
}

/* Latest logs: a quiet two-column list with arrows. */
#home .v2-tile #bio-logs-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px !important;
    margin-top: 0 !important;
}

body .v2-tile .bio-log-card {
    position: relative;
    padding: 14px 32px 14px 0 !important;
    border-bottom: 1px solid rgba(244, 239, 234, 0.12) !important;
    transform: none;
}

body .v2-tile .bio-log-card::after {
    content: "\2192";
    position: absolute;
    right: 4px;
    top: 50%;
    translate: 0 -50%;
    opacity: 0.45;
    transition: translate 0.3s var(--ease-out, ease-out), opacity 0.2s ease;
}

body .v2-tile .bio-log-card:hover::after {
    translate: 4px -50%;
    opacity: 1;
}

body .content-section .v2-tile .bio-log-card .meta {
    font-size: 11px;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    color: inherit !important;
    opacity: 0.55;
}

body .content-section .v2-tile .bio-log-card h3 {
    font-family: var(--v2-sans);
    font-size: clamp(16px, 1.15vw, 18px) !important;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: inherit !important;
}

/* Schedule: the live card, opened up to fill its tile. */
body .content-section .v2-tile .schedule-now {
    --sn-class: #7FB2FF; --sn-study: #AEB8C2; --sn-train: #FFB25E; --sn-hockey: #FF7066;
    --sn-meal: #74D493; --sn-self: #6FD3DE; --sn-club: #C9A2FF; --sn-free: #E6D57C; --sn-sleep: #A9A5FF; --sn-oh: #F29BCB; --sn-laundry: #D9B98A;
    --sn-text: var(--v2-paper); --sn-muted: rgba(244, 239, 234, 0.6); --sn-track: rgba(244, 239, 234, 0.1);
    flex: 1;
    gap: 8px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    font-family: var(--v2-sans);
    color: var(--sn-text) !important;
}

body .v2-tile .schedule-now .sn-status {
    font-size: clamp(24px, 2vw, 32px);
    letter-spacing: -0.025em;
    gap: 12px;
}

body .v2-tile .schedule-now .sn-dot {
    width: 12px;
    height: 12px;
}

body .v2-tile .schedule-now .sn-next,
body .v2-tile .schedule-now .sn-kicker {
    font-size: 14px;
}

body .v2-tile .schedule-now .sn-strip {
    height: 10px;
    margin-top: auto;
    border-radius: 5px;
}

body .v2-tile .schedule-now .sn-strip i {
    border-right-color: rgba(0, 0, 0, 0.25);
}

body .content-section .v2-tile .schedule-now .sn-axis span {
    font-size: 11px;
    opacity: 0.6;
}

body .content-section .v2-tile .schedule-now .sn-link {
    align-self: flex-start;
    margin-top: 14px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(244, 239, 234, 0.25);
    font-size: 14px;
    text-decoration: none !important;
}

body .v2-tile .schedule-now .sn-link:hover {
    background: rgba(244, 239, 234, 0.08);
}

/* Video of the week */
.v2-video-frame {
    position: relative;
    flex: 1;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    overflow: hidden;
    background: #000;
}

#home .v2-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none !important;
    border: 0;
}

@media (min-width: 1051px) {
    /* Same Safari zoom fix as .home-video-card in styles.css. */
    #home .v2-video-frame iframe {
        zoom: 1.25;
    }
}

/* Last watched / last listened: compact side-by-side cards. */
.v2-tile--media,
.v2-tile--media .v2-media-link {
    flex-direction: row;
    align-items: center;
    gap: clamp(16px, 1.6vw, 24px);
}

.v2-tile--media { --glow: rgba(242, 166, 90, 0.16); }
.v2-tile--media:has(#now-playing) { --glow: rgba(111, 207, 151, 0.14); }

.v2-media-link {
    display: flex;
    flex: 1;
    min-width: 0;
    color: inherit !important;
    text-decoration: none !important;
}

#now-playing {
    display: flex;
    flex: 1;
    min-width: 0;
}

.v2-media-thumb {
    flex: none;
    width: clamp(96px, 9vw, 136px);
    aspect-ratio: 1;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(244, 239, 234, 0.08);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.v2-media-thumb--poster {
    width: clamp(80px, 7vw, 108px);
    aspect-ratio: 2 / 3;
    border-radius: 8px;
}

.v2-media-thumb--poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.v2-media-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.v2-media-text .v2-tile-label {
    margin-bottom: 4px;
}

.v2-media-title {
    font-family: var(--v2-sans);
    font-size: clamp(17px, 1.35vw, 21px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body .content-section .v2-tile .v2-media-sub {
    font-size: 14px;
    opacity: 0.65;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body .content-section .v2-tile .v2-media-rating {
    color: #F2A65A !important;
    opacity: 1;
}

body .content-section .v2-tile .v2-media-source {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.45;
}

.v2-now-playing .now-playing-status {
    font-size: 14px;
    opacity: 0.6;
}

@media (hover: hover) and (pointer: fine) {
    a.v2-tile--media,
    .v2-tile--media:has(.v2-media-link) {
        transition: translate 0.45s var(--ease-out, ease-out);
    }

    a.v2-tile--media:hover,
    .v2-tile--media:has(.v2-media-link:hover) {
        translate: 0 -4px;
    }
}

@media (max-width: 1050px) {
    .v2-tile--intro,
    .v2-tile--schedule,
    .v2-tile--video,
    .v2-now-side {
        grid-column: 1 / -1;
    }

    .v2-now-side {
        grid-template-rows: none;
        grid-template-columns: 1fr 1fr;
    }

    body .content-section .v2-tile .v2-intro {
        text-align: left;
    }
}

@media (max-width: 700px) {
    #home .v2-tile #bio-logs-list,
    .v2-now-side,
    .v2-scores {
        grid-template-columns: 1fr;
    }
}

/* ---------- Bento cards ---------- */
.v2-bento {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 24px);
}

.v2-span-1 { grid-column: span 2; }
.v2-span-15 { grid-column: span 3; }

/* Project and research cards: photo on top (same shape across a row, so
   the rows line up), then the text, on one shared surface. */
.v2-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: var(--v2-radius);
    text-decoration: none !important;
    background: #1F2C33;
    border: 1px solid rgba(244, 239, 234, 0.07);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    transition: translate 0.5s var(--ease-out, ease-out), box-shadow 0.5s var(--ease-out, ease-out), border-color 0.3s ease;
}

.v2-card-media {
    order: -1;
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: calc(var(--v2-radius) - 12px);
    overflow: hidden;
    background: #16222A;
}

.v2-span-15 .v2-card-media {
    aspect-ratio: 16 / 10;
}

.v2-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: scale 0.9s var(--ease-out, ease-out);
}

.v2-card-media--doc img {
    object-position: top center;
}

.v2-card-media svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* A card with a second link inside: the card itself is a div, an empty
   link covers it (the main target), and the extra link sits above that. */
.v2-card-cover {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
}

.v2-card-cover:focus-visible {
    outline: 2px solid #EE964B;
    outline-offset: 3px;
}

body .content-section .v2-card .v2-card-ext {
    position: relative;
    z-index: 4;
    display: inline-flex;
    align-self: flex-start;
    gap: 6px;
    /* Pinned to the card's bottom so the buttons line up across a row. */
    margin-top: auto;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(244, 239, 234, 0.22);
    font-size: 14px;
    color: var(--v2-paper) !important;
    text-decoration: none !important;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.v2-card .v2-card-ext:hover {
    background: rgba(244, 239, 234, 0.1);
    border-color: rgba(244, 239, 234, 0.45);
}

/* Cards that open something on this page (a log folder) get an arrow
   pointing down instead. */
.v2-card--internal::after {
    content: "\2193" !important;
}

/* "Opens elsewhere" mark, a glass circle in the photo's corner. */
.v2-card::after {
    content: "\2197";
    position: absolute;
    top: 24px;
    right: 24px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 17px;
    color: var(--v2-paper);
    background: rgba(23, 34, 41, 0.45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(244, 239, 234, 0.18);
    transition: background-color 0.3s ease;
}

.v2-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 1.8vw, 28px) clamp(10px, 1vw, 16px) clamp(10px, 1vw, 16px);
}

.v2-card .v2-card-kicker {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.5;
    opacity: 0.55;
    margin: 0 0 10px;
}

.v2-card .v2-card-title {
    font-family: var(--v2-sans);
    font-size: clamp(24px, 2vw, 32px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 10px;
}

.v2-card .v2-card-desc {
    font-size: clamp(15px, 1vw, 16px);
    line-height: 1.55;
    opacity: 0.7;
    margin: 0 0 18px;
}

@media (hover: hover) and (pointer: fine) {
    .v2-card:hover {
        translate: 0 -6px;
        border-color: rgba(244, 239, 234, 0.16);
        box-shadow: 0 40px 90px rgba(0, 0, 0, 0.28);
    }

    .v2-card:hover::after {
        background: rgba(23, 34, 41, 0.7);
    }

    .v2-card:hover .v2-card-media img {
        scale: 1.04;
    }
}

#current-projects,
#research {
    padding-top: clamp(40px, 5vw, 88px) !important;
}

@media (max-width: 1050px) {
    .v2-bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .v2-span-1,
    .v2-span-15 {
        grid-column: span 1;
    }

    /* Three project cards in two columns: the last one spans both. */
    .v2-span-1:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    .v2-span-1:last-child:nth-child(odd) .v2-card-media {
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 700px) {
    .v2-bento {
        grid-template-columns: 1fr;
    }

    .v2-span-1,
    .v2-span-15,
    .v2-span-1:last-child:nth-child(odd) {
        grid-column: auto;
    }

    .v2-span-1:last-child:nth-child(odd) .v2-card-media {
        aspect-ratio: 4 / 3;
    }
}

/* ---------- Rounder, calmer existing cards ---------- */
.bio-log-card,
.cert-card,
.highlights-card,
.work-grid .work-card,
.log-card {
    border-radius: 20px !important;
}

/* ---------- Contact + sign-off ---------- */
.content-section.v2-contact {
    padding: clamp(72px, 9vw, 140px) 0 0 !important;
    color: var(--v2-paper);
}

.v2-contact-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--v2-gutter);
    text-align: center;
}

.v2-contact .v2-contact-title {
    font-family: var(--v2-sans);
    font-size: clamp(40px, 5.4vw, 84px);
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1;
    margin: 18px 0 36px;
}

.v2-contact-email,
.v2-contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.v2-contact-links {
    margin-top: 12px;
}

.v2-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
    background: transparent;
    color: inherit !important;
    font: 500 16px/1 var(--v2-sans);
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, scale 0.2s ease;
}

.v2-pill:hover {
    border-color: color-mix(in srgb, currentColor 50%, transparent);
    background: color-mix(in srgb, currentColor 6%, transparent);
}

.v2-pill:active {
    scale: 0.97;
}

.v2-pill svg {
    flex-shrink: 0;
}

body .content-section .v2-pill--solid,
body .content-section .v2-pill--solid * {
    background: var(--v2-paper);
    border-color: var(--v2-paper);
    color: var(--v2-ink) !important;
}

body.theme-light .content-section .v2-pill--solid,
body.theme-light .content-section .v2-pill--solid * {
    background: var(--v2-ink);
    border-color: var(--v2-ink);
    color: var(--v2-paper) !important;
}

.v2-pill--solid span,
.v2-pill--solid svg {
    background: none !important;
}

.v2-contact-local {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 30px 0 0;
    font-size: 15px;
    opacity: 0.7;
}

.v2-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6FCF97;
    box-shadow: 0 0 0 4px rgba(111, 207, 151, 0.18);
}

.v2-signoff {
    margin-top: clamp(64px, 8vw, 120px);
    padding: 0 var(--v2-gutter) 36px;
    text-align: center;
    color: inherit !important;
    font-weight: 400;
}

.v2-thanks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 22px;
    margin: 0 0 28px;
    font-size: clamp(17px, 1.5vw, 21px);
    opacity: 0.85;
}

.v2-thanks [lang="ja"] {
    font-family: "Shippori Mincho", serif;
}

.v2-signoff-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    max-width: 1600px;
    margin: 0 auto;
    padding-top: 22px;
    border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    font-size: 13px;
}

.v2-signoff-row p {
    margin: 0;
    opacity: 0.6;
}

.v2-top {
    color: inherit !important;
}

.v2-top {
    opacity: 0.7;
    text-decoration: none !important;
}

.v2-top:hover {
    opacity: 1;
}

@media (max-width: 700px) {
    .v2-signoff-row {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .v2-hero-media,
    .v2-hero-media img,
    .v2-hero-copy,
    .v2-caret,
    .v2-hero-copy > *,
    .v2-scroll-cue {
        animation: none !important;
    }

    body .content-section .v2-dark .v2-quote .w {
        color: var(--v2-paper) !important;
    }
}

/* Goals photo, a little bigger than the other side photos. */
#goals .experience-header-right img.v2-goals-photo {
    /* .experience-header-right img caps every side image at 260px. */
    max-width: 100% !important;
    aspect-ratio: 4 / 5;
    object-fit: cover !important;
}
