:root {
    --background: #080a09;
    --surface: #0c0f0d;
    --surface-hover: #151a16;
    --text: #f1f3f0;
    --muted: #929a93;
    --line: rgb(202 255 192 / 12%);
    --line-strong: rgb(202 255 192 / 22%);
    --body-overlay-start: rgb(8 10 9 / 88%);
    --body-overlay-end: rgb(8 10 9 / 92%);
    --texture-color: rgb(255 255 255 / 2.5%);
    --ambient-a: rgb(139 255 156 / 4%);
    --ambient-b: rgb(196 255 136 / 3%);
    --header-bg: rgb(8 10 9 / 78%);
    --tile-overlay: rgb(12 15 13 / 96%);
    --tile-texture: rgb(255 255 255 / 3%);
    --tile-glow: rgb(210 255 203 / 9%);
    --tile-sheen: rgb(255 255 255 / 3%);
    --focus-ring: rgb(220 255 214 / 75%);
    --accent: #cfffbe;
    --accent-soft: rgb(202 255 192 / 10%);
    --shadow: rgb(0 0 0 / 24%);
    --header-height: 3.75rem;
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
    --background: #f4f6f2;
    --surface: #ffffff;
    --surface-hover: #e9eee7;
    --text: #141814;
    --muted: #626b63;
    --line: rgb(35 77 37 / 12%);
    --line-strong: rgb(35 77 37 / 22%);
    --body-overlay-start: rgb(244 246 242 / 88%);
    --body-overlay-end: rgb(244 246 242 / 94%);
    --texture-color: rgb(20 40 20 / 3.5%);
    --ambient-a: rgb(74 160 75 / 7%);
    --ambient-b: rgb(104 145 49 / 5%);
    --header-bg: rgb(244 246 242 / 84%);
    --tile-overlay: rgb(255 255 255 / 96%);
    --tile-texture: rgb(20 40 20 / 3%);
    --tile-glow: rgb(53 133 57 / 10%);
    --tile-sheen: rgb(20 40 20 / 3%);
    --focus-ring: rgb(38 103 42 / 78%);
    --accent: #286b31;
    --accent-soft: rgb(40 107 49 / 10%);
    --shadow: rgb(25 45 25 / 14%);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
    min-width: 20rem;
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(var(--body-overlay-start), var(--body-overlay-end)),
        repeating-linear-gradient(
            118deg,
            var(--texture-color) 0,
            var(--texture-color) 1px,
            transparent 1px,
            transparent 4px
        ),
        var(--background);
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 10%, var(--ambient-a), transparent 27rem),
        radial-gradient(circle at 85% 60%, var(--ambient-b), transparent 30rem);
}

a {
    color: inherit;
}

.site-header {
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    left: 0;
    height: var(--header-height);
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 2rem, 72rem);
    height: 100%;
    margin-inline: auto;
}

.site-nav__brand,
.site-nav__links a {
    text-decoration: none;
}

.site-nav__brand {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-nav__links {
    display: flex;
    align-items: center;
    gap: 1.3rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.site-nav__links a {
    color: var(--muted);
    transition: color 160ms ease;
}

.site-nav__links a:hover,
.site-nav__links a:focus-visible {
    color: var(--text);
}

.hero {
    display: grid;
    min-height: 100svh;
    padding: calc(var(--header-height) + 3.5rem) 1rem 2rem;
}

.hero__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(100%, 72rem);
    margin-inline: auto;
}

.hero__intro {
    margin-bottom: clamp(2rem, 8vh, 4.5rem);
}

.hero__eyebrow {
    margin: 0 0 0.35rem;
    color: var(--muted);
    font-size: clamp(0.62rem, 1.7vw, 0.76rem);
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.hero__title {
    margin: 0;
    font-size: clamp(2rem, 9.5vw, 5.2rem);
    line-height: 0.96;
    letter-spacing: -0.065em;
}

.hero__description {
    max-width: 29rem;
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: clamp(0.84rem, 2.6vw, 1.08rem);
    line-height: 1.55;
}

.hero__navbar {
    display: grid;
    grid-template-areas:
        "about services services"
        "projects services services"
        "contacts contacts social";
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, clamp(5.8rem, 17vw, 8rem));
    gap: 1px;
    overflow: hidden;
    width: 100%;
    background: var(--line-strong);
    border: 1px solid var(--line-strong);
    border-radius: 0.85rem;
    box-shadow:
        0 1.2rem 4rem var(--shadow),
        inset 0 1px rgb(255 255 255 / 2%);
}

.hero-tile {
    --pointer-x: 50%;
    --pointer-y: 50%;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
    padding: clamp(0.65rem, 2.8vw, 1.15rem);
    overflow: hidden;
    text-decoration: none;
    background:
        linear-gradient(var(--tile-overlay), var(--tile-overlay)),
        repeating-linear-gradient(
            115deg,
            var(--tile-texture) 0,
            var(--tile-texture) 1px,
            transparent 1px,
            transparent 4px
        );
    transition:
        background-color 180ms ease,
        transform 180ms ease;
}

.hero-tile::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background: radial-gradient(
        circle 12rem at var(--pointer-x) var(--pointer-y),
        var(--tile-glow),
        transparent 62%
    );
    opacity: 0;
    transition: opacity 180ms ease;
}

