:root,
[data-theme="blue"] {
    --bg-base: #0b1128;
    --bg-panel: rgba(12, 20, 48, 0.94);
    --bg-card: rgba(10, 18, 42, 0.7);
    --bg-topbar: rgba(8, 14, 36, 0.95);
    --text-main: #ffffff;
    --text-soft: #c8daf5;
    --text-muted: #7b93b8;
    --line: rgba(0, 180, 255, 0.1);
    --line-hover: rgba(0, 212, 255, 0.35);
    --accent-a: #00c6fb;
    --accent-b: #0ef6cc;
    --accent-warm: #5ce8d4;
    --glow-a: rgba(0, 198, 251, 0.25);
    --glow-a-strong: rgba(0, 198, 251, 0.4);
    --glow-warm: rgba(92, 232, 212, 0.25);
    --glow-subtle: rgba(0, 198, 251, 0.1);
    --pill-bg: rgba(0, 180, 255, 0.06);
    --active-bg: rgba(0, 198, 251, 0.07);
    --card-grad: linear-gradient(135deg, #0d1a3a, #122250, #163060, #1a3a5c);
}

[data-theme="green"] {
    --bg-base: #000000;
    --bg-panel: rgba(0, 0, 0, 0.98);
    --bg-card: rgba(0, 5, 0, 0.85);
    --bg-topbar: rgba(0, 0, 0, 0.98);
    --text-main: #33ff66;
    --text-soft: #00ff41;
    --text-muted: #1fcc4a;
    --line: rgba(0, 255, 65, 0.22);
    --line-hover: rgba(0, 255, 65, 0.5);
    --accent-a: #39ff14;
    --accent-b: #00ff41;
    --accent-warm: #33ff66;
    --glow-a: rgba(0, 255, 65, 0.18);
    --glow-a-strong: rgba(0, 255, 65, 0.4);
    --glow-warm: rgba(0, 255, 65, 0.18);
    --glow-subtle: rgba(0, 255, 65, 0.07);
    --pill-bg: rgba(0, 255, 65, 0.07);
    --active-bg: rgba(0, 255, 65, 0.1);
    --card-grad: linear-gradient(135deg, #000000, #000500, #000a00, #000f00);
}

* {
    box-sizing: border-box;
}

/* Theme switch crossfade (js/shared.js), a little slower than the browser's default */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.35s;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    color: var(--text-main);
    font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-base);
}

.page {
    position: relative;
    min-height: 100vh;
    padding: 14px 0 36px;
    background: var(--bg-base);
}

.shell {
    width: min(1080px, calc(100% - 20px));
    margin: 0 auto;
    position: relative;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    box-shadow: 0 0 40px var(--glow-a), 0 0 80px var(--glow-subtle);
    overflow: hidden;
    animation: reveal-shell 0.5s cubic-bezier(0.2, 0.7, 0.15, 1) both;
}

@keyframes reveal-shell {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-topbar);
    backdrop-filter: blur(10px);
}

.brand {
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.top-nav button,
.nav-link-page {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link-page {
    display: inline-block;
    text-decoration: none;
}

.top-nav button:hover,
.nav-link-page:hover {
    color: var(--accent-a);
    border-color: var(--line-hover);
}

.section {
    padding: 28px 22px 30px;
    border-top: 1px solid var(--line);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.section-heading {
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3.4vw, 2rem);
}

.section-heading h2::before {
    content: "";
    display: block;
    width: 32px;
    height: 3px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    border-radius: 2px;
}

.hero {
    border-top: 0;
    min-height: 300px;
    display: grid;
    grid-template-columns: minmax(120px, 200px) 1fr;
    gap: 22px;
    align-items: center;
}

.profile-ring {
    justify-self: center;
    width: min(180px, 38vw);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    padding: 4px;
    border: 2px solid var(--line-hover);
    box-shadow: 0 0 20px var(--glow-a), 0 0 40px var(--glow-subtle);
    overflow: hidden;
}

.profile-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-base);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    line-height: 1.08;
}

