/* Main Layout */
.work-section {
    max-width: clamp(320px, 90vw, 1400px);
    margin: 20px auto;
    padding: 0 20px;
}

.section-header {
    margin-bottom: 8px;
}

.section-header h1 {
    font-size: 2.5em;
    margin-bottom: 4px;
    color: #333;
}

.section-header p {
    font-size: 1.2em;
    color: #666;
    line-height: 1.5;
}

/* Toggle Pills */
.view-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    width: 100%;
}

.toggle-pill {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid #333;
    background: transparent;
    color: #333;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.toggle-pill svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.toggle-pill:first-child {
    border-radius: 25px 0 0 25px;
    border-right: 1px solid #333;
}

.toggle-pill:last-child {
    border-radius: 0 25px 25px 0;
    border-left: 1px solid #333;
}

.toggle-pill:hover {
    background: #f0f0f0;
}

.toggle-pill:focus-visible {
    outline: 2px solid #333;
    outline-offset: 2px;
}

.toggle-pill.active:focus-visible {
    outline-color: #666;
}

.toggle-pill.active {
    background: #333;
    color: #fff;
}

/* Work Grid - Aligned with header section padding */
.work-grid {
    max-width: clamp(320px, 90vw, 1400px);
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
    transition: opacity 0.2s ease;
}

/* 3-column on wide screens */
@media (min-width: 900px) {
    .work-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile - single column */
@media (max-width: 600px) {
    .work-grid,
    .work-grid[data-view="personal"] {
        grid-template-columns: 1fr;
    }
}

/* Projects view: same 3-column layout as professional */
@media (min-width: 900px) {
    .work-grid[data-view="personal"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

.work-grid.hidden {
    display: none;
}

/* Company Tile */
.company-tile {
    position: relative;
    cursor: pointer;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    width: 100%;
}

.company-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

/* Logo Section */
.logo-section {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    position: relative;
    overflow: hidden;
}

.logo-section img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

/* Couchbase logo is wide - scale down */
#couchbase .logo-section img {
    max-width: 70%;
}

.company-tile:hover .logo-section img {
    transform: scale(1.05);
}

/* Content Section */
.content-section {
    padding: 16px;
}

.role-header {
    margin-bottom: 8px;
}

.role-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.3;
}

.tile-description {
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
    margin: 8px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: default;
}

/* Tags on tiles */
.tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tile-tag {
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 0.75em;
    color: #555;
    font-weight: 500;
}

/* Tooltip */
.company-tooltip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 10px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    font-size: 0.85em;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
}

.company-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.8);
}

.company-tile:hover .company-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    margin: 30px auto;
    padding: 24px;
    max-width: 900px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal .close {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    background: none;
    border: none;
    padding: 0;
}

.modal .close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    margin-top: 12px;
}

/* Achievement Cards */
.achievement-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.achievement-header h3 {
    font-size: 1.3em;
    color: #333;
    margin: 0 0 4px 0;
}

.achievement-card .description {
    font-size: 1em;
    line-height: 1.5;
    color: #444;
    margin-bottom: 12px;
}

.impact-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.impact-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #555;
}

.impact-list li:before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #666;
}

.impact-list li:last-child {
    margin-bottom: 0;
}

/* Achievement Body - 70/30 layout when video present */
.achievement-body {
    display: block;
}

.achievement-body.has-video {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 20px;
    align-items: start;
}

.achievement-content {
    min-width: 0;
}

/* Video Container - responsive 16:9 */
.achievement-video {
    min-width: 0;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Achievement Links - positioned under title */
.achievement-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.achievement-links a {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.achievement-links a:hover {
    background-color: #f0f7ff;
}

.link-separator {
    color: #ccc;
    font-size: 0.9em;
}

/* Responsive: stack video below on smaller screens */
@media (max-width: 768px) {
    .achievement-body.has-video {
        grid-template-columns: 1fr;
    }

    .achievement-video {
        margin-top: 16px;
    }
}

/* Product Layout Styles */
.product-hero {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.product-hero h3 {
    font-size: 1.3em;
    color: #333;
    margin: 0 0 4px 0;
}

.product-hero .description {
    font-size: 1em;
    line-height: 1.5;
    color: #444;
    margin-bottom: 4px;
}

/* Split layout: content left, demo right */
.product-split {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 16px;
}

.product-split h3 {
    font-size: 1.15em;
    color: #333;
    margin: 0 0 10px 0;
}

.product-split-item {
    margin-bottom: 10px;
    font-size: 0.9em;
    line-height: 1.45;
    color: #444;
}

.product-split-item:last-child {
    margin-bottom: 0;
}

.product-split-item strong {
    color: #333;
    display: block;
    margin-bottom: 2px;
}

.product-demo-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #1e1e1e;
}

.product-demo-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1200px;
    height: 900px;
    transform: scale(0.3);
    transform-origin: top left;
    border: 0;
}

.product-demo-link {
    display: none;
    color: #0066cc;
    font-size: 0.95em;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 0;
}

.product-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.product-grid-item {
    padding: 16px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
}

.product-grid-item h4 {
    font-size: 1.1em;
    color: #333;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.product-grid-item .description {
    margin-bottom: 0;
}

.product-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-chips .tile-tag {
    font-size: 0.85em;
    padding: 6px 14px;
}

.product-chips-caption {
    margin: 8px 0 0 0;
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .product-split {
        grid-template-columns: 1fr;
    }

    .product-demo-container {
        display: none;
    }

    .product-demo-link {
        display: inline-block;
    }

    .product-grid-2col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-hero h3 {
        font-size: 1.2em;
    }

    .product-grid-item {
        padding: 12px;
    }

    .product-chips .tile-tag {
        font-size: 0.8em;
        padding: 5px 12px;
    }
}

/* Error Message Styles */
.error-message {
    width: 100%;
    margin: 20px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    line-height: 1.4;
    box-sizing: border-box;
    animation: slideIn 0.3s ease-out;
}

.error-message.error {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.error-message.warning {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #d97706;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 1.1em;
}

.error-text {
    flex: 1;
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional Responsive Styles */
@media (max-width: 1024px) {
    .modal-content {
        margin: 24px auto;
        padding: 20px;
    }

    .achievement-card {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .modal {
        padding: 12px;
    }

    .modal-content {
        margin: 16px auto;
        padding: 16px;
    }

    .modal .close {
        right: 16px;
        top: 16px;
    }

    .achievement-header {
        flex-direction: column;
    }

    .achievement-header h3 {
        font-size: 1.2em;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 8px;
        padding: 12px;
    }

    .achievement-card {
        padding: 12px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .company-tile:hover {
        transform: none;
    }

    .company-tooltip {
        display: none;
    }
}

/* Print Styles */
@media print {
    .modal {
        position: relative;
        display: block;
        padding: 0;
        background: none;
    }

    .modal-content {
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .close {
        display: none;
    }

    .work-grid {
        grid-template-columns: 1fr; /* Force single column */
        max-width: 100%;
        gap: 20px;
        padding: 0 16px;
    }

    .company-tile {
        page-break-inside: avoid;
        break-inside: avoid;
        width: 100%;
        margin: 0 auto 20px;
    }

    .achievement-card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .company-tile {
        border: 1px solid CanvasText;
    }

    .achievement-card {
        border: 1px solid CanvasText;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
}
