/* ================================================================
   UI/UX Pro Max – Visual Refinement Layer
   Portfolio / Creative Agency / Dark Mode
   Overrides style.css for a polished, editorial look
   ================================================================ */

/* ── 0. Design Tokens ─────────────────────────────────────────── */
:root {
    --surface-0: rgba(4, 4, 8, 0.42);
    --surface-1: rgba(13, 17, 28, 0.66);
    --surface-2: rgba(18, 24, 38, 0.78);
    --surface-3: rgba(26, 34, 52, 0.84);
    --stroke-soft: rgba(255, 255, 255, 0.10);
    --stroke-mid: rgba(125, 220, 255, 0.22);
    --stroke-hot: rgba(var(--cyan-rgb), 0.52);
    --shadow-panel: 0 24px 70px rgba(0, 0, 0, 0.36);
    --shadow-lift: 0 26px 70px rgba(0, 0, 0, 0.46), 0 0 34px rgba(var(--cyan-rgb), 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --page-gutter: clamp(1.25rem, 4vw, 3rem);

    --space-section-sm: clamp(2.35rem, 4.8vw, 3.5rem);
    --space-section-md: clamp(3rem, 6vw, 4.75rem);
    --space-section-lg: clamp(3.5rem, 7vw, 6rem);
}

html {
    color-scheme: dark;
}

body {
    min-width: 320px;
    font-size: 16px;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

::selection {
    color: #041018;
    background: rgba(var(--cyan-rgb), 0.82);
}

a,
button,
.btn,
.nav-link,
.filter-chip,
.lab-aspect-chip,
.content-card,
.work-card,
.knowledge-card {
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.filter-chip:focus-visible,
.lab-aspect-chip:focus-visible,
.content-card:focus-visible {
    outline: 2px solid rgba(var(--cyan-rgb), 0.88);
    outline-offset: 3px;
}

/* ── 1. Background Layer Refinement ──────────────────────────── */
.blurred-bg-container::before {
    background:
        radial-gradient(circle at 16% 16%, rgba(var(--cyan-rgb), 0.14), transparent 28%),
        radial-gradient(circle at 84% 10%, rgba(var(--magenta-rgb), 0.10), transparent 26%),
        linear-gradient(180deg, rgba(4, 4, 8, 0.08) 0%, rgba(4, 4, 8, 0.24) 52%, rgba(4, 4, 8, 0.58) 100%);
    backdrop-filter: blur(3px) saturate(130%);
    -webkit-backdrop-filter: blur(3px) saturate(130%);
}

.blurred-bg-container::after {
    background:
        linear-gradient(90deg, rgba(var(--cyan-rgb), 0.06), transparent 22%, transparent 78%, rgba(var(--magenta-rgb), 0.06)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 20%),
        radial-gradient(circle at center, transparent 52%, rgba(0, 0, 0, 0.40) 100%);
}

.blurred-bg-layer img {
    filter: blur(6px) saturate(1.15) brightness(0.96) contrast(1.06);
}

/* ── 2. Layout Container ─────────────────────────────────────── */
.container,
.subpage-main {
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
}

/* ── 3. Header / Navbar ──────────────────────────────────────── */
.site-header {
    --header-edge-proximity: 0;
    --header-edge-x: 50%;
    --header-edge-y: 0%;
    --header-glow-w: 168px;
    --header-glow-h: 22px;
    --header-halo-w: 300px;
    --header-halo-h: 86px;
    --header-edge-sensitivity: 30;
    --header-color-sensitivity: 44;
    top: 12px;
    right: 0;
    left: 0;
    width: min(1240px, calc(100% - 24px));
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, rgba(11, 15, 26, 0.82), rgba(18, 20, 31, 0.62)),
        rgba(4, 4, 8, 0.46);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(20px) saturate(155%);
    -webkit-backdrop-filter: blur(20px) saturate(155%);
    isolation: isolate;
    overflow: visible;
}

.site-header::before,
.site-header::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: inherit;
    transition: opacity 220ms ease-out;
}

.site-header:not(:hover)::before,
.site-header:not(:hover)::after {
    opacity: 0;
    transition: opacity 620ms ease-in-out;
}

.site-header::before {
    inset: -1px;
    z-index: 1;
    padding: 1px;
    background:
        radial-gradient(ellipse var(--header-glow-w) var(--header-glow-h) at var(--header-edge-x) var(--header-edge-y),
            rgba(255, 255, 255, 1) 0 7%,
            rgba(255, 249, 221, 0.98) 10%,
            rgba(145, 233, 255, 0.94) 20%,
            rgba(121, 159, 255, 0.82) 34%,
            rgba(178, 108, 255, 0.54) 50%,
            transparent 76%),
        linear-gradient(120deg, rgba(34, 211, 238, 0.14), rgba(244, 114, 182, 0.08) 48%, rgba(192, 132, 252, 0.12));
    opacity: calc((var(--header-edge-proximity) - var(--header-color-sensitivity)) / (100 - var(--header-color-sensitivity)));
    filter:
        drop-shadow(0 0 7px rgba(255, 255, 255, 0.82))
        drop-shadow(0 0 14px rgba(114, 223, 255, 0.72))
        drop-shadow(0 0 28px rgba(168, 125, 255, 0.42));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
}

.site-header::after {
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse var(--header-halo-w) var(--header-halo-h) at var(--header-edge-x) var(--header-edge-y),
            rgba(255, 255, 255, 0.46) 0 4%,
            rgba(236, 252, 255, 0.38) 8%,
            rgba(130, 232, 255, 0.48) 18%,
            rgba(119, 147, 255, 0.28) 38%,
            rgba(178, 108, 255, 0.16) 58%,
            rgba(244, 114, 182, 0.06) 74%,
            transparent 92%);
    filter: blur(22px) saturate(1.45);
    mix-blend-mode: screen;
    opacity: calc((var(--header-edge-proximity) - var(--header-edge-sensitivity)) / (100 - var(--header-edge-sensitivity)));
}

