/*
Copyright (c) 2026 Vincent Hiribarren

Permission is granted to redistribute this file in its original,
unmodified form, provided that this copyright notice is preserved.

All other rights are reserved.
*/

:root {
    --bg-color: #f7f5f0;
    --bg-gradient: linear-gradient(135deg, #fdfbf7 0%, #edeae3 100%);
    --paper-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-color: #2563eb;
    --accent-light: #eff6ff;
    --border-color: #cbd5e1;

    --page-width: 210mm;
    --page-height: 297mm;
    --page-padding: 12mm;
    --font-size-base: 9.6pt;

    --overlay-max-width: 900px;
    --spacing-xl: 3rem;
    --spacing-lg: 1.5rem;
    --spacing-md: 0.75rem;
    --spacing-sm: 0.5rem;
    --spacing-xs: 0.25rem;
    --blur-standard: 8px;
    --accent-hover: #1d4ed8;
    --header-bg-opacity: 0.85;
    --overlay-bg-opacity: 0.40;

    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --line-height-base: 1.6;
    --line-height-tight: 1.4;
    --zoom-factor: 1.1;

    --pill-bg: #f1f5f9;
    --pill-text: #64748b;
    --pill-border: #e2e8f0;

    --header-bg-rgb: 253, 251, 247;
    --header-border-color: rgba(0, 0, 0, 0.05);

    --nav-arrow-icon: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --nav-burger-icon: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='3' y1='12' x2='21' y2='12'%3E%3C/line%3E%3Cline x1='3' y1='6' x2='21' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='18' x2='21' y2='18'%3E%3C/line%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --bg-gradient: linear-gradient(135deg, #020617 0%, #0f172a 100%);
        --paper-color: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --accent-color: #3b82f6;
        --accent-light: rgba(59, 130, 246, 0.15);
        --border-color: #334155;
        --accent-hover: #60a5fa;

        --pill-bg: #334155;
        --pill-text: #94a3b8;
        --pill-border: #475569;

        --header-bg-rgb: 15, 23, 42;
        --header-border-color: rgba(255, 255, 255, 0.05);

        --nav-arrow-icon: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        --nav-burger-icon: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='3' y1='12' x2='21' y2='12'%3E%3C/line%3E%3Cline x1='3' y1='6' x2='21' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='18' x2='21' y2='18'%3E%3C/line%3E%3C/svg%3E");
    }
}

.u-hidden {
    display: none !important;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    background: var(--bg-gradient);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: var(--line-height-base);
    padding: 0 0 2rem 0;
    min-height: 100vh;
    font-size: var(--font-size-base);
}

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

ul {
    margin-top: var(--spacing-sm);
    padding-left: 1.25rem;
    list-style-type: disc;
    padding-bottom: 4px;
}

header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    transform: translateY(var(--header-offset, 0));
    will-change: opacity;
    transition: opacity 0.4s ease-in-out;
    background-color: rgba(var(--header-bg-rgb), var(--header-bg-opacity));
    backdrop-filter: blur(var(--blur-standard));
    -webkit-backdrop-filter: blur(var(--blur-standard));
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--header-border-color);
}

.header__actions {
    display: flex;
    gap: 1rem;
}

.header__title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.action-btn:hover {
    background-color: var(--accent-hover);
    /* Blue 700 */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.nav-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--paper-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 2.2rem 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    background-image: var(--nav-arrow-icon);
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1.2em;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: 130px;
}

.nav-select:hover,
.nav-select:focus {
    background-color: var(--accent-light);
    border-color: var(--accent-color);
    outline: none;
}

.nav-select option {
    background-color: var(--paper-color);
    color: var(--text-primary);
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    counter-reset: page;
    padding-top: 20px;
}

article {
    width: var(--page-width);
    height: var(--page-height);
    background-color: var(--paper-color);
    padding: var(--page-padding);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 0, 0, 0.05);
    position: relative;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    counter-increment: page;
}

section {
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
    position: relative;
    scroll-margin-top: 6rem;
}

.section--interactive {
    cursor: zoom-in;
}

