:root {
    color-scheme: light;
    --bg: #eef6ff;
    --bg-gradient-start: #f6fbff;
    --bg-gradient-end: #dcefff;
    --panel: rgba(255, 255, 255, 0.88);
    --surface: #f7fbff;
    --surface-strong: rgba(255, 255, 255, 0.94);
    --text: #10233f;
    --muted: #5f7896;
    --accent: #0f8bff;
    --accent-strong: #0a63c9;
    --border: rgba(15, 139, 255, 0.18);
    --shadow: rgba(14, 83, 173, 0.12);
    --shadow-strong: rgba(14, 83, 173, 0.2);
    --chip-bg: rgba(15, 139, 255, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.82);
    --hero-glow: rgba(15, 139, 255, 0.16);
}

body[data-theme="forest"] {
    color-scheme: light;
    --bg: #eef8f1;
    --bg-gradient-start: #f8fff9;
    --bg-gradient-end: #dceedd;
    --panel: rgba(255, 255, 255, 0.9);
    --surface: #f6fbf6;
    --surface-strong: rgba(255, 255, 255, 0.95);
    --text: #173223;
    --muted: #557261;
    --accent: #2f9e61;
    --accent-strong: #1f6f42;
    --border: rgba(47, 158, 97, 0.18);
    --shadow: rgba(31, 111, 66, 0.12);
    --shadow-strong: rgba(31, 111, 66, 0.2);
    --chip-bg: rgba(47, 158, 97, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.84);
    --hero-glow: rgba(47, 158, 97, 0.16);
}

body[data-theme="sunset"] {
    color-scheme: light;
    --bg: #fff3ec;
    --bg-gradient-start: #fff9f6;
    --bg-gradient-end: #ffe2d1;
    --panel: rgba(255, 255, 255, 0.9);
    --surface: #fff8f3;
    --surface-strong: rgba(255, 255, 255, 0.95);
    --text: #47261d;
    --muted: #8b6458;
    --accent: #ff7a45;
    --accent-strong: #d94f18;
    --border: rgba(255, 122, 69, 0.2);
    --shadow: rgba(217, 79, 24, 0.12);
    --shadow-strong: rgba(217, 79, 24, 0.22);
    --chip-bg: rgba(255, 122, 69, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.84);
    --hero-glow: rgba(255, 122, 69, 0.16);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1323;
    --bg-gradient-start: #131c31;
    --bg-gradient-end: #090e1b;
    --panel: rgba(15, 22, 40, 0.9);
    --surface: #17213a;
    --surface-strong: rgba(24, 34, 58, 0.96);
    --text: #e8eefb;
    --muted: #a8b4cb;
    --accent: #7ab8ff;
    --accent-strong: #b4d6ff;
    --border: rgba(122, 184, 255, 0.18);
    --shadow: rgba(2, 6, 23, 0.34);
    --shadow-strong: rgba(2, 6, 23, 0.46);
    --chip-bg: rgba(122, 184, 255, 0.12);
    --nav-bg: rgba(13, 19, 35, 0.88);
    --hero-glow: rgba(122, 184, 255, 0.18);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top, var(--hero-glow), transparent 28%),
        linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg) 55%, var(--bg-gradient-end) 100%);
    color: var(--text);
    padding: 24px;
    transition: background 0.3s ease, color 0.3s ease;
}

.card {
    width: min(960px, 100%);
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(14px);
    border-radius: 24px;
    padding: 32px 48px 48px;
    box-shadow: 0 24px 70px var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar {
    position: sticky;
    top: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 40px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 24px var(--shadow);
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.brand {
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav-toggle,
.theme-toggle,
.theme-select {
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 6px 18px var(--shadow);
}

.nav-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
    content: "";
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle span {
    margin-top: 6px;
    margin-bottom: 6px;
}

.nav-links,
.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav-actions {
    margin-left: auto;
}

.nav-links a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--accent-strong);
    background: var(--chip-bg);
}

.theme-select {
    min-height: 46px;
    border-radius: 14px;
    padding: 0 14px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.9fr);
    gap: 32px;
    align-items: center;
}

.eyebrow {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--accent);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.8rem);
    line-height: 1;
    margin: 0 0 16px;
}

h1 span {
    color: var(--accent);
}

p {
    margin: 0;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.7;
}

.intro {
    max-width: 680px;
    margin-bottom: 32px;
}

.actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 32px 0 24px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 22px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.button.primary {
    background: var(--accent-strong);
    color: #ffffff;
}

