/*
 * GovConn Portal Design System
 * ----------------------------
 * Shared design tokens + component classes for BOTH the admin Portal Page Builder and the
 * public municipality home page. This file is hand-authored static CSS (not part of the
 * Tailwind build), so it is always present regardless of what Tailwind utility classes were
 * safelisted at build time, and it is the single place the visual language now lives instead
 * of being duplicated across a dozen component-level <style> blocks.
 *
 * Per-municipality brand color (Context.Portal.PrimaryColor / SecondaryColor) is still applied
 * inline where a specific municipality's identity needs to show through (logos, hero, primary
 * CTAs) - this file supplies the neutral chrome, type system, spacing, motion, and focus/contrast
 * rules that stay constant across every municipality and admin screen.
 */

:root {
    --gc-font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --gc-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

    --gc-ink-950: #0b1220;
    --gc-ink-900: #14202f;
    --gc-ink-700: #3b4a5f;
    --gc-ink-500: #647087;
    --gc-ink-300: #c7d0dc;
    --gc-ink-200: #dde3ec;
    --gc-ink-100: #eef1f6;
    --gc-surface: #ffffff;
    --gc-surface-muted: #f6f8fb;
    --gc-line: #dfe5ee;

    --gc-brand: #0f6e4f;
    --gc-brand-ink: #0b4d38;
    --gc-brand-tint: #e6f3ec;
    --gc-accent: #b7590c;
    --gc-accent-tint: #fbead9;
    --gc-danger: #b3261e;
    --gc-danger-tint: #fbe9e8;

    --gc-radius-sm: 10px;
    --gc-radius-md: 16px;
    --gc-radius-lg: 24px;
    --gc-radius-xl: 32px;
    --gc-radius-full: 999px;

    --gc-shadow-sm: 0 1px 2px rgba(11, 18, 32, .07), 0 1px 1px rgba(11, 18, 32, .04);
    --gc-shadow-md: 0 12px 28px -12px rgba(11, 18, 32, .22), 0 2px 8px rgba(11, 18, 32, .06);
    --gc-shadow-lg: 0 30px 70px -24px rgba(11, 18, 32, .38);

    --gc-focus-ring: 0 0 0 2px var(--gc-surface), 0 0 0 4.5px rgba(15, 110, 79, .55);
    --gc-focus-ring-dark: 0 0 0 2px rgba(11, 18, 32, .9), 0 0 0 4.5px rgba(110, 231, 183, .6);

    --gc-motion-fast: 150ms;
    --gc-motion-base: 220ms;
    --gc-motion-slow: 420ms;
    --gc-ease: cubic-bezier(.22, 1, .36, 1);

    --gc-touch-min: 44px;

    --gc-site-background-image: url("/images/govconn-standard-background.png");
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --gc-motion-fast: 0ms;
        --gc-motion-base: 0ms;
        --gc-motion-slow: 0ms;
    }
}

/* ---------- Base typography ---------- */

.gc-font-display {
    font-family: var(--gc-font-display);
}

.gc-font-body {
    font-family: var(--gc-font-body);
}

html,
body,
button,
input,
select,
textarea {
    font-family: var(--gc-font-body);
}

html,
body {
    min-height: 100%;
}

body,
.gc-site-background {
    background-attachment: fixed;
    background-color: #f8fafc;
    background-image: var(--gc-site-background-image);
    background-position: center top;
    background-repeat: repeat-y;
    background-size: 100% auto;
}

.gc-site-background {
    min-height: 100vh;
}

.gc-eyebrow {
    font-family: var(--gc-font-body);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--gc-brand-ink);
}

.gc-eyebrow-inverted {
    font-family: var(--gc-font-body);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #86e5bd;
}

.gc-heading-xl {
    font-family: var(--gc-font-display);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: 0;
    color: var(--gc-ink-950);
}

