:root {
    /* Color Tokens */
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-muted: #666666;
    --color-border: #dddddd;
    --color-accent: #21759b;
    --color-error: #cc0000;

    /* Paper Texture Mode (Default Light) */
    --paper-texture-opacity: 0.05;

    /* Sanctuary Mode Tokens (Global) */
    --mercy-base: #F6EFE2;
    --grounded-text: #2A2A2A;
    --covenant-accent: #7A1E2C;

    /* Typography */
    --font-primary: "Lora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
    --fs-base: 1rem;
    --fs-lg: 1.25rem;
    --fs-xl: 1.5rem;
    --lh-base: 1.5;
    --lh-heading: 1.2;

    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    /* Layout */
    --container-width: 1200px;
    --header-height: 60px;
    --vf-page-canvas: #faf9f6;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1a1a1a;
        --color-text: #f0f0f0;
        --color-muted: #aaaaaa;
        --color-border: #444444;
        --color-accent: #4da6ff;
    }
}

/*
 * Most VerseFlow surfaces are authored as light canvases unless they opt into
 * an explicit `.atmosphere-night` treatment. Keep readable light tokens on
 * every non-night page even when the OS prefers dark mode.
 */
body:not(.atmosphere-night) {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-muted: #666666;
    --color-border: #dddddd;
    --color-accent: #21759b;
    color-scheme: light;
}

/* Resets & Baseline */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--vf-page-canvas);
}

body {
    min-height: 100%;
    background: var(--vf-page-canvas);
    color: var(--color-text);
    font-family: var(--font-primary);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    line-height: var(--lh-heading);
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-skip-ink: auto;
}

a:hover {
    text-decoration: none;
}

/* Accessibility: Focus States */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Fallback for browsers without :focus-visible support */
:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Remove outline for mouse users if :focus-visible is supported */
:focus:not(:focus-visible) {
    outline: none;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    body:not(.vf-motion-force) *,
    body:not(.vf-motion-force) *::before,
    body:not(.vf-motion-force) *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Utility Containers */
.container {
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
}

.site-main {
    padding-top: calc(var(--space-lg) + 80px);
    /* Offset for fixed header */
    padding-bottom: var(--space-xl);
}

/* -------------------------------------------------------------------------- */
/* Silent Gateway Header (Ticket-707/708) */
/* -------------------------------------------------------------------------- */

.vf-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;

    background-color: var(--mercy-base);
    border-bottom: 1px solid var(--covenant-border);

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);

    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Scrolled State */
.vf-header.scrolled {
    background-color: var(--mercy-base);
    border-bottom: 1px solid var(--covenant-border);
}

/* Admin Bar Offset */
body.admin-bar .vf-header {
    top: 32px;
    /* Fallback */
    top: var(--wp-admin--admin-bar--height, 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .vf-header {
        top: 46px;
        /* WP Mobile Admin Bar Height */
    }

    .site-main {
        padding-top: calc(var(--space-md) + 60px);
        /* Tighter mobile header offset */
    }

    .vf-header {
        padding: var(--space-xs) var(--space-sm);
        height: 60px;
        /* Explicit height helps with layout stability */
    }

    .vf-logo {
        font-size: 1.25rem;
    }

    .vf-nav a {
        font-size: 0.85rem;
    }

    /* Ensure Footer grid stacks */
    .vf-footer .container {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
}

/* Wordmark */
.vf-logo {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    margin: 0;
    line-height: 1;
}

.vf-logo a {
    color: var(--grounded-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.vf-logo a:hover {
    color: var(--covenant-accent);
}

/* Navigation */
.vf-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--space-lg);
}

.vf-nav li {
    margin: 0;
}

.vf-nav a {
    color: var(--grounded-text);
    text-decoration: none;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.vf-nav a:hover,
.vf-nav a:focus {
    color: var(--covenant-accent);
}

/* Focus Visibility (Global Interactive Elements) */
.vf-header :focus-visible,
.vf-footer :focus-visible,
.vf-footer a:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--covenant-accent);
    outline-offset: 4px;
    border-radius: 2px;
}

/* -------------------------------------------------------------------------- */
/* Sacristy Footer (Ticket-709/710) */
/* -------------------------------------------------------------------------- */

.vf-footer {
    background-color: var(--mercy-base);
    color: var(--color-text);
    border-top: 1px solid var(--covenant-border);

    padding: 4rem 0 0;
    /* padding-bottom moved to bottom row */
    font-family: var(--font-secondary);
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.footer-content {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: 1.5fr 1fr;
        gap: 5rem;
        align-items: start;
    }
}

.vf-footer__bottom {
    margin-top: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(122, 30, 44, 0.08);
    /* faint covenant */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.75;
    font-size: 0.8rem;
    text-align: center;
}

.vf-footer__bottom .site-info p {
    margin-bottom: 0.25rem;
}

.vf-footer__bottom a {
    color: inherit;
    text-decoration: underline;
}

/* Typography & Links */
.footer-column-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
}

