/* ============================================
   Personal Website Styles - kangjunhao.com
   Design System: Pantone PMS 319, 320, 326
   ============================================ */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    /* Pantone Colors */
    --color-pms-319: #00B2A9;
    --color-pms-320: #009CA6;
    
    /* Neutrals */
    --color-black: #000000;
    --color-charcoal: #2D2D2D;
    --color-grey: #6B6B6B;
    --color-light-grey: #E5E5E5;
    --color-white: #FAFAFA;
    
    /* Spacing Scale (8px grid system) */
    --space-xs: 0.5rem;      /* 8px */
    --space-sm: 1rem;        /* 16px */
    --space-md: 1.5rem;      /* 24px */
    --space-lg: 2rem;        /* 32px */
    --space-xl: 3rem;        /* 48px */
    --space-2xl: 4rem;       /* 64px */
    --space-3xl: 6rem;       /* 96px */
    
    /* Typography */
    --font-primary: 'JetBrains Mono', 'Courier New', monospace;
    --font-size-base: 1.125rem;  /* 18px */
    --line-height-base: 1.6;
    
    /* Transitions */
    --transition-base: 0.3s ease;
    
    /* Shadows */
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-accent: 0 4px 12px rgba(0, 178, 169, 0.3);
}

/* ============================================
   Dark Mode — via OS preference
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-black: #EBEBEB;
        --color-charcoal: #D4D4D4;
        --color-grey: #9A9A9A;
        --color-light-grey: #2A2A2A;
        --color-white: #111111;

        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
        --shadow-accent: 0 4px 12px rgba(0, 178, 169, 0.4);
    }
}

/* Dark Mode — via explicit toggle */
:root[data-theme="dark"] {
    --color-black: #EBEBEB;
    --color-charcoal: #D4D4D4;
    --color-grey: #9A9A9A;
    --color-light-grey: #2A2A2A;
    --color-white: #111111;

    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 12px rgba(0, 178, 169, 0.4);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-grey);
    background-color: var(--color-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: 2.5rem;      /* 40px */
    color: var(--color-charcoal);
}

p {
    margin-bottom: var(--space-md);
}

p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--color-pms-319);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-pms-320);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-pms-319);
    outline-offset: 2px;
}

/* ============================================
   Layout
   ============================================ */
.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    width: 100%;
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    min-height: 92vh;  /* Changed to min-height for better mobile flexibility */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg) 0;  /* Reduced padding from 3xl to lg */
}

.hero-section .content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);  /* Reduced from 3xl (96px) to xl (48px) - half the gap */
    align-items: center;
}

.hero-content {
    max-width: 600px;
}

.hero-description {
    margin-bottom: var(--space-2xl);
}

.hero-description p {
    font-size: 1.25rem;     /* 20px - increased from base size */
    color: var(--color-grey);
    line-height: 1.7;
}

/* ============================================
   Profile Image
   ============================================ */
.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;  /* Increased from 400px to 500px to show more of the image */
    /* Removed aspect-ratio to preserve original photo proportions */
}

.profile-photo {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.profile-photo:hover {
    transform: translateY(-4px);
    box-shadow:
        0 8px 30px rgba(0, 178, 169, 0.35),
        0 0 40px rgba(0, 178, 169, 0.15);
}

/* ============================================
   Contact Section
   ============================================ */
.contact-section {
    margin-top: var(--space-2xl);
}

/* ============================================
   Keyword Section
   ============================================ */
.keyword-section {
    min-height: 33vh;  /* Reduced to keep the next section visible but less obvious */
    display: flex;
    align-items: flex-start;  /* Changed from center to flex-start to position at top */
    justify-content: center;  /* Center horizontally */
    padding: var(--space-lg) 0 var(--space-lg) 0;  /* Reduced top padding to show roughly two-thirds of the heading */
}

.keyword-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    text-align: center;  /* Center the text */
}

.keyword {
    font-size: 12rem;       /* 192px - very large */
    font-weight: 900;       /* Maximum font-weight for boldest appearance */
    color: var(--color-black);
    line-height: 0.9;
    margin: -50px 0 0 0;    /* Move word up by 50px to create more peek effect */
    letter-spacing: -0.01em; /* Slightly increased letter-spacing for better readability at max weight */
    -webkit-text-stroke: 0.5px var(--color-black); /* Add text stroke for extra boldness */
    text-stroke: 0.5px var(--color-black);
}

.section-heading {
    font-size: 0.875rem;    /* 14px - smaller */
    font-weight: 700;
    color: var(--color-black);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-md);
}

.contact-item {
    display: flex;
    align-items: baseline;
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;    /* 14px - smaller */
}

