/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Kolory jak Portfolio 2026 (tokens.css - dark) */
:root {
    color-scheme: dark;
    --brand-bg: #08080a;
    --brand-surface: #0f0f11;
    --brand-border: #262626;
    --brand-muted: #757980;
    --brand-text: #ffffff;
    --brand-accent: #a39e6b;
    --brand-accent-text: #c5bf81;
    --brand-divider: #161719;

    --foreground: var(--brand-text);
    --muted: var(--brand-muted);
    --muted-foreground: #5c6169;
    --border: var(--brand-border);
    --background: var(--brand-surface);
    --surface: var(--brand-bg);
    --surface-elevated: color-mix(in srgb, var(--brand-surface) 92%, #ffffff 8%);
    /* Kafelki narzędzi: ledwo jaśniejsze niż tło .page */
    --tool-card-bg: color-mix(in srgb, var(--brand-surface) 97%, #ffffff 3%);
    --radius: 6px;
    --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--brand-bg);
    color: var(--foreground);
    line-height: 1.6;
    padding: 40px 20px;
}

/* ===== Layout + language switch (above CV) ===== */
.cv-layout {
    max-width: 800px;
    margin: 0 auto;
}

.cv-lang-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 14px;
}

.cv-lang-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-muted);
    margin-right: 0.25rem;
}

.cv-lang-toggle {
    display: inline-flex;
    border-radius: var(--radius);
    border: 1px solid var(--brand-border);
    background: var(--brand-surface);
    overflow: hidden;
}

.cv-lang-btn {
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

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

.cv-lang-btn.is-active {
    background: color-mix(in srgb, var(--brand-accent) 22%, transparent);
    color: var(--brand-accent-text);
}

.cv-lang-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand-accent) 55%, transparent);
    outline-offset: 2px;
    z-index: 1;
}

/* ===== PAGE (A4-like container) ===== */
.page {
    width: 100%;
    background: var(--brand-surface);
    border: none;
    border-radius: 0;
    padding: 48px 52px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
}

.header-photo-wrap {
    flex-shrink: 0;
    line-height: 0;
}

.header-photo {
    display: block;
    width: 112px;
    height: 112px;
    border-radius: 0;
    object-fit: cover;
    object-position: center 20%;
    border: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.header-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--foreground);
}

.title {
    font-size: 0.9375rem;
    color: var(--brand-muted);
    font-weight: 400;
    margin-top: 0;
    letter-spacing: -0.01em;
}

.header-right {
    flex-shrink: 0;
}

.contact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contact-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--brand-muted);
    line-height: 1.4;
}

.contact-list li svg {
    flex-shrink: 0;
    color: var(--foreground);
    opacity: 0.5;
}

.contact-list .contact-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .contact-list .contact-link:hover {
        color: var(--brand-accent-text);
    }
}

.contact-list .contact-link:focus-visible {
    color: var(--brand-accent-text);
    outline: 2px solid var(--brand-accent-text);
    outline-offset: 2px;
}

/* ===== DIVIDER ===== */
.divider {
    border: none;
    border-top: 1px solid var(--brand-divider);
    margin: 28px 0;
}

/* ===== SECTIONS ===== */
.section {
    /* spacing handled by dividers */
}

.section-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand-muted);
    margin-bottom: 16px;
}

/* ===== ABOUT ===== */
.about-text {
    font-size: 0.9375rem;
    color: var(--brand-text);
    line-height: 1.7;
}