.header-container {
    position: relative;
    z-index: 2;
    min-height: 72px;
    padding: 0.75rem 1.25rem;
}

body.has-viewport-auth .header-container {
    padding-right: clamp(0.75rem, 2vw, 1.25rem);
}

body.has-viewport-auth .main-nav ul {
    flex-wrap: wrap;
    justify-content: center;
}

.admin-quick-link {
    position: fixed;
    top: 10px;
    right: 12px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 0.72rem;
    border: 1px solid rgba(var(--cyan-rgb), 0.54);
    border-radius: var(--radius-sm);
    color: rgba(240, 249, 255, 0.94);
    background:
        linear-gradient(135deg, rgba(10, 18, 32, 0.76), rgba(20, 26, 42, 0.58)),
        rgba(4, 8, 14, 0.48);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.07),
        0 0 18px rgba(var(--cyan-rgb), 0.14);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
    transition: border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.admin-quick-link:hover {
    border-color: rgba(var(--cyan-rgb), 0.92);
    color: #ffffff;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 0 24px rgba(var(--cyan-rgb), 0.26);
    transform: translateY(-1px);
}

.logo-icon-wrapper {
    border-radius: var(--radius-md);
    background: rgba(var(--cyan-rgb), 0.08);
    box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), 0.18), 0 0 24px rgba(var(--cyan-rgb), 0.1);
}

.brand-name {
    letter-spacing: 0;
}

.brand-sub,
.nav-en {
    color: rgba(226, 232, 240, 0.62);
}

.main-nav ul {
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link {
    min-height: 44px;
    padding: 0.56rem 0.82rem;
    border-radius: var(--radius-sm);
    transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-light);
    background: rgba(var(--cyan-rgb), 0.10);
    transform: translateY(-1px);
}

.nav-link.active {
    box-shadow: inset 0 -2px 0 rgba(var(--cyan-rgb), 0.9);
}

/* ── 4. Global Button & Link Targets ─────────────────────────── */
.btn,
.section-link,
.filter-chip,
.play-btn-circle,
.t-btn {
    min-height: 44px;
    touch-action: manipulation;
}

