@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@400;500;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 15% 10%, color-mix(in oklab, var(--accent) 15%, transparent), transparent 20%),
        radial-gradient(circle at 90% 90%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 25%),
        var(--bg-image),
        var(--bg);
    background-repeat: no-repeat, no-repeat, repeat, no-repeat;
    background-size: cover, cover, auto, auto;
    background-attachment: fixed, fixed, fixed, fixed;
    color: var(--font-page-color);
    font-family: var(--font-page);
    line-height: 1.6;
}

.wrap {
    flex-wrap: wrap;
}

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

a:hover {
    text-decoration: underline;
}

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

.site-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
    z-index: 20;
}

.brand {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--title-site-color);
    padding: 1rem 0;
    display: inline-block;
}

.brand-logo {
    display: block;
    max-height: 46px;
    width: auto;
}

.hero {
    margin: 2.5rem 0 2rem;
}

.hero h1,
h1,
h2 {
    font-family: 'Fraunces', serif;
    line-height: 1.2;
    margin: 0;
    color: var(--title-page-color);
}

.card h1,
.card h2 {
    color: var(--title-card-color);
}

.hero p,
.muted {
    color: var(--muted);
}

.break-all {
    word-break: break-all;
}

.card {
    background: var(--surface);
    border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: 0 8px 30px color-mix(in oklab, var(--text) 8%, transparent);
    font-family: var(--font-box);
    color: var(--font-main-color);
}

.stack-sm > * + * { margin-top: 0.65rem; }
.stack-md > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }

.row {
    display: flex;
}

.row.center {
    align-items: center;
}

.row.space-between {
    justify-content: space-between;
}

.gap-sm {
    gap: 0.6rem;
}

.downloads-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plain-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.downloads-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.download-token-buttons {
    flex-wrap: wrap;
}

.download-select-list {
    max-height: 220px;
    overflow: auto;
    padding-right: 0.4rem;
}

.prose-download-link {
    margin: 0.9rem 0;
}

.markdown-preview-wrap {
    border: 1px solid color-mix(in oklab, var(--text) 14%, transparent);
    border-radius: calc(var(--radius) * 0.6);
    background: color-mix(in oklab, var(--surface) 85%, black 15%);
    padding: 0.8rem;
}

.markdown-preview {
    min-height: 140px;
    line-height: 1.55;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
    margin: 0.6rem 0 0.35rem;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview blockquote {
    margin: 0.45rem 0;
}

.markdown-preview blockquote {
    border-left: 3px solid color-mix(in oklab, var(--accent) 60%, transparent);
    padding-left: 0.65rem;
    color: var(--muted);
}

.markdown-preview code {
    background: color-mix(in oklab, var(--text) 14%, transparent);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}
.html-source-box {
    margin: 0;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.visual-editor {
    min-height: 16rem;
    padding: 0.8rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in oklab, var(--text) 20%, transparent);
    background: color-mix(in oklab, var(--surface) 90%, black 10%);
    color: var(--font-box-color);
    line-height: 1.5;
}

.visual-editor:focus {
    outline: 2px solid color-mix(in oklab, var(--accent) 60%, transparent);
    outline-offset: 1px;
}

main.container {
    padding: 1.4rem 0 3rem;
}

.button,
button {
    border: 0;
    border-radius: calc(var(--radius) * 0.7);
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: var(--font-box);
}

.button.ghost {
    background: color-mix(in oklab, var(--text) 10%, transparent);
    color: var(--text);
}

input,
textarea,
select {
    width: 100%;
    background: #fff;
    color: var(--font-box-color);
    border: 1px solid color-mix(in oklab, var(--text) 18%, transparent);
    border-radius: calc(var(--radius) * 0.6);
    padding: 0.55rem 0.7rem;
    font-family: var(--font-box);
    font-size: 1rem;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    flex: 0 0 auto;
}

label {
    font-weight: 600;
    color: var(--label-color);
}

label:not(.row) {
    display: block;
    padding-top: 10px;
    padding-bottom: 3px;
}

.alert {
    border-left: 4px solid #b91c1c;
    background: #fee2e2;
    color: #7f1d1d;
    padding: 0.6rem;
    border-radius: 8px;
}

.site-logo-preview {
    display: block;
    max-width: 260px;
    max-height: 110px;
    width: auto;
    height: auto;
    border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
    border-radius: calc(var(--radius) * 0.5);
    padding: 0.25rem;
    background: color-mix(in oklab, var(--surface) 90%, black 10%);
}

.theme-bg-preview {
    display: block;
    width: min(100%, 540px);
    max-height: 180px;
    object-fit: cover;
    border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
    border-radius: calc(var(--radius) * 0.5);
}

.auth-wrap {
    min-height: 65vh;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(460px, 100%);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.55rem;
    border-bottom: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
}

.pill {
    text-transform: capitalize;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--accent) 18%, white);
    color: color-mix(in oklab, var(--accent) 75%, black);
    font-size: 0.82rem;
}

.inline-form {
    display: inline;
}

.link-button {
    background: none;
    border: none;
    color: #b91c1c;
    padding: 0;
    margin-left: 0.4rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.color-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.color-picker {
    width: 3rem;
    min-width: 3rem;
    height: 2.25rem;
    padding: 0.15rem;
    cursor: pointer;
}

.thumb-grid,
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.7rem;
}

.thumb,
.gallery-thumb img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: calc(var(--radius) * 0.5);
    border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
}

.thumb-card {
    background: color-mix(in oklab, var(--surface) 88%, black 12%);
    border: 1px solid color-mix(in oklab, var(--text) 18%, transparent);
    border-radius: calc(var(--radius) * 0.5);
    padding: 0.6rem;
}

.thumb-card-draggable {
    cursor: grab;
}

.thumb-card-draggable.dragging {
    opacity: 0.45;
}

.drag-handle {
    display: inline-flex;
    width: fit-content;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--accent) 20%, transparent);
    color: var(--font-box-color);
    font-size: 0.78rem;
    user-select: none;
}

.gallery-thumb {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.prose-inline-image {
    margin: 1rem 0;
}

.prose-inline-image img {
    width: 100%;
    height: auto;
    max-height: 540px;
    object-fit: contain;
    border-radius: calc(var(--radius) * 0.6);
    border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-figure {
    margin: 0;
    text-align: center;
}

.lightbox-figure img {
    max-width: min(92vw, 1200px);
    max-height: 82vh;
    width: auto;
    height: auto;
    border-radius: calc(var(--radius) * 0.6);
}

.lightbox-figure figcaption {
    margin-top: 0.6rem;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.lightbox-close,
.lightbox-nav {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 0.5rem 0.8rem;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

@media (max-width: 700px) {
    .lightbox {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .lightbox-nav {
        width: 100%;
        max-width: 220px;
    }
}

@media (max-width: 700px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .row {
        flex-wrap: wrap;
    }
}
