/**
 * ServeSimple Tenant Base CSS
 *
 * Provides base styles for tenant sites using CSS custom properties
 * for theming. Colors and fonts are set dynamically from site_config.
 */

/* ========================================
   CSS Custom Properties (Defaults)
   ======================================== */
:root {
    /* Colours are NOT defined here: inc/theme.php resolves the venue's colours to an accessible
       palette and the layout prints it in <head> (a default here would override it, because this
       file loads after); the same goes for the fonts, set by the layout. */
}

/* Headings and Bootstrap components follow the theme, never Bootstrap's own near-black */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: inherit; }
.card, .modal-content, .list-group-item, .accordion-item { color: var(--text-color); }
.modal-content.bg-dark { color: #fff; }
.text-muted, .text-body-secondary { color: var(--muted-color) !important; }

/* ========================================
   Base Reset & Typography
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    margin-top: 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Skip Link (Accessibility)
   ======================================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--on-primary);
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* ========================================
   Header / Navigation
   ======================================== */
.site-header {
    color: var(--on-surface);
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
}

.navbar {
    padding: 0.75rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 56px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--on-surface);
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--muted-on-surface);
}

.navbar-dark .nav-link {
    color: var(--on-surface);
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link:focus {
    color: var(--link-on-surface);
    text-decoration: underline;
}

.nav-divider {
    display: block;
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary, .btn-primary:focus, .btn-primary:active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
}

/* disabled (closed hours): still the venue's colour, dimmed, never Bootstrap blue */
.btn-primary:disabled, .btn-primary.disabled {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
    opacity: 0.45;
}

/* keyboard focus: a ring in the text colour reads on every theme (the default was dark navy on black) */
.btn:focus-visible, a:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible {
    outline: 3px solid var(--text-color);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--on-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.btn-outline-primary {
    color: var(--link-color);
    border-color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--on-primary);
}

.btn-outline-light {
    color: var(--on-surface);
    border-color: rgba(var(--on-surface-rgb), 0.6);
    background: transparent;
}

.btn-outline-light:hover {
    background-color: rgba(var(--on-surface-rgb), 0.15);
    border-color: var(--on-surface);
    color: var(--on-surface);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.0625rem;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

/* ========================================
   Section Styles
   ======================================== */
.section {
    padding: 60px 0;
}

.section-dark {
    background-color: var(--secondary-color);
    color: var(--on-surface);
}

.section-light {
    background-color: rgba(var(--text-rgb), 0.05);
}

.section-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.section-image {
    background-size: cover;
    background-position: center;
    position: relative;
}

.section-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.section-image > .container {
    position: relative;
    z-index: 1;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    background: var(--secondary-color);
    color: var(--on-surface);
    border-top: 1px solid var(--border-color);
}

.footer-logo {
    border-radius: 0.5rem;
}

.footer-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
}

.footer-heading {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-list li {
    margin-bottom: 0.5rem;
}

.footer-link {
    color: var(--on-surface);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--link-on-surface);
    opacity: 1;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(var(--on-surface-rgb), 0.12);
    border-radius: 50%;
    color: var(--on-surface);
    transition: all 0.2s ease;
}

.social-link:hover {
    background: var(--primary-color);
    color: var(--on-primary);
    transform: translateY(-3px);
}

.disclaimer-box {
    background: rgba(var(--text-rgb), 0.05);
    border-left: 3px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.map-embed {
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.map-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ========================================
   Forms
   ======================================== */
.form-control {
    background-color: rgba(var(--text-rgb), 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    background-color: rgba(var(--text-rgb), 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    color: var(--text-color);
}

.form-control::placeholder {
    color: var(--muted-color);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--ok-color, #10b981);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--err-color, #ef4444);
}

/* ========================================
   Utilities
   ======================================== */
.text-primary {
    color: var(--link-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: var(--on-primary);
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.opacity-75 {
    opacity: 0.75;
}

.opacity-50 {
    opacity: 0.5;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--secondary-color);
        padding: 1rem;
        margin-top: 0.5rem;
        border-radius: 0.5rem;
    }

    .nav-divider {
        display: none;
    }

    .brand-subtitle {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .section {
        padding: 40px 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }
}

/* Links inside the footer / header sit on the surface colour, not the page colour */
.site-footer a:not(.btn):not(.social-link) { color: var(--link-on-surface); }
.site-footer a.footer-link { color: var(--on-surface); }

/* Finger-sized controls (round-3 UX minor 9): buttons, fields, the header brand and every footer link are at least 44 px high. */
.btn, .form-control, .form-select, .navbar-toggler { min-height: 44px; }
.navbar-brand, .logo, a.footer-link, .footer-list a, .site-footer .btn, .nav-link { display: inline-flex; align-items: center; min-height: 44px; }
.footer-list li { margin: 0; }
.btn-sm, a.footer-link { min-width: 44px; justify-content: center; }
.form-check { min-width: 44px; min-height: 44px; display: flex; align-items: center; gap: .5rem; }
.form-check-input { margin-top: 0; }