.gc-heading-lg {
    font-family: var(--gc-font-display);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: 0;
    color: var(--gc-ink-950);
}

.gc-heading-md {
    font-family: var(--gc-font-display);
    font-weight: 800;
    line-height: 1.2;
    color: var(--gc-ink-950);
}

.gc-lede {
    font-family: var(--gc-font-body);
    color: var(--gc-ink-700);
    line-height: 1.7;
}

/* ---------- Accessibility primitives ---------- */

.gc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gc-skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 10000;
    background: var(--gc-ink-950);
    color: #fff;
    font-weight: 800;
    font-size: .875rem;
    padding: .75rem 1.25rem;
    border-radius: var(--gc-radius-sm);
    box-shadow: var(--gc-shadow-md);
    transition: top var(--gc-motion-base) var(--gc-ease);
}

.gc-skip-link:focus {
    top: 1rem;
}

:focus-visible {
    outline: none;
    box-shadow: var(--gc-focus-ring);
}

.gc-focus-ring-dark:focus-visible {
    box-shadow: var(--gc-focus-ring-dark);
}

/* ---------- Buttons ---------- */

.gc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: var(--gc-touch-min);
    padding: .7rem 1.35rem;
    border-radius: var(--gc-radius-full);
    font-family: var(--gc-font-body);
    font-weight: 800;
    font-size: .9rem;
    line-height: 1.2;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform var(--gc-motion-fast) var(--gc-ease), box-shadow var(--gc-motion-fast) var(--gc-ease), background-color var(--gc-motion-fast) var(--gc-ease), border-color var(--gc-motion-fast) var(--gc-ease), opacity var(--gc-motion-fast) var(--gc-ease);
}

.gc-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.gc-btn:not(:disabled):hover {
    transform: translateY(-1px);
}

.gc-btn-primary {
    background: var(--gc-ink-950);
    color: #fff;
    box-shadow: var(--gc-shadow-sm);
}

.gc-btn-primary:not(:disabled):hover {
    background: #1c2c40;
}

.gc-btn-brand {
    background: var(--gc-brand);
    color: #fff;
    box-shadow: var(--gc-shadow-sm);
}

.gc-btn-brand:not(:disabled):hover {
    filter: brightness(1.06);
}

.gc-btn-secondary {
    background: var(--gc-surface);
    color: var(--gc-ink-900);
    border-color: var(--gc-line);
    box-shadow: var(--gc-shadow-sm);
}

.gc-btn-secondary:not(:disabled):hover {
    border-color: var(--gc-ink-300);
    background: var(--gc-surface-muted);
}

.gc-btn-ghost {
    background: transparent;
    color: var(--gc-ink-700);
}

.gc-btn-ghost:not(:disabled):hover {
    background: var(--gc-ink-100);
    color: var(--gc-ink-950);
}

/* For use directly on dark/hero backgrounds (e.g. the homepage hero, dark section banners). */
.gc-btn-on-dark {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    border-color: rgba(255, 255, 255, .18);
    backdrop-filter: blur(12px);
}

.gc-btn-on-dark:not(:disabled):hover {
    background: rgba(255, 255, 255, .16);
}

.gc-btn-danger {
    background: var(--gc-danger-tint);
    color: var(--gc-danger);
}

.gc-btn-danger:not(:disabled):hover {
    background: #f6d9d7;
}

.gc-btn-sm {
    min-height: 36px;
    padding: .45rem 1rem;
    font-size: .8rem;
}

.gc-icon-btn {
    display: grid;
    place-items: center;
    height: var(--gc-touch-min);
    width: var(--gc-touch-min);
    border-radius: var(--gc-radius-full);
    border: 1px solid var(--gc-line);
    background: var(--gc-surface);
    font-weight: 900;
    color: var(--gc-ink-900);
    transition: background-color var(--gc-motion-fast) var(--gc-ease), transform var(--gc-motion-fast) var(--gc-ease);
}

