:root {
    color-scheme: light;

    --background: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f0f2f3;

    --header-background: rgb(255 255 255 / 85%);

    --border: #d9dde0;
    --border-hover: #c8cdd1;

    --text: #202428;
    --text-secondary: #626a71;
    --text-muted: #858d94;

    --accent: #1769b5;
    --accent-hover: #00529f;
    --accent-text: #ffffff;

    --max-width: 1040px;
    --header-max-width: 1080px;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --background: #171a1d;
    --surface: #202428;
    --surface-hover: #282d31;

    --header-background: rgb(23 26 29 / 85%);

    --border: #353b40;
    --border-hover: #444b51;

    --text: #f0f2f3;
    --text-secondary: #adb5bc;
    --text-muted: #818990;

    --accent: #4d8fe8;
    --accent-hover: #6aa5f0;
    --accent-text: #151817;
}


* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}

html[data-theme="dark"] .site-header {
    background: var(--header-background);
}

body {
    margin: 0;

    padding-top: 76px;

    background: var(--background);
    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;
    line-height: 1.6;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}


a {
    color: inherit;
    text-decoration: none;
}


.container {
    width: min(var(--max-width), calc(100% - 48px));

    margin: 0 auto;
}


/* Header */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    width: min(var(--header-max-width), calc(100% - 32px));
    margin: 0 auto;

    background: var(--header-background);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-radius: 0 0 16px 16px;

    box-shadow: 0 1px 6px rgb(0 0 0 / 5%);

    transition: transform 0.25s ease;
}

.site-header.is-hidden {
    transform: translate(-50%, -100%);
}

.header-inner {
    min-height: 76px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    min-width: 0;
}


.logo {
    display: flex;
    align-items: center;

    flex: 1 1 auto;
    min-width: 0;

    gap: 8px;
}


.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    border: 0;
    border-radius: 10px;

    color: var(--accent);

    overflow: hidden;
}


.logo-mark img {
    display: block;

    width: 100%;
    height: 100%;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
}


.logo-title {
    min-width: 0;

    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;

    letter-spacing: -0.025em;

    white-space: nowrap;
}


.header-right {
    display: flex;
    align-items: center;

    flex: 0 0 auto;

    gap: 28px;

    min-width: 0;
}


.navigation {
    display: flex;
    align-items: center;

    flex: 0 0 auto;

    gap: 26px;

    min-width: 0;
}


.navigation a {
    color: var(--text-secondary);

    font-size: 16px;
    font-weight: 500;

    white-space: nowrap;

    transition: color 0.2s ease;
}


.navigation a:hover {
    color: var(--text);
}


/* Theme */

.theme-button {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    flex: 0 0 38px;

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface);
    color: var(--text-secondary);

    cursor: pointer;

    font-size: 18px;
    line-height: 1;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}


.theme-button:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}


html[data-theme="light"] .theme-button {
    color: #3b82f6;
}


html[data-theme="dark"] .theme-button {
    color: #facc15;
}


/* Hero */

.hero {
    padding: 60px 0;
}


.eyebrow {
    display: inline-flex;
    align-items: center;

    gap: 9px;

    margin: 0 0 24px;

    color: var(--accent);

    font-size: clamp(16px, 2vw, 18px);
    font-weight: 650;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.eyebrow::before {
    content: "";

    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;

    background: var(--accent);
}


.hero h1 {
    max-width: 900px;

    margin: 0;

    font-size: clamp(30px, 7vw, 72px);
    line-height: 1.04;

    letter-spacing: -0.05em;
    font-weight: 750;
}


.hero-description {
    max-width: 720px;

    margin: 30px 0 0;

    color: var(--text-secondary);

    font-size: clamp(18px, 2vw, 21px);
    line-height: 1.6;
}


/* Sections */

section {
    padding: 60px 0;

    border-top: 1px solid var(--border);
}

section:first-of-type {
    padding: 40px 0;

    border-top: 0;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 30px;

    margin-bottom: 32px;
}

.section-title {
    margin: 0;

    font-size: clamp(22px, 3vw, 30px);
    
    line-height: 1.2;

    letter-spacing: -0.035em;
}


.section-description {
    margin: 8px 0 0;

    color: var(--text-muted);

    font-size: 18px;
}


.section-link {
    color: var(--text-secondary);

    font-size: 18px;
    font-weight: 600;

    white-space: nowrap;
}


.section-link:hover {
    color: var(--accent);
}


/* Applications */

.application-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 20px;
}


.application-card {
    display: flex;

    gap: 22px;

    min-height: 190px;

    padding: 28px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.application-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);

    transform: translateY(-2px);
}


.application-icon {
    width: 54px;
    height: 54px;

    flex: 0 0 54px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 10px;

    color: var(--accent);

    font-size: 16px;
    font-weight: 750;
}


.application-icon-svg {
    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;

    overflow: hidden;
}


