:root {
    --bg: #f5f3ed;
    --bg-2: #ffffff;
    --line: rgba(28, 30, 22, 0.12);
    --text: #1c1e18;
    --muted: #6a6860;
    --accent: #4e7018;
    --accent-ink: #ffffff;
    --highlight: #d2ea64;
    --highlight-ink: #1a220c;
    --danger: #c4473d;
    --shadow: 0 18px 44px rgba(28, 30, 22, 0.08);
    --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(210, 234, 100, 0.28), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(111, 168, 148, 0.16), transparent 50%),
        var(--bg);
    color: var(--text);
    font-family: "Outfit", sans-serif;
    line-height: 1.65;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(28, 30, 22, 0.06);
    padding: 0.12rem 0.4rem;
    border-radius: 6px;
}

.site-header, .site-footer, main, .admin {
    width: min(1120px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 8px;
}
.brand {
    font-family: "Fraunces", serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
}
.nav { display: flex; gap: 22px; color: var(--muted); }
.nav a:hover { color: var(--text); }

.hero { padding: 64px 0 36px; max-width: 760px; }
.eyebrow {
    color: var(--accent);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.78rem;
    margin: 0 0 14px;
}
h1, h2, h3 { font-family: "Fraunces", serif; line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: clamp(2.1rem, 5vw, 4rem); }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 640px; }

.section { padding-bottom: 80px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 22px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(78, 112, 24, 0.35);
}
.card-cover, .detail-cover {
    aspect-ratio: 16 / 10;
    background: #e7eadc;
    overflow: hidden;
}
.card-cover img, .detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cover-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-family: "Fraunces", serif;
    font-size: 3rem;
    color: var(--accent);
    background: linear-gradient(135deg, #eef3dc, #d7e4c4);
}
.cover-fallback.large { font-size: 5rem; min-height: 280px; }
.card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 22px 24px;
    flex: 1;
}
.card-body h3 {
    font-size: 1.55rem;
    margin: 0;
    line-height: 1.2;
}
.card-label {
    margin: 0 0 8px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}
.card-summary {
    margin: 0;
    color: var(--text);
    opacity: 0.86;
    font-size: 0.98rem;
    line-height: 1.6;
    flex: 1;
}
.card-btn {
    align-self: flex-start;
    margin-top: 6px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; }
.tags span {
    border: 1px solid rgba(78, 112, 24, 0.22);
    background: rgba(78, 112, 24, 0.08);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: var(--accent);
}

.text-link {
    color: var(--accent);
    font-weight: 500;
}
.back-link {
    display: inline-block;
    color: var(--muted);
    margin: 28px 0 18px;
}
.back-link:hover { color: var(--text); }

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    background: var(--highlight);
    color: var(--highlight-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }

.detail { padding-bottom: 80px; }
.detail-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 28px;
}
.detail-cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.panel {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}
.panel h3 { margin-top: 22px; font-size: 1.05rem; }
.prose { white-space: pre-wrap; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.method {
    display: inline-block;
    min-width: 52px;
    text-align: center;
    border-radius: 6px;
    background: rgba(78, 112, 24, 0.12);
    color: var(--accent);
    font-size: 0.78rem;
    padding: 2px 6px;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0 48px;
    color: var(--muted);
}
.site-footer p { margin: 0; }
.footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 28px;
}
.footer-note,
.footer-link,
.visitor {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.footer-note {
    flex: 1 1 220px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.footer-emoji {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
}
.visitor {
    margin-top: 12px;
    color: var(--accent);
    font-weight: 500;
}

.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.auth-card {
    width: min(420px, calc(100% - 32px));
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 36px 28px;
    box-shadow: var(--shadow);
}

.form { display: grid; gap: 14px; }
.form.stack { margin-top: 18px; }
label { display: grid; gap: 8px; font-size: 0.92rem; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(78, 112, 24, 0.28);
    border-color: var(--accent);
}
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.current-cover img {
    width: 180px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.admin { padding-bottom: 80px; }
.admin .section-head { padding-top: 36px; }
.row-actions, .repeat-head {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.row-actions form { display: inline; }
.link-btn {
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    padding: 0;
}
.danger { color: var(--danger); }
.flash {
    background: rgba(210, 234, 100, 0.28);
    border: 1px solid rgba(78, 112, 24, 0.22);
    border-radius: 12px;
    padding: 10px 14px;
}
.flash.error {
    background: rgba(196, 71, 61, 0.1);
    border-color: rgba(196, 71, 61, 0.28);
    color: #8b2e26;
}
.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

.repeat-block {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}
.repeat-block h2 { font-size: 1.1rem; margin: 0; }
.repeat-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.3fr auto;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}
#endpoints .repeat-row {
    grid-template-columns: 90px 1.2fr 1.4fr auto;
}

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

@media (max-width: 800px) {
    .detail-hero, .grid-2, .repeat-row, #endpoints .repeat-row {
        grid-template-columns: 1fr;
    }
    .hero { padding-top: 36px; }
    .section-head, .admin .section-head {
        flex-direction: column;
        align-items: start;
    }
}
