:root {
    --bg: #040404;
    --bg-soft: #0b0b0a;
    --surface: #10100e;
    --surface-2: #181611;
    --ink: #f0e4cf;
    --muted: #b8a58d;
    --faint: #756956;
    --gold: #b88b43;
    --wine: #4f1923;
    --clay: #8f4939;
    --jade: #4aa086;
    --line: rgba(200, 161, 90, .22);
    --shadow: 0 28px 90px rgba(0, 0, 0, .58);
    --serif: Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 12% 0%, rgba(79, 25, 35, .34), transparent 28rem),
        radial-gradient(circle at 92% 10%, rgba(74, 160, 134, .09), transparent 24rem),
        linear-gradient(145deg, #040404 0%, #0b0908 62%, #120d0a 100%);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.6;
}

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

a:hover { color: var(--gold); }

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

button,
.button,
input,
textarea {
    min-height: 44px;
    border-radius: 8px;
    font: inherit;
}

button,
.button {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid rgba(200, 161, 90, .42);
    background: var(--gold);
    color: #11100d;
    padding: .75rem 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    background: #d8b873;
    color: #11100d;
}

.secondary {
    background: transparent;
    color: var(--ink);
}

.secondary:hover {
    background: rgba(200, 161, 90, .1);
    color: var(--ink);
}

.danger {
    background: transparent;
    border-color: rgba(173, 102, 80, .55);
    color: #f0c2b5;
}

.danger:hover {
    background: rgba(118, 47, 58, .45);
    color: var(--ink);
}

:focus-visible {
    outline: 3px solid rgba(74, 160, 134, .88);
    outline-offset: 3px;
}

.public-page,
.admin-page {
    animation: rise .45s ease both;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav.top {
    padding: 1.5rem clamp(1rem, 5vw, 4.5rem);
}

.brand {
    color: var(--gold);
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.link {
    color: var(--muted);
    font-size: .95rem;
}

.kicker {
    margin: 0 0 .75rem;
    color: var(--jade);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.hero {
    min-height: 54vh;
    padding: 1.75rem clamp(1rem, 5vw, 4.5rem) 3.5rem;
    border-bottom: 1px solid var(--line);
}

.hero-copy {
    max-width: 64rem;
    padding-top: clamp(4rem, 12vw, 8rem);
}

.hero h1,
.article h1 {
    max-width: 10ch;
    margin: 0 0 1.25rem;
    font-family: var(--serif);
    font-size: clamp(3.25rem, 9vw, 7rem);
    font-weight: 700;
    line-height: .92;
}

.hero p,
.summary,
.empty,
.note-card p {
    color: var(--muted);
}

.hero-copy > p:last-child {
    max-width: 48rem;
    font-size: 1.12rem;
}

.presentation {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
    gap: clamp(1rem, 4vw, 3rem);
    width: min(1180px, calc(100% - 2rem));
    margin: -2rem auto 0;
    padding: clamp(1.2rem, 4vw, 2rem);
    border: 1px solid rgba(184, 139, 67, .28);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(79, 25, 35, .55), transparent 58%),
        linear-gradient(180deg, rgba(240, 228, 207, .055), transparent),
        #0a0908;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .62);
    overflow: hidden;
}

.presentation::before {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 1px solid rgba(240, 228, 207, .16);
    background: linear-gradient(90deg, transparent, rgba(184, 139, 67, .16), transparent);
    transform: translateX(-100%);
    animation: glint 7s ease-in-out infinite;
    pointer-events: none;
}

.presentation h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: .98;
}

.presentation > p {
    align-self: center;
    margin: 0;
    color: #d8c5a8;
    font-family: var(--serif);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.72;
}

.presentation-tags {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.presentation-tags span {
    border: 1px solid rgba(184, 139, 67, .26);
    border-radius: 999px;
    background: rgba(0, 0, 0, .22);
    color: var(--muted);
    padding: .45rem .75rem;
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.collage {
    display: grid;
    grid-auto-flow: dense;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(.9rem, 2vw, 1.35rem);
    padding: clamp(1rem, 5vw, 4.5rem);
}

.note-card {
    position: relative;
    overflow: hidden;
    grid-column: span 2;
    border: 1px solid rgba(184, 139, 67, .2);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(240, 228, 207, .055), transparent 42%),
        linear-gradient(145deg, rgba(79, 25, 35, .28), transparent 64%),
        var(--surface);
    box-shadow: var(--shadow);
    transition: transform .2s ease, border-color .2s ease, filter .2s ease, box-shadow .2s ease;
}

.note-card:hover,
.note-card:focus-within {
    transform: translateY(-5px);
    border-color: rgba(200, 161, 90, .46);
    filter: brightness(1.04);
    box-shadow: 0 32px 100px rgba(0, 0, 0, .68);
}

.note-card:nth-child(5n + 1) {
    grid-column: span 3;
}

.note-card:nth-child(7n + 3) {
    grid-column: span 4;
}

.note-card:nth-child(6n + 4) {
    margin-top: 2rem;
}

.note-card-media {
    display: block;
    overflow: hidden;
    background: #080807;
    color: var(--faint);
}

.note-card img,
.note-card-media {
    width: 100%;
    aspect-ratio: 5 / 4;
    object-fit: cover;
    filter: grayscale(.18) saturate(.72) contrast(1.18);
}

.note-card img {
    transition: transform .35s ease, filter .35s ease;
}

.note-card:hover img,
.note-card:focus-within img {
    transform: scale(1.035);
    filter: grayscale(.08) saturate(.86) contrast(1.2);
}

.note-card:nth-child(5n + 1) .note-card-media,
.note-card:nth-child(5n + 1) img {
    aspect-ratio: 16 / 9;
}

.note-card-copy {
    display: grid;
    gap: .75rem;
    padding: clamp(1rem, 2.4vw, 1.55rem);
}

.note-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    color: var(--faint);
    font-size: .78rem;
}

.note-card-meta {
    margin: 0;
    color: var(--clay);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.note-card h2,
.preview-note h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    line-height: 1;
}

.note-card p {
    margin: 0;
}

.read-link {
    justify-self: start;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: var(--gold);
    font-size: .9rem;
    font-weight: 800;
}

.read-link::after {
    content: "->";
    margin-left: .5rem;
    transition: transform .18s ease;
}

.note-card:hover .read-link::after,
.note-card:focus-within .read-link::after {
    transform: translateX(4px);
}

.article {
    width: min(980px, calc(100% - 2rem));
    margin: 0 auto 5rem;
}

.cover {
    width: 100%;
    max-height: 62vh;
    margin: 1rem 0 2rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    filter: grayscale(.12) saturate(.78) contrast(1.12);
}

.article-copy {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) 0;
}

