:root {
    --bg: #121212;
    --bg-soft: #1a1a1a;
    --surface: #1e1e1e;
    --surface-2: #252526;
    --line: #323232;
    --text: #e7e7e7;
    --muted: #a0a0a0;
    --accent: #c8c8c8;
    --accent-soft: rgba(200, 200, 200, 0.14);
    --ok: #22c55e;
    --shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 11px;
    --theme-transition: background-color 260ms ease, color 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

html.light-mode {
    --bg: #eaf0f6;
    --bg-soft: #dbe6f1;
    --surface: #ffffff;
    --surface-2: #f3f7fb;
    --line: #d3deea;
    --text: #182635;
    --muted: #5f7389;
    --accent: #1769b0;
    --accent-soft: rgba(23, 105, 176, 0.14);
    --ok: #1f9e64;
    --shadow: 0 14px 30px rgba(41, 74, 110, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: "Manrope", "Noto Sans Thai", "Noto Sans JP", sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, var(--bg) 0%, var(--bg-soft) 100%);
    transition: var(--theme-transition);
    overflow: hidden;
}

.bento-page {
    max-width: 1700px;
    height: 100vh;
    min-height: 0;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.theme-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    transition: var(--theme-transition), transform 180ms ease;
}

.theme-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.34), 0 0 24px rgba(255, 255, 255, 0.08);
}

.theme-btn-floating {
    position: fixed;
    top: 28px;
    right: 42px;
    z-index: 40;
    border-color: rgba(255, 255, 255, 0.14);
    background: color-mix(in srgb, var(--surface) 88%, white 12%);
}

.theme-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 255, 255, 0.14);
}

.theme-btn i {
    transition: transform 0.45s ease;
}

.bento-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 2.1fr);
    align-items: start;
    gap: 12px;
}

.bento-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--theme-transition), transform 180ms ease;
    overflow: hidden;
}

.bento-card:hover {
    transform: translateY(-2px);
}

.bento-inner {
    padding: 18px;
    height: 100%;
}

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

.card-title {
    font-family: "Space Grotesk", "Noto Sans Thai", "Noto Sans JP", sans-serif;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.small-note {
    color: var(--muted);
    font-size: 0.75rem;
}

.profile-card {
    grid-column: 1;
    grid-row: 1;
}

.profile-card .bento-inner {
    overflow-y: auto;
    padding-right: 14px;
}

.profile-card .bento-inner::-webkit-scrollbar {
    width: 6px;
}

.profile-card .bento-inner::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
}

.projects-pane {
    grid-column: 2;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(272px, auto);
    gap: 12px;
    align-content: start;
    padding-right: 4px;
    padding-bottom: 12px;
}

.projects-pane::-webkit-scrollbar {
    width: 8px;
}

.projects-pane::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
}

.projects-pane .bento-card {
    min-height: 272px;
}

.projects-pane .bento-inner {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 20px;
}

.projects-pane .project-description-list {
    margin-bottom: 0;
    line-height: 1.45;
}

.projects-pane .p-featured,
.projects-pane .p-wide,
.projects-pane .p-card {
    grid-column: auto;
    grid-row: auto;
}

