/*
    Main stylesheet for Meierijstad website
    Order of sections:
    1) CSS Variables
    2) Base/Reset
    3) Layout (header/nav/main/footer)
    4) Components (hero, carousel, sidebar, cards, forms)
    5) Utilities
    6) Dark-mode overrides
*/

/* 1) CSS Variables */
:root {
    --brand: #139ff0;
    --brand-ink: #0c3e4e;
    --ink: #222;
    --muted-ink: #555;
    --bg: #f7f9fc;
    --surface: #ffffff;
    --border: #e3e8ef;
    --radius: 12px;
    --shadow: 0 10px 20px rgba(0,0,0,0.08);
}

/* 2) Base/Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, 'Helvetica Neue', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--brand-ink); line-height: 1.25; margin: 0.6em 0 0.4em; }
p { margin: 0.6em 0; }

/* 3) Layout */
.container {
    width: min(1100px, 92%);
    margin: 0 auto;
}

header.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; z-index: 10;
}
.branding {
    display: flex;
    align-items: center; gap: 12px;
    padding: 12px 0;
}
.branding img { width: 56px; height: auto; }
.branding-title { font-size: 1.25rem; font-weight: 700; color: var(--brand-ink); }

nav.primary-nav { background: var(--surface); }
.nav-list {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 16px; margin: 0; list-style: none;
}
.nav-list a {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    transition: transform .1s ease, background .2s ease;
}
.nav-list a:hover { background: #0d7fc0; transform: translateY(-1px); }

main { padding: 24px 0; }
footer.site-footer {
    margin-top: 32px;
    background: var(--brand);
    color: #fff;
    padding: 20px 0;
    text-align: center;
}

/* Grid helpers for page layouts */
.grid {
    display: grid;
    gap: 20px;
}
.grid-2 {
    grid-template-columns: 1fr;
}
@media (min-width: 820px) {
    .grid-2 { grid-template-columns: 3fr 1fr; }
}

/* 4) Components */

/* Hero with background image for the index page */
.hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #0b1f2a url('../image.jpg') center/cover no-repeat;
    color: #fff;
    box-shadow: var(--shadow);
}
.hero-overlay { background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.55)); padding: 64px 28px; }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 2.2vw + 1rem, 2.4rem); margin: 0 0 10px; }
.hero p { color: #e8f4fb; margin: 0; }

/* Carousel */
.carousel { position: relative; width: 100%; max-width: 960px; margin: 0 auto; }
.carousel-images { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.carousel-images img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    border-radius: var(--radius);
    opacity: 0; transition: opacity .6s ease;
}
.carousel-images img.is-active { opacity: 1; position: absolute; }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.8); color: #0b1f2a; border: none;
    width: 42px; height: 42px; border-radius: 999px; cursor: pointer;
    display: grid; place-items: center; font-size: 22px;
}
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

/* Sidebar */
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}
.sidebar h6 { margin: 0 0 8px; color: var(--muted-ink); font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; }

/* Cards (used e.g. on sport/tourism pages) */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }

/* Forms and interactive widgets */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.form-row { display: grid; gap: 10px; grid-template-columns: 1fr auto; align-items: end; }
label { font-weight: 600; }
input[type="text"], textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--ink); }
button.btn { background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button.btn:hover { background: #0d7fc0; }
.muted { color: var(--muted-ink); font-size: .95rem; }

/* Page-specific helpers */
body.home .news img.lead { border-radius: var(--radius); box-shadow: var(--shadow); }

/* 5) Utilities */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.center { text-align: center; }
.spacer { height: 16px; }
.rule { border: 0; border-top: 1px solid var(--brand); margin: 18px 0; }

/* 6) Dark-mode overrides */
body.dark-mode { background: #0e1116; color: #e5e7eb; }
body.dark-mode header.site-header, body.dark-mode nav.primary-nav, body.dark-mode .panel, body.dark-mode .card, body.dark-mode .sidebar {
    background: #111827; color: #e5e7eb; border-color: #1f2937;
}
body.dark-mode .nav-list a { background: #2563eb; }
body.dark-mode .hero { background-color: #0b1f2a; }
body.dark-mode .carousel-btn { background: rgba(0,0,0,0.5); color: #fff; }
body.dark-mode footer.site-footer { background: #0b6ea8; }