.btn {
    border-radius: var(--radius-sm);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.btn:hover,
.section-link:hover {
    transform: translateY(-2px);
}

.btn:active,
.section-link:active,
.filter-chip:active {
    transform: translateY(0) scale(0.98);
}

/* ── 5. HERO SECTION — Clean Editorial Layout ────────────────── */
.hero-section {
    position: relative;
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    min-height: auto;
    padding-top: clamp(5.5rem, 8vw, 7rem);
    padding-bottom: clamp(1.25rem, 2.5vw, 2rem);
    gap: 0;
    overflow: visible;
    isolation: isolate;
}

.hero-portrait-stage {
    display: none !important;
}

.hero-right {
    display: none !important;
}

.hero-left {
    position: relative;
    z-index: 2;
    max-width: 960px;
    width: 100%;
    padding-top: 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    overflow: visible;
}

.hero-tag-badge,
.page-kicker {
    align-self: center;
    border-radius: 999px;
    padding: 0.4rem 1.1rem;
    background:
        linear-gradient(90deg, rgba(var(--cyan-rgb), 0.12), rgba(var(--magenta-rgb), 0.06)),
        rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(var(--cyan-rgb), 0.18);
    box-shadow: 0 0 20px rgba(var(--cyan-rgb), 0.06);
}

.hero-title {
    max-width: 100%;
    font-family:
        "Microsoft YaHei UI",
        "PingFang SC",
        "Noto Sans SC",
        var(--font-sci-fi),
        sans-serif;
    font-size: clamp(2rem, 3.2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.015em;
    text-wrap: balance;
    color: rgba(248, 250, 252, 0.96);
    overflow: visible;
    padding-top: 0.12em;
    padding-bottom: 0.08em;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06),
        0 12px 40px rgba(0, 0, 0, 0.4);
}

.hero-title .text-glow-cyan,
.hero-title .text-glow-gradient,
.hero-title .brand-name {
    font-weight: 750;
    display: inline-block;
    padding-block: 0.06em;
    overflow: visible;
}

.hero-title .text-glow-cyan {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(66, 240, 255, 0.92) 42%, rgba(0, 174, 255, 0.76) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.hero-title .text-glow-gradient {
    background:
        linear-gradient(92deg, rgba(0, 210, 255, 0.92) 0%, rgba(255, 92, 128, 0.9) 42%, rgba(244, 176, 103, 0.9) 72%, rgba(255, 255, 255, 0.94) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.hero-intro {
    max-width: 62ch;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: rgba(210, 218, 230, 0.88);
    background: rgba(255, 255, 255, 0.04);
    line-height: 1.72;
    font-size: 0.98rem;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hero-pills {
    gap: 0.4rem;
    margin-top: -0.1rem;
    justify-content: center;
}

.pill-badge,
.tag {
    min-height: 36px;
    border-radius: 999px;
    color: rgba(226, 232, 240, 0.88);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: none;
    font-size: 0.84rem;
    transition: all 200ms ease;
}

.pill-badge:hover {
    background: rgba(var(--cyan-rgb), 0.10);
    border-color: rgba(var(--cyan-rgb), 0.3);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--cyan-rgb), 0.12);
}

/* ── 6. SECTION SHARED STYLES ────────────────────────────────── */
.section-header,
.page-hero {
    gap: 0.85rem;
    margin-bottom: clamp(1.5rem, 3.2vw, 2.5rem);
}

.section-title,
.page-title,
.content-card-title,
.work-title {
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.section-title {
    font-size: clamp(1.65rem, 3.5vw, 2.4rem);
    font-weight: 700;
}

.section-bracket {
    display: inline-block;
    margin: 0 0.2em;
    opacity: 0.6;
    font-size: 0.85em;
}

.section-subtitle {
    max-width: 60ch;
    color: rgba(203, 213, 225, 0.72);
    line-height: 1.7;
}

.section-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(var(--cyan-rgb), 0.20);
    border-radius: var(--radius-sm);
    background: rgba(var(--cyan-rgb), 0.06);
    font-size: 0.88rem;
    transition: all 200ms ease;
}

.section-link:hover {
    background: rgba(var(--cyan-rgb), 0.14);
    border-color: rgba(var(--cyan-rgb), 0.4);
}

/* Section divider – subtle gradient line between sections */
.works-section,
.knowledge-section,
.prompt-lab-section,
.about-section,
.contact-section {
    position: relative;
}

.works-section::before,
.knowledge-section::before,
.prompt-lab-section::before,
.about-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(240px, 50%);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--cyan-rgb), 0.25), rgba(var(--magenta-rgb), 0.15), transparent);
}