.section--interactive::after {
    content: "🔍";
    position: absolute;
    top: 0.15rem;
    right: 1rem;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.section--interactive:hover::after {
    opacity: 1;
    transform: scale(1.1);
}

.section--interactive:hover {
    background-color: var(--accent-light);
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

cv-footer {
    display: contents;
}

.page-footer {
    position: absolute;
    bottom: var(--page-padding);
    left: var(--page-padding);
    right: var(--page-padding);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    line-height: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    background-color: var(--paper-color);
    z-index: 20;
}

.page-footer__number::after {
    content: "Page " counter(page) " / 4";
}

.page-footer__contact {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.page-footer__contact a {
    color: var(--text-secondary) !important;
    text-decoration: none;
}

.page-footer__contact a:hover {
    color: var(--accent-color) !important;
    text-decoration: underline;
}

h1,
h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--accent-light);
    padding: 0.15rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    border-left: 4px solid var(--accent-color);
    margin: 0rem 0 1rem 0;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

dl {
    line-height: var(--line-height-tight);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

dt {
    font-weight: 400;
    font-style: italic;
    color: var(--text-secondary);
    text-align: left;
}

dd {
    margin: 0;
    color: var(--text-secondary);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

a:visited {
    color: var(--accent-color);
}

p,
ul {
    color: var(--text-secondary);
}

.intro__info {
    text-align: left;
}

.intro__bio {
    text-align: justify;
    text-indent: 1rem;
}

.columns {
    display: flex;
    gap: 1rem;
}

.columns__item {
    flex: 1;
}

.skills {
    column-count: 2;
    column-gap: var(--spacing-md);
}

.skill-item {
    flex: none;
    break-inside: avoid;
    margin-bottom: var(--spacing-xs);
    position: relative;
    transition: all 0.3s ease;
}

.skill-item.section--interactive:hover {
    padding: var(--spacing-md) var(--spacing-base, 1rem);
    margin-top: calc(-1 * var(--spacing-md));
    margin-left: 0;
    margin-right: 0;
    z-index: 10;
}

.skill-item.section--interactive:hover::after {
    top: 0.65rem;
}

.skill-item.section--interactive::after {
    opacity: 1;
    top: -0.1rem;
}

.skill-item h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

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

.timeline__header,
.timeline__sub-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.timeline__header {
    margin-bottom: var(--spacing-xs);
}

.timeline__header h3 {
    margin-bottom: 0;
}

header.is-scrolling {
    opacity: 0 !important;
    transition: opacity 0.05s ease-out;
}

header>* {
    margin-bottom: 0;
}

.timeline .date {
    display: block;
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 600;
}

.timeline__header .date {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
}

.timeline__sub-header h4 {
    margin-bottom: 0;
}

.timeline__sub-item {
    margin-bottom: 0.7rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

.tech-pills {
    display: flex;
    flex-wrap: wrap;
    /* Allows pills to naturally wrap to the next line */
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.tech-pills__item {
    background-color: var(--pill-bg);
    /* Slate 100 */
    color: var(--pill-text);
    /* Slate 500 */
    border: 1px solid var(--pill-border);
    /* Slate 200 */
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 500;
}

/* Classes applied to body when a section is zoomed to prevent scrolling */
body.is-overlay-active {
    overflow: hidden;
}

.detail-overlay {
    font-size: 12pt;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, var(--overlay-bg-opacity));
    backdrop-filter: blur(var(--blur-standard));
    -webkit-backdrop-filter: blur(var(--blur-standard));
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.detail-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.detail-drawer {
    position: fixed;
    z-index: 101;
    background-color: var(--paper-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1), visibility 0s 0.4s;
    visibility: hidden;
    display: flex;
    flex-direction: column;
}

.detail-drawer.is-open {
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1), visibility 0s 0s;
}

.detail-drawer__content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
}

.detail-drawer__content section {
    padding: 0;
    border: none;
    background: transparent;
    transform: none;
    box-shadow: none;
    cursor: default;
}

.detail-drawer__content .section--interactive:hover {
    background-color: transparent;
    border-color: transparent;
    transform: none;
    box-shadow: none;
}

.detail-drawer__content .section--interactive::after {
    display: none;
}

.detail-drawer__content h2 {
    font-size: 1.75rem;
}

.detail-drawer__content .columns {
    gap: 4rem;
}

.close-btn {
    position: absolute;
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
    z-index: 102;
}

.close-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

.close-btn svg {
    width: 24px;
    height: 24px;
}

@media screen and (min-width: 901px) {

    .detail-drawer {
        top: 0;
        right: 0;
        width: 450px;
        max-width: 90vw;
        height: 100vh;
        transform: translateX(100%);
    }

    .detail-drawer.is-open {
        transform: translateX(0);
    }

    .detail-drawer .close-btn {
        top: 1rem;
        left: -3.5rem;
    }

    main {
        zoom: var(--zoom-factor);
    }

}

@media screen and (max-width: 900px) {

    .detail-drawer {
        bottom: 0;
        left: 0;
        width: 100vw;
        max-height: 85vh;
        min-height: 40vh;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        transform: translateY(100%);
        padding-top: 3rem;
    }

    .detail-drawer.is-open {
        transform: translateY(0);
    }

    .detail-drawer .close-btn {
        top: 0.5rem;
        right: 0.5rem;
    }

    body {
        font-size: 12pt;
    }

    main {
        padding: 20px 1rem 0 1rem;
        gap: 1rem;
    }

    header {
        padding: 0.8rem 0.5rem;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        height: auto;
        gap: 0.5rem;
    }

    .header__title {
        font-size: 0.95rem;
        /* Slight reduction for fitting */
        line-height: 1.2;
        flex-grow: 1;
        text-align: left;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-left: 0.2rem;
    }

    .header__actions {
        display: flex;
        flex-direction: row;
        width: auto;
        margin: 0;
    }

    .nav-select {
        color: transparent;
        background-color: transparent;
        border-color: transparent;
        box-shadow: none;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 8px;
        background-image: var(--nav-burger-icon);
        background-position: center;
        background-size: 24px;
    }

    .nav-select:hover,
    .nav-select:focus {
        background-color: rgba(0, 0, 0, 0.05);
        border-color: transparent;
    }

    .action-btn {
        padding: 0.6rem;
        width: 40px;
        height: 40px;
        justify-content: center;
        border-radius: 8px;
        /* matching the hamburger */
    }

    .action-btn__text {
        display: none;
    }

    .action-btn svg {
        width: 20px;
        height: 20px;
    }

    article {
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 0;
        background-color: transparent;
        box-shadow: none;
        gap: var(--spacing-md);
        position: relative;
    }

    dl {
        display: block;
        margin-bottom: 0;

    }

    dd {
        margin-bottom: var(--spacing-md);
    }

    .columns {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .columns__item {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .timeline__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline__sub-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .timeline__sub-header .date {
        order: -1;
    }

    section {
        background-color: transparent;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        margin: 0;
        scroll-margin-top: 5rem;
    }

    .content-card {
        background-color: var(--paper-color);
        box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
        padding: var(--spacing-md);
        border-radius: 8px;
        margin-bottom: var(--spacing-md);
    }

    .content-card:last-child {
        margin-bottom: 0;
    }

    /* Card that announces "the next card continues me" */
    .content-card--merge-down {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin-bottom: 0;
        /* clip-path cuts the shadow exactly at the bottom edge, invisibiling it */
        clip-path: inset(-20px -20px 0px -20px);
    }

    .content-card--merge-up {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-top: 1px solid var(--border-color);
        position: relative;
        z-index: 2;
    }

    /* Pull the section itself up to cancel the flex gap on the article */
    section:has(> .content-card--merge-up) {
        margin-top: calc(-1 * var(--spacing-md));
    }

    /* Hide the footer inside an article when a merge-down card is present,
       so the next article's merge-up card can connect seamlessly */
    article:has(.content-card--merge-down) cv-footer {
        display: none;
    }

    /* Cancel the main gap for the following article */
    article:has(> section:first-child > .content-card--merge-up) {
        margin-top: -1rem;
    }

    .skill-item.content-card {
        margin-bottom: 0;
        border-bottom: none;
    }

    .content-card.section--interactive::after {
        top: 1rem;
        right: 1rem;
    }

    .content-card.section--interactive:hover {
        background-color: var(--accent-light);
        border-radius: 8px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
        border-color: transparent;
        z-index: 2;
    }

    .skills {
        column-count: 1;
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .detail-drawer__content {
        padding: var(--spacing-lg);
    }

    .page-footer {
        display: none;
    }
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background-color: transparent;
        color: black;
        padding: 0;
        margin: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    main {
        display: block;
        width: var(--page-width);
        margin: 0 auto;
        padding: 0;
        gap: 0;
    }

    article {
        height: auto;
        min-height: calc(var(--page-height) - 0.5mm);
        margin: 0 auto;
        box-shadow: none;
        border-radius: 0;
        page-break-inside: avoid;
    }

    section {
        transition: none;
        border: none;
        border-radius: 0;
        pointer-events: none;
        cursor: default;
    }

    .section--interactive:hover,
    .skill-item.section--interactive:hover {
        transform: none;
        box-shadow: none;
        margin-top: 0;
    }

    .detail-overlay,
    .detail-drawer,
    header {
        display: none !important;
    }
}