:root {
    --accent: #f59e0b;
    --tint: #fef3c7;
    --ink: #292524;
    --muted: #57534e;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --border: rgba(255, 255, 255, 0.72);
    --shadow: 0 24px 70px rgba(31, 41, 55, 0.16);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--tint);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background-color 180ms ease;
}

body[data-section="training"] {
    --accent: #0b6b42;
    --tint: #ecfdf3;
}

body[data-section="consulting"] {
    --accent: #1e40af;
    --tint: #eff6ff;
}

body[data-section="design"] {
    --accent: #4338ca;
    --tint: #eef2ff;
}

body[data-section="contact"] {
    --accent: #334155;
    --tint: #f8fafc;
}

a,
button {
    -webkit-tap-highlight-color: transparent;
}

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

button,
a {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

::selection {
    color: #fff;
    background: var(--accent);
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #fff;
    background: #0f172a;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

#background-image,
#grid-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#background-image {
    z-index: -2;
    opacity: 0.46;
    overflow: hidden;
}

.wallpaper-layer {
    position: absolute;
    z-index: 0;
    inset: -1.5rem;
    background-image: url("backgrounds/about.webp");
    background-position: center;
    background-size: cover;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: scale(1.055);
    filter: saturate(0.9);
    transition:
        clip-path 850ms cubic-bezier(0.65, 0, 0.2, 1),
        opacity 420ms ease,
        transform 1050ms cubic-bezier(0.2, 0.7, 0.2, 1),
        filter 700ms ease;
    will-change: clip-path, opacity, transform;
}

.wallpaper-layer:nth-child(2) {
    clip-path: inset(0 0 0 100%);
}

.wallpaper-layer.is-visible {
    z-index: 2;
    opacity: 1;
    clip-path: inset(0);
    transform: scale(1);
    filter: saturate(1);
}

.wallpaper-layer.is-leaving {
    z-index: 1;
    opacity: 1;
    clip-path: inset(0);
    transform: scale(0.985);
    filter: saturate(1.08);
}

.wallpaper-layer[data-wallpaper="training"] {
    background-image: url("backgrounds/training.webp");
}

.wallpaper-layer[data-wallpaper="consulting"] {
    background-image: url("backgrounds/consulting.webp");
}

.wallpaper-layer[data-wallpaper="design"] {
    background-image: url("backgrounds/design.webp");
}

.wallpaper-layer[data-wallpaper="contact"] {
    background-image: url("backgrounds/contact.webp");
}

.wallpaper-layer::after {
    position: absolute;
    inset: -1.5rem;
    content: "";
    background-image: inherit;
    background-position: inherit;
    background-size: inherit;
    filter: blur(14px);
    mask-image: linear-gradient(to top left, #000 0%, #000 42%, transparent 72%);
}

#grid-overlay {
    z-index: -1;
    opacity: 0.11;
    background: url("backgrounds/grid.png") repeat;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}

.site-shell {
    width: min(100%, 94rem);
    min-height: 100svh;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 4rem) clamp(1rem, 4vw, 4rem) calc(7.5rem + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 6rem);
}

.identity {
    min-width: 0;
}

#site-title {
    margin: 0;
    font-size: clamp(3.15rem, 7.4vw, 6.8rem);
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 0.86;
    text-transform: uppercase;
    text-wrap: balance;
    filter: drop-shadow(0 2px 18px rgba(255, 255, 255, 0.46));
}

#site-title > span {
    animation: name-enter 700ms ease-out both;
}

#site-title > span:nth-child(2) { animation-delay: 90ms; }
#site-title > span:nth-child(3) { animation-delay: 180ms; }
#site-title > span:nth-child(4) { animation-delay: 270ms; }

@keyframes name-enter {
    from { opacity: 0; transform: translateX(-1.25rem); }
    to { opacity: 1; transform: translateX(0); }
}

#site-title > span,
.last-line {
    display: flex;
    align-items: center;
    width: fit-content;
}

.last-line,
#k-word {
    white-space: nowrap;
}

body[data-section="contact"] #site-title {
    font-size: clamp(2.8rem, 6.4vw, 5.8rem);
}

.accent-word {
    color: var(--accent);
    transition: color 180ms ease;
}

.cursor {
    width: 0.09em;
    height: 0.78em;
    margin-left: 0.09em;
    background: var(--accent);
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 48%, 100% { opacity: 1; }
    49%, 98% { opacity: 0; }
}

.content-card {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: clamp(1.35rem, 3vw, 2.4rem);
    border: 0;
    background: transparent;
}

.panel {
    animation: panel-enter 220ms ease both;
}

.panel[hidden] {
    display: none;
}