.application-icon-svg img {
    display: block;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
}


.application-icon-svg--nextcloud {
    background: #1b4fb3;
}


.application-icon-svg--nextcloud img {
    width: 38px;
    height: 38px;
}


.application-content {
    min-width: 0;
}


.application-content h3 {
    margin: 0;

    font-size: clamp(18px, 2vw, 21px);
    line-height: 1.3;

    letter-spacing: -0.025em;
}


.application-content p {
    margin: 10px 0 20px;

    color: var(--text-secondary);

    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.55;
}


.application-link {
    display: inline-flex;
    align-items: center;

    gap: 7px;

    color: var(--text-secondary);

    font-size: 16px;
    font-weight: 650;
}


.application-link:hover {
    color: var(--accent);
}


/* Projects */

.project-card {
    padding: 30px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.project-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);

    transform: translateY(-2px);
}


.project-main {
    display: flex;

    gap: 22px;

    min-width: 0;
}


.project-main > div:last-child {
    min-width: 0;
}


.project-icon {
    width: 54px;
    height: 54px;

    flex: 0 0 54px;

    display: block;
}


.project-icon img {
    display: block;

    width: 54px;
    height: 54px;

    max-width: 54px;
    max-height: 54px;

    object-fit: contain;

    border-radius: 10px;
}


.project-name {
    margin: 0;

    font-size: clamp(20px, 3vw, 24px);
    line-height: 1.3;

    letter-spacing: -0.025em;
}


.project-description {
    max-width: 760px;

    margin: 9px 0 18px;

    color: var(--text-secondary);

    font-size: clamp(16px, 2vw, 18px);
}


.project-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;
}


.project-meta span {
    padding: 5px 9px;

    border: 1px solid var(--border);
    border-radius: 5px;

    color: var(--text-muted);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size: 14px;
}


.project-links {
    display: flex;

    gap: 22px;

    margin-top: 26px;
    padding-top: 20px;

    border-top: 1px solid var(--border);
}


.project-links a {
    color: var(--text-secondary);

    font-size: 16px;
    font-weight: 650;
}


.project-links a:hover {
    color: var(--accent);
}


/* About */

.about {
    display: grid;

    grid-template-columns: 1.1fr 1fr;

    gap: 80px;
}


.about-content h2 {
    margin: 0;

    font-size: clamp(26px, 4vw, 32px);
    line-height: 1.2;

    letter-spacing: -0.035em;
}


.about-content p {
    max-width: 600px;

    margin: 18px 0 0;

    color: var(--text-secondary);

    font-size: 17px;
    line-height: 1.65;
}


.about-links {
    display: flex;
    flex-direction: column;
}


.link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 17px 0;

    border-bottom: 1px solid var(--border);

    color: var(--text-secondary);

    font-size: 18px;
}


.link-row:hover {
    color: var(--text);
}


.link-row span:last-child {
    color: var(--text-muted);
}


/* Footer */

.site-footer {
    padding: 32px 0 44px;

    border-top: 1px solid var(--border);
}


.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    color: var(--text-muted);

    font-size: 18px;
}


.footer-inner a:hover {
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 22px;
}

.footer-links a:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 20px;
    height: 20px;

    color: var(--text-muted);
}

.footer-links a:first-child:hover {
    color: var(--text-secondary);
}

.footer-links a:first-child svg {
    width: 18px;
    height: 18px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Responsive */

@media (max-width: 760px) {
    body {
        padding-top: 68px;
    }    

    .container {
        width: calc(100% - 28px);
    }

    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;

        width: 100%;

        background: var(--background);

        transition: transform 0.25s ease;
    }
    
    .site-header.is-hidden {
        transform: translateY(-100%);
    }

    .container {
        width: min(
            var(--max-width),
            calc(100% - 32px)
        );
    }


    .header-inner {
        min-height: 68px;

        gap: 16px;
    }


    .header-right {
        gap: 16px;
    }


    .navigation {
        gap: 14px;
    }


    .navigation a {
        font-size: 16px;
    }


    .logo-title {
        font-size: 22px;
    }


    .hero {
        padding: 40px 0;
    }

    section {
        padding: 40px 0;
    }

    .section-heading {
        display: block;
    }

    .section-link {
        display: inline-block;

        margin-top: 14px;
    }

    .application-grid {
        grid-template-columns: 1fr;
    }

    .application-card {
        min-height: auto;

        padding: 24px;
    }

    .about {
        grid-template-columns: 1fr;

        gap: 20px;
    }

    .link-row:last-child {
        border-bottom: 0;
    }

    .footer-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}


/* Mobile header */