.profile-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.profile-img-small {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(145deg, #5a5a5a, #3d3d3d);
}

html.light-mode .profile-img-small {
    background: linear-gradient(145deg, #9cb7d2, #6f8eac);
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-status {
    align-self: flex-start;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
    animation: pulse 1.8s ease-in-out infinite;
}

.name {
    margin-top: 16px;
    font-family: "Space Grotesk", "Noto Sans Thai", "Noto Sans JP", sans-serif;
    font-size: clamp(1.6rem, 1.9vw, 2.2rem);
    line-height: 1.08;
    position: relative;
    z-index: 1;
}

.title {
    margin-top: 7px;
    color: var(--muted);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.profile-badges {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tagline {
    margin-top: 12px;
    position: relative;
    z-index: 1;
    color: var(--text);
}

.quick-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
    position: relative;
    z-index: 1;
}

.profile-inline-meta {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.profile-inline-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
    padding: 0;
}

.profile-inline-meta > .profile-inline-line:first-child {
    margin: 0;
    padding: 0;
    line-height: 1;
    margin-bottom: 4px;
}

.profile-inline-meta > .profile-inline-line:first-child .profile-inline-label {
    display: inline-block;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.profile-inline-connect .social-row {
    margin-top: 0;
}

.profile-inline-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
}

.profile-inline-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.profile-inline-link:hover {
    border-bottom-color: var(--text);
}

.resume-inline {
    margin-top: 2px;
}

.meta-pill {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 7px 9px;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

.location-card {
    grid-column: span 2;
    grid-row: span 1;
}

.social-card {
    grid-column: span 2;
    grid-row: span 1;
}

.resume-card {
    grid-column: span 2;
    grid-row: span 1;
}

.exp-1,
.exp-2 {
    grid-column: span 2;
    grid-row: span 2;
}

.p-featured {
    grid-column: span 4;
    grid-row: span 3;
}

.p-wide {
    grid-column: span 4;
    grid-row: span 2;
}

.p-card {
    grid-column: span 2;
    grid-row: span 2;
}

.profile-sections {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.profile-block {
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 12px;
    padding: 10px;
}

.profile-block-title {
    color: var(--muted);
    font-size: 0.73rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-location {
    font-size: 0.92rem;
}

.profile-experience-list {
    display: grid;
    gap: 8px;
}

.profile-exp-item {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px;
    background: var(--surface);
}

.profile-exp-item .company-logo {
    width: 34px;
    height: 34px;
}

.profile-exp-item .company-name {
    font-size: 0.82rem;
}

.profile-exp-item .role-title {
    font-size: 0.74rem;
    margin-top: 1px;
}

.profile-experience-detail {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
}

.exp-entry h4 {
    font-size: 0.92rem;
    line-height: 1.3;
}

.exp-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exp-logo {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #ffffff;
    object-fit: contain;
    padding: 2px;
    flex-shrink: 0;
}

.exp-date {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.82rem;
}

.exp-role {
    margin-top: 4px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
}

.exp-entry ul {
    margin-top: 7px;
    margin-left: 16px;
    color: var(--muted);
    font-size: 0.82rem;
    display: grid;
    gap: 5px;
    line-height: 1.4;
}

.social-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.social-icon,
.btn-resume,
.project-link {
    text-decoration: none;
}

.social-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    display: grid;
    place-items: center;
    transition: var(--theme-transition), transform 180ms ease;
}

.social-icon:hover,
.btn-resume:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.btn-resume {
    display: inline-flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 700;
    margin-top: 6px;
    transition: var(--theme-transition), transform 180ms ease;
}

.company-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

.company-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
    background: #ffffff;
    padding: 4px;
}

.company-name {
    font-size: 0.95rem;
}

.role-title {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.82rem;
}

.project-title {
    font-size: 0.96rem;
    line-height: 1.3;
    margin-bottom: 8px;
}

.project-link {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.project-link > i {
    margin-right: 6px;
}

.project-link[href*="github.com"]::after {
    content: "\f0c1";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.72rem;
    margin-left: 6px;
    opacity: 0.85;
}

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

.project-tech-stack {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tech-badge {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tech-badge i {
    font-size: 0.78rem;
}

.tech-badge .fa-brands.fa-docker {
    color: #2496ed;
}

.tech-badge .fa-brands.fa-node-js {
    color: #68a063;
}

.tech-badge .fa-brands.fa-python {
    color: #3776ab;
}

.tech-badge .fa-brands.fa-react {
    color: #61dafb;
}

.tech-badge .fa-solid.fa-bolt {
    color: #10b981;
}

.tech-badge .fa-solid.fa-robot {
    color: #f59e0b;
}

.tech-badge .fa-solid.fa-code {
    color: #3178c6;
}

.tech-badge .fa-solid.fa-network-wired,
.tech-badge .fa-solid.fa-shuffle,
.tech-badge .fa-solid.fa-diagram-project,
.tech-badge .fa-solid.fa-sitemap,
.tech-badge .fa-solid.fa-table,
.tech-badge .fa-solid.fa-list-check,
.tech-badge .fa-solid.fa-chart-line,
.tech-badge .fa-solid.fa-database {
    color: #94a3b8;
}

.tech-badge i[class*="devicon-"] {
    font-size: 0.92rem;
    line-height: 1;
}

.project-description-list {
    margin-top: 10px;
    margin-left: 16px;
    color: var(--muted);
    font-size: 0.8rem;
    display: grid;
    gap: 5px;
}

.project-description-list strong {
    color: var(--text);
    font-weight: 800;
}

.project-tags {
    margin-top: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 0.7rem;
    background: var(--surface-2);
}

.reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: reveal 0.68s ease forwards;
}

.reveal-delay-1 {
    animation-delay: 70ms;
}

.reveal-delay-2 {
    animation-delay: 140ms;
}

.reveal-delay-3 {
    animation-delay: 220ms;
}

.reveal-delay-4 {
    animation-delay: 300ms;
}

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.24);
        opacity: 0.72;
    }
}

@keyframes floatGlow {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(12px);
    }
}

@media (max-width: 1320px) {
    .bento-grid {
        grid-template-columns: minmax(300px, 1fr) minmax(0, 1.9fr);
    }
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .bento-page {
        height: auto;
        min-height: 100vh;
    }

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

    .profile-card {
        grid-column: 1;
    }

    .projects-pane {
        grid-column: 1;
        height: auto;
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 700px) {
    .bento-page {
        padding: 14px;
    }

    .theme-btn-floating {
        top: auto;
        right: auto;
        bottom: 18px;
        left: 18px;
    }

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

    .projects-pane {
        grid-template-columns: 1fr;
    }
}