.hero-title {
    margin: 0;
    color: var(--accent-warm);
    font-size: clamp(0.95rem, 2vw, 1.2rem);
    font-weight: 600;
    line-height: 1.35;
}

.hero-summary {
    margin: 0;
    color: var(--text-muted);
    max-width: 65ch;
    line-height: 1.6;
    font-size: clamp(0.88rem, 1.6vw, 0.98rem);
}

.hero-actions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    color: var(--bg-base);
    background: linear-gradient(130deg, var(--accent-a), var(--accent-b));
    border-color: var(--line-hover);
    box-shadow: 0 0 12px var(--glow-a);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px var(--glow-a-strong), 0 4px 16px var(--glow-a);
}

.btn-ghost {
    color: var(--text-soft);
    background: transparent;
    border-color: var(--line);
}

.btn-ghost:hover {
    transform: translateY(-1px);
    color: var(--accent-warm);
    border-color: var(--accent-warm);
    box-shadow: 0 0 12px var(--glow-warm);
}

.meta-line {
    margin: 0;
    color: var(--accent-a);
    font-size: 0.8rem;
}

.social-links {
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text-soft);
    text-decoration: none;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.social-link:hover {
    color: var(--accent-a);
    border-color: var(--line-hover);
    box-shadow: 0 0 8px var(--glow-subtle);
}

.social-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.career-layout {
    display: grid;
    gap: 12px;
    align-items: start;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
}

.career-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.career-item {
    width: 100%;
    border: 1px solid var(--line);
    border-left: 3px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    text-align: left;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all 0.2s ease;
}

.career-item .company {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}

.career-item .role {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 500;
}

.career-item:hover {
    border-color: var(--line-hover);
}

.career-item.active {
    border-left-color: var(--accent-a);
    border-color: var(--line-hover);
    background: var(--active-bg);
    box-shadow: inset 0 0 12px var(--pill-bg), 0 0 8px var(--glow-subtle);
}

.career-details {
    min-height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg-card);
}