/* ── 7. WORKS SECTION ────────────────────────────────────────── */
.works-section {
    padding-top: clamp(1.25rem, 2.5vw, 2rem);
    padding-bottom: var(--space-section-md);
}

.works-grid {
    gap: clamp(1rem, 2vw, 1.5rem);
}

/* ── 8. KNOWLEDGE SECTION ────────────────────────────────────── */
.knowledge-section {
    padding-top: var(--space-section-md);
    padding-bottom: var(--space-section-md);
}

.knowledge-grid {
    gap: clamp(1rem, 2vw, 1.5rem);
}

.knowledge-card {
    padding: clamp(1.75rem, 3vw, 2.5rem);
}

/* ── 9. PROMPT LAB SECTION ───────────────────────────────────── */
.prompt-lab-section {
    padding-top: var(--space-section-md);
    padding-bottom: var(--space-section-md);
}

.prompt-lab-container {
    gap: clamp(0.85rem, 1.5vw, 1.25rem);
}

.lab-run-frame {
    position: relative;
    isolation: isolate;
    border-radius: var(--radius-md, 14px);
    border-color: rgba(220, 38, 68, 0.22) !important;
    background:
        linear-gradient(180deg, rgba(220, 38, 68, 0.04) 0%, transparent 18%),
        var(--surface-1, #060614) !important;
    box-shadow:
        0 0 0 1px rgba(220, 38, 68, 0.08),
        0 0 28px rgba(220, 38, 68, 0.06),
        var(--shadow-panel, 0 18px 48px rgba(0, 0, 0, 0.55)) !important;
}

.lab-run-body {
    gap: 0;
}

.lab-preview-pane {
    min-width: 0;
    background: var(--lab-preview-surface);
}

.lab-preview-pane .terminal-output {
    max-width: min(100%, clamp(280px, 72vw, 800px));
}

.lab-editor-pane {
    background:
        linear-gradient(180deg, rgba(56, 189, 248, 0.06) 0%, rgba(56, 189, 248, 0.015) 50%, transparent 100%),
        rgba(6, 10, 22, 0.65);
}

.lab-run-actions {
    border-top-color: rgba(56, 189, 248, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.lab-aspect-bar {
    border-top-color: rgba(56, 189, 248, 0.12);
}

.lab-aspect-chip {
    border-radius: var(--radius-sm, 999px);
    font-weight: 650;
    transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.lab-aspect-chip.active,
.lab-aspect-chip:hover:not(:disabled) {
    color: #061018;
    border-color: rgba(var(--cyan-rgb), 0.72);
    background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.9), rgba(223, 181, 108, 0.82));
    box-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.18);
}

.lab-aspect-chip:active:not(:disabled) {
    transform: scale(0.97);
}

.lab-aspect-chip:focus-visible {
    outline: 2px solid rgba(var(--cyan-rgb), 0.65);
    outline-offset: 2px;
}

.lab-shortcuts-row {
    gap: clamp(0.4rem, 0.9vw, 0.55rem);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.lab-pagination-tabs .lab-shortcut-card {
    border-radius: var(--radius-sm, 6px);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ── 10. ABOUT SECTION ───────────────────────────────────────── */
.about-section {
    padding-top: var(--space-section-lg);
    padding-bottom: var(--space-section-md);
}

.about-container {
    gap: clamp(1.75rem, 3.5vw, 3rem);
}

.about-name {
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    letter-spacing: -0.02em;
}

.about-role {
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    opacity: 0.9;
}

.about-bio {
    line-height: 1.8;
    color: rgba(210, 218, 230, 0.82);
}

.skills-wrapper {
    margin-top: 2rem;
}

.skills-section-title {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: rgba(148, 163, 184, 0.7);
    margin-bottom: 0.75rem;
}

/* ── 11. CONTACT SECTION ─────────────────────────────────────── */
.contact-section {
    padding-top: var(--space-section-md);
    padding-bottom: var(--space-section-lg);
}

.glass-contact-panel {
    border-radius: var(--radius-lg);
    padding: clamp(2.5rem, 5vw, 4rem);
}

.contact-title {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    letter-spacing: -0.02em;
}

/* ── 12. CARD SYSTEM — Unified Glass Panels ──────────────────── */
.portal-wrapper,
.prompt-terminal,
.lab-run-frame,
.glass-contact-panel,
.content-card,
.detail-panel,
.side-panel,
.knowledge-card,
.work-card {
    border-radius: var(--radius-md);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
        var(--surface-1);
    border-color: var(--stroke-soft);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.portal-wrapper {
    overflow: hidden;
}

.portal-wrapper::before,
.content-card::before,
.work-card::before,
.knowledge-card::before,
.detail-panel::before,
.side-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        linear-gradient(120deg, rgba(var(--cyan-rgb), 0.12), transparent 30%, transparent 70%, rgba(var(--magenta-rgb), 0.08)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 26%);
    opacity: 0.5;
}

.content-card,
.work-card,
.knowledge-card,
.detail-panel,
.side-panel {
    position: relative;
    isolation: isolate;
}

.content-card > *,
.work-card > *,
.knowledge-card > *,
.detail-panel > *,
.side-panel > * {
    position: relative;
    z-index: 1;
}

.content-card::before,
.work-card::before,
.knowledge-card::before,
.detail-panel::before,
.side-panel::before {
    z-index: 0;
}

.work-card,
.knowledge-card,
.content-card {
    transform: translateZ(0);
    transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.work-card:hover,
.knowledge-card:hover,
.content-card:hover {
    transform: translateY(-5px);
    border-color: var(--stroke-hot);
    box-shadow: var(--shadow-lift);
}

.work-img-container,
.content-card-media,
.preview-gallery a {
    background: rgba(0, 0, 0, 0.32);
}

.work-img-container img,
.content-card-media img,
.preview-gallery img {
    filter: saturate(1.06) contrast(1.04);
}

/* Override card system radius for specific panels */
.glass-contact-panel {
    border-radius: var(--radius-lg);
    padding: clamp(2.5rem, 5vw, 4rem);
}

/* ── 13. FOOTER ──────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.36));
}

/* ── 14. SUBPAGE STYLES ──────────────────────────────────────── */
.page-hero {
    align-items: end;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 18% 0%, rgba(var(--cyan-rgb), 0.14), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018));
}

.page-title {
    font-size: clamp(2rem, 4vw, 3.25rem);
}

.page-subtitle {
    max-width: 74ch;
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.75;
}

.page-toolbar {
    position: sticky;
    top: 100px;
    z-index: 8;
    grid-template-columns: minmax(260px, 1fr) minmax(0, auto);
    padding: 0.8rem;
}

.search-input {
    min-height: 44px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.24);
}

.search-input::placeholder {
    color: rgba(203, 213, 225, 0.54);
}

.filter-chip {
    border-radius: var(--radius-sm);
    font-weight: 650;
    transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.filter-chip.active,
.filter-chip:hover {
    color: #061018;
    border-color: rgba(var(--cyan-rgb), 0.72);
    background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.9), rgba(223, 181, 108, 0.82));
}

