:root {
    color-scheme: light;
    --bg: #f7f3ea;
    --surface: #fffaf1;
    --surface-strong: #ffffff;
    --text: #172026;
    --muted: #64707a;
    --line: #ded7c9;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #d8f3ef;
    --warm: #b45309;
    --shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
    --radius: 12px;
    --max-width: 100%;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #101820;
        --surface: #14232d;
        --surface-strong: #1a2c38;
        --text: #eef5f7;
        --muted: #a7b7bf;
        --line: #2d414c;
        --accent: #58d5c9;
        --accent-strong: #8ee5dc;
        --accent-soft: #173a3a;
        --warm: #f3b45d;
        --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    }
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f3ea;
    --surface: #fffaf1;
    --surface-strong: #ffffff;
    --text: #172026;
    --muted: #64707a;
    --line: #ded7c9;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #d8f3ef;
    --warm: #b45309;
    --shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101820;
    --surface: #14232d;
    --surface-strong: #1a2c38;
    --text: #eef5f7;
    --muted: #a7b7bf;
    --line: #2d414c;
    --accent: #58d5c9;
    --accent-strong: #8ee5dc;
    --accent-soft: #173a3a;
    --warm: #f3b45d;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 34rem),
        linear-gradient(180deg, var(--bg), var(--surface));
    color: var(--text);
    font-size: 18px;
    font-family: "Aptos", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.78;
}

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

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    max-width: var(--max-width);
    width: calc(100% - 24px);
    margin: 12px auto 0;
    padding: 14px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: max-content;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--surface-strong);
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.2;
}

.brand small {
    color: var(--muted);
    font-size: 0.86rem;
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.98rem;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
    outline: none;
}

.theme-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--accent);
    outline: 3px solid var(--accent-soft);
}

.section {
    width: calc(100% - 24px);
    margin: 18px auto;
    padding: clamp(30px, 4vw, 64px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
    gap: clamp(24px, 5vw, 64px);
    align-items: center;
    min-height: calc(100vh - 120px);
}

.hero h1,
.page-hero h1 {
    max-width: 860px;
    margin: 0;
    font-size: clamp(3rem, 5.8vw, 6.4rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.hero-text,
.page-hero p {
    max-width: 740px;
    color: var(--muted);
    font-size: clamp(1.1rem, 1.55vw, 1.28rem);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--warm);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--accent-strong);
}

.btn-secondary {
    border-color: var(--line);
    background: var(--surface-strong);
    color: var(--text);
}

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

.stats-grid span,
.skills-grid article,
.contact-panel,
.contact-form-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.stats-grid strong {
    display: block;
    color: var(--accent-strong);
    font-size: 1.65rem;
    line-height: 1.1;
}

.profile-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.profile-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.profile-card div {
    padding: 20px;
}

.profile-card h2,
.project-card h3,
.timeline h3,
.skills-grid h3,
.blog-card h2,
.contact-panel h2,
.contact-form-card h2,
.detail-copy h2 {
    margin: 0 0 8px;
    line-height: 1.2;
}

.profile-card p,
.project-card p,
.timeline p,
.skills-grid p,
.blog-card p,
.rich-text p,
.detail-copy p,
.contact-section p {
    color: var(--muted);
}

.split-section,
.two-column,
.contact-section,
.contact-page-grid {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
    gap: clamp(22px, 4vw, 54px);
}

.section h2 {
    margin-top: 0;
    font-size: clamp(2.1rem, 3vw, 3.45rem);
    line-height: 1.1;
}

.rich-text p:first-child,
.contact-section p:first-of-type {
    margin-top: 0;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 22px;
}

.card-grid,
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.project-card,
.blog-card {
    overflow: hidden;
    display: grid;
    align-content: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.project-card img,
.blog-card img,
.detail-media img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--accent-soft);
}

.project-card div,
.blog-card div {
    padding: 18px;
}

.text-link {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
    text-decoration: underline;
}

.timeline {
    display: grid;
    gap: 14px;
}

.timeline article {
    padding: 0 0 18px 20px;
    border-left: 3px solid var(--accent);
}

.timeline span {
    color: var(--warm);
    font-weight: 800;
    font-size: 0.88rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.page-hero {
    min-height: 340px;
    display: grid;
    align-content: center;
}

.project-detail {
    display: grid;
    grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr);
    gap: clamp(22px, 4vw, 46px);
    align-items: center;
}

.project-detail.reverse .detail-media {
    order: 2;
}

.detail-media {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.tag-list span {
    padding: 6px 10px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.86rem;
    font-weight: 800;
}

.check-list {
    padding-left: 20px;
    color: var(--muted);
}

.check-list li + li {
    margin-top: 8px;
}

.compact-projects .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.blog-card {
    grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1fr);
}

.blog-card img {
    height: 100%;
    aspect-ratio: auto;
}

form {
    display: grid;
    gap: 10px;
}

label {
    color: var(--accent-strong);
    font-weight: 800;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 12px 14px;
}

textarea {
    resize: vertical;
    min-height: 140px;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 3px solid var(--accent-soft);
}

.contact-links,
.contact-methods {
    display: grid;
    gap: 10px;
}

.contact-links {
    margin-top: 20px;
}

.contact-links a,
.contact-methods a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.contact-links a:hover,
.contact-links a:focus-visible,
.contact-methods a:hover,
.contact-methods a:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.contact-methods img {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    object-fit: contain;
}

.site-footer {
    width: calc(100% - 24px);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 auto 18px;
    padding: 18px;
    color: var(--muted);
}

.site-footer a {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

@supports not (color: color-mix(in srgb, white, black)) {
    .site-header,
    .section {
        background: var(--surface);
    }
}

@media (max-width: 900px) {
    .site-header {
        grid-template-columns: 1fr auto;
    }

    .site-nav {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .hero,
    .split-section,
    .two-column,
    .contact-section,
    .contact-page-grid,
    .project-detail,
    .blog-card {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .profile-card {
        max-width: 420px;
    }

    .card-grid,
    .skills-grid,
    .compact-projects .skills-grid,
    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-detail.reverse .detail-media {
        order: 0;
    }

    .blog-card img {
        height: auto;
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 620px) {
    .site-header {
        width: calc(100% - 16px);
        margin-top: 8px;
        padding: 10px;
        gap: 10px;
    }

    .brand {
        min-width: 0;
    }

    .brand strong {
        font-size: 0.95rem;
    }

    .brand small {
        font-size: 0.78rem;
    }

    .site-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .site-nav a {
        white-space: nowrap;
    }

    .section {
        width: calc(100% - 16px);
        margin: 10px auto;
        padding: 20px;
    }

    .hero h1,
    .page-hero h1 {
        font-size: clamp(2.05rem, 13vw, 3.35rem);
    }

    .stats-grid,
    .card-grid,
    .skills-grid,
    .compact-projects .skills-grid,
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .button-row {
        display: grid;
    }

    .btn {
        width: 100%;
    }
}