.gc-icon-btn:not(:disabled):hover {
    background: var(--gc-surface-muted);
}

.gc-icon-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* ---------- Cards, badges, empty states ---------- */

.gc-card {
    background: var(--gc-surface);
    border-radius: var(--gc-radius-lg);
    box-shadow: var(--gc-shadow-sm);
    border: 1px solid var(--gc-line);
}

.gc-card-interactive {
    transition: transform var(--gc-motion-base) var(--gc-ease), box-shadow var(--gc-motion-base) var(--gc-ease), border-color var(--gc-motion-base) var(--gc-ease);
}

.gc-card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--gc-shadow-md);
}

.gc-card-selected {
    border-color: #6ee7b7;
    background: var(--gc-brand-tint);
    box-shadow: var(--gc-shadow-sm);
}

.gc-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: var(--gc-radius-full);
    padding: .3rem .75rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.gc-badge-brand {
    background: var(--gc-brand-tint);
    color: var(--gc-brand-ink);
}

.gc-badge-neutral {
    background: var(--gc-ink-100);
    color: var(--gc-ink-700);
}

.gc-badge-accent {
    background: var(--gc-accent-tint);
    color: var(--gc-accent);
}

.gc-empty-state {
    border: 1.5px dashed var(--gc-ink-300);
    border-radius: var(--gc-radius-lg);
    background: var(--gc-surface-muted);
    padding: 2rem;
    text-align: center;
    color: var(--gc-ink-500);
}

/* ---------- Form controls ---------- */

.gc-field-label {
    display: block;
    font-family: var(--gc-font-body);
    font-size: .82rem;
    font-weight: 800;
    color: var(--gc-ink-700);
    margin-bottom: .4rem;
}

.gc-input,
.gc-select,
.gc-textarea {
    display: block;
    width: 100%;
    min-height: var(--gc-touch-min);
    border-radius: var(--gc-radius-sm);
    border: 1.5px solid var(--gc-line);
    background: var(--gc-surface);
    padding: .65rem .9rem;
    font-family: var(--gc-font-body);
    font-size: .925rem;
    color: var(--gc-ink-950);
    transition: border-color var(--gc-motion-fast) var(--gc-ease), box-shadow var(--gc-motion-fast) var(--gc-ease);
}

.gc-textarea {
    min-height: 7rem;
    resize: vertical;
}

.gc-input:hover,
.gc-select:hover,
.gc-textarea:hover {
    border-color: var(--gc-ink-300);
}

.gc-input:focus-visible,
.gc-select:focus-visible,
.gc-textarea:focus-visible {
    border-color: var(--gc-brand);
}

/* ---------- Toggle switch ---------- */

.gc-toggle-track {
    position: relative;
    height: 1.75rem;
    width: 3rem;
    border-radius: var(--gc-radius-full);
    border: none;
    background: var(--gc-ink-300);
    transition: background-color var(--gc-motion-base) var(--gc-ease);
    flex-shrink: 0;
}

.gc-toggle-track[aria-pressed="true"] {
    background: var(--gc-brand);
}

.gc-toggle-thumb {
    position: absolute;
    top: .2rem;
    left: .2rem;
    height: 1.35rem;
    width: 1.35rem;
    border-radius: var(--gc-radius-full);
    background: #fff;
    box-shadow: var(--gc-shadow-sm);
    transition: transform var(--gc-motion-base) var(--gc-ease);
}

.gc-toggle-track[aria-pressed="true"] .gc-toggle-thumb {
    transform: translateX(1.25rem);
}

/* ---------- Shared carousel engine styling ----------
 * Consumed by every section renderer that supports the "Carousel" layout (Hero, CardGrid,
 * MediaGallery, ListSection). Consolidated here instead of duplicated per-component. */

.gc-carousel-track,
.gc-hero-carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gc-carousel-track::-webkit-scrollbar,
.gc-hero-carousel-track::-webkit-scrollbar {
    display: none;
}

