/*
 * Portofolio Fuad — satu berkas gaya untuk halaman umum dan admin.
 *
 * Selalu terang, apa pun pengaturan perangkatnya: portofolio dibaca orang
 * lain, dan tampilannya harus sama di layar siapa pun.
 *
 * Tata letak halaman umum: kategori sebagai panel tetap di kiri, isi
 * halaman di kanannya. Di ponsel panel itu digeser masuk lewat tombol ☰.
 */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --border: #e5e9f2;
    --border-strong: #d3dae8;
    --heading: #1b2540;
    --text: #334155;
    --muted: #6b7a90;
    --accent: #3b5bdb;
    --accent-hover: #3049c0;
    --accent-soft: #edf2ff;
    --accent-text: #3451c6;
    --danger: #d9304f;
    --danger-soft: #fff0f3;
    --ok: #237a3b;
    --ok-soft: #e8f7ec;
    --warn: #b35c00;
    --warn-soft: #fff4e2;
    --sidebar: 264px;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.05);
    --shadow-md: 0 6px 20px rgb(16 24 40 / 0.07);
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    color-scheme: light;
}

/* Warna per kategori; nomornya dari toneOf() di assets/js/ui.js. */
[data-tone="1"] { --tone-bg: #e8f0ff; --tone-fg: #2358c9; }
[data-tone="2"] { --tone-bg: #f1ebff; --tone-fg: #6a3fc8; }
[data-tone="3"] { --tone-bg: #e2f6f2; --tone-fg: #0f7768; }
[data-tone="4"] { --tone-bg: #e8f7ec; --tone-fg: #2b8141; }
[data-tone="5"] { --tone-bg: #fff2da; --tone-fg: #a95a06; }
[data-tone="6"] { --tone-bg: #ffe9ef; --tone-fg: #bf2a5c; }
[data-tone="7"] { --tone-bg: #e1f5fa; --tone-fg: #0b6f84; }
[data-tone="8"] { --tone-bg: #ffece2; --tone-fg: #bd4a12; }

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-text);
}

h1,
h2 {
    color: var(--heading);
}

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

.muted {
    color: var(--muted);
}

[hidden] {
    display: none !important;
}

/* ------------------------------------------------------------- tombol */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--heading);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.button:hover {
    border-color: #b9c3d6;
    background: var(--surface-soft);
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.button--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgb(59 91 219 / 0.25), 0 4px 10px rgb(59 91 219 / 0.18);
}

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

.button--danger {
    color: var(--danger);
}

.button--danger:hover {
    border-color: #f3b4c2;
    background: var(--danger-soft);
}

.button--small {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--heading);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder,
textarea::placeholder {
    color: #97a3b6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(59 91 219 / 0.15);
}

.button:focus-visible,
.category:focus-visible,
.project__row:focus-visible,
.link:focus-visible,
.menu-button:focus-visible,
.sidebar__close:focus-visible {
    outline: 3px solid rgb(59 91 219 / 0.35);
    outline-offset: 2px;
}

/* --------------------------------------------------------- kerangka */

.shell {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex: none;
    flex-direction: column;
    width: var(--sidebar);
    height: 100vh;
    padding: 20px 14px 16px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar:focus {
    outline: none;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 6px 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--heading);
    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4c6ef5, #3b5bdb 55%, #2f47b8);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 4px 10px rgb(59 91 219 / 0.3);
}

.brand__name {
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand__badge {
    margin-left: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 700;
    vertical-align: 2px;
}

.sidebar__title {
    margin: 0 8px 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.categories {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 8px;
}

.category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.category:hover {
    background: var(--surface-soft);
    color: var(--heading);
}

.category__dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tone-fg, var(--accent));
}

.category__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category__count {
    min-width: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f1f4f9;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.category--active {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 700;
}

.category--active .category__count {
    background: var(--accent);
    color: #fff;
}

.sidebar__github {
    margin-top: auto;
    padding: 12px 12px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.sidebar__github:hover {
    color: var(--accent-text);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ----------------------------------------------------------- bilah atas */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: rgb(255 255 255 / 0.9);
    backdrop-filter: saturate(160%) blur(10px);
}

.topbar__title {
    color: var(--heading);
    font-size: 15px;
    font-weight: 700;
}

.menu-button,
.sidebar__close {
    display: none;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--heading);
    cursor: pointer;
}

.menu-button svg {
    width: 20px;
    height: 20px;
}

.sidebar__close {
    font-size: 22px;
    line-height: 1;
}

.login,
.admin-links {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.login input {
    width: 170px;
}

.login__error {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    margin: 0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* -------------------------------------------------------- kepala halaman */

.page-head {
    padding: 36px 32px 28px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(600px 240px at 8% 0%, rgb(76 110 245 / 0.1), transparent 70%),
        radial-gradient(520px 220px at 95% 100%, rgb(18 184 134 / 0.09), transparent 70%),
        linear-gradient(180deg, #f3f6ff 0%, #f8faff 100%);
}

.page-head__eyebrow {
    margin: 0 0 6px;
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-head__title {
    margin: 0;
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.page-head__tagline {
    max-width: 62ch;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.page-head__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.stat {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.85);
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.stat strong {
    color: var(--heading);
    font-weight: 700;
}

.search {
    position: relative;
    display: block;
}

.search--page {
    max-width: 560px;
    margin-top: 22px;
}

.search--page input {
    min-height: 50px;
    padding-left: 46px;
    border-color: var(--border);
    border-radius: 14px;
    font-size: 15px;
    box-shadow: var(--shadow-md);
}

.search__icon {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 18px;
    height: 18px;
    color: #8a96aa;
    transform: translateY(-50%);
    pointer-events: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 2px 6px 2px 10px;
    border-radius: 999px;
    background: var(--tone-bg, var(--accent-soft));
    color: var(--tone-fg, var(--accent-text));
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.filter-chip span {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.7);
    font-size: 14px;
    line-height: 1;
}

/* -------------------------------------------------------------- proyek */

.main {
    flex: 1;
    padding: 24px 32px 40px;
}

.summary {
    display: flex;
    align-items: center;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.projects {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.project + .project {
    border-top: 1px solid var(--border);
}

.project__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    width: 100%;
    padding: 16px 20px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.project__row:hover {
    background: var(--surface-soft);
}

.project__row--static {
    cursor: default;
}

.project__row--static:hover {
    background: none;
}

.project__name {
    color: var(--heading);
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.005em;
}

.project__meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.project__chevron {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f4f9;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s, background 0.15s, color 0.15s;
}

.project__row:hover .project__chevron {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.project--open .project__chevron {
    background: var(--accent);
    color: #fff;
    transform: rotate(90deg);
}

.project--open {
    box-shadow: inset 3px 0 0 var(--accent);
}

.project--open .project__row {
    background: var(--surface-soft);
}

.project--admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding-right: 16px;
}

.project--admin .project__row {
    flex: 1 1 320px;
}

.project__actions {
    display: flex;
    gap: 6px;
    padding-left: 16px;
}

.tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--tone-bg, var(--accent-soft));
    color: var(--tone-fg, var(--accent-text));
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status--selesai {
    background: var(--ok-soft);
    color: var(--ok);
}

.status--berjalan {
    background: var(--warn-soft);
    color: var(--warn);
}

.detail {
    padding: 4px 20px 22px;
    background: var(--surface-soft);
}

.detail__text {
    max-width: 72ch;
    margin: 0 0 16px;
    color: var(--text);
    font-size: 15px;
    white-space: pre-line;
}

.detail__meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 20px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: 14px;
}

.detail__meta dt {
    color: var(--muted);
    font-weight: 500;
}

.detail__meta dd {
    margin: 0;
    color: var(--heading);
    font-weight: 600;
}

.detail__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.empty {
    padding: 48px 20px;
    color: var(--muted);
    text-align: center;
}

.notice {
    margin: 16px;
    padding: 14px 16px;
    border: 1px solid #ffd8a8;
    border-radius: 12px;
    background: var(--warn-soft);
    color: #8a4b00;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 32px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.footer a {
    font-weight: 600;
    text-decoration: none;
}

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(27 37 64 / 0.35);
    backdrop-filter: blur(2px);
}

/* --------------------------------------------------------------- admin */

.admin {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.toolbar .search {
    flex: 1 1 240px;
}

.dialog {
    width: min(580px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 60px rgb(16 24 40 / 0.2);
}

.dialog--wide {
    width: min(740px, calc(100vw - 32px));
}

.dialog::backdrop {
    background: rgb(27 37 64 / 0.4);
    backdrop-filter: blur(3px);
}

.dialog__title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 26px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--heading);
    font-size: 14px;
    font-weight: 600;
}

.field small {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form__error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 14px;
    font-weight: 600;
}

.form__error:empty {
    display: none;
}

.dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.repos {
    max-height: 55vh;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.repos:empty {
    display: none;
}

.repo {
    padding: 12px 14px;
}

.repo:hover {
    background: var(--surface-soft);
}

.repo + .repo {
    border-top: 1px solid var(--border);
}

.repo label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.repo input {
    width: 16px;
    min-height: 16px;
    accent-color: var(--accent);
    box-shadow: none;
}

.repo__name {
    color: var(--heading);
    font-weight: 700;
}

.repo__text {
    margin: 2px 0 0 24px;
    font-size: 13px;
}

.repo--added {
    opacity: 0.55;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--ok);
    border-radius: 12px;
    background: var(--surface);
    color: var(--heading);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.toast--error {
    border-left-color: var(--danger);
    color: var(--danger);
}

/* --------------------------------------------------- layar sedang & kecil */

@media (max-width: 1000px) {
    .topbar,
    .page-head,
    .main,
    .footer {
        padding-right: 20px;
        padding-left: 20px;
    }
}

@media (max-width: 860px) {
    .menu-button,
    .sidebar__close {
        display: grid;
    }

    /* Panel kategori digeser masuk dari kiri. */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(290px, 84vw);
        height: auto;
        border-radius: 0 18px 18px 0;
        box-shadow: 0 0 40px rgb(16 24 40 / 0.18);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0s linear 0.25s;
    }

    .sidebar-open .sidebar {
        transform: none;
        visibility: visible;
        transition: transform 0.25s ease;
    }

    /* Halaman di belakang panel tidak ikut tergulir. */
    .sidebar-open {
        overflow: hidden;
    }

    .category {
        padding: 11px 12px;
        font-size: 15px;
    }

    .topbar {
        min-height: 60px;
        padding: 10px 16px;
    }

    .page-head {
        padding: 24px 16px 20px;
    }

    .main {
        padding: 18px 16px 32px;
    }

    .footer {
        padding: 16px;
    }

    .login input {
        width: 120px;
    }

    .project__row {
        padding: 14px 16px;
    }

    .project__meta {
        margin-left: 0;
    }

    .project__chevron {
        margin-left: auto;
    }

    .detail {
        padding: 4px 16px 18px;
    }

    .project__actions {
        padding: 0 16px 14px;
    }

    .admin {
        padding: 20px 16px 32px;
    }

    .form {
        padding: 20px;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .admin-links .button {
        min-height: 34px;
        padding: 0 12px;
        font-size: 13px;
    }
}

/* Ponsel sempit: judul di bilah atas disembunyikan supaya kolom password
   dan tombol Login tetap muat. */
@media (max-width: 480px) {
    .topbar__title {
        display: none;
    }

    .brand__name:has(.brand__badge) #brand {
        display: none;
    }
}
