:root {
    --bg: #fbfaf8;
    --surface: #ffffff;
    --surface-soft: #f4f1ed;
    --ink: #1f1d1a;
    --muted: #706c66;
    --line: #e5e0da;
    --accent: #e85c12;
    --accent-soft: #fff0e7;
    --accent-strong: #c84808;
    --shadow: 0 16px 38px rgb(29 25 21 / 0.06);
    --radius: 11px;
    --shell: 760px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color-scheme: light;
}

body[data-theme="dark"] {
    --bg: #181411;
    --surface: #211c18;
    --surface-soft: #2a231d;
    --ink: #f7f1ea;
    --muted: #b3a89e;
    --line: #3d342d;
    --accent: #f37b2d;
    --accent-soft: #352016;
    --accent-strong: #ff9a59;
    --shadow: 0 16px 38px rgb(0 0 0 / 0.18);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.6;
    transition: background-color 180ms ease, color 180ms ease;
}

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

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

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

button,
input,
textarea {
    font: inherit;
}

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

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10;
    padding: 8px 11px;
    border-radius: 6px;
    background: var(--ink);
    color: var(--bg);
    transform: translateY(-150%);
}

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

.shell {
    width: min(calc(100% - 40px), var(--shell));
    margin-inline: auto;
}

.site-header {
    padding: 24px 0 0;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
}

.brand,
.top-nav,
.hero__actions,
.link-pills {
    display: flex;
    align-items: center;
}

.brand {
    gap: 8px;
    min-width: 0;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.brand__name {
    font-size: 15px;
    white-space: nowrap;
}

.brand__crop {
    position: relative;
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--bg);
}

.brand__crop img {
    position: absolute;
    max-width: none;
}

.brand__crop--header {
    width: 25px;
    height: 21px;
}

.brand__crop--header img {
    width: 42px;
    top: -10px;
    left: -8px;
}

.brand__crop--hero {
    width: 150px;
    height: 126px;
}

.brand__crop--hero img {
    width: 210px;
    top: -48px;
    left: -30px;
}

.top-nav {
    gap: 17px;
    color: var(--muted);
    font-size: 13px;
}

.top-nav a,
.theme-toggle {
    transition: color 160ms ease;
}

.top-nav a:hover,
.theme-toggle:hover {
    color: var(--accent);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.theme-toggle__icon {
    display: inline-flex;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 18px;
    font-size: 17px;
    font-style: normal;
    line-height: 1;
}

.site-icon {
    display: inline-block;
    font-style: normal;
    line-height: 1;
}

.site-icon--external {
    font-size: 0.9em;
    vertical-align: -0.06em;
}

.site-icon--action,
.site-icon--brand {
    flex: 0 0 auto;
    font-size: 1.1em;
}

.site-icon--label {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 1.15em;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}

.language-toggle button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-weight: 500;
}

.language-toggle button:hover,
.language-toggle button[aria-pressed="true"] {
    color: var(--accent);
}

.language-toggle button[aria-pressed="true"] {
    font-weight: 700;
}

.hero {
    padding: 72px 0 86px;
}