.contact-label {
    font-weight: 400;
    color: var(--color-grey);
    min-width: 80px;
    margin-right: var(--space-md);
}

.contact-link {
    font-weight: 400;
    word-break: break-all;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --font-size-base: 1.0625rem;  /* 17px */
    }
    
    .hero-description p {
        font-size: 1.125rem;    /* 18px for tablet */
    }
    
    h2 {
        font-size: 2rem;        /* 32px */
    }
    
    .hero-section .content-wrapper {
        gap: var(--space-2xl);
    }
    
    .image-wrapper {
        max-width: 350px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    :root {
        --font-size-base: 1rem;  /* 16px */
    }
    
    .hero-description p {
        font-size: 1rem;        /* 16px for mobile */
    }
    
    h2 {
        font-size: 1.75rem;     /* 28px */
    }
    
    .hero-section {
        min-height: 85vh;       /* Reduced height for mobile */
        height: auto;           /* Allow content to determine height */
        padding: var(--space-xl) var(--space-md);  /* Reduced top padding from 2xl to xl */
    }
    
    .hero-section .content-wrapper {
        display: flex;
        flex-direction: column;
        gap: var(--space-xl);
    }
    
    /* Mobile order: description → contact → profile photo → catalyst */
    .hero-description {
        order: 1;
    }
    
    .contact-section {
        order: 2;
    }
    
    .hero-image {
        order: 3;
    }
    
    .keyword-section {
        order: 4;
    }
    
    .image-wrapper {
        max-width: 300px;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;     /* 20px */
    }
    
    .contact-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .contact-label {
        margin-bottom: var(--space-xs);
    }
    
    .keyword-section {
        min-height: auto;       /* Remove fixed height, let content determine size */
        padding: var(--space-xl) 0 var(--space-2xl) 0;  /* Add appropriate padding instead */
    }
    
    .keyword {
        font-size: 6rem;        /* 96px on mobile */
        margin: -20px 0 0 0;    /* Reduced negative margin for mobile */
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .hero-section {
        min-height: auto;       /* Allow content to fully determine height */
        padding: var(--space-lg) var(--space-sm);  /* Further reduced top padding */
    }
    
    .hero-section .content-wrapper {
        display: flex;
        flex-direction: column;
    }
    
    .content-wrapper {
        padding: 0 var(--space-sm);
    }
    
    /* Maintain mobile order: description → contact → profile photo → catalyst */
    .hero-description {
        order: 1;
    }
    
    .contact-section {
        order: 2;
    }
    
    .hero-image {
        order: 3;
    }
    
    .keyword-section {
        order: 4;
    }
    
    .image-wrapper {
        max-width: 250px;
    }
    
    .keyword {
        font-size: 4rem;        /* 64px on small mobile */
        margin: 0;              /* Remove negative margin on smallest screens */
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-pms-319);
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-grey: #4A4A4A;
    }
    
    .profile-photo {
        border: 2px solid var(--color-black);
    }
}

/* ============================================
   Resume Overlay
   ============================================ */
.resume-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.resume-overlay.active {
    opacity: 1;
    visibility: visible;
}

.resume-modal {
    position: relative;
    width: 90vw;
    max-width: 800px;
    height: 88vh;
    background: var(--color-white);
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.resume-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-light-grey);
    flex-shrink: 0;
}

.resume-modal-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-black);
}

.resume-modal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.resume-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-grey);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 0.25rem;
    transition: color var(--transition-base), background var(--transition-base);
}

.resume-btn:hover {
    color: var(--color-black);
    background: var(--color-light-grey);
}

.resume-btn i {
    font-size: 1rem;
}

.resume-modal-body {
    flex: 1;
    overflow: hidden;
}

.resume-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 100;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    border: 1px solid var(--color-grey);
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-black);
    font-size: 1rem;
    transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
    opacity: 0.75;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.theme-toggle:hover {
    opacity: 1;
    border-color: var(--color-black);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.theme-toggle i {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   Dark Mode — element-specific overrides
   ============================================ */

/* Keyword text stroke needs inverting */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .keyword {
        -webkit-text-stroke-color: var(--color-black);
        text-stroke: 0.5px var(--color-black);
    }
    :root:not([data-theme="light"]) .profile-photo:hover {
        box-shadow:
            0 8px 30px rgba(0, 178, 169, 0.4),
            0 0 40px rgba(0, 178, 169, 0.2);
    }
    :root:not([data-theme="light"]) .resume-modal {
        background: #1a1a1a;
    }
    :root:not([data-theme="light"]) .resume-modal-header {
        border-bottom-color: #333;
    }
}

:root[data-theme="dark"] .keyword {
    -webkit-text-stroke-color: var(--color-black);
    text-stroke: 0.5px var(--color-black);
}
:root[data-theme="dark"] .profile-photo:hover {
    box-shadow:
        0 8px 30px rgba(0, 178, 169, 0.4),
        0 0 40px rgba(0, 178, 169, 0.2);
}
:root[data-theme="dark"] .resume-modal {
    background: #1a1a1a;
}
:root[data-theme="dark"] .resume-modal-header {
    border-bottom-color: #333;
}

/* Globe wrapper background in dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .globe-wrapper {
        background: #1a1a1a;
        border-color: #333;
    }
}
:root[data-theme="dark"] .globe-wrapper {
    background: #1a1a1a;
    border-color: #333;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body {
        background-color: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .profile-photo {
        box-shadow: none;
    }
}

/* ============================================
   Site Nav
   ============================================ */
.site-nav {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-xl);
    z-index: 100;
}