.content-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1rem;
}

.content-card-media {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.content-card-body {
    gap: 0.8rem;
    padding: 1.05rem;
}

.content-meta {
    gap: 0.4rem;
    color: rgba(203, 213, 225, 0.7);
}

.content-card-title {
    font-size: clamp(1.06rem, 1.6vw, 1.25rem);
}

.content-card-summary,
.prompt-mini p,
.markdown-body {
    color: rgba(226, 232, 240, 0.8);
}

.content-card-footer {
    padding-top: 0.2rem;
}

.prompt-code,
.markdown-body code {
    border-color: rgba(var(--cyan-rgb), 0.22);
    background: rgba(0, 0, 0, 0.42);
}

.prompt-code {
    max-height: 260px;
    overflow: auto;
}

.prompt-mini {
    position: relative;
}

.prompt-mini .prompt-code {
    max-height: 132px;
    overflow: hidden;
    line-height: 1.62;
    mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
}

.prompt-mini .prompt-code:hover,
.prompt-mini .prompt-code:focus-visible {
    max-height: 220px;
    overflow: auto;
    mask-image: none;
    -webkit-mask-image: none;
}

.detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.detail-body {
    padding: clamp(1.1rem, 2vw, 1.65rem);
}

.markdown-body {
    max-width: 76ch;
    font-size: 1rem;
}

.detail-body > .imported-handbook {
    max-width: 100%;
}

.article-import-layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
}