.vf-footer-logo {
    margin-bottom: 0.5rem !important;
    /* overrides inline style if present */
}

.vf-footer-curator-note {
    font-style: italic;
    line-height: 1.7;
    max-width: 450px;
    color: var(--color-muted);
}

.vf-footer-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.vf-footer-links li {
    margin-bottom: 0;
}

.vf-footer-links a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.vf-footer-links a:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--covenant-accent);
}

/* Peace Button CTA */
.vf-peace-button {
    margin-top: 0.5rem;
    padding: 1rem 2rem;
    /* Ensure 32px side padding */
    background: transparent;

    border: 1px solid var(--covenant-border);
    border-radius: 999px;

    color: var(--color-text);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    /* TICKET-942: Prevent wrap */
    cursor: pointer;

    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.vf-peace-button:hover {
    background-color: var(--vf-surface);
    border-color: var(--covenant-accent);
}



/* Helper Message */
.vf-peace-helper {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--color-muted);
    opacity: 0.8;
    font-style: italic;
    background: var(--vf-surface);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-block;
}

[hidden] {
    display: none !important;
}

/* Ticket-912: Contact Page Layout Fix */
body.page-template-page-contact .site-main {
    padding-top: calc(var(--space-lg) + 60px);
    /* Slightly tighter than default */
}

body.page-template-page-contact .guidance-hub-layout {
    margin-top: 0;
    padding-top: 0;
}

body.page-template-page-contact .page-header {
    margin-top: 0;
}

/* 
 * Sanctuary Forms & Buttons (Global)
 * Ticket-937 / Contact Page Update
 */

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--grounded-text);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.form-group.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.form-group.checkbox input {
    margin-top: 0.25rem;
    accent-color: var(--covenant-accent);
}

/* Inputs & Textareas */
.vf-input-field {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: transparent;
    font-family: var(--font-primary);
    font-size: 1rem;
    color: var(--grounded-text);
    transition: all 0.2s ease;
}

.vf-input-field:focus {
    border-color: var(--grounded-text);
    box-shadow: 0 0 0 1px var(--grounded-text);
    outline: none;
    background-color: rgba(246, 239, 226, 0.3);
    /* hint of mercy */
}

/* Primary Action Button (Global Sanctuary Style) */
.vf-seek-button {
    display: inline-block;
    width: auto;
    font-family: var(--font-primary);
    background-color: var(--grounded-text);
    color: var(--mercy-base);
    border: 1px solid var(--grounded-text);
    padding: 1rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.vf-seek-button:hover,
.vf-seek-button:focus {
    background-color: var(--mercy-base);
    color: var(--covenant-accent);
    border-color: var(--covenant-accent);
    box-shadow: 0 4px 12px rgba(122, 30, 44, 0.15);
}

/* Full width modifier */
.vf-seek-button.full-width {
    width: 100%;
}

/* Make the contact button full width by context if needed, or use util class */
.vf-contact-form .vf-seek-button {
    width: 100%;
    margin-top: 1rem;
}