.nav-link {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-black);
    text-decoration: none;
    border-bottom: 1px solid var(--color-black);
    padding-bottom: 1px;
    transition: color var(--transition-base), border-color var(--transition-base);
}

.nav-link:hover {
    color: var(--color-pms-319);
    border-color: var(--color-pms-319);
    text-decoration: none;
}

/* ============================================
   Contact Icons
   ============================================ */
.contact-section {
    margin-top: var(--space-2xl);
}

.contact-icons {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.icon-link {
    color: var(--color-black);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    transition: color var(--transition-base);
}

.icon-link i {
    font-size: 1.5rem;   /* 24px */
    line-height: 1;
}

.icon-link:hover {
    color: var(--color-pms-319);
    text-decoration: none;
}

.resume-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}

/* ============================================
   About Page Layout — two-column, mirrors home
   ============================================ */
.about-section-main {
    min-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg) 0;
}

.about-section-main .content-wrapper {
    display: block;   /* content-wrapper handles max-width/centering */
}

/* .about-two-col is now just a single-col wrapper; layout handled by children */
.about-two-col {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Full-width top: tagline + what drives me */
.about-top {
    margin-bottom: var(--space-2xl);
}

/* Bottom row: outside of work | globe */
.about-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: start;
}

/* LEFT column */
.about-left {
    min-width: 0;
}

/* RIGHT column */

.about-tagline {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1.2;
    margin-bottom: var(--space-2xl);
    letter-spacing: -0.01em;
}

.about-block {
    margin-bottom: var(--space-2xl);
}

.about-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-black);
    margin-bottom: var(--space-md);
    display: block;
}

.about-block p {
    font-size: 1.125rem;
    color: var(--color-grey);
    line-height: 1.7;
}

.about-list {
    list-style: none;
    padding: 0;
}

.about-list li {
    font-size: 1rem;
    color: var(--color-grey);
    line-height: 1.6;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--color-light-grey);
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
}

.about-list li:last-child {
    border-bottom: none;
}

.about-list-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-black);
    min-width: 80px;
    flex-shrink: 0;
}

/* RIGHT column — globe */
.about-right {
    display: flex;
    flex-direction: column;
    min-width: 0;   /* prevent grid blowout from canvas child */
}

.globe-wrapper {
    position: relative;
    width: 100%;
    border: 1px solid var(--color-light-grey);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f5f5f5;
}

#globe-container {
    width: 100%;
    height: 380px;
    cursor: default;
    /* prevent the canvas from dictating column width */
    max-width: 100%;
}

/* City label overlay — bottom-left */
.globe-overlay {
    position: absolute;
    bottom: var(--space-md);
    left: var(--space-md);
    pointer-events: none;
}

.globe-city {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-black);
    letter-spacing: 0.02em;
    opacity: 0;
}

.globe-period {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-grey);
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
    opacity: 0;
}

.globe-city.fade-in,
.globe-period.fade-in {
    animation: globeFadeIn 0.5s ease forwards;
}

@keyframes globeFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.globe-current {
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--color-grey);
}

/* ============================================
   About Page — Responsive
   ============================================ */
@media (max-width: 1024px) {
    #globe-container {
        height: 360px;
    }
}

@media (max-width: 768px) {
    .site-nav {
        top: var(--space-md);
        right: var(--space-md);
    }

    .about-bottom-row {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .about-tagline {
        font-size: 1.4rem;
    }

    #globe-container {
        height: 300px;
    }

    .about-list li {
        flex-direction: column;
        gap: 0.2rem;
    }

    .about-list-label {
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .about-tagline {
        font-size: 1.25rem;
    }

    #globe-container {
        height: 240px;
    }

    .contact-icons {
        gap: var(--space-md);
    }
}