.article .kicker { margin-top: 2rem; }

.summary {
    max-width: 58ch;
    color: #cbb99e;
    font-size: clamp(1.15rem, 2vw, 1.35rem);
    line-height: 1.7;
}

.markdown {
    max-width: 68ch;
    color: #eadcc5;
    font-family: var(--serif);
    font-size: clamp(1.16rem, 1.5vw, 1.32rem);
    line-height: 1.86;
}

.markdown p {
    margin: 0 0 1.35rem;
}

.markdown h1,
.markdown h2,
.markdown h3 {
    color: var(--gold);
    font-family: var(--serif);
    line-height: 1.1;
}

.markdown blockquote {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 4px solid var(--clay);
    color: var(--muted);
}

.admin-page {
    min-height: 100vh;
    padding: 2rem 1rem;
}

.admin-page:not(.editor-page) {
    display: grid;
    place-items: start center;
}

.panel {
    width: min(960px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(245, 239, 226, .045), transparent 12rem), var(--surface);
    box-shadow: var(--shadow);
    padding: clamp(1.1rem, 4vw, 2rem);
}

.login {
    max-width: 420px;
}

.panel h1 {
    margin: 0 0 1.25rem;
    color: var(--gold);
    font-family: var(--serif);
    font-size: clamp(2.25rem, 7vw, 4rem);
    line-height: 1;
}

.panel h2 {
    margin: 0 0 1rem;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.5rem;
}

label {
    display: block;
    margin: 1rem 0 .4rem;
    color: var(--muted);
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(200, 161, 90, .25);
    background: #0b0c0b;
    color: var(--ink);
    padding: .75rem .85rem;
}

textarea {
    resize: vertical;
}

input[type="file"] {
    padding: .65rem;
}

.field-meta {
    margin: .35rem 0 0;
    color: var(--faint);
    font-size: .86rem;
}

.field-group {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(200, 161, 90, .16);
}

.admin-head,
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.actions {
    justify-content: flex-start;
    margin-top: 1.25rem;
}

.actions form {
    margin: 0;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    min-height: 44px;
    cursor: pointer;
}

.switch input {
    width: 1.2rem;
    min-height: 1.2rem;
    accent-color: var(--jade);
}

table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
}

th,
td {
    border-top: 1px solid rgba(200, 161, 90, .16);
    padding: .85rem .45rem;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--faint);
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.status {
    display: inline-flex;
    border: 1px solid rgba(74, 160, 134, .35);
    border-radius: 999px;
    color: #bce8da;
    padding: .22rem .55rem;
    font-size: .82rem;
}

.thumb,
.preview-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(200, 161, 90, .2);
    border-radius: 8px;
    object-fit: cover;
}

.thumb {
    max-width: 14rem;
    margin-top: .75rem;
}

.empty-preview {
    display: grid;
    place-items: center;
    background: rgba(245, 239, 226, .04);
    color: var(--faint);
}

.error {
    color: #ffb6a8;
}

.editor-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, .75fr);
    gap: 1rem;
    width: min(1280px, 100%);
    margin: 0 auto;
}

.editor-form,
.live-panel {
    align-self: start;
}

.live-panel {
    position: sticky;
    top: 1rem;
}

.preview-note {
    display: grid;
    gap: 1rem;
}

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

.preview-body p {
    margin: 0 0 1rem;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glint {
    0%, 38%, 100% {
        transform: translateX(-100%);
    }
    58% {
        transform: translateX(100%);
    }
}

@media (max-width: 820px) {
    .hero {
        min-height: auto;
    }

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

    .presentation {
        grid-template-columns: 1fr;
        margin-top: -1rem;
    }

    .note-card,
    .note-card:nth-child(5n + 1),
    .note-card:nth-child(7n + 3) {
        grid-column: span 1;
    }

    .note-card:nth-child(6n + 4) {
        margin-top: 0;
    }

    .editor-shell {
        grid-template-columns: 1fr;
    }

    .live-panel {
        position: static;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    tr {
        padding: .75rem 0;
        border-top: 1px solid rgba(200, 161, 90, .16);
    }

    td {
        border: 0;
        padding: .3rem 0;
    }
}

@media (max-width: 560px) {
    .hero h1,
    .article h1 {
        font-size: clamp(2.75rem, 17vw, 4.3rem);
    }

    .collage {
        grid-template-columns: 1fr;
    }
}

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