.hero-tile::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background: linear-gradient(135deg, transparent 25%, var(--tile-sheen));
    opacity: 0;
    transition: opacity 180ms ease;
}

.hero-tile:hover::before,
.hero-tile:focus-visible::before,
.hero-tile.is-pressed::before {
    opacity: 1;
}

.hero-tile:hover::after,
.hero-tile:focus-visible::after,
.hero-tile.is-pressed::after {
    opacity: 1;
}

.hero-tile:focus-visible {
    z-index: 2;
    outline: 1px solid var(--focus-ring);
    outline-offset: -2px;
}

.hero-tile.is-pressed {
    transform: scale(0.985);
}

.hero-tile--about {
    grid-area: about;
}

.hero-tile--services {
    grid-area: services;
}

.hero-tile--projects {
    grid-area: projects;
}

.hero-tile--contacts {
    grid-area: contacts;
}

.hero-tile--social {
    grid-area: social;
}

.hero-tile__number,
.hero-tile__arrow {
    color: var(--muted);
    font-size: clamp(0.5rem, 1.8vw, 0.66rem);
    font-weight: 700;
    letter-spacing: 0.1em;
}

.hero-tile__number {
    grid-column: 1;
    grid-row: 1;
}

.hero-tile__arrow {
    grid-column: 2;
    grid-row: 1;
    font-size: clamp(0.72rem, 2.5vw, 0.95rem);
    transition:
        color 180ms ease,
        transform 180ms ease;
}

.hero-tile:hover .hero-tile__arrow,
.hero-tile:focus-visible .hero-tile__arrow {
    color: var(--text);
    transform: translate(0.12rem, -0.12rem);
}

.hero-tile__title {
    grid-column: 1 / -1;
    grid-row: 3;
    align-self: end;
    font-size: clamp(0.72rem, 2.6vw, 1.05rem);
    font-weight: 650;
    line-height: 1.05;
    letter-spacing: -0.025em;
}

.content-section {
    display: grid;
    align-content: center;
    width: min(100% - 2rem, 72rem);
    min-height: 70svh;
    margin-inline: auto;
    padding-block: 5rem;
    border-top: 1px solid var(--line);
}

