/* =====================================================================
   theme.css — "Comic Impact" design tokens and shared components.
   Loaded by every page: the public site (site.css) and the editor's
   desk (admin.css) both build on these variables and classes.
   ===================================================================== */

:root {
    /* Palette (from the original demo) */
    --paper: #fffaea;
    --paper-deep: #f5edd3;
    --ink: #15141c;
    --stroke: #181721;
    --red: #f24d54;
    --red-dark: #b9262d;
    --blue: #344bd0;
    --yellow: #ffda4d;
    --muted: #585263;
    --white: #ffffff;

    /* Type */
    --font-display: Impact, "Anton", "Arial Narrow", "Arial Black", sans-serif;
    --font-body: Arial, Helvetica, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Hard comic shadows and borders */
    --border: 2px solid var(--stroke);
    --shadow-sm: 3px 3px 0 var(--stroke);
    --shadow: 5px 5px 0 var(--stroke);
    --shadow-lg: 10px 10px 0 var(--stroke);

    --gutter: clamp(20px, 4.5vw, 74px);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
}

img,
svg {
    max-width: 100%;
}

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}

::selection {
    background: var(--yellow);
    color: var(--ink);
}

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

/* ---------- Brand mark (the tilted red square) ---------- */

.mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    background: var(--red);
    color: #fff;
    border: var(--border);
    box-shadow: var(--shadow-sm);
    transform: rotate(-7deg);
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 1;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: var(--border);
    box-shadow: 4px 4px 0 var(--stroke);
    background: var(--yellow);
    color: #19141b;
    font-family: var(--font-body);
    font-weight: 900;
    font-size: 12px;
    line-height: 1.1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--stroke);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--stroke);
}

.btn-yellow { background: var(--yellow); color: #19141b; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-danger { background: var(--red); color: #fff; }

.btn-sm {
    padding: 8px 12px;
    font-size: 11px;
    box-shadow: var(--shadow-sm);
}

.btn-sm:hover {
    box-shadow: 4px 4px 0 var(--stroke);
}

/* ---------- Panels ---------- */

.panel {
    border: var(--border);
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 22px;
}

.panel-title {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 22px;
    line-height: 1.05;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.panel-subtitle {
    margin: 20px 0 0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---------- Chips, stamps, badges ---------- */

.chips {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chips li {
    border: 1.5px solid var(--stroke);
    background: var(--white);
    padding: 3px 8px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
}

.chips-quiet li {
    background: transparent;
    border-style: dashed;
    font-weight: 600;
}

/* Status labels drawn like rubber stamps */
.stamp {
    display: inline-block;
    padding: 3px 8px;
    border: 2px solid currentColor;
    color: var(--blue);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: nowrap;
    transform: rotate(-3deg);
}

.stamp-published,
.stamp-accepted,
.stamp-shipped { color: var(--blue); }

.stamp-under-review,
.stamp-in-progress { color: var(--red-dark); }

.stamp-preprint { color: var(--ink); }

.stamp-in-preparation,
.stamp-proposal,
.stamp-archived {
    color: var(--muted);
    border-style: dashed;
}

/* Flat labels used in tables and lists */
.badge {
    display: inline-block;
    vertical-align: middle;
    padding: 3px 7px;
    border: 1.5px solid var(--stroke);
    background: var(--paper);
    color: var(--ink);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-live,
.badge-shipped,
.badge-published,
.badge-accepted {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.badge-in-progress,
.badge-under-review,
.badge-learning {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.badge-feature { background: var(--yellow); }

.badge-draft,
.badge-in-preparation,
.badge-proposal,
.badge-archived {
    background: transparent;
    border-style: dashed;
    color: var(--muted);
}

/* ---------- Form controls (login dialog + editor) ---------- */

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.field-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.optional {
    font-weight: 500;
    font-size: 12px;
    color: var(--muted);
}

.input {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    border: var(--border);
    border-radius: 0;
    box-shadow: inset 2px 2px 0 rgba(21, 20, 28, 0.06);
}

textarea.input {
    resize: vertical;
    line-height: 1.6;
}

select.input {
    appearance: none;
    padding-right: 36px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink) 50%),
        linear-gradient(135deg, var(--ink) 50%, transparent 50%);
    background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

.input:focus {
    outline: none;
    box-shadow: 4px 4px 0 var(--blue);
}

.input.has-error {
    border-color: var(--red);
    box-shadow: 3px 3px 0 var(--red);
}

.input::placeholder {
    color: #9a94a3;
}

.field-error {
    margin: 0;
    color: var(--red-dark);
    font-size: 13px;
    font-weight: 700;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

/* ---------- Prose: rendered Markdown ---------- */

.prose {
    max-width: 68ch;
    font-size: 17px;
    line-height: 1.75;
    overflow-wrap: break-word;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    margin: 1.8em 0 0.5em;
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.prose h1,
.prose h2 { font-size: 30px; }
.prose h3 { font-size: 22px; }
.prose h4 { font-size: 18px; }

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose pre { margin: 0 0 1.1em; }

.prose ul,
.prose ol { padding-left: 1.3em; }

.prose li { margin-bottom: 0.35em; }

.prose li::marker {
    color: var(--red);
    font-weight: 900;
}

.prose a {
    color: var(--blue);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.prose strong { font-weight: 800; }

.prose code {
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: #fff2b8;
    border: 1px solid rgba(21, 20, 28, 0.2);
}

.prose pre {
    padding: 18px 20px;
    overflow-x: auto;
    background: var(--ink);
    color: #f4f1ea;
    border: var(--border);
    box-shadow: var(--shadow);
    font-size: 14px;
    line-height: 1.6;
}

.prose pre code {
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font-size: inherit;
}

.prose blockquote {
    margin: 1.2em 0;
    padding: 4px 0 4px 18px;
    border-left: 5px solid var(--red);
    color: var(--muted);
    font-style: italic;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.prose th,
.prose td {
    padding: 8px 10px;
    border: 2px solid var(--stroke);
    text-align: left;
}

.prose th { background: var(--yellow); }

.prose img { border: var(--border); }

.prose hr {
    margin: 2em 0;
    border: 0;
    border-top: 2px dashed var(--stroke);
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Verified owner vs. editable demo content: prominent without changing the theme. */
.demo-label {
    display: inline-block;
    margin-left: .45rem;
    padding: .12rem .42rem;
    border: 1px solid currentColor;
    border-radius: 3px;
    color: var(--ink, #17141e);
    background: #ffe89d;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .035em;
    vertical-align: middle;
}
.demo-notice {
    display: block;
    max-width: 60rem;
    padding: .75rem 1rem;
    border-left: 5px solid #b6771d;
    background: #fff0be;
    color: #302415;
    font-weight: 700;
    line-height: 1.5;
    margin: 1rem 0;
}


/* Strong wrapping on generated Markdown, including very long URLs and headings. */
.prose { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.prose :is(p, li, a, blockquote, h1, h2, h3, h4, strong) { overflow-wrap: anywhere; }
.prose pre { max-width: 100%; overflow-x: auto; white-space: pre; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
.prose img, .prose video, .prose iframe { max-width: 100%; height: auto; }
