/* WF CMS — default stylesheet. Override any property via tenant theme config. */
:root {
    /* Colour */
    --wfcms-color-primary:    #1a1a1a;
    --wfcms-color-accent:     #0066cc;
    --wfcms-color-bg:         #ffffff;
    --wfcms-color-text:       #333333;
    --wfcms-color-text-muted: #666666;
    --wfcms-color-border:     #e0e0e0;

    /* Typography */
    --wfcms-font-body:    system-ui, sans-serif;
    --wfcms-font-heading: system-ui, sans-serif;
    --wfcms-font-mono:    ui-monospace, monospace;
    --wfcms-font-size:    1rem;
    --wfcms-line-height:  1.6;

    /* Spacing */
    --wfcms-spacing-xs:    0.25rem;
    --wfcms-spacing-sm:    0.5rem;
    --wfcms-spacing-md:    1rem;
    --wfcms-spacing-lg:    2rem;
    --wfcms-spacing-xl:    4rem;
    --wfcms-spacing-block: 2rem;

    /* Layout */
    --wfcms-max-width:     1200px;
    --wfcms-content-width: 720px;
    --wfcms-radius:        0.25rem;
}

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

[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--wfcms-font-body);
    font-size:   var(--wfcms-font-size);
    line-height: var(--wfcms-line-height);
    color:       var(--wfcms-color-text);
    background:  var(--wfcms-color-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family:   var(--wfcms-font-heading);
    color:         var(--wfcms-color-primary);
    line-height:   1.15;
    margin-top:    0;
    margin-bottom: 0.5rem;
}

/* Perfect Fourth scale (×1.333) */
h1 { font-size: 1.953rem; }
h2 { font-size: 1.563rem; }
h3 { font-size: 1.25rem;  }

/* Proximity: top margin only when something precedes the heading */
* + h2 { margin-top: 4rlh; }
* + h3 { margin-top: 2.5rlh; }

/* When a snippet block starts with a heading, its margin collapses through the
   parent (no border/padding) to give the same spacing as in-flow headings */
.cms-block + .cms-block--snippet > h2:first-child { margin-top: 4rlh;   }
.cms-block + .cms-block--snippet > h3:first-child { margin-top: 2.5rlh; }

p { margin-bottom: 1em; }

/* Snippet blocks are prose-width by default */
.cms-block--snippet {
    max-width:     var(--wfcms-content-width);
    margin-inline: auto;
}

/* Layout blocks default to site max-width (not prose-width, but not viewport-wide) */
.cms-block--collection,
.cms-block--component,
.cms-block--container {
    max-width:     var(--wfcms-max-width);
    margin-inline: auto;
}

/* Explicit wide override — bypasses the default for any block type */
.cms-block--wide {
    max-width: none;
}

/* Lead paragraph on explicitly marked article prose */
.article-body > p:first-of-type {
    font-size:   1.2rem;
    line-height: 1.7;
}

.article-body blockquote {
    border-left: solid;
    padding-left: 1rem;
    margin: 1.618rem;
    font-size: 1.1rem;
}

a {
    color: var(--wfcms-color-accent);
}

.cms-block {
    margin-bottom: var(--wfcms-spacing-block);
}

/* Markdown table — responsive horizontal scroll */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap table {
    border-collapse: collapse;
    width: 100%;
    min-width: 400px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.table-wrap th,
.table-wrap td {
    padding: 0.5em 0.85em;
    border: 1px solid var(--wfcms-color-border);
    text-align: left;
    white-space: nowrap;
}
.table-wrap th {
    background: color-mix(in srgb, var(--wfcms-color-primary) 5%, var(--wfcms-color-bg));
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wfcms-color-text-muted);
}
.table-wrap tr:nth-child(even) td {
    background: color-mix(in srgb, var(--wfcms-color-primary) 2%, var(--wfcms-color-bg));
}
.table-wrap tr:hover td {
    background: color-mix(in srgb, var(--wfcms-color-accent) 6%, var(--wfcms-color-bg));
}

/* Admin status badges */
.status-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: var(--wfcms-radius);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-published { background: #d1fae5; color: #065f46; }
.status-draft     { background: #f3f4f6; color: #374151; }
.status-scheduled { background: #fef3c7; color: #92400e; }

/* ── Container layouts ───────────────────────────────────────── */
.container-layout {
    display: grid;
    gap: var(--wfcms-spacing-lg);
}
.container-item { min-width: 0; }

.container-layout--grid-2        { grid-template-columns: repeat(2, 1fr); }
.container-layout--grid-3        { grid-template-columns: repeat(3, 1fr); }
.container-layout--grid-4        { grid-template-columns: repeat(4, 1fr); }
.container-layout--sidebar-left  { grid-template-columns: 1fr 2fr; }
.container-layout--sidebar-right { grid-template-columns: 2fr 1fr; }
.container-layout--cards         { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

@media (max-width: 640px) {
    .container-layout--grid-2,
    .container-layout--grid-3,
    .container-layout--grid-4,
    .container-layout--sidebar-left,
    .container-layout--sidebar-right {
        grid-template-columns: 1fr;
    }
}

/* ── Toggle switches (admin checkboxes) ──────────────────────── */
.field-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #d1d5db;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    border: none;
    vertical-align: middle;
}
.field-check input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.field-check input[type="checkbox"]:checked             { background: var(--wfcms-color-accent); }
.field-check input[type="checkbox"]:checked::before     { transform: translateX(16px); }
.field-check input[type="checkbox"]:focus-visible       { outline: 2px solid var(--wfcms-color-accent); outline-offset: 2px; }

/* ── Inline images ─────────────────────────────────────────────── */
figure.img-content,
figure.img-wide,
figure.img-full {
    margin: var(--wfcms-spacing-lg) 0;
}

figure.img-content img,
figure.img-wide img,
figure.img-full img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--wfcms-radius);
}

figure.img-content {
    max-width: var(--wfcms-content-width);
    margin-inline: auto;
}

figure.img-wide {
    max-width: var(--wfcms-max-width);
    margin-inline: auto;
}

/* Breaks out of snippet/prose max-width — full viewport bleed */
figure.img-full {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