.content-section__index {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.content-section h2 {
    max-width: 14ch;
    margin: 0;
    font-size: clamp(2.2rem, 8vw, 5.5rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

@media (min-width: 48rem) {
    .site-nav {
        width: min(100% - 4rem, 72rem);
    }

    .hero {
        padding-inline: 2rem;
    }

    .hero__content {
        justify-content: center;
    }

    .hero__navbar {
        grid-template-rows: repeat(3, 9rem);
        border-radius: 1rem;
    }

    .content-section {
        width: min(100% - 4rem, 72rem);
    }
}

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

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

/* Internal section pages */
.section-page {
    min-height: 100svh;
}

.page-shell {
    width: min(100% - 2rem, 72rem);
    margin-inline: auto;
    padding: calc(var(--header-height) + 2rem) 0 5rem;
}

.page-hero {
    display: grid;
    align-content: end;
    min-height: auto;
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
    border-bottom: 1px solid var(--line);
}

.page-hero__index,
.content-card__index,
.project-row__meta,
.contact-panel__label {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-hero h1 {
    max-width: 14ch;
    margin: 0;
    font-size: clamp(3rem, 10vw, 7.5rem);
    line-height: 0.92;
    letter-spacing: -0.07em;
}

.page-hero__lead {
    max-width: 42rem;
    margin: 2rem 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    line-height: 1.6;
}

.page-content {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 2rem;
    padding-block: clamp(4rem, 10vw, 8rem);
}

.page-content h2,
.content-card h2,
.project-row h2 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.page-content p,
.content-card p,
.project-row p {
    color: var(--muted);
    line-height: 1.7;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin-top: 1px;
    background: var(--line-strong);
    border: 1px solid var(--line-strong);
    border-radius: 1rem;
    overflow: hidden;
}

.content-card {
    min-height: 22rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--surface);
}

.content-card p:last-child {
    margin-top: 2rem;
}

.project-list {
    border-top: 1px solid var(--line-strong);
}

.project-row {
    display: grid;
    grid-template-columns: minmax(8rem, 0.6fr) minmax(12rem, 0.9fr) minmax(16rem, 1.5fr);
    gap: 2rem;
    align-items: start;
    padding-block: 2rem;
    border-bottom: 1px solid var(--line-strong);
}

.project-row__meta,
.project-row p {
    margin-top: 0;
}

.contact-panel {
    display: grid;
    align-content: end;
    min-height: 20rem;
    margin-top: 1px;
    padding: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid var(--line-strong);
    background: var(--surface);
}

.contact-panel a {
    width: fit-content;
    font-size: clamp(1.8rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.06em;
    text-decoration: none;
}

.social-links {
    display: grid;
    margin-top: 1px;
    border-top: 1px solid var(--line-strong);
}

.social-links a {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--line-strong);
    font-size: clamp(1.6rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.05em;
    text-decoration: none;
}

.social-links a span {
    color: var(--muted);
    transition: transform 180ms ease, color 180ms ease;
}

.social-links a:hover span,
.social-links a:focus-visible span {
    color: var(--text);
    transform: translate(0.2rem, -0.2rem);
}

@media (min-width: 48rem) {
    .page-shell {
        width: min(100% - 4rem, 72rem);
    }
}

@media (max-width: 47.99rem) {
    .site-nav__links {
        gap: 0.8rem;
        font-size: 0.72rem;
    }

    .page-content,
    .project-row {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .content-card {
        min-height: 15rem;
    }
}

/* Compact internal-page spacing; the homepage hero remains unchanged. */
.page-shell {
    padding-top: calc(var(--header-height) + clamp(1.25rem, 4vw, 2.5rem));
}

.page-hero {
    min-height: 0;
    padding: clamp(1.5rem, 5vw, 3.5rem) 0 clamp(2rem, 6vw, 4rem);
}

.page-body,
.page-blocks {
    padding-block: clamp(2.5rem, 7vw, 5rem);
}

.page-body {
    max-width: 52rem;
}

.page-blocks {
    display: grid;
    gap: 1px;
    background: var(--line-strong);
}

.page-block {
    padding: clamp(1.25rem, 4vw, 2.5rem);
    background: var(--surface);
}

.page-block h2 {
    margin-top: 0;
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    letter-spacing: -0.05em;
}

.content-card__link,
.page-block > a,
.prose a {
    color: var(--accent);
}

.content-card__link {
    display: inline-block;
    margin-top: 1.5rem;
    text-decoration: none;
}

.social-links a > span:first-child {
    display: grid;
    gap: 0.3rem;
}

.social-links small {
    color: var(--muted);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Collection item links and detail pages */
.content-summary > :first-child {
    margin-top: 0;
}

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

.content-item__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.content-item__footer a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.content-item__likes {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.item-detail__shell {
    max-width: 60rem;
}

.item-back {
    padding: 0 0 clamp(1.5rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--line);
}

.item-back a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.item-back a:hover,
.item-back a:focus-visible {
    color: var(--text);
    border-color: rgb(202 255 192 / 42%);
    background: var(--surface-hover);
}

.item-detail__hero {
    padding: clamp(2.5rem, 8vw, 6rem) 0 clamp(2rem, 6vw, 4rem);
    border-bottom: 1px solid var(--line-strong);
}

.item-detail__hero h1 {
    max-width: 15ch;
    margin: 0;
    font-size: clamp(3rem, 10vw, 7rem);
    line-height: 0.94;
    letter-spacing: -0.07em;
}

.item-detail__body {
    max-width: 48rem;
    padding-block: clamp(2.5rem, 7vw, 5rem);
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    line-height: 1.75;
}

.item-detail__external {
    margin: 0 0 clamp(2.5rem, 7vw, 5rem);
}

.item-detail__external a {
    color: var(--accent);
    font-weight: 700;
}

.item-detail__footer {
    display: grid;
    gap: 0.8rem;
    padding: clamp(1.5rem, 5vw, 3rem) 0;
    border-top: 1px solid var(--line-strong);
}

.like-form {
    width: fit-content;
}

.like-button {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
    padding: 0.65rem 0.8rem 0.65rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
    cursor: pointer;
    background: var(--surface);
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.like-button:hover,
.like-button:focus-visible {
    border-color: rgb(202 255 192 / 48%);
    background: var(--surface-hover);
}

.like-button:active {
    transform: scale(0.97);
}

.like-button.is-liked {
    border-color: rgb(202 255 192 / 60%);
    background: var(--accent-soft);
}

.like-button__icon {
    color: var(--muted);
    font-size: 1.05rem;
    transition: color 160ms ease, transform 160ms ease;
}

.like-button.is-liked .like-button__icon {
    color: var(--accent);
    transform: scale(1.12);
}

.like-button__count {
    display: inline-grid;
    min-width: 1.9rem;
    min-height: 1.9rem;
    place-items: center;
    padding-inline: 0.45rem;
    border-radius: 999px;
    color: var(--muted);
    background: rgb(255 255 255 / 5%);
    font-size: 0.78rem;
}

.like-note {
    max-width: 34rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

@media (max-width: 35rem) {
    .content-item__footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

.social-links__aside {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.social-links__aside small {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.content-summary {
    position: relative;
    max-height: 8.5rem;
    overflow: hidden;
}

.content-summary::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2.5rem;
    content: "";
    pointer-events: none;
    background: linear-gradient(transparent, var(--surface));
}

.project-row .content-summary::after {
    background: linear-gradient(transparent, var(--background));
}

.page-block .content-summary::after {
    background: linear-gradient(transparent, var(--surface));
}

.collection-empty {
    margin-top: 1px;
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid var(--line-strong);
    color: var(--muted);
    background: var(--surface);
}

.collection-empty p {
    margin: 0;
}

/* Language and theme controls */
.site-nav__controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.18rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.language-switcher a {
    min-width: 1.8rem;
    padding: 0.28rem 0.42rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
    text-decoration: none;
}

.language-switcher a:hover,
.language-switcher a:focus-visible,
.language-switcher a.is-active {
    color: var(--text);
    background: var(--surface-hover);
}

.theme-toggle {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    background: var(--surface);
    transition: background-color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--line-strong);
    background: var(--surface-hover);
}

.theme-toggle:active {
    transform: scale(0.94);
}

.prose img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 1.75rem auto;
    border: 1px solid var(--line-strong);
    border-radius: 0.8rem;
    box-shadow: 0 1rem 3rem var(--shadow);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root[data-theme="light"] .hero__navbar {
    box-shadow: 0 1.2rem 4rem var(--shadow), inset 0 1px rgb(255 255 255 / 70%);
}

:root[data-theme="light"] .like-button:hover,
:root[data-theme="light"] .like-button:focus-visible,
:root[data-theme="light"] .like-button.is-liked {
    border-color: rgb(40 107 49 / 42%);
}

:root[data-theme="light"] .like-button__count {
    background: rgb(40 70 40 / 7%);
}

@media (max-width: 40rem) {
    .site-nav {
        width: min(100% - 1rem, 72rem);
    }

    .site-nav__controls {
        gap: 0.35rem;
    }

    .site-nav__links {
        gap: 0.55rem;
        font-size: 0.7rem;
    }

    .site-nav__brand {
        font-size: 0.74rem;
    }

    .language-switcher a {
        min-width: 1.45rem;
        padding-inline: 0.25rem;
        font-size: 0.56rem;
    }

    .theme-toggle {
        width: 1.9rem;
        height: 1.9rem;
    }
}