.article-import-layout .detail-panel {
    width: 100%;
}

.article-import-layout .detail-body {
    padding: 0;
}

.imported-handbook .hero,
.imported-handbook .part,
.imported-handbook .chapter,
.imported-handbook .colophon {
    border-color: rgba(255, 255, 255, 0.12);
}

.imported-handbook .avatar-portrait {
    margin-inline: auto;
}

.article-import-layout .imported-handbook {
    --maxw: 100%;
    --col-text: 100%;
    --bg: #09131a;
    --paper: rgba(8, 15, 22, 0.78);
    --ink: #eef6fb;
    --ink-2: #cfdae4;
    --muted: #9eacbb;
    --line: rgba(255, 255, 255, 0.11);
    width: 100%;
    background:
        radial-gradient(circle at 50% 18%, rgba(var(--cyan-rgb), 0.12), transparent 32%),
        linear-gradient(180deg, rgba(5, 12, 18, 0.92), rgba(8, 17, 24, 0.96));
}

.article-import-layout .imported-handbook .hero,
.article-import-layout .imported-handbook .part,
.article-import-layout .imported-handbook .section,
.article-import-layout .imported-handbook section,
.article-import-layout .imported-handbook footer {
    width: 100%;
    max-width: 100%;
}

.article-import-layout .imported-handbook .hero,
.article-import-layout .imported-handbook .part {
    background:
        linear-gradient(180deg, rgba(7, 16, 24, 0.9), rgba(8, 18, 27, 0.96));
}

.article-import-layout .imported-handbook .hero {
    padding-left: clamp(1rem, 4vw, 3.5rem);
    padding-right: clamp(1rem, 4vw, 3.5rem);
}

.article-import-layout .imported-handbook .sect-body,
.article-import-layout .imported-handbook .part-intro,
.article-import-layout .imported-handbook .callout,
.article-import-layout .imported-handbook footer .colophon,
.article-import-layout .imported-handbook .sect-body > p.desc,
.article-import-layout .imported-handbook .sect-body p,
.article-import-layout .imported-handbook .sect-body ul,
.article-import-layout .imported-handbook .sect-body ol {
    max-width: 100%;
}