@keyframes panel-enter {
    from { opacity: 0; transform: translateY(0.45rem); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.panel-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.15;
    text-wrap: balance;
}

.panel-icon {
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    color: var(--accent);
}

.panel p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.6vw, 1.1rem);
    font-weight: 560;
    line-height: 1.7;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.contact-actions {
    justify-content: center;
}

.button {
    min-height: 2.9rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--accent);
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    filter: none;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    color: #fff;
    background: var(--accent);
}

.button-secondary {
    color: var(--accent);
    background: var(--surface-strong);
}

#bottom-taskbar {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0;
    width: fit-content;
    margin: 0 auto;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 12px 32px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(18px) saturate(1.25);
}

.tab-list {
    display: flex;
    gap: 0.45rem;
}

.taskbar-item {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    min-height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 0.95rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
    transition: transform 160ms ease, color 160ms ease, background-color 160ms ease;
}

.taskbar-item:hover {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.taskbar-item[aria-selected="true"] {
    color: #fff;
    background: var(--accent);
    box-shadow: none;
    transform: translateY(-2px) scale(1.08);
}

.taskbar-item > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.taskbar-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.error-page {
    width: min(calc(100% - 2rem), 42rem);
    min-height: 100svh;
    margin: 0 auto;
    padding: 4rem 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.error-page h1 {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(3rem, 10vw, 6.5rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.error-page p {
    max-width: 34rem;
    margin: 1.25rem 0;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 650;
    line-height: 1.6;
}

@media (max-width: 899px) {
    .site-shell {
        grid-template-columns: 1fr;
        align-items: start;
        gap: clamp(5rem, 18vh, 9rem);
        padding-top: clamp(1.25rem, 5vw, 2.5rem);
    }

    #site-title {
        font-size: clamp(2.65rem, 11vw, 5.4rem);
    }

    .content-card {
        width: 100%;
        min-height: 0;
    }
}

@media (max-width: 767px) {
    .wallpaper-layer {
        background-image: url("backgrounds/about-mobile.webp");
    }

    .wallpaper-layer[data-wallpaper="training"] {
        background-image: url("backgrounds/training-mobile.webp");
    }

    .wallpaper-layer[data-wallpaper="consulting"] {
        background-image: url("backgrounds/consulting-mobile.webp");
    }

    .wallpaper-layer[data-wallpaper="design"] {
        background-image: url("backgrounds/design-mobile.webp");
    }

    .wallpaper-layer[data-wallpaper="contact"] {
        background-image: url("backgrounds/contact-mobile.webp");
    }

    .wallpaper-layer::after {
        mask-image: linear-gradient(to top, #000 0%, #000 58%, transparent 88%);
    }

    #bottom-taskbar {
        padding: 0.48rem 0.7rem;
    }

    .taskbar-item {
        width: 2.8rem;
        height: 2.8rem;
        min-width: 2.8rem;
        min-height: 2.8rem;
    }
}

@media (min-width: 700px) and (max-width: 1023px) and (max-height: 620px) and (orientation: landscape) {
    .site-shell {
        grid-template-columns: minmax(17rem, 0.85fr) minmax(0, 1.15fr);
        gap: 1.25rem;
        padding-top: 1rem;
        padding-bottom: 6.5rem;
    }

    #site-title {
        font-size: clamp(2.45rem, 6.5vw, 3.65rem);
    }

    .content-card {
        max-height: calc(100svh - 7rem);
        min-height: 0;
        overflow-y: auto;
        padding: 1.2rem;
    }

    .panel p {
        font-size: 0.92rem;
        line-height: 1.5;
    }
}

@media (max-width: 420px) {
    .site-shell {
        gap: clamp(4rem, 13vh, 6rem);
        padding-right: 0.9rem;
        padding-left: 0.9rem;
    }

    #site-title {
        font-size: clamp(2.45rem, 11.3vw, 3.2rem);
    }

    body[data-section="contact"] #site-title {
        font-size: clamp(2.1rem, 9.5vw, 2.7rem);
    }

    .content-card {
        padding: 1.15rem;
        border-radius: 1.3rem;
    }

    .panel-heading {
        gap: 0.65rem;
    }

    .panel-heading h2 {
        font-size: 1.32rem;
    }

    .panel-icon {
        width: 2rem;
        height: 2rem;
    }

    .panel p {
        font-size: 0.95rem;
        line-height: 1.58;
    }

    .panel-actions,
    .button {
        width: 100%;
    }

    .contact-actions .button {
        width: auto;
        min-width: 7.5rem;
    }

    #bottom-taskbar {
        bottom: max(0.45rem, env(safe-area-inset-bottom));
    }

    .taskbar-item {
        min-height: 2.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .cursor {
        opacity: 1;
    }

    .wallpaper-layer {
        clip-path: inset(0);
        transform: none;
    }
}

@media (forced-colors: active) {
    .content-card,
    #bottom-taskbar {
        border: 2px solid CanvasText;
    }
}