/* ===== EXPERIENCE - oś czasu ===== */
.experience-timeline {
    --tl-dot-offset: 0.42em;
    /* kropka 10×10 z obramowaniem (box-sizing: border-box) → środek +5px */
    --tl-dot-outer: 10px;
    --tl-gap: 26px;

    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: grid;
    grid-template-columns: 14px minmax(7.25rem, 11rem) 1fr;
    gap: 0 16px;
    /* stretch: oś musi mieć pełną wysokość wpisu, żeby linia (100% + gap) łączyła kropki */
    align-items: stretch;
    padding-bottom: var(--tl-gap);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-axis {
    position: relative;
    justify-self: center;
    width: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-dot {
    display: block;
    width: var(--tl-dot-outer);
    height: var(--tl-dot-outer);
    margin-top: var(--tl-dot-offset);
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--brand-surface);
    border: 2px solid var(--brand-muted);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/*
 * Linia: od środka kropki w dół przez całą wysokość osi (100%) + odstęp do następnego wpisu.
 * Wysokość = H + gap dokładanie sięga do środka kropki poniżej (T + H + gap = H + gap + T).
 */
.timeline-item:not(:last-child) .timeline-axis::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(var(--tl-dot-offset) + 5px);
    height: calc(100% + var(--tl-gap));
    width: 1px;
    background: var(--brand-border);
    z-index: 0;
}

.timeline-dates {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 0.35em;
    min-width: 0;
}

.timeline-dates .entry-date {
    white-space: normal;
    line-height: 1.35;
}

.timeline-panel {
    min-width: 0;
}

.timeline-panel__head {
    margin-bottom: 10px;
}

/* ===== ENTRIES (Education - klasyczny układ) ===== */
.entry {
    margin-bottom: 24px;
}

.entry:last-child {
    margin-bottom: 0;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 10px;
}

.entry-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.entry-company {
    font-size: 0.8125rem;
    color: var(--brand-muted);
    font-weight: 400;
    margin-top: 2px;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.entry-date {
    font-size: 0.75rem;
    color: var(--brand-muted);
    font-weight: 400;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: 1px solid var(--brand-accent-text);
    border-radius: 9999px;
    color: var(--brand-accent-text);
    background: transparent;
    white-space: nowrap;
}

.entry-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 0;
}

.entry-list li {
    font-size: 0.8125rem;
    color: var(--brand-muted);
    line-height: 1.6;
    padding-left: 16px;
    position: relative;
}

.entry-list li::before {
    content: '-';
    position: absolute;
    left: 0;
    color: var(--muted-foreground);
}

.entry-description {
    font-size: 0.8125rem;
    color: var(--brand-muted);
    line-height: 1.6;
}

/* ===== SKILLS ===== */
.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skill-group-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 8px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    border-radius: 0;
    color: var(--foreground);
    background: var(--tool-card-bg);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

/* ===== TOOLS (jak Software stack w Portfolio 2026) ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.tool-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.75rem;
    padding: 0 8px;
    border: none;
    border-radius: 0;
    background: var(--tool-card-bg);
    transition: background-color 0.2s ease;
}

@media (min-width: 640px) {
    .tool-card {
        min-height: 4.25rem;
        padding: 0 10px;
    }
}

@media (hover: hover) {
    .tool-card:hover {
        background-color: color-mix(in srgb, var(--tool-card-bg) 98%, #ffffff 2%);
    }
}

/* Ten sam slot co .about-stack__logo-slot w tokens.css */
.tool-logo-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: min(100%, 6.25rem);
    height: 1rem;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .tool-logo-slot {
        max-width: min(100%, 7.5rem);
        height: 1.25rem;
    }
}

.tool-logo-slot--icon {
    height: 2.75rem;
}

.tool-fallback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
}

.tool-fallback-icon svg {
    width: 28px;
    height: 28px;
}

.tool-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

/* ===== LANGUAGES ===== */
.languages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.language-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.language-level {
    font-size: 0.8125rem;
    color: var(--brand-muted);
}

/* ===== PRINT / PDF - ciemny motyw, pełna strona (bez zewnętrznych marginesów / drugiego tła) ===== */
@media print {
    @page {
        margin: 0;
        size: A4;
    }

    html {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 14px;
        background: transparent;
    }

    body {
        background: transparent;
        padding: 0;
        color: var(--foreground);
    }

    .cv-lang-bar {
        display: none;
    }

    .page {
        max-width: none;
        width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 28px 32px;
        background: var(--brand-surface);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .divider {
        margin: 18px 0;
        border-top-color: var(--brand-divider);
    }

    .tool-card:hover {
        background: var(--tool-card-bg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    body {
        padding: 16px 12px;
    }

    .page {
        padding: 32px 24px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .header-left {
        width: 100%;
    }

    .header-photo {
        width: 96px;
        height: 96px;
    }

    .timeline-item {
        grid-template-columns: 12px 1fr;
        grid-template-rows: auto auto;
        column-gap: 14px;
    }

    .timeline-axis {
        grid-row: 1 / -1;
    }

    .timeline-dates {
        grid-column: 2;
        grid-row: 1;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding-top: 0;
        padding-bottom: 6px;
    }

    .timeline-panel {
        grid-column: 2;
        grid-row: 2;
    }

    .entry-header {
        flex-direction: column;
        gap: 4px;
    }

    .entry-meta {
        order: -1;
    }

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