.career-panel {
    position: relative;
    height: 100%;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.career-panel.overlay-panel {
    position: absolute;
    inset: 0;
}

.career-title {
    margin: 0;
    font-size: 1.15rem;
}

.career-role {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 600;
}

.career-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.career-summary {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.87rem;
}

.stack-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stack-pill {
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    color: var(--accent-a);
    background: var(--pill-bg);
    font-size: 0.7rem;
    font-weight: 600;
}

.highlight-list {
    margin: 0;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.highlight-list li {
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    background: var(--pill-bg);
    padding: 7px 12px 7px 9px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.skill-pill:hover {
    border-color: var(--line-hover);
    box-shadow: 0 0 10px var(--glow-subtle);
}

.skill-pill img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.project-carousel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.project-card {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-grad);
    border: 1px solid var(--line-hover);
    box-shadow: 0 4px 24px var(--glow-a), 0 0 48px var(--pill-bg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.project-image-wrap {
    width: min(100%, 640px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.project-image-wrap img {
    width: 100%;
    display: block;
}

.project-info {
    width: min(100%, 640px);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.project-info h3 {
    margin: 0;
    font-size: 1.3rem;
}

.project-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.project-source {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 2px;
    transition: color 0.2s ease;
}

.project-source:hover {
    color: var(--accent-a);
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-100%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line-hover);
    background: var(--bg-card);
    backdrop-filter: blur(6px);
    color: var(--accent-a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.carousel-arrow:hover {
    border-color: var(--accent-a);
    color: #ffffff;
    box-shadow: 0 0 14px var(--glow-a);
}

.carousel-arrow svg {
    width: 20px;
    height: 20px;
}

.carousel-prev {
    left: -20px;
}

.carousel-next {
    right: -20px;
}

.carousel-dots {
    display: flex;
    gap: 8px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--line-hover);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.carousel-dot.active {
    background: var(--accent-a);
    border-color: var(--accent-a);
    box-shadow: 0 0 6px var(--glow-a);
}

@media (max-width: 640px) {
    .project-card {
        padding: 16px;
    }

    .carousel-prev {
        left: 8px;
    }

    .carousel-next {
        right: 8px;
    }
}

.cert-list {
    display: flex;
    flex-direction: column;
}

.cert-row {
    border-top: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
    padding: 12px 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: opacity 0.2s ease;
}

.cert-row h3 {
    margin: 0;
    font-size: 0.95rem;
}

.cert-row p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.cert-row .arrow {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.cert-row:hover h3 {
    color: var(--accent-a);
}

.cert-row:hover .arrow {
    color: var(--accent-warm);
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-switcher-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.theme-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    transform: scale(1.2);
}

.theme-btn.active {
    border-color: var(--text-main);
    box-shadow: 0 0 8px var(--glow-a);
}

.theme-btn[data-set-theme="blue"] {
    background: linear-gradient(135deg, #00c6fb, #0ef6cc);
}

.theme-btn[data-set-theme="green"] {
    background: linear-gradient(135deg, #39ff14, #00ff41);
}

[data-theme="green"] body,
[data-theme="green"] button,
[data-theme="green"] a {
    font-family: "Courier New", "Lucida Console", "Consolas", monospace;
}

/* phosphor glow */
[data-theme="green"] body {
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.45);
}

/* green theme: sharper corners, less glow */
[data-theme="green"] .shell {
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.12);
}

[data-theme="green"] .top-nav button,
[data-theme="green"] .nav-link-page,
[data-theme="green"] .btn,
[data-theme="green"] .career-item,
[data-theme="green"] .career-details,
[data-theme="green"] .social-link,
[data-theme="green"] .project-image-wrap,
[data-theme="green"] .carousel-arrow,
[data-theme="green"] .carousel-dot {
    border-radius: 2px;
}

[data-theme="green"] .skill-pill,
[data-theme="green"] .stack-pill {
    border-radius: 3px;
}

[data-theme="green"] .project-card {
    border-radius: 4px;
    box-shadow: none;
}

[data-theme="green"] .profile-ring {
    border-radius: 6px;
    box-shadow: none;
}

[data-theme="green"] .profile-image {
    border-radius: 4px;
}

[data-theme="green"] .btn-primary {
    box-shadow: none;
}

[data-theme="green"] .btn-primary:hover {
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.45);
}

[data-theme="green"] .btn-ghost:hover {
    box-shadow: none;
}

[data-theme="green"] .career-item.active {
    box-shadow: none;
}

[data-theme="green"] .section-heading h2::before {
    border-radius: 0;
}

/* typewriter effect */
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

[data-theme="green"] .typing-cursor::after {
    content: "\2588";
    color: var(--accent-a);
    animation: blink-cursor 0.7s step-end infinite;
    margin-left: 1px;
}

[data-theme="green"] .hero-title.typing,
[data-theme="green"] .hero-summary.typing {
    min-height: 1.2em;
}

@media (max-width: 960px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 18px;
    }

    .hero-content {
        align-items: center;
    }

    .social-links {
        justify-content: center;
    }

    .career-layout {
        grid-template-columns: 1fr;
    }

    .career-details {
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .top-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 10px 14px;
    }

    .brand {
        order: 0;
        flex: 1;
        text-align: left;
        font-size: 0.9rem;
    }

    .theme-switcher {
        order: 1;
        flex: 0 0 auto;
    }

    .top-nav {
        order: 2;
        flex: 1 1 100%;
        justify-content: center;
        gap: 6px;
    }

    .top-nav button {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .section {
        padding: 22px 14px 24px;
    }

    .hero-actions {
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .social-link span:nth-child(2) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html,
    body {
        scroll-behavior: auto;
    }

    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Beyond Work page */

/* Beyond Hero (mini header) */
.beyond-hero {
    text-align: center;
    padding: 40px 22px;
}

.beyond-hero h1 {
    margin-bottom: 8px;
}

.beyond-hero .hero-summary {
    margin: 0 auto;
}

.empty-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Interests Grid */
.interests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.interest-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.interest-card:hover {
    border-color: var(--line-hover);
    box-shadow: 0 0 16px var(--glow-subtle);
}

.interest-card--no-icon {
    justify-content: center;
}

.interest-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.interest-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.interest-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.interest-link {
    color: var(--accent-a);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.interest-link:hover {
    text-decoration: underline;
}

[data-theme="green"] .interest-card {
    border-radius: 2px;
}

/* Aviation Section: text on the left, photos on the right (stacked below 860px) */
.aviation-content {
    display: grid;
    gap: 24px;
}

.aviation-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 860px) {
    .aviation-content {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
        align-items: start;
    }

    .aviation-content .aviation-photos {
        grid-template-columns: 1fr;
    }
}

/* Logbook stat tiles */
.aviation-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.aviation-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--pill-bg);
}

.aviation-stat-value {
    color: var(--accent-a);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.1;
}

.aviation-stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

[data-theme="green"] .aviation-stat {
    border-radius: 2px;
}

.aviation-intro {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aviation-badge {
    display: inline-block;
    align-self: flex-start;
    border: 1px solid var(--accent-a);
    border-radius: 999px;
    padding: 4px 12px;
    color: var(--accent-a);
    background: var(--pill-bg);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.aviation-intro h3 {
    margin: 0;
    font-size: 1.3rem;
}

.aviation-summary {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 65ch;
}

.aviation-subsection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aviation-subsection h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-soft);
    font-weight: 600;
}

/* Aviation timeline */
.aviation-timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-left: 16px;
    border-left: 2px solid var(--line);
}

.timeline-entry {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 10px;
}

.timeline-dot {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-a);
    box-shadow: 0 0 6px var(--glow-a);
}

.timeline-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
}

[data-theme="green"] .aviation-badge,
[data-theme="green"] .timeline-dot {
    border-radius: 2px;
}

/* Aviation photos */
.aviation-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.aviation-photo-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    aspect-ratio: 4 / 3;
    cursor: zoom-in;
}

.aviation-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.aviation-photo-wrap:hover img {
    transform: scale(1.05);
}

[data-theme="green"] .aviation-photo-wrap {
    border-radius: 2px;
}

/* Travel Grid */
.travel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.travel-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
    transition: all 0.2s ease;
}

.travel-card:hover {
    border-color: var(--line-hover);
    box-shadow: 0 4px 20px var(--glow-subtle);
}

.travel-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    cursor: zoom-in;
}

.travel-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.travel-card:hover .travel-image-wrap img {
    transform: scale(1.05);
}

.travel-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.travel-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.travel-date {
    font-size: 0.75rem;
    color: var(--accent-a);
    font-weight: 600;
}

.travel-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
}

/* Cards without a photo stay as tall as their text instead of stretching to the row */
.travel-card--no-image {
    align-self: start;
}

[data-theme="green"] .travel-card {
    border-radius: 2px;
}

/* Travel map */
.travel-map {
    position: relative;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-card);
}

