:root {
    --bg: #0a0d16;
    --surface: #111625;
    --surface-2: #171d2f;
    --surface-3: #202840;
    --text: #f6f7fb;
    --muted: #aeb7cc;
    --line: rgba(255,255,255,.10);
    --primary: #7c5cff;
    --primary-2: #4fc3ff;
    --danger: #ff667e;
    --success: #4fd1a1;
    --warning: #ffc857;
    --radius: 22px;
    --shadow: 0 24px 70px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 10% 0%, rgba(124,92,255,.20), transparent 34rem),
        radial-gradient(circle at 100% 20%, rgba(79,195,255,.12), transparent 32rem),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }

.container {
    width: min(1160px, calc(100% - 36px));
    margin-inline: auto;
}

.site-header,
.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(10,13,22,.80);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
}

.nav {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 28px rgba(124,92,255,.35);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--muted);
}

.nav-links > a:hover { color: var(--text); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #6d77ff);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(124,92,255,.26);
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.button:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(124,92,255,.35); }
.button-small { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: .93rem; }
.button-ghost { background: transparent; border-color: var(--line); color: var(--text); box-shadow: none; }
.button-ghost:hover { background: rgba(255,255,255,.06); box-shadow: none; }
.button-full { width: 100%; }

.hero {
    padding: 94px 0 64px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 70px;
    align-items: center;
}

.eyebrow {
    display: inline-block;
    color: #9f8cff;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .18em;
    margin-bottom: 12px;
}

.hero h1,
.project-detail-hero h1,
.admin-heading h1 {
    margin: 0;
    font-size: clamp(2.8rem, 8vw, 5.7rem);
    line-height: .98;
    letter-spacing: -.06em;
}

.hero h1 span {
    background: linear-gradient(90deg, #a58fff, #62ceff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    max-width: 700px;
    margin: 25px 0 32px;
    font-size: 1.18rem;
    color: var(--muted);
}

.hero-card {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 34px;
    background: linear-gradient(145deg, rgba(124,92,255,.22), rgba(79,195,255,.08)), var(--surface);
    box-shadow: var(--shadow);
    transform: rotate(2deg);
}

.hero-card-icon {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 26px;
    background: rgba(255,255,255,.08);
    font-size: 2rem;
    font-weight: 900;
}

.hero-card strong { font-size: 3.5rem; margin-top: 16px; line-height: 1; }
.hero-card span:last-child { color: var(--muted); margin-top: 8px; }

.content-section { padding: 54px 0 100px; }

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.section-heading h2,
.panel-heading h2,
.form-card h2 {
    margin: 0;
    letter-spacing: -.035em;
}

.section-heading h2 { font-size: clamp(2rem, 5vw, 3.2rem); }

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 260px auto auto;
    gap: 12px;
    margin-bottom: 30px;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.045);
    color: var(--text);
    outline: none;
    padding: 13px 15px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

select option { background: #151a29; color: var(--text); }

input:focus, textarea:focus, select:focus {
    border-color: rgba(124,92,255,.75);
    box-shadow: 0 0 0 4px rgba(124,92,255,.13);
    background: rgba(255,255,255,.065);
}

textarea { resize: vertical; }

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

.project-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(17,22,37,.88);
    box-shadow: 0 18px 45px rgba(0,0,0,.18);
    transition: transform .22s ease, border-color .22s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(124,92,255,.48);
}

.project-image {
    aspect-ratio: 16/10;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(124,92,255,.26), rgba(79,195,255,.10));
}

.project-image img { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { font-size: 2.2rem; font-weight: 900; color: rgba(255,255,255,.62); }

.project-card-body { padding: 22px; }
.project-card h3 { margin: 14px 0 8px; font-size: 1.35rem; line-height: 1.25; }
.project-card h3 a:hover { color: #b6a8ff; }
.project-card p { color: var(--muted); margin: 0 0 18px; }

.category-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124,92,255,.16);
    color: #c5baff;
    font-size: .78rem;
    font-weight: 800;
}

.text-link { color: #9f8cff; font-weight: 800; }
.centered { display: block; text-align: center; }

.empty-state {
    padding: 60px 24px;
    text-align: center;
    border: 1px dashed rgba(255,255,255,.18);
    border-radius: var(--radius);
    background: rgba(255,255,255,.025);
}

.empty-state.compact { padding: 36px 24px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--muted); }
.empty-icon { font-size: 2.5rem; }

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.footer-inner {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.project-detail-hero {
    padding: 80px 0 60px;
    border-bottom: 1px solid var(--line);
}

.project-detail-hero h1 {
    max-width: 950px;
    margin-top: 18px;
    font-size: clamp(2.5rem, 7vw, 5rem);
}

.back-link {
    display: inline-flex;
    color: var(--muted);
    margin-bottom: 24px;
}
.back-link:hover { color: var(--text); }

.lead {
    max-width: 780px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.2rem;
}

.project-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 34px;
    padding-top: 46px;
    padding-bottom: 100px;
}