@media (max-width: 600px) {
    body {
        padding-top: 110px;
    }    

    .header-inner {
        display: grid;

        min-height: 0;

        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "logo theme"
            "navigation navigation";

        gap: 0;
        padding: 10px 0;
    }

    section:first-of-type {
        padding: 10px 0;
    }


    .logo {
        grid-area: logo;

        width: 100%;

        min-width: 0;

        gap: 8px;
    }


    .header-right {
        display: contents;
    }


    .theme-button {
        grid-area: theme;

        width: 36px;
        height: 36px;

        margin-left: 12px;

        flex: 0 0 36px;
    }


    .navigation {
        grid-area: navigation;

        width: 100%;

        display: flex;
        align-items: center;
        justify-content: center;

        gap: 18px;

        margin-top: 10px;
        padding: 10px 0;

        border-top: 1px solid var(--border);

        overflow-x: auto;
        overflow-y: hidden;

        scrollbar-width: none;
    }


    .navigation::-webkit-scrollbar {
        display: none;
    }


    .navigation a {
        flex: 0 0 auto;

        font-size: 16px;
    }


    .logo-mark {
        width: 40px;
        height: 40px;

        flex-basis: 40px;
    }


    .logo-title {
        font-size: 20px;
    }
}


/* Smartphone */

@media (max-width: 480px) {
    body {
        padding-top: 100px;
    }    

    .header-inner {
        padding-top: 4px;
        padding-bottom: 4px;
    }


    .logo {
        gap: 6px;
    }


    .logo-mark {
        width: 36px;
        height: 36px;

        flex-basis: 36px;
    }


    .logo-title {
        overflow: hidden;

        font-size: 20px;
        text-overflow: ellipsis;
    }


    .theme-button {
        width: 34px;
        height: 34px;

        margin-left: 10px;

        flex-basis: 34px;

        font-size: 16px;
    }


    .navigation {
        gap: 16px;

        margin-top: 8px;
        padding: 9px 0;
    }


    .navigation a {
        font-size: 16px;
    }


    .hero {
        padding: 16px 0 30px;
    }


    .hero h1 {
        line-height: 1.08;
    }


    .hero h1 br {
        display: none;
    }

    .eyebrow {
        gap: 7px;

        margin-bottom: 18px;

        font-size: 16px;
    }


    .eyebrow::before {
        width: 6px;
        height: 6px;

        flex-basis: 6px;
    }


    section {
        padding: 30px 0;
    }


    .section-title {
        line-height: 1.2;
    }


    .section-description {
        margin-top: 6px;

        font-size: 18px;
    }


    .section-link {
        font-size: 16px;
    }


    .application-card {
        gap: 18px;
    }


    .application-icon,
    .project-icon {
        width: 46px;
        height: 46px;

        flex-basis: 46px;
    }


    .application-icon-svg--nextcloud img {
        width: 32px;
        height: 32px;
    }


    .application-content h3 {
        font-size: 19px;
    }


    .project-card {
        padding: 20px;
    }

    .project-main {
        gap: 16px;
    }

    .project-icon img {
        width: 46px;
        height: 46px;
    }

    .project-meta span {
        padding: 4px 8px;

        font-size: 13px;
    }

    .project-links {
        gap: 18px;

        margin-top: 20px;
        padding-top: 16px;
    }

    .site-footer {
        padding: 24px 0;
    }
}

/* Very narrow screens */

@media (max-width: 380px) {

    .container {
        width: calc(100% - 24px);
    }


    .logo-title {
        font-size: 20px;
    }


    .navigation {
        gap: 14px;
    }


    .navigation a {
        font-size: 16px;
    }


    .theme-button {
        width: 32px;
        height: 32px;

        flex-basis: 32px;
    }
}


/* Extra narrow screens */

@media (max-width: 340px) {

    .logo-title {
        display: none;
    }


    .logo-mark {
        width: 34px;
        height: 34px;

        flex-basis: 34px;
    }


    .navigation {
        gap: 12px;
    }


    .navigation a {
        font-size: 16px;
    }


    .theme-button {
        width: 32px;
        height: 32px;

        flex-basis: 32px;
    }
}


/* Scroll reveal */

.reveal {
    opacity: 0;

    transform: translateY(28px);

    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}


.reveal.is-visible {
    opacity: 1;

    transform: translateY(0);
}


.reveal-delay-1 {
    transition-delay: 0.1s;
}


.reveal-delay-2 {
    transition-delay: 0.2s;
}


.reveal-delay-3 {
    transition-delay: 0.3s;
}


@media (prefers-reduced-motion: reduce) {

    .reveal {
        opacity: 1;

        transform: none;

        transition: none;
    }
}

/* Scroll to top */

.scroll-to-top {
    position: fixed;

    right: 48px;
    bottom: 32px;

    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--text-secondary);

    cursor: pointer;

    font-size: 20px;
    line-height: 1;

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.scroll-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    color: var(--text);
}

@media (max-width: 480px) {
    .scroll-to-top {
        right: 32px;
        bottom: 32px;

        width: 40px;
        height: 40px;

        font-size: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-to-top {
        transition: none;
    }
}