[data-theme="green"] .travel-map {
    border-radius: 2px;
}

.travel-map-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 10px;
}

.travel-map-views {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.travel-map-stats {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* The flat map and its zoom buttons */
.travel-map-flat {
    position: relative;
}

/* On phones, vertical swipes still scroll the page; sideways ones pan the map */
.travel-map-svg {
    --map-zoom: 1;
    display: block;
    width: 100%;
    height: auto;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.travel-map-svg.is-dragging {
    cursor: grabbing;
}

.travel-map-svg:focus-visible {
    border-radius: 6px;
    box-shadow: 0 0 0 2px var(--accent-a);
}

/* --map-dot (js/travel-map.js) grows the dots more slowly than the zoom, so zoomed-in land stays airy */
.map-land {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: calc(1.3px * var(--map-dot, 1));
    stroke-linecap: round;
    opacity: 0.35;
}

.map-web {
    fill: none;
    stroke: var(--accent-a);
    stroke-width: calc(0.8px * var(--map-zoom));
    opacity: 0.5;
    pointer-events: none;
    /* Hidden until the map scrolls into view. Each path holds four copies of its line
       (ROUTE_COPIES in js/travel-map.js), so the dash pattern repeats every quarter. */
    stroke-dasharray: 0 0.25;
}

/* Only drawing in is animated, so leaving view clears the lines at once */
.travel-map-svg.is-drawn .map-web {
    stroke-dasharray: 0.25 0;
    transition:
        stroke-dasharray 0.4s ease-out var(--route-delay, 0s),
        opacity 0.2s ease,
        stroke-width 0.2s ease;
}

/* Hovering a pin brightens its routes and fades the others */
.travel-map-svg.is-focusing .map-web {
    opacity: 0.12;
}

.travel-map-svg.is-focusing .map-web.is-highlighted {
    opacity: 1;
    stroke-width: calc(1.4px * var(--map-zoom));
}

/* Globe view (js/globe.js): the canvas takes the flat map's place */
.travel-map-globe-wrap {
    position: relative;
    display: none;
}

.travel-map-globe {
    display: block;
    width: 100%;
    height: min(460px, 80vw);
    cursor: grab;
    touch-action: pan-y;
    outline: none;
}

.travel-map-globe.is-over-pin {
    cursor: pointer;
}

.travel-map-globe.is-dragging {
    cursor: grabbing;
}

.travel-map-globe:focus-visible {
    border-radius: 8px;
    box-shadow: 0 0 0 2px var(--accent-a);
}

.travel-map.is-globe .travel-map-flat {
    display: none;
}

.travel-map.is-globe .travel-map-globe-wrap {
    display: block;
}

/* Zoom buttons in the bottom-right corner of the flat map and the globe */
.map-zoom {
    position: absolute;
    right: 4px;
    bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-zoom-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line-hover);
    border-radius: 50%;
    background: var(--bg-panel);
    color: var(--accent-a);
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.map-zoom-btn:hover:not(:disabled) {
    border-color: var(--accent-a);
    box-shadow: 0 0 8px var(--glow-a);
}

.map-zoom-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

[data-theme="green"] .map-zoom-btn {
    border-radius: 2px;
}

/* js/replay.js sets stroke-dasharray every frame. With the draw-in transition left on, each change would
   restart its delay and the lines would trail behind the plane. */
.travel-map-svg.is-replaying .map-web {
    transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

/* The line being flown in the replay */
.travel-map-svg.is-replaying .map-web.is-highlighted {
    opacity: 1;
    stroke-width: calc(1.4px * var(--map-zoom));
}

.map-pin {
    cursor: pointer;
    outline: none;
    transition: opacity 0.3s ease;
}

/* During the replay, hovering is off and places not reached yet are hidden */
.travel-map-svg.is-replaying .map-pin {
    pointer-events: none;
}

.map-pin.is-pending {
    opacity: 0;
}

/* Counter-scales the pin so it stays the same size when the map zooms in */
.map-pin-body {
    transform: scale(var(--map-zoom));
    animation-delay: inherit;
}

.map-pin-dot {
    fill: var(--accent-a);
    stroke: var(--bg-base);
    stroke-width: 1;
    filter: drop-shadow(0 0 3px var(--accent-a));
    transition: transform 0.2s ease;
}

.map-pin--home .map-pin-dot {
    fill: var(--accent-b);
    filter: drop-shadow(0 0 3px var(--accent-b));
}

/* Map-only stops: smaller hollow dots, not clickable */
.map-pin--stop {
    cursor: default;
}

.map-pin--stop .map-pin-dot {
    fill: var(--bg-card);
    stroke: var(--accent-a);
    stroke-width: 1.2;
    filter: none;
}

/* City names, shown only in zoomed-in views. Sizes are in map units (about 1.2px each at full width). */
.map-pin-label {
    font-size: 9px;
    font-weight: 600;
    fill: var(--text-main);
    stroke: var(--bg-card);
    stroke-width: 2.5px;
    paint-order: stroke;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.travel-map-svg.is-zoomed .map-pin-label {
    opacity: 0.9;
}

/* Plane that flies along a pin's routes on hover */
.map-plane {
    fill: var(--text-main);
    filter: drop-shadow(0 0 2px var(--accent-a));
    pointer-events: none;
}

.map-pin:hover .map-pin-dot,
.map-pin:focus-visible .map-pin-dot,
.map-pin.is-active .map-pin-dot {
    transform: scale(1.5);
}

.map-pin-pulse {
    fill: none;
    stroke: var(--accent-a);
    stroke-width: 1;
    transform-box: fill-box;
    transform-origin: center;
    animation: map-pulse 2.4s ease-out infinite;
    animation-delay: inherit;
}

.map-pin.is-active .map-pin-pulse {
    stroke-width: 1.6;
}

@keyframes map-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .map-pin-pulse {
        opacity: 0;
    }

    .map-web {
        stroke-dasharray: 0.25 0;
    }
}

.map-tooltip {
    position: absolute;
    transform: translate(-50%, calc(-100% - 10px));
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg-panel);
    color: var(--text-main);
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 0 16px var(--glow-a);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.map-tooltip.is-visible {
    opacity: 1;
}

.map-tooltip span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.map-tooltip-photo {
    display: block;
    width: 160px;
    height: 100px;
    margin-bottom: 4px;
    border-radius: 4px;
    object-fit: cover;
}

/* Replay controls under the map: play button, timeline, date */
.travel-map-replay {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.travel-map-replay[hidden] {
    display: none;
}

.travel-map-replay-btn {
    flex-shrink: 0;
    min-width: 6.5em;
}

/* A thin line with a small round handle; the track and handle need separate rules for each browser */
.travel-map-scrubber {
    flex: 1;
    min-width: 0;
    height: 14px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.travel-map-scrubber::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 1px;
    background: var(--line-hover);
}

.travel-map-scrubber::-moz-range-track {
    height: 2px;
    border-radius: 1px;
    background: var(--line-hover);
}

.travel-map-scrubber::-webkit-slider-thumb {
    width: 10px;
    height: 10px;
    margin-top: -4px;
    border: none;
    border-radius: 50%;
    background: var(--accent-a);
    box-shadow: 0 0 6px var(--glow-a-strong);
    -webkit-appearance: none;
    appearance: none;
}

.travel-map-scrubber::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: var(--accent-a);
    box-shadow: 0 0 6px var(--glow-a-strong);
}

.travel-map-scrubber:focus {
    outline: none;
}

.travel-map-scrubber:focus-visible::-webkit-slider-thumb {
    outline: 2px solid var(--accent-a);
    outline-offset: 2px;
}

.travel-map-scrubber:focus-visible::-moz-range-thumb {
    outline: 2px solid var(--accent-a);
    outline-offset: 2px;
}

.travel-map-date {
    flex-shrink: 0;
    min-width: 7.5em;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.travel-map-btn {
    align-self: flex-start;
    margin-top: 6px;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent-a);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.travel-map-btn:hover {
    text-decoration: underline;
}

.travel-card.is-highlighted {
    border-color: var(--accent-a);
    box-shadow: 0 0 20px var(--glow-a-strong);
}

/* Photo Gallery */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.gallery-filter-btn {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gallery-filter-btn:hover {
    border-color: var(--line-hover);
    color: var(--accent-a);
}

.gallery-filter-btn.active {
    background: var(--active-bg);
    border-color: var(--accent-a);
    color: var(--accent-a);
    box-shadow: 0 0 8px var(--glow-subtle);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.gallery-cell {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-cell:hover {
    border-color: var(--line-hover);
    box-shadow: 0 0 14px var(--glow-a);
}

.gallery-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-cell:hover img {
    transform: scale(1.08);
}

[data-theme="green"] .gallery-filter-btn,
[data-theme="green"] .gallery-cell {
    border-radius: 2px;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
}

.lightbox-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px var(--glow-a);
    cursor: default;
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    text-align: center;
    cursor: default;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 2.2rem;
    line-height: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    border: none;
    background: transparent;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
}

@media (max-width: 640px) {
    .interests-grid {
        grid-template-columns: 1fr;
    }

    .travel-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .aviation-photos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Entry gate (js/gate.js): boarding pass in blue, terminal login in green */

/* Cover the page until the gate is gone (a backdrop, so the page itself is left untouched) */
html.gate-active body {
    overflow: hidden;
}

html.gate-active::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--bg-base);
}

.gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 20px;
    background: var(--bg-base);
    transition: opacity 0.5s ease;
}

.gate:focus {
    outline: none;
}

.gate.is-leaving {
    opacity: 0;
    pointer-events: none;
}

.gate-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Boarding pass */
.pass {
    display: flex;
    width: min(640px, 100%);
    border-radius: 14px;
    background: var(--card-grad);
    border: 1px solid var(--line-hover);
    box-shadow: 0 0 40px var(--glow-a);
    color: var(--text-main);
    animation: pass-in 0.6s ease-out;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.gate.is-leaving .pass {
    transform: translateY(-40px) scale(0.97);
}

@keyframes pass-in {
    from { transform: translateY(24px); opacity: 0; }
}

.pass-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 22px;
}

.pass-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.pass-airline {
    color: var(--accent-a);
}

.pass-kind {
    color: var(--text-muted);
}

.pass-route {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pass-place {
    display: flex;
    flex-direction: column;
}

.pass-place--to {
    text-align: right;
}

.pass-code {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
}

.pass-city {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Dotted flight path with a plane in the middle */
.pass-path {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pass-path::before,
.pass-path::after {
    content: "";
    flex: 1;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--accent-a) 0 6px, transparent 6px 12px);
    opacity: 0.8;
}

.pass-path svg {
    width: 22px;
    height: 22px;
    transform: rotate(90deg);
    fill: var(--accent-a);
    filter: drop-shadow(0 0 4px var(--accent-a));
}

.pass-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 16px;
}

.pass-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pass-label {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.pass-value {
    font-size: 0.95rem;
    font-weight: 700;
}

/* Tear-off stub, split from the main part by a perforated line */
.pass-stub {
    width: 190px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 20px 18px;
    border-left: 2px dashed var(--line-hover);
}

.pass-barcode {
    position: relative;
    display: flex;
    gap: 2px;
    height: 64px;
    padding: 6px;
    border-radius: 4px;
    background: #ffffff;
    overflow: hidden;
}

.pass-bar {
    flex-basis: 0;
    background: #0b1128;
}

/* Laser line that sweeps across the barcode when scanned */
.pass-scan {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -10%;
    width: 3px;
    background: #ff3b3b;
    box-shadow: 0 0 8px 2px rgba(255, 59, 59, 0.7);
    opacity: 0;
}

.gate.is-scanning .pass-scan {
    animation: pass-scan 0.7s ease-in-out;
}

@keyframes pass-scan {
    0% { left: -5%; opacity: 1; }
    100% { left: 105%; opacity: 1; }
}

.pass-btn {
    padding: 9px 12px;
    border: 1px solid var(--accent-a);
    border-radius: 999px;
    background: var(--active-bg);
    color: var(--accent-a);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.pass-btn:hover,
.pass-btn:focus-visible,
.gate.is-scanning .pass-btn {
    background: var(--accent-a);
    color: var(--bg-base);
}

@media (max-width: 640px) {
    .pass {
        flex-direction: column;
    }

    .pass-stub {
        width: auto;
        border-left: none;
        border-top: 2px dashed var(--line-hover);
    }

    .pass-code {
        font-size: 1.9rem;
    }
}

/* Terminal login */
.term {
    width: min(640px, 100%);
    border: 1px solid var(--line-hover);
    border-radius: 2px;
    background: #000000;
    box-shadow: 0 0 30px var(--glow-a);
}

.term-bar {
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.term-body {
    min-height: 220px;
    margin: 0;
    padding: 14px 16px;
    color: var(--text-main);
    font-family: "Courier New", "Lucida Console", "Consolas", monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.term-granted {
    color: #000000;
    background: var(--accent-a);
    padding: 0 4px;
    text-shadow: none;
}

.term-cursor {
    display: inline-block;
    width: 0.6em;
    background: var(--accent-a);
    animation: term-blink 1s steps(1) infinite;
}

@keyframes term-blink {
    50% { opacity: 0; }
}