.detail-content,
.detail-sidebar { min-width: 0; }

.detail-image {
    width: 100%;
    max-height: 620px;
    object-fit: cover;
    border-radius: 26px;
    border: 1px solid var(--line);
    margin-bottom: 32px;
}

.prose {
    white-space: normal;
    color: #d8deeb;
    font-size: 1.06rem;
}

.info-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    margin-bottom: 14px;
}

.info-card strong { display: block; margin-top: 5px; }
.muted-label { color: var(--muted); font-size: .82rem; }

.login-body {
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-shell { width: min(430px, 100%); }
.login-brand { margin-bottom: 24px; }

.login-card {
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(17,22,37,.94);
    box-shadow: var(--shadow);
}

.login-card h1 { margin: 0; font-size: 2.35rem; letter-spacing: -.045em; }
.login-card > p { color: var(--muted); margin: 10px 0 24px; }
.login-card label { display: grid; gap: 8px; margin-bottom: 18px; }
.login-card label span { font-weight: 700; }

.admin-main { padding-top: 40px; padding-bottom: 100px; }

.admin-heading {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    align-items: end;
    margin-bottom: 32px;
}

.admin-heading h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); }
.admin-heading p { color: var(--muted); margin: 12px 0 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.stat-card strong { display: block; font-size: 2rem; line-height: 1; }
.stat-card span { display: block; color: var(--muted); margin-top: 9px; }

.admin-panel,
.form-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(17,22,37,.90);
    box-shadow: 0 18px 45px rgba(0,0,0,.12);
}

.admin-panel { margin-top: 22px; overflow: hidden; }

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 790px; }
th, td { padding: 16px 20px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:last-child td { border-bottom: 0; }

.table-project { display: flex; align-items: center; gap: 13px; }
.table-project img, .mini-placeholder {
    width: 50px; height: 50px; border-radius: 12px; flex: 0 0 50px;
}
.table-project img { object-fit: cover; }
.mini-placeholder {
    display: grid; place-items: center;
    background: rgba(124,92,255,.15);
    color: #aa9aff; font-weight: 900;
}
.table-project strong { display: block; }
.table-project small { display: block; color: var(--muted); max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}
.status-published { background: rgba(79,209,161,.14); color: #72e5ba; }
.status-draft { background: rgba(255,200,87,.13); color: #ffd67e; }

.row-actions { display: flex; align-items: center; gap: 14px; }
.row-actions a, .link-button { color: #a99bff; font-weight: 750; font-size: .9rem; }
.link-button { border: 0; background: none; padding: 0; cursor: pointer; }
.row-actions .danger { color: var(--danger); }

.category-admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px;
}

.category-admin-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.025);
}

.category-admin-card h3 { margin: 0; }
.category-admin-card p { margin: 5px 0; color: var(--muted); font-size: .9rem; }
.category-admin-card span { color: #9f8cff; font-size: .82rem; }

.alert {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 14px;
    border: 1px solid;
    transition: opacity .35s ease, transform .35s ease;
}
.alert-success { color: #81e8c1; background: rgba(79,209,161,.10); border-color: rgba(79,209,161,.25); }
.alert-error { color: #ff9aad; background: rgba(255,102,126,.10); border-color: rgba(255,102,126,.25); }
.alert-hide { opacity: 0; transform: translateY(-6px); pointer-events: none; }

.admin-form { margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
.form-main, .form-sidebar { display: grid; gap: 20px; align-content: start; }
.form-card { padding: 24px; }
.form-card h2 { margin-bottom: 20px; font-size: 1.2rem; }
.form-card label { display: grid; gap: 8px; margin-bottom: 17px; }
.form-card label:last-child { margin-bottom: 0; }
.form-card label > span { font-weight: 750; }
.form-card small { color: var(--muted); }

.checkbox { grid-template-columns: auto 1fr; align-items: center; }
.checkbox input { width: auto; }

.image-preview {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--line);
}

.form-submit-bar {
    position: sticky;
    bottom: 14px;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(17,22,37,.90);
    backdrop-filter: blur(18px);
}

.narrow-heading, .narrow-form { max-width: 720px; }
.narrow-form { padding: 28px; }
.form-submit-inline { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

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

@media (max-width: 920px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-card { min-height: 220px; transform: none; }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters { grid-template-columns: 1fr 1fr; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-heading { align-items: start; flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .container { width: min(100% - 24px, 1160px); }
    .nav { min-height: 68px; }
    .nav-links > a:first-child { display: none; }
    .brand > span:last-child { font-size: .92rem; }
    .hero { padding-top: 62px; }
    .project-grid, .category-admin-grid { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
    .filters .button { width: 100%; }
    .footer-inner { flex-direction: column; justify-content: center; text-align: center; }
    .detail-sidebar { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .admin-actions { width: 100%; }
    .admin-actions .button { flex: 1; }
    .category-admin-card { align-items: flex-start; flex-direction: column; }
    .form-submit-bar { position: static; }
}
