/* Crickhowell.org — warm rural palette */

:root {
    --moss: #4a5d3a;
    --moss-deep: #384628;
    --cream: #f7f1e3;
    --cream-deep: #efe6d1;
    --stone: #6b7266;
    --terracotta: #c77b5a;
    --terracotta-deep: #a85f40;
    --ink: #2d2a26;
    --ink-muted: #5c574f;
    --border: #d8cfb9;

    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --max-width: 1120px;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(45, 42, 38, 0.08), 0 4px 12px rgba(45, 42, 38, 0.04);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* accounts for sticky header height */
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3 {
    font-family: var(--serif);
    color: var(--ink);
    line-height: 1.2;
    margin: 0 0 0.5em 0;
    font-weight: 600;
}

h2 {
    font-size: 2.1rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 1em 0;
}

a {
    color: var(--terracotta-deep);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--ink);
}

/* Header */
.site-header {
    background: var(--moss);
    color: var(--cream);
    padding: 20px 0;
    border-bottom: 4px solid var(--moss-deep);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.brand-title {
    font-size: 1.75rem;
    color: var(--cream);
    margin: 0;
    letter-spacing: -0.01em;
}

.brand-tagline {
    font-size: 0.9rem;
    margin: 0;
    color: var(--cream-deep);
    opacity: 0.85;
    font-family: var(--serif);
    font-style: italic;
}

.site-nav {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--cream);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.site-nav a:hover {
    color: var(--terracotta);
}

/* Hamburger button — hidden on desktop, shown on mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--cream);
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* Animate burger → X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--cream) 0%, var(--cream-deep) 100%);
    padding: 80px 0 100px 0;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    height: 120px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'><path d='M0,80 Q300,20 600,70 T1200,60 L1200,120 L0,120 Z' fill='%234a5d3a' opacity='0.08'/></svg>") no-repeat center / cover;
    pointer-events: none;
}

.hero-greeting {
    font-family: var(--serif);
    font-style: italic;
    color: var(--terracotta-deep);
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    margin: 0 0 12px 0;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    max-width: 720px;
    margin-bottom: 0.5em;
}

.hero-lead {
    font-size: 1.15rem;
    max-width: 640px;
    color: var(--ink-muted);
}

.hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 32px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--moss);
    color: var(--cream);
}

.btn-primary:hover {
    background: var(--moss-deep);
    color: var(--cream);
}

.btn-secondary {
    background: transparent;
    color: var(--moss);
    border: 1.5px solid var(--moss);
}

.btn-secondary:hover {
    background: var(--moss);
    color: var(--cream);
}

/* Sections */
.section {
    padding: 72px 0;
    border-bottom: 1px solid var(--border);
}

.section-head {
    max-width: 640px;
    margin-bottom: 48px;
}

.section-head p {
    color: var(--ink-muted);
    font-size: 1.05rem;
}

/* Cards (businesses) */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.card h3 {
    margin-bottom: 4px;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--stone);
    font-style: italic;
    margin-bottom: 12px;
}

.card p {
    flex-grow: 1;
    color: var(--ink-muted);
    font-size: 0.95rem;
}

.card-link {
    margin-top: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.card-link::after {
    content: " \2192";
    transition: margin 0.15s ease;
    display: inline-block;
}

.card-link:hover::after {
    margin-left: 4px;
}

.card-cta {
    background: var(--moss);
    border-color: var(--moss);
    color: var(--cream);
}

.card-cta h3,
.card-cta p {
    color: var(--cream);
}

.card-cta .card-link {
    color: var(--cream);
}

/* Things to do */
.section-todo {
    background: #fff;
}

.todo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.todo-item {
    padding: 24px;
    border-left: 3px solid var(--terracotta);
    background: var(--cream);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.todo-item h3 {
    margin-bottom: 8px;
    color: var(--moss-deep);
}

.todo-item p {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.95rem;
}

/* Events */
.section-events {
    background: #fff;
}

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.event {
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    border-top: 3px solid var(--terracotta);
    display: flex;
    flex-direction: column;
}

.event-date {
    font-size: 0.85rem;
    color: var(--terracotta-deep);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.event h3 {
    margin-bottom: 8px;
    color: var(--moss-deep);
}

.event p:not(.event-date) {
    color: var(--ink-muted);
    font-size: 0.95rem;
    flex-grow: 1;
}

.event-link {
    margin-top: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.event-link::after {
    content: " \2192";
    transition: margin 0.15s ease;
    display: inline-block;
}

.event-link:hover::after {
    margin-left: 4px;
}

/* Error state for failed JSON loads */
.card-error {
    background: var(--cream-deep);
    border-color: var(--terracotta);
    border-left: 3px solid var(--terracotta);
}

.card-error h3 {
    color: var(--terracotta-deep);
}

/* News feed */
.section-news {
    background: var(--cream-deep);
}

.news-feed {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.news-item {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.news-item h3 {
    margin-bottom: 8px;
}

.news-meta {
    font-size: 0.85rem;
    color: var(--stone);
    margin-bottom: 12px;
}

.news-item p:last-child {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--ink-muted);
}

.news-item-placeholder {
    border-left: 3px solid var(--stone);
    background: #fafaf5;
}

/* Visit section */
.section-visit {
    background: var(--moss);
    color: var(--cream);
    border-bottom: none;
}

.section-visit h2,
.section-visit h3 {
    color: var(--cream);
}

.section-visit p {
    color: var(--cream-deep);
}

.visit-subhead {
    margin-top: 24px;
    font-size: 1.05rem;
    color: var(--cream);
    opacity: 0.95;
}

.visit-inner {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 48px;
    align-items: start;
}

.visit-facts {
    background: var(--moss-deep);
    padding: 28px;
    border-radius: var(--radius);
}

.visit-facts dl {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    row-gap: 8px;
    margin: 0;
    font-size: 0.95rem;
}

.visit-facts dt {
    color: var(--cream-deep);
    opacity: 0.7;
    font-weight: 500;
}

.visit-facts dd {
    margin: 0;
    color: var(--cream);
    font-weight: 500;
}

/* Map */
.visit-map {
    margin-top: 48px;
}

.visit-map iframe {
    width: 100%;
    height: 380px;
    border: none;
    border-radius: var(--radius);
    display: block;
    opacity: 0.92;
}

.map-credit {
    font-size: 0.8rem;
    margin-top: 8px;
    opacity: 0.65;
    color: var(--cream-deep);
}

.map-credit a {
    color: var(--cream-deep);
}

/* Footer */
.site-footer {
    background: var(--ink);
    color: var(--cream-deep);
    padding: 32px 0;
    font-size: 0.9rem;
}

.footer-inner p {
    margin: 0 0 4px 0;
}

.footer-note {
    opacity: 0.6;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
    .header-inner {
        flex-wrap: nowrap;
        align-items: center;
        gap: 16px;
    }

    .brand {
        flex: 1;
        min-width: 0;
    }

    .nav-toggle {
        display: flex;
    }

    /* Nav collapses by default on mobile; opens via JS toggle */
    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: 12px;
        padding-top: 8px;
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        padding: 10px 0;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .site-nav a:last-child {
        border-bottom: none;
    }

    .hero {
        padding: 48px 0 64px 0;
    }

    .section {
        padding: 48px 0;
    }

    .visit-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .visit-map iframe {
        height: 280px;
    }

    h2 {
        font-size: 1.75rem;
    }
}
