/* CMS site - the Desk's look (shadcn tokens from frontend/src/assets/main.css).
   The accent and the color scheme come from WebsiteSettings (_base.html). */

:root {
    --radius: 0.625rem;
    --background: oklch(1 0 0);
    --foreground: oklch(0.141 0.005 285.823);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.141 0.005 285.823);
    --popover: oklch(1 0 0);
    --primary: oklch(0.21 0.006 285.885);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.967 0.001 286.375);
    --muted: oklch(0.967 0.001 286.375);
    --muted-foreground: oklch(0.552 0.016 285.938);
    --accent: oklch(0.967 0.001 286.375);
    --destructive: oklch(0.577 0.245 27.325);
    --success: oklch(0.627 0.17 149.2);
    --border: oklch(0.92 0.004 286.32);
    --input: oklch(0.92 0.004 286.32);
    --ring: oklch(0.705 0.015 286.067);
    --link: var(--primary);
    --font-sans: 'Inter Variable', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    color-scheme: light;
}

.dark {
    --background: oklch(0.141 0.005 285.823);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.21 0.006 285.885);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.21 0.006 285.885);
    --primary: oklch(0.92 0.004 286.32);
    --primary-foreground: oklch(0.21 0.006 285.885);
    --secondary: oklch(0.274 0.006 286.033);
    --muted: oklch(0.274 0.006 286.033);
    --muted-foreground: oklch(0.705 0.015 286.067);
    --accent: oklch(0.274 0.006 286.033);
    --destructive: oklch(0.704 0.191 22.216);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.552 0.016 285.938);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--foreground);
    font: 15px/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }
.narrow { max-width: 48rem; }
.muted { color: var(--muted-foreground); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1rem; height: 1rem; flex: none; }

/* Buttons - shadcn Button */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    height: 2.25rem; padding: 0 1rem; border-radius: calc(var(--radius) * 0.8);
    font-size: 0.875rem; font-weight: 500; white-space: nowrap; cursor: pointer;
    background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs);
    transition: background-color .15s, color .15s, opacity .15s;
}
.btn:hover { opacity: 0.9; }
.btn-outline { background: var(--background); color: var(--foreground); border: 1px solid var(--border); }
.btn-outline:hover, .btn-ghost:hover { background: var(--accent); opacity: 1; }
.btn-ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.btn-sm { height: 2rem; padding: 0 0.75rem; }
.btn-lg { height: 2.5rem; padding: 0 1.5rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-block { width: 100%; }

/* Card, badge */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow-sm); }
.card-body { padding: 1.5rem; }
.badge {
    display: inline-flex; align-items: center; gap: 0.25rem; height: 1.375rem; padding: 0 0.5rem;
    border: 1px solid var(--border); border-radius: calc(var(--radius) * 0.6);
    font-size: 0.75rem; font-weight: 500; white-space: nowrap;
}
a.badge:hover { background: var(--accent); }

/* Form controls - shadcn Input / Textarea / Select */
.input {
    display: block; width: 100%; min-height: 2.25rem; padding: 0.375rem 0.75rem;
    background: transparent; border: 1px solid var(--input); border-radius: calc(var(--radius) * 0.8);
    font-size: 0.875rem; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 6rem; resize: vertical; }
.input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.field { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.field > label { font-size: 0.875rem; font-weight: 500; }
.field .req { color: var(--destructive); margin-left: 0.125rem; }
.field-check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.field-check input { width: 1rem; height: 1rem; accent-color: var(--primary); }
.alert { padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1.25rem; }
.alert-error { color: var(--destructive); border-color: color-mix(in oklab, var(--destructive) 40%, transparent); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--background) 95%, transparent); backdrop-filter: blur(8px); }
.site-header .container { display: flex; align-items: center; gap: 1rem; height: 3.5rem; }
.brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; font-weight: 600; }
.brand img { height: 1.75rem; width: auto; }
.brand-mark { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; flex: none; border-radius: calc(var(--radius) * 0.8); background: var(--primary); color: var(--primary-foreground); font-size: 0.875rem; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.nav-item { position: relative; }
.nav-link { display: inline-flex; align-items: center; gap: 0.375rem; height: 2.25rem; padding: 0 0.75rem; border-radius: calc(var(--radius) * 0.8); font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground); background: none; cursor: pointer; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--foreground); background: var(--accent); }
.nav-menu { position: absolute; top: calc(100% + 0.25rem); left: 0; min-width: 13rem; padding: 0.25rem; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); display: none; }
.nav-item:hover > .nav-menu, .nav-item:focus-within > .nav-menu { display: block; }
.nav-menu a { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.5rem; border-radius: calc(var(--radius) * 0.6); font-size: 0.875rem; }
.nav-menu a:hover { background: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.nav-toggle { display: none; margin-left: auto; }
.topbar { border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.topbar .container { display: flex; justify-content: flex-end; gap: 1.25rem; height: 2rem; align-items: center; }
.topbar a { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--muted-foreground); }
.topbar a:hover { color: var(--foreground); }
@media (max-width: 767px) {
    .nav-toggle { display: inline-flex; }
    .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 0.5rem 1rem 1rem; max-height: calc(100vh - 3.5rem); overflow-y: auto; background: var(--background); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
    .site-header.is-open .nav { display: flex; }
    .nav-link { width: 100%; justify-content: space-between; height: 2.5rem; }
    .nav-menu { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 0.25rem 0.75rem; background: none; }
    .nav-actions { padding-top: 0.5rem; }
}

/* Footer */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--border); padding: 3rem 0 2rem; font-size: 0.875rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin-bottom: 2rem; }
.site-footer h4 { font-size: 0.875rem; margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; display: grid; gap: 0.5rem; }
.site-footer a { color: var(--muted-foreground); }
.site-footer a:hover { color: var(--foreground); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--muted-foreground); }

