/* ==========================================================================
   base.css
   Shared foundation for both surfaces (public + admin):
   design tokens, reset/base, and prose (rich-text body rendering).
   Loaded before styles.css (public) and admin.css (admin).
   The admin editor adds class="prose" to its content so the WYSIWYG view
   matches the published render — keep .prose here, not in either surface file.
   CSS custom properties are overridden inline in header.php from DB settings.
   ========================================================================== */


/* --------------------------------------------------------------------------
   Custom properties — defaults (overridden by inline style in header.php)
   -------------------------------------------------------------------------- */
:root {
    --accent:        #A24A2E;
    --accent-hover:  color-mix(in srgb, var(--accent) 82%, black);
    --font-heading:  'Schibsted Grotesk', system-ui, sans-serif;
    --font-body:     'Hanken Grotesk', system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', ui-monospace, "SFMono-Regular", Menlo, monospace;

    /* Colour palette — warm ink on soft-white paper */
    --text-primary:   #211C17;
    --text-secondary: #6E665C;
    --text-muted:     #9A9183;
    --border:         #ECE7DF;
    --bg:             #FEFCF8;
    --bg-subtle:      #F4EFE8;
    --tag-bg:         #F1EADF;
    --tag-text:       #6E665C;

    /* Typographic detail */
    --head-tracking:  -0.02em;

    /* Code block (dark) */
    --code-bg:        #272320;
    --code-fg:        #E6DFD4;

    /* Layout */
    --content-width:  680px;
    --wide-width:     900px;
    --spacing:        1.5rem;
    --radius:         6px;
}


/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family:     var(--font-body);
    color:           var(--text-primary);
    background:      var(--bg);
    line-height:     1.7;
    min-height:      100vh;
    display:         flex;
    flex-direction:  column;
}

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

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

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

ul,
ol {
    list-style: none;
}


/* --------------------------------------------------------------------------
   Prose — rich text body (posts and static pages)
   Shared: the admin editor mirrors these via class="prose" for WYSIWYG.
   -------------------------------------------------------------------------- */
.prose {
    font-size:   1.08rem;
    line-height: 1.78;
    color:       var(--text-primary);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    font-family:    var(--font-heading);
    font-weight:    600;
    line-height:    1.25;
    letter-spacing: var(--head-tracking);
    margin-top:     2.5rem;
    margin-bottom:  0.85rem;
    color:          var(--text-primary);
}

.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.2rem; }
.prose h4 { font-size: 1.05rem; }

.prose p {
    margin-bottom: 1.35rem;
    text-wrap:     pretty;
}

.prose p:last-child {
    margin-bottom: 0;
}

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

.prose a:hover {
    color: var(--accent-hover);
}

.prose ul,
.prose ol {
    margin-bottom: 1.35rem;
    padding-left:  1.4rem;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
    margin-bottom: 0.45rem;
}

.prose li::marker { color: var(--text-muted); }

.prose li > ul,
.prose li > ol {
    margin-top:    0.45rem;
    margin-bottom: 0;
}

/* Blockquote — quote a source/passage (faint clay wash + thin left rule) */
.prose blockquote {
    margin:        1.9rem 0;
    padding:       0.95rem 1.3rem;
    border-radius: 0 8px 8px 0;
    background:    color-mix(in srgb, var(--accent) 3%, var(--bg));
    border-left:   1.5px solid color-mix(in srgb, var(--accent) 45%, var(--bg));
    font-style:    italic;
    font-weight:   400;
    font-size:     1.08rem;
    line-height:   1.7;
    color:         var(--text-secondary);
}

.prose blockquote p { margin-bottom: 0.8rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* Inline code */
.prose code {
    font-family:   var(--font-mono);
    font-size:     0.86em;
    background:    color-mix(in srgb, var(--text-primary) 7%, var(--bg));
    padding:       0.12em 0.38em;
    border-radius: 4px;
}

/* Code block — dark, for legibility against the light page */
.prose pre {
    background:    var(--code-bg);
    color:         var(--code-fg);
    border-radius: 10px;
    padding:       1.1rem 1.25rem;
    overflow-x:    auto;
    margin:        1.6rem 0;
    font-family:   var(--font-mono);
    font-size:     0.86rem;
    line-height:   1.65;
}

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

/* Images — in-column, optional caption */
.prose figure { margin: 2rem 0; }

.prose img {
    max-width:     100%;
    height:        auto;
    border-radius: 8px;
    margin:        1.75rem 0;
}

.prose figure img { margin: 0; }

.prose figcaption {
    font-family:    var(--font-body);
    font-size:      0.72rem;
    font-weight:    500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color:          var(--text-muted);
    margin-top:     0.65rem;
}

.prose hr {
    border:     none;
    border-top: 1px solid var(--border);
    margin:     2.75rem 0;
}

.prose table {
    width:           100%;
    border-collapse: collapse;
    font-size:       0.95rem;
    margin:          1.6rem 0;
}

.prose th,
.prose td {
    padding:       0.55rem 0.7rem;
    text-align:    left;
    border-bottom: 1px solid var(--border);
}

.prose th {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size:   0.82rem;
}

.prose strong { font-weight: 700; }
.prose em     { font-style: italic; }


/* --------------------------------------------------------------------------
   Responsive — shared base + prose
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
    html { font-size: 16px; }

    /* Code scales down on small viewports — less horizontal scroll, stays legible */
    .prose pre {
        font-size: 0.78rem;
        padding:   0.9rem 1rem;
    }

    .prose code { font-size: 0.82em; }
}
