/* Components */

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 980px;
    /* Pill shape */
    font-size: var(--font-size-small);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    color: var(--color-white);
    text-decoration: none;
    transform: scale(1.02);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--color-text-main);
    color: var(--color-text-main);
}

.btn-secondary:hover {
    background-color: var(--color-text-main);
    color: var(--color-bg);
    text-decoration: none;
}

.btn-text {
    padding: 0;
    color: var(--color-accent);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-text:hover {
    gap: 8px;
    /* Arrow animation */
}

/* Cards */
.card {
    background-color: var(--color-bg);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    border: 1px solid var(--color-border);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 4px);
    margin-bottom: var(--spacing-sm);
    background-color: var(--color-bg-alt);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-main);
}

.card-subtitle {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-text {
    flex-grow: 1;
    margin-bottom: var(--spacing-sm);
}

/* Sections */
.section {
    padding: var(--spacing-xl) 0;
}

.section-header {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

/* Override: Hero section should be left-aligned */
.hero-section .section-header,
.hero-section .hero-content {
    text-align: left;
}

.section-title {
    font-size: var(--font-size-h2);
    margin-bottom: var(--spacing-xs);
}

.section-subtitle {
    font-size: var(--font-size-h3);
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn:hover {
    color: var(--color-text-main);
}

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 120px;
    z-index: 1001;
    padding: var(--spacing-xs) 0;
}

.lang-dropdown.show {
    display: block;
}

.lang-option {
    display: block;
    padding: 8px 16px;
    color: var(--color-text-main);
    font-size: var(--font-size-small);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.lang-option:hover {
    background-color: var(--color-bg-alt);
    text-decoration: none;
}

/* Mobile: Make language switcher same size as nav links */
@media (max-width: 768px) {
    .lang-btn {
        font-size: 1rem;
        padding: 0.875rem 0;
    }

    #current-lang {
        font-weight: 500;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.metric-card {
    background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeIn 0.6s ease forwards;
    opacity: 0;
}

.metric-card:nth-child(1) {
    animation-delay: 0.1s;
}

.metric-card:nth-child(2) {
    animation-delay: 0.2s;
}

.metric-card:nth-child(3) {
    animation-delay: 0.3s;
}

.metric-card:nth-child(4) {
    animation-delay: 0.4s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.metric-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    display: block;
    color: var(--color-accent);
    animation: pulse 2s ease-in-out infinite;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
    display: block;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Metric Animations */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .btn {
        padding: 10px 20px;
        font-size: 0.875rem;
    }

    .card {
        padding: 1.25rem;
    }

    .card-title {
        font-size: 1.125rem;
    }

    /* CRITICAL: Significantly reduce section padding on iPhone */
    .section {
        padding: 1.5rem 0;
    }

    /* Reduce top padding for header sections specifically */
    header.section {
        padding-top: 1.5rem;
        padding-bottom: 0.75rem;
    }

    /* Reduce main section top padding */
    main.section {
        padding-top: 1.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 2rem 0;
    }

    header.section {
        padding-top: 2rem;
        padding-bottom: 1rem;
    }

    main.section {
        padding-top: 2rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

/* Bento Grid (Apple-style Mosaic) */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 1.5rem;
    margin: 3rem 0;
}

.bento-card {
    background-color: var(--color-bg-alt);
    border-radius: 24px;
    /* Apple-style large radius */
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    /* Added for AI interaction */
}

.bento-card:active {
    transform: scale(0.98);
}

/* Dark mode adjustment for border if needed, assuming vars handle colors */
@media (prefers-color-scheme: dark) {
    .bento-card {
        border: 1px solid rgba(255, 255, 255, 0.1);
        background-color: rgba(255, 255, 255, 0.05);
    }
}

.bento-card:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* Card Sizes */
.bento-card.span-4 {
    grid-column: span 4;
}

/* 3 per row */
.bento-card.span-6 {
    grid-column: span 6;
}

/* 2 per row */
.bento-card.span-8 {
    grid-column: span 8;
}

/* 2/3 width */
.bento-card.span-12 {
    grid-column: span 12;
}

/* Full width */

/* Content Styling */
.bento-content {
    z-index: 1;
}

.bento-icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--color-bg);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.bento-icon {
    width: 32px;
    height: 32px;
    color: var(--color-accent);
}

.bento-value {
    font-size: 3rem;
    /* Big, bold numbers */
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--color-text-main) 0%, var(--color-text-secondary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.bento-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-main);
    margin-bottom: 0.25rem;
}

.bento-sub {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* Responsive */
@media (max-width: 992px) {
    .bento-card.span-4 {
        grid-column: span 6;
    }

    .bento-card.span-8 {
        grid-column: span 12;
    }
}

@media (max-width: 576px) {
    .bento-grid {
        gap: 0.875rem;
    }

    .bento-card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .bento-icon-wrapper {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .bento-icon {
        width: 24px;
        height: 24px;
    }

    .bento-value {
        font-size: 2rem;
    }

    .bento-label {
        font-size: 0.9375rem;
    }

    .bento-sub {
        font-size: 0.8125rem;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .bento-card {
        min-height: 180px;
    }
}

/* Compact Bento Grid for Homepage (One Screen High) */
.bento-grid-compact {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    /* Removed fixed rows to allow auto-flow with headers */
    gap: 1rem;
    margin: 2rem 0;
    /* height: 85vh; Removed fixed height to accommodate content naturally */
    /* max-height: 900px; */
    /* min-height: 600px; */
}

.bento-group-header {
    grid-column: span 12;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Remove top margin for the first header */
.bento-group-header:first-child {
    margin-top: 0;
}

/* New class for section headers with links */
.bento-section-header {
    grid-column: span 12;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.bento-grid-compact .bento-card {
    padding: 1.5rem;
    border-radius: 20px;
    background: var(--color-bg-alt);
    border: 1px solid rgba(0, 0, 0, 0.03);
    /* Ensure cards stretch to fill their grid area */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bento-grid-compact .bento-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.bento-grid-compact .bento-icon {
    width: 24px;
    height: 24px;
}

.bento-grid-compact .bento-value {
    font-size: 3rem;
    /* Slightly reduced from 3.5rem to fit better */
    margin-bottom: 0.25rem;
    line-height: 1;
}

.bento-grid-compact .bento-value.text-value {
    font-size: 1.75rem;
    word-break: break-word;
    line-height: 1.1;
}

.bento-grid-compact .bento-label {
    font-size: 1rem;
    margin-bottom: 0;
    opacity: 0.9;
    line-height: 1.2;
}

.bento-grid-compact .bento-sub {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* Responsive for Compact Grid */

/* iPhone-specific optimizations */
@media (max-width: 576px) {

    /* CRITICAL: Make bento grid 2 columns with 1:1 square aspect ratio */
    .bento-grid-compact {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin: 1.5rem 0;
    }

    .bento-grid-compact .bento-card {
        padding: 0.75rem;
        border-radius: 12px;
        aspect-ratio: 1 / 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Allow span-8 cards to be full width horizontal rectangles */
    .bento-grid-compact .bento-card.span-8 {
        grid-column: span 2;
        aspect-ratio: 2 / 1;
    }

    /* Force span-4 and span-6 to be half width (1 column) on mobile */
    .bento-grid-compact .bento-card.span-4,
    .bento-grid-compact .bento-card.span-6 {
        grid-column: span 1;
        aspect-ratio: 1 / 1;
    }

    .bento-grid-compact .bento-icon-wrapper {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        margin-bottom: 0.25rem;
    }

    .bento-grid-compact .bento-icon {
        width: 16px;
        height: 16px;
    }

    /* Reorder content: Label -> Value -> Sub */
    .bento-grid-compact .bento-content {
        display: flex;
        flex-direction: column;
    }

    .bento-grid-compact .bento-label {
        order: -1;
        font-size: 0.875rem;
        opacity: 0.8;
        margin-bottom: 0.25rem;
        font-weight: 500;
    }

    .bento-grid-compact .bento-value {
        font-size: 1.75rem;
        line-height: 1.1;
        font-weight: 700;
        margin-bottom: 0.25rem;
    }

    .bento-grid-compact .bento-sub {
        font-size: 0.75rem;
        opacity: 0.6;
        margin-top: 0;
    }



    .bento-group-header {
        grid-column: span 2;
        font-size: 0.75rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    .bento-section-header {
        grid-column: span 2;
    }
}

@media (max-width: 992px) {
    .bento-grid-compact {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .bento-group-header {
        margin-top: 1.5rem;
        padding-left: 0.5rem;
    }

    .bento-grid-compact .bento-value {
        font-size: 2.5rem;
    }
}

/* Experience Page Styles */
.experience-section {
    margin-bottom: 3rem;
}

.section-divider {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text-main);
}

.timeline {
    position: relative;
    padding-left: 0;
    /* Removed left padding */
}

.timeline::before {
    display: none;
    /* Hide the vertical line */
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    display: none;
    /* Hide all dots */
}

.timeline-dot.active {
    display: none;
    /* Hide active dots */
}

.timeline-dot.edu {
    display: none;
    /* Hide education dots */
}

.timeline-dot.edu.active {
    display: none;
    /* Hide active education dots */
}

.timeline-header {
    width: 100%;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
}

.timeline-header:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.timeline-header-content {
    flex: 1;
}

.timeline-period {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.timeline-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--color-text-main);
}

.timeline-company {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0;
    color: var(--color-text-secondary);
}

.timeline-company.edu {
    font-style: italic;
    font-weight: 400;
}

.expand-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    transition: transform var(--transition-fast);
}

.timeline-header[aria-expanded="true"] .expand-icon {
    transform: rotate(45deg);
}

.timeline-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
    padding: 0 1.5rem;
}

.timeline-content.expanded {
    max-height: 2000px;
    padding: 1.25rem 1.5rem;
    margin-top: 0.75rem;
}

.timeline-content ul {
    padding-left: 1.2rem;
    list-style-type: disc;
}

.timeline-content li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    color: var(--color-text-main);
}

.timeline-content p {
    margin: 0;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* Responsive adjustments for Experience page */

/* iPhone-specific timeline optimizations */
@media (max-width: 576px) {
    .experience-section {
        margin-bottom: 2rem;
    }

    .section-divider {
        font-size: 1.125rem;
        margin-bottom: 1.5rem;
    }

    .timeline {
        padding-left: 0;
        /* No padding needed */
    }

    .timeline-item {
        margin-bottom: 1.25rem;
    }

    .timeline-header {
        padding: 0.875rem 1rem;
        border-radius: 10px;
    }

    .timeline-period {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .timeline-title {
        font-size: 0.9375rem;
        margin-bottom: 0.375rem;
    }

    .timeline-company {
        font-size: 0.8125rem;
    }

    .timeline-content.expanded {
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .timeline-content li {
        margin-bottom: 0.625rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 768px) {
    .timeline {
        padding-left: 0;
        /* No padding needed */
    }

    .timeline-header {
        padding: 1rem;
    }

    .timeline-title {
        font-size: 1rem;
    }

    .timeline-company {
        font-size: 0.875rem;
    }
}