/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --text-primary: #f5f5f5;
    --text-secondary: #b8b8b8;
    --text-muted: #8a8a8a;
    --accent: #9333ea;
    --accent-hover: #a855f7;
    --accent-secondary: #6366f1;
    --border-color: #1f1f1f;
    --tag-bg: #1c1c1c;
    --tag-border: #333333;
    --info-bg: #1a1a1a;
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-bg-hover: rgba(255, 255, 255, 0.07);
    --glow-color: rgba(147, 51, 234, 0.15);
    --glow-strong: rgba(147, 51, 234, 0.3);
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --text-primary: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-secondary: #4f46e5;
    --border-color: #e5e5e5;
    --tag-bg: #eeeeee;
    --tag-border: #d4d4d4;
    --info-bg: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.06);
    --card-bg-hover: rgba(255, 255, 255, 0.9);
    --glow-color: rgba(124, 58, 237, 0.1);
    --glow-strong: rgba(124, 58, 237, 0.2);
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* ===== Base ===== */
body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background:
        linear-gradient(135deg, #0a0a0a 0%, #0e0a12 35%, #100b14 50%, #0e0a11 65%, #0a0a0a 100%);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background 0.4s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background:
        linear-gradient(135deg, #fafafa 0%, #f8f5fc 30%, #f6f3fa 50%, #f8f6fb 70%, #fafafa 100%);
}

/* Ambient background glow */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 15% 65%, rgba(147, 51, 234, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 85% 20%, rgba(99, 102, 241, 0.09) 0%, transparent 70%),
        radial-gradient(ellipse 40% 35% at 50% 50%, rgba(147, 51, 234, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 60% 50% at 15% 65%, rgba(124, 58, 237, 0.09) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 85% 20%, rgba(79, 70, 229, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 40% 35% at 50% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 60%);
}

/* Noise grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes subtleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ===== Layout ===== */
.container {
    display: grid;
    grid-template-columns: 2fr 3fr;
    height: 100vh;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 48px;
    animation: fadeIn 0.6s ease-out;
    position: relative;
    z-index: 2;
}

.left-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 48px;
    overflow-y: auto;
    overflow-x: hidden;
}

.right-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-left: 48px;
    padding-top: 5vh;
    padding-bottom: 0;
    border-left: 1px solid var(--border-color);
}

/* ===== Scrollable ===== */
.scrollable {
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 16px;
    padding-bottom: 20px;
}

.scrollable::-webkit-scrollbar {
    width: 4px;
}

.scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 2px;
}

.scrollable:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.scrollable {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.scrollable:hover {
    scrollbar-color: var(--border-color) transparent;
}

/* ===== Scroll to Top ===== */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    box-shadow: 0 4px 16px var(--glow-color);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--glow-strong);
}

/* ===== Typography ===== */
h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
    letter-spacing: -0.03em;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 50%, var(--accent) 75%, var(--accent-secondary) 100%);
    background-size: 200% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: background-position 0.5s ease;
}

h1:hover {
    background-position: 100% 50%;
}

h1::after {
    content: '_';
    -webkit-text-fill-color: var(--accent);
    animation: cursorBlink 1s infinite;
    margin-left: 4px;
}

.title {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.profile-text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    margin-top: 20px;
    color: var(--text-muted);
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    flex-shrink: 0;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color), transparent);
    border-radius: 1px;
}

.section-title:first-of-type {
    margin-top: 0;
}

/* ===== Contact Info ===== */
.contact-info {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
}

.contact-item {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    word-break: break-word;
}

.contact-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: var(--accent);
}

.contact-item + .contact-item::before {
    content: "";
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 16px;
    flex-shrink: 0;
}

/* ===== Social Links ===== */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.social-links a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.social-links a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--glow-color);
}

.social-links a.resume-button {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.social-links a.resume-button:hover {
    box-shadow: 0 6px 28px var(--glow-strong);
    transform: translateY(-2px);
}

/* ===== Skills — Single Column ===== */
.skills-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skill-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.skill-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.skill-tag:hover {
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--glow-color);
    transform: translateY(-1px);
    color: var(--text-primary);
}

