/* Site-wide additions on top of Pico (classless). */

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/fraunces-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('fonts/nunito.woff2') format('woff2');
}

/* Brand tokens + Pico mapping (light scheme) */
:root {
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --brand-ink: #3d2f26;
    --brand-cream-2: #f3e7d3;
    --brand-primary: #c2410c;
    --brand-primary-hover: #9a3412;
    --brand-forest: #3f6212;
    --brand-forest-hover: #365314;
    --brand-amber: #b45309;
    --brand-success: #16a34a;
    --footer-bg: #2f2620;
    --footer-ink: #f2e9db;

    --pico-font-family: 'Nunito', system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --pico-background-color: #faf5ec;
    --pico-color: var(--brand-ink);
    --pico-primary: #b33c0a;
    --pico-primary-background: var(--brand-primary);
    --pico-primary-border: var(--brand-primary);
    --pico-primary-hover-background: var(--brand-primary-hover);
    --pico-primary-hover-border: var(--brand-primary-hover);
    --pico-primary-hover: var(--brand-primary-hover);
    --pico-primary-underline: rgba(194, 65, 12, 0.4);
    --pico-primary-focus: rgba(194, 65, 12, 0.3);
    --pico-primary-inverse: #fff;
    --pico-border-radius: 10px;
    --pico-card-background-color: #fffdf8;
    --pico-card-sectioning-background-color: #fdf4e6;
    --pico-card-border-color: #ecdfc9;
    --pico-card-box-shadow: 0 2px 10px rgba(61, 47, 38, 0.08);
    --pico-muted-color: #7c6c5e;
    --pico-muted-border-color: #e5d9c5;
    --pico-box-shadow: 0 2px 10px rgba(61, 47, 38, 0.1);
}