.button.secondary {
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface-strong);
}

.button:hover,
.button:focus-visible,
.social-links a:hover,
.social-links a:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px var(--shadow-strong);
}

.social-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.social-links a {
    padding: 10px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--accent-strong);
    background: var(--chip-bg);
    border: 1px solid var(--border);
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.material-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.3s ease;
}

.material-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 36px var(--shadow-strong);
}

.profile-panel {
    border-radius: 24px;
    padding: 28px;
    text-align: center;
}

.profile-image {
    width: 220px;
    max-width: 100%;
    aspect-ratio: 1;
    border-radius: 28px;
    display: block;
    margin: 0 auto 18px;
    object-fit: contain;
    object-position: center;
    padding: 12px;
    background: var(--surface-strong);
    box-shadow: 0 18px 40px var(--shadow-strong);
}

.profile-panel h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.profile-panel p {
    font-size: 1rem;
}

.section {
    margin-top: 48px;
}

.section h2 {
    margin: 0 0 14px;
    font-size: 1.8rem;
}

.section p {
    max-width: 720px;
}

.rich-copy {
    color: var(--muted);
}

.rich-copy p,
.rich-copy ul,
.rich-copy ol {
    margin: 0 0 14px;
}

.rich-copy ul,
.rich-copy ol {
    padding-left: 22px;
}

.rich-copy a {
    color: var(--accent-strong);
}

.highlights,
.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.highlights {
    padding: 0;
    margin: 0;
    list-style: none;
}

.highlights li,
.project-card,
.contact-box {
    border-radius: 18px;
    padding: 22px;
}

.highlights li {
    color: var(--text);
}

.project-card h3 {
    margin: 0 0 10px;
    font-size: 1.15rem;
}

.project-actions {
    margin-top: 18px;
}

.contact-box {
    margin-top: 22px;
}

.contact-box a {
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
}

footer {
    margin-top: 36px;
    color: var(--muted);
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.auth-shell {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(480px, 100%);
    padding: 32px;
    border-radius: 24px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.admin-stack {
    display: grid;
    gap: 12px;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.compact-row {
    justify-content: space-between;
}

.admin-projects {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.admin-user-card {
    display: grid;
    gap: 10px;
}

.inline-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-toggle input {
    width: auto;
    margin-top: 0;
}

.admin-users-form {
    display: grid;
    gap: 18px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.sortable-list {
    position: relative;
}

.sortable-item {
    position: relative;
}

.sortable-item.is-dragging {
    opacity: 0.6;
}

.sort-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--chip-bg);
    color: var(--accent-strong);
    cursor: grab;
    font-weight: 700;
}

.media-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
}

.media-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 14px;
    background: var(--surface-strong);
}

.media-meta {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 0.95rem;
}

.media-inline {
    margin-top: 14px;
}

.button-danger {
    border-color: rgba(220, 38, 38, 0.24);
    color: #b91c1c;
}

.upload-dropzone {
    position: relative;
    display: grid;
    gap: 10px;
    border-style: dashed;
    cursor: pointer;
}

.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-dropzone.is-dragover {
    border-color: var(--accent-strong);
    background: var(--chip-bg);
}

.preview-shell {
    padding: 24px;
    display: grid;
    gap: 16px;
}

.preview-projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.rich-editor {
    display: grid;
    gap: 10px;
}

.compact-editor {
    margin-top: 14px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-button {
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
}

.editor-surface {
    min-height: 180px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--text);
    line-height: 1.7;
}

.editor-surface:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.is-hidden {
    display: none;
}

@media (max-width: 860px) {
    .navbar {
        top: 8px;
        align-items: stretch;
        flex-direction: column;
    }

    .nav-toggle {
        display: inline-block;
    }

    .nav-links,
    .nav-actions {
        display: none;
        width: 100%;
    }

    .navbar.is-open .nav-links,
    .navbar.is-open .nav-actions {
        display: flex;
    }

    .navbar.is-open .nav-links {
        flex-direction: column;
        align-items: stretch;
        padding-top: 8px;
    }

    .navbar.is-open .nav-actions {
        margin-left: 0;
        padding-top: 8px;
        flex-direction: column;
        align-items: stretch;
    }

    .navbar.is-open .nav-toggle::before {
        transform: translateY(8px) rotate(45deg);
    }

    .navbar.is-open .nav-toggle span {
        opacity: 0;
    }

    .navbar.is-open .nav-toggle::after {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: 16px;
    }

    .card {
        padding: 24px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }
}