.hero__identity {
    margin-bottom: 25px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1,
h2,
h3 {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.055em;
}

h1 {
    max-width: none;
    font-size: clamp(2.15rem, 5vw, 3rem);
    line-height: 1.1;
}

.accent-underline {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}

.hero__role {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 20px;
    color: var(--muted);
}

.flag-dot {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: var(--accent);
    transform: rotate(45deg);
}

.hero__intro {
    max-width: 58ch;
    margin-top: 18px;
    color: var(--muted);
}

.hero__actions {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 27px;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 7px 13px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

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

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

.button--accent:hover {
    background: var(--accent-strong);
}

.button--quiet {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.button--quiet:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.section {
    padding: 0 0 82px;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    font-size: 15px;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.section-heading p {
    max-width: 64ch;
    margin-top: 10px;
    color: var(--muted);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.project-card {
    display: flex;
    gap: 13px;
    min-height: 125px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 0 rgb(255 255 255 / 0.5);
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.project-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

body[data-theme="dark"] .project-card {
    box-shadow: none;
}

body[data-theme="dark"] .project-card:hover,
body[data-theme="dark"] .project-card:focus-visible {
    background: var(--surface-soft);
}

.project-card > img {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
}

.project-card__body {
    min-width: 0;
}

.project-card__title-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 7px;
}

.project-card__link-icon {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--muted);
    transition: color 180ms ease, transform 180ms ease;
}

.project-card:hover .project-card__link-icon,
.project-card:focus-visible .project-card__link-icon {
    color: var(--accent-strong);
    transform: translate(2px, -2px);
}

.project-card h3 {
    font-size: 14px;
    line-height: 1.35;
    letter-spacing: -0.04em;
}

.project-card p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.project-card__tag {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.about-section {
    padding-top: 4px;
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr);
    gap: 42px;
    align-items: start;
}

.about-copy {
    max-width: 58ch;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 0;
}

.stats div {
    padding-left: 12px;
    border-left: 1px solid var(--accent);
}

.stats dt {
    color: var(--ink);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.08em;
}

.stats dd {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.link-pills {
    flex-wrap: wrap;
    gap: 9px;
}

.link-pills a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.link-pills a:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
    transform: translateY(-2px);
}

.contact-section {
    padding-bottom: 105px;
}

.contact-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.contact-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 160ms ease, transform 160ms ease;
}

a.contact-link:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.contact-link__label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.contact-link__value {
    color: var(--ink);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.contact-link__value span {
    color: var(--accent);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 27px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 650px) {
    body {
        font-size: 16px;
    }

    .shell {
        width: min(calc(100% - 28px), var(--shell));
    }

    .site-header {
        padding-top: 8px;
    }

    .top-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0 2px;
        font-size: 12px;
    }

    .top-nav a,
    .theme-toggle {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding-inline: 0;
    }

    .language-toggle {
        min-height: 44px;
        gap: 0;
    }

    .language-toggle button {
        min-width: 36px;
        min-height: 44px;
        padding-inline: 4px;
    }

    .hero {
        padding: 32px 0 56px;
    }

    .hero__identity {
        margin-bottom: 18px;
    }

    .brand__crop--hero {
        width: 118px;
        height: 99px;
    }

    .brand__crop--hero img {
        width: 165px;
        top: -38px;
        left: -24px;
    }

    .hero__role {
        align-items: flex-start;
        gap: 8px;
    }

    .hero__role > span:first-child {
        min-width: 0;
    }

    .flag-dot {
        flex: 0 0 11px;
        margin-top: 0.35em;
    }

    h1 {
        font-size: clamp(2rem, 9vw, 2.8rem);
        line-height: 1.12;
        text-wrap: balance;
    }

    .accent-underline {
        text-underline-offset: 5px;
    }

    .hero__actions {
        gap: 8px;
        margin-top: 22px;
    }

    .hero__actions .button {
        padding-inline: 12px;
    }

    .projects-grid,
    .about-grid,
    .contact-links {
        grid-template-columns: 1fr;
    }

    .about-grid {
        gap: 24px;
    }

    .section {
        padding-bottom: 58px;
    }

    .project-card {
        gap: 12px;
        min-height: 112px;
    }

    .project-card > img {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
    }

    .project-card p {
        font-size: 15px;
    }

    .link-pills a {
        min-height: 44px;
        padding: 9px 12px;
    }

    .contact-section {
        padding-bottom: 64px;
    }

    .site-footer {
        padding-bottom: 20px;
        font-size: 12px;
    }

    .stats {
        width: 100%;
        max-width: 360px;
    }

    .site-footer {
        flex-direction: column;
        gap: 4px;
    }
}

@media (pointer: coarse) {
    .top-nav a,
    .theme-toggle,
    .language-toggle button,
    .button,
    .link-pills a {
        min-height: 44px;
    }

    .language-toggle button {
        min-width: 44px;
    }
}

@media (hover: none) {
    .top-nav a:hover,
    .theme-toggle:hover,
    .language-toggle button:hover {
        color: var(--muted);
    }

    .button--accent:hover {
        background: var(--accent);
    }

    .button--quiet:hover {
        border-color: var(--line);
        color: var(--ink);
    }

    .button:hover,
    .project-card:hover,
    .link-pills a:hover,
    a.contact-link:hover {
        transform: none;
    }

    .project-card:hover {
        border-color: var(--line);
        background: var(--surface);
        box-shadow: none;
    }

    body[data-theme="dark"] .project-card:hover {
        background: var(--surface);
    }

    .project-card:hover .project-card__link-icon {
        color: var(--muted);
        transform: none;
    }

    .link-pills a:hover,
    a.contact-link:hover {
        border-color: var(--line);
        color: var(--ink);
    }

    .button:active,
    .project-card:active,
    .link-pills a:active,
    a.contact-link:active {
        transform: scale(0.99);
    }

    .project-card:active,
    .link-pills a:active,
    a.contact-link:active {
        border-color: var(--accent);
        background: var(--surface-soft);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