.article-import-layout .imported-handbook .avatar-portrait,
.article-import-layout .imported-handbook .avatar-portrait .ap-disc {
    width: min(100%, 720px);
    height: auto;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc img {
    width: 100%;
}

.article-import-layout .imported-handbook .hero.hero-split {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: clamp(2.25rem, 6vw, 5.5rem);
}

.article-import-layout .imported-handbook .hero.hero-split .hero-text {
    width: 100%;
    margin-top: 0;
}

.article-import-layout .imported-handbook .avatar-portrait {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    display: block;
    position: relative;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 21 / 10;
    height: auto;
    border-radius: 0;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc::before,
.article-import-layout .imported-handbook .avatar-portrait .ap-disc::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc::before {
    display: none;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc::after {
    display: none;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-disc img {
    width: 100%;
    height: 100%;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    object-fit: cover;
    object-position: 34% 30%;
    filter: saturate(1) contrast(1) brightness(0.78);
    opacity: 0.72;
    transform: scale(1.58);
    transform-origin: 34% 30%;
    -webkit-mask-image:
        linear-gradient(180deg, #000 0%, #000 38%, rgba(0, 0, 0, 0.72) 56%, rgba(0, 0, 0, 0.28) 76%, transparent 96%);
    mask-image:
        linear-gradient(180deg, #000 0%, #000 38%, rgba(0, 0, 0, 0.72) 56%, rgba(0, 0, 0, 0.28) 76%, transparent 96%);
}

.article-import-layout .imported-handbook .avatar-portrait .ap-ring,
.article-import-layout .imported-handbook .avatar-portrait .ap-corner,
.article-import-layout .imported-handbook .avatar-portrait .ap-scan {
    display: none;
}

.article-import-layout .imported-handbook .avatar-portrait .ap-caption {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

.article-import-layout .imported-handbook .hero h1 {
    max-width: 14ch;
    font-size: clamp(3.15rem, 8vw, 6.8rem);
    line-height: 1;
    letter-spacing: 0;
}

.article-import-layout .imported-handbook .part-title {
    max-width: 100%;
    font-size: clamp(2.35rem, 5.6vw, 5.25rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.article-import-layout .imported-handbook .sect-body > h2 {
    font-size: clamp(1.85rem, 3.2vw, 3rem);
    line-height: 1.16;
    letter-spacing: 0;
}

.article-import-layout .imported-handbook .sect-body h3 {
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    line-height: 1.28;
    letter-spacing: 0;
}

.article-import-layout .imported-handbook .chapter-num,
.article-import-layout .imported-handbook .part-num {
    letter-spacing: 0.08em;
}

.markdown-body h2,
.markdown-body h3 {
    letter-spacing: 0;
}

.side-panel {
    top: 7rem;
}

.empty-state {
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
}

/* ── 14b. GSAP MOTION POLISH ─────────────────────────────────── */
html.gsap-loading body {
    overflow: hidden;
}

html.gsap-ready .work-card,
html.gsap-ready .knowledge-card,
html.gsap-ready .lab-shortcut-card,
html.gsap-ready .content-card {
    transition: border-color 280ms ease, box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

html.gsap-ready .work-card:hover,
html.gsap-ready .knowledge-card:hover,
html.gsap-ready .lab-shortcut-card:hover,
html.gsap-ready .content-card:hover {
    transform: none;
}

html.gsap-ready .filter-chip,
html.gsap-ready .lab-aspect-chip {
    will-change: transform;
}

html.gsap-ready .lab-aspect-chip:hover,
html.gsap-ready .lab-aspect-chip.active {
    transform: none;
}

html.gsap-ready .lab-history-item {
    will-change: transform;
}

html.gsap-ready .lab-history-item:hover,
html.gsap-ready .lab-history-item:focus-visible {
    transform: none;
}

html.gsap-ready .expand-btn:hover,
html.gsap-ready .t-btn.btn-copy:hover,
html.gsap-ready .t-btn.btn-run:hover {
    transform: none;
}

html.gsap-ready .modal-content {
    animation: none;
}

html.gsap-ready .modal-overlay.active,
html.gsap-ready .lab-preview-lightbox.active {
    transition: none;
}

html.gsap-ready .page-toolbar .search-input {
    transition: border-color 280ms ease, box-shadow 280ms ease;
}

.work-card,
.knowledge-card,
.lab-shortcut-card,
.glass-contact-panel {
    box-shadow:
        var(--shadow-panel),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

.work-card:hover,
.knowledge-card:hover,
.lab-shortcut-card:hover {
    box-shadow:
        var(--shadow-lift),
        0 0 48px rgba(var(--cyan-rgb), 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-run {
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(var(--cyan-rgb), 0.35),
        0 0 24px rgba(var(--cyan-rgb), 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-run::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.14) 50%, transparent 70%);
    transform: translateX(-120%);
    pointer-events: none;
}

html.gsap-ready .btn-run:hover::after {
    animation: btnRunShimmer 0.75s ease forwards;
}

@keyframes btnRunShimmer {
    to { transform: translateX(120%); }
}

.lab-shortcut-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
        rgba(8, 12, 22, 0.55);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.lab-shortcut-card:hover {
    border-color: rgba(var(--cyan-rgb), 0.38);
}

.lab-preview-pane {
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.glass-contact-panel {
    box-shadow:
        var(--shadow-panel),
        0 0 80px rgba(var(--magenta-rgb), 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.section-link {
    position: relative;
}

.section-link svg {
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.section-link:hover svg {
    transform: translateX(4px);
}

.site-footer .social-icon {
    will-change: transform;
}

/* ── 15. ACCESSIBILITY & REDUCED MOTION ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ── 16. RESPONSIVE — DESKTOP 1024+ (base) ───────────────────── */

/* ── 16a. TABLET ≤ 1024px ────────────────────────────────────── */
@media (max-width: 1024px) {
    .site-header {
        top: 8px;
        width: calc(100% - 16px);
    }

    .hero-section {
        min-height: auto;
        padding-top: clamp(5rem, 8vw, 6.5rem);
        padding-bottom: clamp(1.25rem, 2.5vw, 2rem);
    }

    .hero-left {
        max-width: 90%;
        gap: 0.95rem;
    }

    .hero-title {
        max-width: 100%;
        font-size: clamp(1.85rem, 3.5vw, 2.35rem);
        line-height: 1.22;
    }

    .page-toolbar {
        position: static;
    }

    .about-container {
        grid-template-columns: 1fr;
    }

    .about-avatar-wrapper {
        max-width: 300px;
    }

    .about-details {
        text-align: center;
    }

    .about-role {
        align-self: center;
    }

    .about-bio {
        text-align: center;
    }
}

/* ── 16b. PHONE ≤ 768px ─────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --space-section-sm: clamp(1.75rem, 4.2vw, 3rem);
        --space-section-md: clamp(2rem, 4.8vw, 3.25rem);
        --space-section-lg: clamp(2.35rem, 5.4vw, 3.5rem);
    }

    .site-header {
        border-radius: var(--radius-md);
    }

    .header-container {
        min-height: 64px;
    }

    .hero-section {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 2rem;
    }

    .hero-left {
        gap: 0.85rem;
    }

    .hero-tag-badge {
        align-self: center;
    }

    .hero-title {
        max-width: 100%;
        font-size: clamp(1.55rem, 5.5vw, 2rem);
        line-height: 1.22;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .hero-intro {
        max-width: 100%;
        padding: 0.6rem 0.85rem;
        text-align: left;
        font-size: 0.95rem;
    }

    .hero-pills,
    .filter-chips {
        justify-content: center;
    }

    .subpage-main {
        padding-top: 6.75rem;
    }

    .page-hero {
        padding: 1rem;
    }

    .page-title {
        font-size: clamp(1.8rem, 9vw, 2.4rem);
    }

    .page-toolbar,
    .page-subtitle,
    .content-grid,
    .detail-layout {
        width: 100%;
        max-width: 100%;
    }

    .filter-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-chip {
        min-width: 0;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .section-title {
        font-size: clamp(1.4rem, 6vw, 1.85rem);
    }

    .knowledge-card {
        padding: 1.5rem;
    }

    .about-name {
        font-size: 1.6rem;
    }

    .glass-contact-panel {
        padding: 2rem 1.5rem;
    }

    .contact-title {
        font-size: 1.4rem;
    }
}

/* ── 16c. SMALL PHONE ≤ 480px ────────────────────────────────── */
@media (max-width: 480px) {
    .logo-icon-wrapper {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .hero-tag-badge {
        line-height: 1.35;
    }

    .hero-section {
        padding-top: 4.75rem;
        padding-bottom: 1.75rem;
    }

    .hero-title {
        font-size: clamp(1.4rem, 6vw, 1.85rem);
        line-height: 1.22;
    }

    .hero-left {
        gap: 0.75rem;
    }

    .hero-pills {
        max-width: 100%;
        gap: 0.35rem;
    }

    .pill-badge {
        flex: 1 1 calc(50% - 0.4rem);
        justify-content: center;
        min-width: 0;
        font-size: 0.78rem;
    }

    .portal-wrapper {
        max-width: 100%;
    }

    .filter-chips {
        grid-template-columns: 1fr;
    }

    .content-card-footer {
        gap: 0.7rem;
    }
}

/* ── 16d. ARTICLE IMPORT MOBILE ──────────────────────────────── */
@media (max-width: 760px) {
    .article-import-layout .imported-handbook .hero h1 {
        font-size: clamp(2.25rem, 14vw, 4.5rem);
    }

    .article-import-layout .imported-handbook .part-title {
        font-size: clamp(2rem, 11vw, 3.75rem);
    }
}