.gc-carousel-track {
    gap: 1.25rem;
}

.gc-carousel-slide {
    scroll-snap-align: start;
    flex: 0 0 100%;
}

@media (min-width: 768px) {
    .gc-carousel-slide {
        flex: 0 0 calc(50% - .625rem);
    }
}

.gc-hero-carousel-slide {
    scroll-snap-align: start;
    flex: 0 0 100%;
    min-width: 100%;
}

.gc-carousel-nav-btn {
    display: grid;
    place-items: center;
    height: 2.75rem;
    width: 2.75rem;
    border-radius: var(--gc-radius-full);
    border: 1px solid var(--gc-line);
    background: var(--gc-surface);
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--gc-ink-950);
    transition: background-color var(--gc-motion-fast) var(--gc-ease), transform var(--gc-motion-fast) var(--gc-ease);
}

.gc-carousel-nav-btn:hover:not(:disabled) {
    background: var(--gc-surface-muted);
    transform: translateY(-1px);
}

.gc-carousel-nav-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.gc-carousel-dot {
    height: .5rem;
    width: .5rem;
    border-radius: var(--gc-radius-full);
    background: var(--gc-ink-300);
    transition: all var(--gc-motion-fast) var(--gc-ease);
}

.gc-carousel-dot[aria-current="true"] {
    background: var(--gc-brand);
    width: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .gc-carousel-track,
    .gc-hero-carousel-track {
        scroll-behavior: auto;
    }
}

/* ---------- Section entrance motion ---------- */

@keyframes gcSectionRise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gc-section-rise {
    animation: gcSectionRise var(--gc-motion-slow) var(--gc-ease) both;
}

@media (prefers-reduced-motion: reduce) {
    .gc-section-rise {
        animation: none;
    }
}

/* ---------- Layout helpers ---------- */

.gc-shell {
    background: transparent;
    color: var(--gc-ink-950);
    font-family: var(--gc-font-body);
}

.gc-container {
    margin-inline: auto;
    max-width: 84rem;
    padding-inline: 1rem;
}

/* ---------- Public portal section layout ---------- */

.gc-portal-section {
    --gc-page-brand: var(--gc-brand);
    --gc-page-brand-strong: var(--gc-brand-ink);
    --gc-page-brand-soft: color-mix(in srgb, var(--gc-page-brand) 11%, #fff);
    --gc-page-brand-line: color-mix(in srgb, var(--gc-page-brand) 20%, var(--gc-line));
    border: 1px solid var(--gc-page-brand-line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .9));
    box-shadow: var(--gc-shadow-sm);
    padding: 1rem;
}

.gc-portal-section-header {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.gc-portal-section-content {
    min-width: 0;
}

@media (min-width: 640px) {
    .gc-portal-section {
        padding: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .gc-portal-section {
        padding: 1.5rem;
    }

    .gc-portal-section-header {
        align-items: flex-end;
        flex-direction: row;
        justify-content: space-between;
    }

    .gc-portal-section-content.gc-auto-grid,
    .gc-portal-section-content.gc-auto-grid-lg {
        align-items: stretch;
    }

    .gc-portal-section-content .gc-content-card {
        height: 100%;
    }
}

.gc-section-title {
    color: var(--gc-ink-950);
    font-family: var(--gc-font-display);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.15;
}

@media (min-width: 1024px) {
    .gc-section-title {
        font-size: 2.25rem;
    }
}

.gc-section-copy {
    color: var(--gc-ink-700);
    line-height: 1.65;
}

.gc-auto-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.gc-auto-grid-sm {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}

.gc-auto-grid-lg {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
}

.gc-brand-link,
.gc-brand-outline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border-radius: 8px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: transform var(--gc-motion-fast) var(--gc-ease), box-shadow var(--gc-motion-fast) var(--gc-ease), background-color var(--gc-motion-fast) var(--gc-ease), border-color var(--gc-motion-fast) var(--gc-ease);
}

.gc-brand-link {
    border: 1px solid var(--gc-page-brand-strong);
    background: var(--gc-page-brand-strong);
    color: #fff;
    box-shadow: var(--gc-shadow-sm);
}

.gc-brand-link:hover {
    background: var(--gc-page-brand);
    border-color: var(--gc-page-brand);
    transform: translateY(-1px);
}

.gc-brand-outline-link {
    border: 1px solid var(--gc-page-brand-line);
    background: #fff;
    color: var(--gc-page-brand-strong);
    box-shadow: var(--gc-shadow-sm);
}

.gc-brand-outline-link:hover {
    border-color: var(--gc-page-brand);
    transform: translateY(-1px);
}

.gc-brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--gc-page-brand-soft);
    color: var(--gc-page-brand-strong);
    font-weight: 800;
}