/* AWS tag with tooltip */
.skill-tag-aws {
    position: relative;
    cursor: help;
}

.skill-tag-aws .aws-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.skill-tag-aws:hover .aws-tooltip {
    display: block;
}

/* ===== Experience Timeline ===== */
.experience-timeline {
    position: relative;
    padding-left: 16px;
}

.experience-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    border-radius: 1px;
    background: linear-gradient(180deg, var(--accent), var(--accent-secondary), transparent);
}

.experience-company-group {
    margin-bottom: 16px;
}

.experience-company-header {
    margin-bottom: 12px;
}

.experience-company-header .experience-company {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.experience-company-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.experience-roles {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.experience-timeline .experience-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.experience-timeline .experience-item::before {
    display: none;
}

.experience-timeline .experience-item:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
}

.experience-timeline .career-note {
    border-left: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

/* ===== Experience — Cards ===== */
.experience-item {
    margin-bottom: 12px;
    padding: 20px 22px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.experience-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, transparent 0%, rgba(147, 51, 234, 0) 40%, rgba(147, 51, 234, 0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.experience-item:hover {
    background: var(--card-bg-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(147, 51, 234, 0.06), 0 0 20px var(--glow-color);
    transform: translateY(-1px);
}

.experience-item:hover::before {
    opacity: 1;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 10px;
    flex-wrap: wrap;
}

.experience-title {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
}

.experience-period {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--tag-bg);
    border-radius: 4px;
    border: 1px solid var(--tag-border);
}

.experience-company {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.experience-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.experience-list,
.project-list {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.experience-list li,
.project-list li {
    position: relative;
    padding-left: 14px;
}

.experience-list li::before,
.project-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.project-list li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== Career Note ===== */
.career-note {
    margin-bottom: 12px;
    padding: 14px 18px;
    border-left: 3px solid var(--accent);
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
}

.career-note-period {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.career-note-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== Projects — Cards ===== */
.project-item {
    margin-bottom: 12px;
    padding: 20px 22px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.project-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, transparent 0%, rgba(147, 51, 234, 0) 40%, rgba(147, 51, 234, 0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-item:hover {
    background: var(--card-bg-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(147, 51, 234, 0.06), 0 0 20px var(--glow-color);
    transform: translateY(-1px);
}

.project-item:hover::before {
    opacity: 1;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 10px;
    flex-wrap: wrap;
}

.project-title {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
}

.project-period {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--tag-bg);
    border-radius: 4px;
    border: 1px solid var(--tag-border);
}

.project-role {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-style: italic;
}

.project-desc,
.project-list {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tech-pill {
    display: inline-block;
    font-size: 0.73rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Education ===== */
.education-item {
    margin-bottom: 10px;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.education-item:hover {
    background: var(--card-bg-hover);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 0 20px var(--glow-color);
}

.education-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 10px;
    flex-wrap: wrap;
}

.education-degree {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
}

.education-period {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--tag-bg);
    border-radius: 4px;
    border: 1px solid var(--tag-border);
}

.education-school {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.education-score {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Certificates ===== */
.certificate-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.certificate-link:hover {
    color: var(--accent);
}

.certificate-link svg {
    opacity: 0.4;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.certificate-link:hover svg {
    opacity: 1;
    transform: translate(3px, -3px);
}

/* ===== Footer ===== */
.portfolio-footer {
    margin-top: 40px;
    padding: 16px 0 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ===== Custom Cursor ===== */
.cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(147, 51, 234, 0.4);
    pointer-events: none;
    z-index: 99999;
    will-change: transform;
    mix-blend-mode: screen;
}

.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(147, 51, 234, 0.7);
    pointer-events: none;
    z-index: 100000;
    will-change: transform;
    box-shadow: 0 0 8px rgba(147, 51, 234, 0.4);
}

@media (pointer: coarse) {
    .cursor-follower,
    .cursor-dot {
        display: none;
    }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--glow-color);
    transform: scale(1.1);
}

.theme-toggle:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) translateY(-50%);
}

.tooltip {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateX(-10px) translateY(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--card-border);
}

.tooltip::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right-color: var(--bg-secondary);
    margin-right: -1px;
}

.theme-toggle-icon {
    position: relative;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-sun,
.icon-moon {
    position: absolute;
    color: var(--text-primary);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.icon-moon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

[data-theme="light"] .icon-sun {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

[data-theme="light"] .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== Tablet (1024px) ===== */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
        padding: 40px 30px;
    }

    .left-section, .right-section {
        padding: 0;
        border: none;
    }

    .left-section {
        overflow: visible;
    }

    .right-section {
        margin-top: 48px;
        padding-top: 0;
    }

    h1 {
        font-size: 2.25rem;
    }

    .scrollable {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }
}

/* ===== Mobile (768px) ===== */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    .theme-toggle {
        left: auto !important;
        right: 20px !important;
    }

    .tooltip {
        left: auto !important;
        right: 44px !important;
    }

    .tooltip::before {
        right: auto;
        left: 100%;
        border-right-color: transparent;
        border-left-color: var(--card-border);
    }

    .tooltip::after {
        right: auto;
        left: 100%;
        border-right-color: transparent;
        border-left-color: var(--bg-secondary);
        margin-right: 0;
        margin-left: -1px;
    }

    h1 {
        font-size: 1.875rem;
        white-space: normal;
    }

    .title {
        font-size: 0.9rem;
    }

    .contact-info {
        gap: 12px;
    }

    .social-links {
        gap: 8px;
    }

    .social-links a {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .right-section {
        margin-top: 40px;
    }

    .section-title {
        margin-top: 24px;
    }

    .experience-item,
    .project-item,
    .education-item {
        padding: 16px;
    }
}

/* ===== Small Mobile (480px) ===== */
@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    h1 {
        font-size: 1.5rem;
        white-space: normal;
    }

    .experience-timeline {
        padding-left: 0;
    }

    .experience-timeline::before {
        display: none;
    }

    .title {
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    .profile-text {
        font-size: 0.8rem;
        margin-bottom: 20px;
    }

    .contact-info {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 20px;
    }

    .contact-item + .contact-item::before {
        display: none;
    }

    .social-links {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 24px;
    }

    .social-links a {
        justify-content: center;
    }

    .section-title {
        margin-top: 20px;
    }

    .right-section {
        margin-top: 32px;
    }

    .experience-header,
    .project-header,
    .education-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .experience-period,
    .project-period,
    .education-period {
        white-space: normal;
    }

    .experience-item,
    .project-item,
    .education-item {
        padding: 14px;
        border-radius: 10px;
    }
}

/* ===== Tablet Landscape ===== */
@media (max-height: 900px) and (min-width: 769px) {
    .left-section {
        justify-content: flex-start;
        padding-top: 5vh;
    }
}

/* ===== Landscape Mobile ===== */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    .scrollable {
        max-height: none;
        overflow-y: visible;
    }
}

/* ===== High DPI ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* ===== Print ===== */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    body::before, body::after {
        display: none;
    }

    .container {
        grid-template-columns: 1fr;
        height: auto;
        padding: 20px;
    }

    .left-section, .right-section {
        padding: 0;
        border: none;
    }

    .social-links a {
        border-color: #000;
        color: #000;
    }

    h1 {
        -webkit-text-fill-color: #000;
        background: none;
    }

    .scrollable {
        max-height: none;
        overflow: visible;
    }

    .theme-toggle {
        display: none;
    }

    .experience-item, .project-item, .education-item {
        background: transparent;
        border: 1px solid #ddd;
    }

    .experience-item::before, .project-item::before {
        display: none;
    }

    .experience-timeline {
        padding-left: 0;
    }

    .experience-timeline::before {
        display: none;
    }
}

/* ===== Accessibility ===== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Mobile touch support for AWS tooltip ===== */
@media (hover: none) and (pointer: coarse) {
    .skill-tag-aws .aws-tooltip {
        display: block;
        position: static;
        background: transparent;
        border: none;
        padding: 4px 0 0 0;
        margin-top: 0;
        color: var(--text-muted);
        box-shadow: none;
        white-space: normal;
        font-size: 0.7rem;
    }
}