/* Brand tokens (dark scheme — must out-specific Pico's dark :root rules) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --brand-ink: #f2e9db;
        --brand-cream-2: #3a2e22;
        --brand-primary: #e8793f;
        --brand-primary-hover: #f1915c;
        --brand-forest: #8fbf5a;
        --brand-forest-hover: #a3cf74;

        --pico-background-color: #201a15;
        --pico-color: var(--brand-ink);
        --pico-primary: #e8793f;
        --pico-primary-background: #c2410c;
        --pico-primary-border: #c2410c;
        --pico-primary-hover-background: #d64f12;
        --pico-primary-hover-border: #d64f12;
        --pico-primary-hover: #f1915c;
        --pico-primary-underline: rgba(232, 121, 63, 0.5);
        --pico-primary-focus: rgba(232, 121, 63, 0.4);
        --pico-primary-inverse: #fff;
        --pico-card-background-color: #2b231c;
        --pico-card-sectioning-background-color: #251d16;
        --pico-card-border-color: #453a2e;
        --pico-card-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
        --pico-muted-color: #b8a693;
        --pico-muted-border-color: #453a2e;
        --pico-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    }
}

/* Site-wide page background: paw pattern over a warm top-fade gradient */
body {
    background-image:
        url('paw-tile.svg'),
        linear-gradient(180deg, #f6e7d2 0, rgba(250, 245, 236, 0) 480px);
    background-repeat: repeat, no-repeat;
}

@media (prefers-color-scheme: dark) {
    body {
        background-image:
            url('paw-tile.svg'),
            linear-gradient(180deg, #2e2318 0, rgba(32, 26, 21, 0) 480px);
    }
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

::selection {
    background: rgba(194, 65, 12, 0.25);
}

/* Nav — sticky, blurred band painted full-width by ::before, active-page underline */
body > header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

body > header::before {
    content: "";
    position: absolute;
    inset: 0 calc(50% - 50vw);
    z-index: -1;
    background: rgba(250, 245, 236, 0.85);
    background: color-mix(in srgb, var(--pico-background-color) 82%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-nav .brand {
    text-decoration: none;
}

/* Paw + wordmark lockup (nav, hero, footer) */
.logo-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.logo-lockup svg {
    display: block;
    height: 2.1rem;
    width: auto;
}

.logo-word {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--brand-ink);
}

.site-nav .nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a[aria-current="page"]:not(.donate-button) {
    color: var(--brand-primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 6px;
}

/* Donate button — forest green so it stands apart from terracotta CTAs */
.donate-button,
a[role="button"].donate-button {
    background: var(--brand-forest);
    border-color: var(--brand-forest);
    color: #fff;
}

.donate-button:hover,
a[role="button"].donate-button:hover {
    background: var(--brand-forest-hover);
    border-color: var(--brand-forest-hover);
}

a.donate-button:not([role="button"]) {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    text-decoration: none;
}

/* Homepage hero — full-bleed band; the page background shows through */
.hero {
    text-align: center;
    margin: calc(var(--pico-block-spacing-vertical) * -1) calc(50% - 50vw) 0;
    padding: 4rem 1rem 3.5rem;
}

.hero .logo-lockup {
    margin-bottom: 1rem;
}

.hero .logo-lockup svg {
    height: 4.5rem;
}

.hero .logo-word {
    font-size: 2.6rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 2.9rem);
    max-width: 22ch;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    max-width: 56ch;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.hero-stat {
    margin-top: 1.75rem;
    margin-bottom: 0;
    font-weight: 700;
    color: var(--brand-forest);
}

/* Active case cards on the home page */
.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
    gap: 1rem;
    justify-content: center;
}

/* Each card is a whole-card link to its case detail page. */
.case-grid > a.case-card {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.case-grid article {
    /* Fill the stretched grid cell so the footer can pin to the bottom. */
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.case-grid > a.case-card:hover article,
.case-grid > a.case-card:focus-visible article {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(61, 47, 38, 0.18);
}

.case-grid .case-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: calc(var(--pico-border-radius) - 2px);
}



/* Case cards: name with breed below it on the left, species chip top right */
.case-grid .case-animal {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.case-grid article > header h3 {
    margin-bottom: 0.1rem;
}

.case-grid .case-breed {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.75;
}

.case-grid .case-animal .chip {
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.case-grid article > footer {
    margin-top: auto; /* pin the case ID to the bottom of the card */
    font-size: 0.9rem;
    opacity: 0.85;
}

/* Chips (species, case status) */
.chip {
    display: inline-block;
    padding: 0.18rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chip-species {
    background: rgba(250, 245, 236, 0.92);
    color: #3d2f26;
}

.chip-open {
    background: #fef3c7;
    color: #92400e;
}

.chip-closed_found {
    background: #dcfce7;
    color: #166534;
}

.chip-closed_not_found {
    background: #e7e2da;
    color: #6b625a;
}

.chip-private {
    background: #e0e7ff;
    color: #3730a3;
}

@media (prefers-color-scheme: dark) {
    .chip-species {
        background: rgba(242, 233, 219, 0.16);
        color: var(--brand-ink);
    }

    .chip-open {
        background: rgba(217, 119, 6, 0.25);
        color: #fbbf24;
    }

    .chip-closed_found {
        background: rgba(34, 197, 94, 0.22);
        color: #86efac;
    }

    .chip-closed_not_found {
        background: rgba(229, 226, 218, 0.15);
        color: #c9c2b8;
    }

    .chip-private {
        background: rgba(99, 102, 241, 0.25);
        color: #c7d2fe;
    }
}

/* Case detail: pet photos as a uniform gallery */
.pet-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pet-gallery img {
    aspect-ratio: 4 / 3;
    width: min(320px, 100%);
    object-fit: cover;
    border-radius: var(--pico-border-radius);
    margin: 0;
}

/* Case detail timeline */
.timeline {
    list-style: none;
    padding: 0;
}

.timeline li {
    position: relative;
    border-left: 2px solid var(--pico-muted-border-color);
    padding: 0 0 1.75rem 1.25rem;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-forest);
    box-shadow: 0 0 0 3px var(--pico-background-color);
}

.timeline li.kind-tip::before {
    background: var(--brand-primary);
}

.timeline li.kind-entry::before {
    background: var(--brand-amber);
}

.timeline li.kind-closed::before {
    background: var(--brand-success);
}

.timeline li:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline .timeline-date {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

.timeline img {
    aspect-ratio: 4 / 3;
    width: min(280px, 100%);
    object-fit: cover;
    border-radius: calc(var(--pico-border-radius) - 2px);
}

/* Testimonials — pull-quote cards */
.testimonial-card {
    background: #fff9f0;
}

.testimonial-card img {
    aspect-ratio: 4 / 3;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: calc(var(--pico-border-radius) - 2px);
    box-shadow: 0 4px 14px rgba(61, 47, 38, 0.15);
}

.story-quote {
    border: none;
    margin: 0;
    font-size: 1.05rem;
}

.story-quote::before {
    content: "\201C";
    display: block;
    font-family: var(--font-display);
    font-size: 3rem;
    line-height: 0.6;
    margin-bottom: 0.5rem;
    color: var(--brand-primary);
}

@media (prefers-color-scheme: dark) {
    .testimonial-card {
        background: #292017;
    }
}

/* Scroll-reveal (progressive enhancement; disabled for reduced motion) */
.reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Form pages (contact, submit tip, report missing): narrow centered column */
.form-page > * {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* Tip form: live pet-photo preview for the selected case */
.tip-preview {
    margin-top: calc(var(--pico-spacing) * -0.5);
    margin-bottom: var(--pico-spacing);
}

.tip-preview img {
    display: block;
    aspect-ratio: 4 / 3;
    width: min(280px, 100%);
    object-fit: cover;
    border-radius: calc(var(--pico-border-radius) - 2px);
}

.tip-preview p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Form help text: small, tucked up against its field (mirrors Pico's input+small pattern) */
form .helptext {
    display: block;
    font-size: 0.75rem;
    margin-top: calc(var(--pico-spacing) * -0.75);
    margin-bottom: var(--pico-spacing);
}

/* Flash messages */
.messages .message {
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    background: #e9f6e6;
    border: 1px solid #a7d89c;
    color: #245c26;
    font-weight: 600;
}

.messages .message::before {
    content: "\2713\0020";
    font-weight: 700;
}

.messages .message.error {
    background: #fde8e8;
    border-color: #f3b4b4;
    color: #8a2424;
}

.messages .message.error::before {
    content: "\00D7\0020";
}

@media (prefers-color-scheme: dark) {
    .messages .message {
        background: rgba(34, 197, 94, 0.16);
        border-color: rgba(34, 197, 94, 0.35);
        color: #bbf7d0;
    }

    .messages .message.error {
        background: rgba(239, 68, 68, 0.16);
        border-color: rgba(239, 68, 68, 0.35);
        color: #fecaca;
    }
}

/* Footer — warm dark band painted full-width by ::before, three columns */
body > footer {
    position: relative;
    z-index: 0; /* keep the ::before band above the page background */
    margin-top: var(--pico-block-spacing-vertical);
    padding-top: 2.5rem;
    padding-bottom: 1.5rem;
    color: var(--footer-ink);
    text-align: left;
    opacity: 1;
    font-size: 0.95rem;
}

body > footer::before {
    content: "";
    position: absolute;
    inset: 0 calc(50% - 50vw);
    z-index: -1;
    background: var(--footer-bg);
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 2rem;
}

.footer-brand .logo-lockup {
    margin-bottom: 0.75rem;
}

.footer-brand .logo-lockup svg {
    height: 2.4rem;
}

.footer-brand .logo-word {
    color: var(--footer-ink);
}

.footer-heading {
    font-family: var(--pico-font-family);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d9c8b4;
    margin-bottom: 0.6rem;
}

body > footer a {
    color: #f5b58e;
}

body > footer a:hover {
    color: #fbcfa8;
}

/* Footer mailing-list signup */
.signup-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.signup-form input[type="email"] {
    flex: 1 1 14rem;
    margin: 0;
}

.signup-form button {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.footer-fine {
    margin: 2rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(242, 233, 219, 0.18);
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.75;
}

/* Sightings map (Leaflet needs an explicit container height) */
.tip-map {
    height: 60vh;
    min-height: 320px;
    margin: 1rem 0;
    border-radius: 8px;
}

/* Shorter variant for the per-case map on case detail pages */
.tip-map-small {
    height: 40vh;
}