/* Page head, breadcrumbs */
.page-head { padding: 3rem 0 2rem; }
.page-head h1 { font-size: 2rem; }
.page-head .lead { margin-top: 0.75rem; font-size: 1.0625rem; color: var(--muted-foreground); max-width: 42rem; }
@media (min-width: 768px) { .page-head h1 { font-size: 2.5rem; } }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 1rem; }
.crumbs a:hover { color: var(--foreground); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; font-size: 0.875rem; color: var(--muted-foreground); }
.meta > span { display: inline-flex; align-items: center; gap: 0.375rem; }

/* Rich text */
.prose { font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: 1.5rem; margin-top: 2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.75em; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: 0.375em; }
.prose img { border-radius: var(--radius); margin-inline: auto; }
.prose blockquote { padding-left: 1em; border-left: 2px solid var(--border); color: var(--muted-foreground); font-style: italic; }
.prose code { padding: 0.125em 0.375em; border-radius: 0.25rem; background: var(--muted); font-size: 0.875em; }
.prose pre { padding: 1rem; overflow-x: auto; border-radius: var(--radius); background: var(--muted); }
.prose pre code { padding: 0; background: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.875rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { font-weight: 500; color: var(--muted-foreground); }
.prose hr { border-top: 1px solid var(--border); }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: var(--radius); }

/* Blocks */
.block { padding: 3rem 0; }
.block-title { font-size: 1.75rem; margin-bottom: 1.5rem; }
.hero { padding: 5rem 0 4rem; text-align: center; }
.hero h1 { font-size: 2.25rem; max-width: 48rem; margin: 0 auto; }
@media (min-width: 768px) { .hero h1 { font-size: 3.25rem; letter-spacing: -0.03em; } }
.hero p { max-width: 40rem; margin: 1.25rem auto 0; font-size: 1.125rem; color: var(--muted-foreground); }
.hero .actions { display: flex; justify-content: center; gap: 0.75rem; margin-top: 2rem; }
.cta { text-align: center; padding: 3rem 1.5rem; }
.cta p { margin: 0.75rem auto 0; max-width: 36rem; color: var(--muted-foreground); }
.cta .btn { margin-top: 1.5rem; }
.features { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.feature-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--muted); font-size: 1.25rem; }
.feature h3 { font-size: 1rem; }
.feature p { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }
.figure img { border-radius: calc(var(--radius) * 1.4); margin: 0 auto; }
.figure figcaption { margin-top: 0.75rem; text-align: center; font-size: 0.875rem; color: var(--muted-foreground); }
.embed-frame { width: 100%; max-width: 40rem; height: 36rem; margin: 0 auto; border: 0; }

/* Blog */
.posts { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); }
.post-card { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s; }
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card .cover { aspect-ratio: 16 / 9; background: var(--muted); overflow: hidden; }
.post-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.post-card .card-body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.post-card h3 { font-size: 1.0625rem; }
.post-card p { font-size: 0.875rem; color: var(--muted-foreground); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .meta { margin-top: auto; padding-top: 0.5rem; font-size: 0.8125rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.chip { display: inline-flex; align-items: center; height: 2rem; padding: 0 0.875rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.875rem; font-weight: 500; }
.chip:hover { background: var(--accent); }
.chip[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.article-cover { margin: 0 0 2rem; border-radius: calc(var(--radius) * 1.4); overflow: hidden; }
.article-cover img { width: 100%; max-height: 32rem; object-fit: cover; }
.related { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related h2 { font-size: 1.25rem; margin-bottom: 1.5rem; }

/* Pagination - shadcn Pagination */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.25rem; margin-top: 2.5rem; }
.pagination .btn { min-width: 2.25rem; }
.pagination .btn[aria-current="page"] { border: 1px solid var(--border); background: var(--background); color: var(--foreground); }
.pagination .gap { display: grid; place-items: center; width: 2.25rem; color: var(--muted-foreground); }

/* Search */
.search-form { display: flex; gap: 0.5rem; max-width: 36rem; }
.results { list-style: none; display: grid; gap: 0.5rem; }
.result { display: block; padding: 1rem 1.25rem; border-radius: var(--radius); }
.result:hover { background: var(--accent); }
.result h3 { font-size: 1rem; }
.result p { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); }
.result mark { background: color-mix(in oklab, var(--primary) 18%, transparent); color: inherit; border-radius: 0.125rem; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted-foreground); }

/* Standalone form page / embedded form */
.form-shell { max-width: 36rem; margin: 3rem auto; padding: 0 1rem; }
.embed body, body.embed { background: transparent; }
.embed .form-shell { margin: 0 auto; padding: 0; }
.form-state { padding: 3rem 1.5rem; text-align: center; }
.form-state .mark { display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto 1rem; border-radius: 999px; background: var(--muted); font-size: 1.25rem; font-weight: 700; }
.form-state.ok .mark { color: var(--success); }
.form-state.err .mark { color: var(--destructive); }
.form-state h2 { font-size: 1.25rem; }
.form-state p { margin-top: 0.375rem; color: var(--muted-foreground); }
.form-state a { color: var(--link); font-weight: 500; }
.section-break { margin: 1.75rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-foreground); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