.gc-content-card {
    border: 1px solid var(--gc-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--gc-shadow-sm);
    overflow: hidden;
    transition: transform var(--gc-motion-base) var(--gc-ease), box-shadow var(--gc-motion-base) var(--gc-ease), border-color var(--gc-motion-base) var(--gc-ease);
}

.gc-content-card:hover {
    border-color: var(--gc-page-brand-line);
    box-shadow: var(--gc-shadow-md);
    transform: translateY(-2px);
}

.gc-card-title {
    color: var(--gc-ink-950);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
}

.gc-card-text {
    color: var(--gc-ink-700);
    line-height: 1.55;
}

.gc-list-section {
    --gc-page-brand: var(--gc-brand);
    --gc-page-brand-strong: var(--gc-brand-ink);
    --gc-page-brand-soft: color-mix(in srgb, var(--gc-page-brand) 11%, #fff);
    --gc-page-brand-line: color-mix(in srgb, var(--gc-page-brand) 20%, var(--gc-line));
    display: grid;
    gap: 1rem;
    border: 1px solid var(--gc-page-brand-line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .9));
    box-shadow: var(--gc-shadow-sm);
    padding: 1rem;
}

@media (min-width: 1024px) {
    .gc-list-section {
        grid-template-columns: minmax(240px, .42fr) minmax(0, 1fr);
        align-items: stretch;
        padding: 1.25rem;
    }
}

.gc-list-sidebar {
    min-width: 0;
}

.gc-list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: 1.25rem;
}

.gc-list-content {
    min-width: 0;
}

.gc-portal-section .gc-badge-brand,
.gc-list-section .gc-badge-brand {
    background: var(--gc-page-brand-soft);
    color: var(--gc-page-brand-strong);
}

@media (min-width: 1024px) {
    .gc-list-sidebar {
        display: flex;
        flex-direction: column;
        height: 100%;
        position: sticky;
        top: 6rem;
    }

    .gc-list-actions {
        margin-top: auto;
        padding-top: 1.25rem;
    }

    .gc-list-content {
        display: flex;
        min-height: 100%;
    }

    .gc-list-content > * {
        width: 100%;
    }

    .gc-list-content .gc-auto-grid {
        min-height: 100%;
    }
}

.gc-compact-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--gc-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--gc-shadow-sm);
    padding: .75rem;
    transition: transform var(--gc-motion-base) var(--gc-ease), box-shadow var(--gc-motion-base) var(--gc-ease), border-color var(--gc-motion-base) var(--gc-ease);
}

.gc-compact-row:hover {
    border-color: var(--gc-page-brand-line);
    box-shadow: var(--gc-shadow-md);
    transform: translateY(-1px);
}

.gc-compact-row-title,
.gc-compact-row-copy {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .gc-compact-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .gc-compact-row .gc-brand-link {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (min-width: 640px) {
    .gc-container {
        padding-inline: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .gc-container {
        padding-inline: 2rem;
    }
}
