:root {
    --color-primary: #1e2a4a;
    --color-primary-rgb: 30, 42, 74;
    --color-accent: #5c7cfa;
    --color-accent-dark: #4263eb;
    --color-holiday: #dc3545;
    --color-joint-leave: #fd7e14;
    --color-religious: #6f42c1;
    --color-local: #198754;
    --color-observance: #6c757d;
    --color-surface: #f7f8fc;
    --color-border: #e6e9f2;
    --color-text: #25304a;
    --shadow-soft: 0 0.75rem 2.5rem rgba(30, 42, 74, 0.1);
    --radius-lg: 1.25rem;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--color-text);
    background: var(--color-surface);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--color-primary);
}

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

:focus-visible {
    outline: 3px solid rgba(var(--color-primary-rgb), 0.35);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 2000;
    top: 0.75rem;
    left: 0.75rem;
    transform: translateY(-180%);
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    background: #fff;
    color: var(--color-primary);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-main {
    flex: 1 0 auto;
}

.site-header {
    background: rgba(30, 42, 74, 0.97);
    box-shadow: 0 0.35rem 1.5rem rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
}

.navbar {
    min-height: 4.75rem;
}

.navbar-brand img {
    filter: drop-shadow(0 0.25rem 0.5rem rgba(0, 0, 0, 0.2));
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-copy strong {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.brand-copy small {
    margin-top: 0.3rem;
    font-size: 0.68rem;
    font-weight: 500;
    opacity: 0.72;
}

.navbar .nav-link {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 0.65rem;
    padding-inline: 0.85rem !important;
    font-weight: 600;
}

.navbar .nav-link.active,
.navbar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
}

.hero-section {
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary) 0%, #2b3c69 55%, #38529b 100%);
    box-shadow: var(--shadow-soft);
}

.hero-section h1 {
    letter-spacing: -0.04em;
}

.hero-lead {
    color: rgba(255, 255, 255, 0.84);
    max-width: 42rem;
}

.hero-next-holiday {
    min-height: 20rem;
    background: linear-gradient(145deg, rgba(92, 124, 250, 0.92), rgba(66, 99, 235, 0.82));
}

.hero-countdown {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

.hero-countdown strong {
    font-size: clamp(3.5rem, 10vw, 6rem);
    letter-spacing: -0.08em;
    line-height: 1;
}

.hero-countdown span {
    font-size: 1.1rem;
    font-weight: 700;
}

.eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--color-accent);
    --bs-btn-border-color: var(--color-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--color-accent-dark);
    --bs-btn-hover-border-color: var(--color-accent-dark);
    font-weight: 700;
}

.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: #121b33;
    --bs-btn-hover-border-color: #121b33;
}

.section-heading h2,
.long-weekend-panel h2,
.about-panel h2,
.cta-section h2 {
    letter-spacing: -0.025em;
}

.holiday-card {
    border-radius: 1rem;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.holiday-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft) !important;
}

.min-w-0 {
    min-width: 0;
}

.date-tile {
    width: 3.75rem;
    height: 4.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: #eef1ff;
    color: var(--color-primary);
}

.date-tile-day {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.date-tile-month {
    max-width: 3.25rem;
    margin-top: 0.3rem;
    overflow: hidden;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.holiday-type-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
}

.holiday-type-national { background: var(--color-holiday); }
.holiday-type-joint-leave { background: var(--color-joint-leave); }
.holiday-type-religious { background: var(--color-religious); }
.holiday-type-local { background: var(--color-local); }
.holiday-type-observance { background: var(--color-observance); }

.long-weekend-panel,
.about-panel,
.cta-section,
.empty-state {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: #fff;
}

.long-weekend-panel {
    background: linear-gradient(140deg, #fff 0%, #f0f3ff 100%);
}

.long-weekend-range {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-primary);
}

.metric-pill {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    border: 1px solid #d9def4;
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    background: #fff;
    font-size: 0.85rem;
}

.feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    background: #eef1ff;
    color: var(--color-accent-dark);
    font-size: 1.55rem;
}

.text-link {
    font-weight: 800;
    text-decoration: none;
}

.cta-section p,
.error-page p {
    max-width: 42rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.site-footer {
    color: #f4f6ff;
    background: var(--color-primary);
}

.text-footer-muted {
    color: rgba(244, 246, 255, 0.7);
}

.footer-heading {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-links li + li {
    margin-top: 0.55rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
}

.footer-links a:hover {
    color: #fff;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.16);
}

.error-page {
    min-height: 55vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-code {
    font-size: clamp(5rem, 20vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.1em;
    line-height: 0.9;
    color: #dfe4f5;
}

.request-id {
    color: #667085;
    font-size: 0.82rem;
}

.tibur-toast {
    position: fixed;
    z-index: 2000;
    right: 1rem;
    bottom: 1rem;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: 0.9rem 1.1rem;
    border-radius: 0.85rem;
    color: #fff;
    background: var(--color-primary);
    box-shadow: var(--shadow-soft);
}

body.tibur-mode .hero-section {
    background: linear-gradient(135deg, #1e2a4a 0%, #3c4e80 55%, #5c7cfa 100%);
}

body.tibur-mode .site-header img,
body.tibur-mode .hero-section {
    animation: tibur-pulse 900ms ease-in-out 1;
}

@keyframes tibur-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.025); }
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        padding-block: 0.75rem 1rem;
    }

    .navbar .nav-link {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

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

/* Holiday list and detail */
.holiday-filter-panel,
.holiday-result-card,
.adjacent-holiday-card {
    border-radius: 1rem;
}

.holiday-filter-panel .form-label {
    font-size: 0.82rem;
    font-weight: 750;
    color: #44506b;
}

.holiday-filter-panel .form-control,
.holiday-filter-panel .form-select,
.holiday-filter-panel .input-group-text {
    min-height: 2.85rem;
}

.holiday-result-card {
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.holiday-result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft) !important;
}

.holiday-result-date {
    width: 100%;
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 800;
}

.holiday-result-meta {
    --gap-x: 1rem;
    column-gap: var(--gap-x);
    row-gap: 0.5rem;
}

.holiday-result-meta a {
    color: inherit;
}

.holiday-description {
    line-height: 1.75;
    white-space: pre-line;
}

.adjacent-holiday-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.adjacent-holiday-card:hover {
    border-color: #bec8f3;
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.adjacent-holiday-card.is-next {
    text-align: left;
}

.adjacent-holiday-direction {
    color: var(--color-accent-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.adjacent-holiday-card small {
    color: #667085;
}

.pagination .page-link {
    min-width: 2.65rem;
    min-height: 2.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem !important;
}

.pagination .page-item.active .page-link {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

@media (min-width: 768px) {
    .holiday-result-date {
        width: 12.5rem;
        padding-top: 0.15rem;
    }

    .adjacent-holiday-card.is-next {
        align-items: flex-end;
        text-align: right;
    }
}

/* Long weekend search and recommendations */
.long-weekend-search-panel,
.long-weekend-recommendation {
    border-radius: 1rem;
}

.long-weekend-search-panel .form-label {
    color: #44506b;
    font-size: 0.82rem;
    font-weight: 750;
}

.long-weekend-search-panel .form-select {
    min-height: 2.85rem;
}

.long-weekend-recommendation {
    overflow: hidden;
}

.long-weekend-recommendation::before {
    display: block;
    width: 100%;
    height: 0.3rem;
    background: linear-gradient(90deg, var(--color-accent), var(--color-local));
    content: "";
}

.recommendation-number {
    display: inline-grid;
    min-width: 2.3rem;
    height: 2.3rem;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 850;
}

.recommendation-metric {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e1e5f2;
    border-radius: 0.9rem;
    background: #f9faff;
}

.recommendation-metric-icon {
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 2.7rem;
    place-items: center;
    border-radius: 0.75rem;
    color: var(--color-accent-dark);
    background: #e9edff;
    font-size: 1.15rem;
}

.recommendation-metric strong,
.recommendation-metric span {
    display: block;
}

.recommendation-metric strong {
    color: var(--color-primary);
    font-size: 1.35rem;
    line-height: 1.1;
}

.recommendation-metric div > span {
    margin-top: 0.2rem;
    color: #667085;
    font-size: 0.82rem;
}

.leave-date-chip {
    display: inline-flex;
    flex-direction: column;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ffd4b5;
    border-radius: 0.8rem;
    color: #7a3d0a;
    background: #fff6ee;
    font-size: 0.84rem;
}

.leave-date-chip strong {
    color: #a64b00;
}

.involved-holiday {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #edf0f6;
}

.involved-holiday:last-child {
    border-bottom: 0;
}

.copy-summary-button.btn-success {
    border-color: var(--color-local);
    background: var(--color-local);
}

@media (max-width: 575.98px) {
    .long-weekend-recommendation .btn {
        width: 100%;
    }

    .involved-holiday {
        align-items: flex-start;
    }
}

/* UI Stage 6: accessibility and responsive hardening */
.brand-logo-trigger {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-grid;
    flex: 0 0 2.75rem;
    place-items: center;
    border: 0;
    border-radius: 0.75rem;
    padding: 0.15rem;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.brand-logo-trigger:hover,
.brand-logo-trigger[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.12);
}

.brand-logo-trigger:disabled {
    cursor: default;
    opacity: 1;
}

.brand-home-link {
    color: #fff;
    text-decoration: none;
}

.brand-home-link:hover,
.brand-home-link:focus-visible {
    color: #fff;
}

.btn,
.form-control,
.form-select,
.page-link,
.navbar-toggler,
.admin-sidebar .nav-link {
    min-height: 2.75rem;
}

.btn-sm,
.form-select-sm,
.form-control-sm {
    min-height: 2.5rem;
}

.table-responsive {
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
    vertical-align: middle;
}

.table td {
    overflow-wrap: anywhere;
}

.holiday-type-joint-leave,
.calendar-holiday-link.holiday-type-joint-leave {
    color: #2d1600;
}

.btn-accent {
    --bs-btn-bg: var(--color-accent-dark);
    --bs-btn-border-color: var(--color-accent-dark);
}

.tibur-toast {
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 180ms ease, transform 180ms ease;
}

.tibur-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

body.tibur-mode .brand-logo-trigger[aria-pressed="true"] {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}

body.tibur-mode .brand-logo-trigger img {
    animation: tibur-wiggle 700ms ease-in-out 1;
}

@keyframes tibur-wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-7deg) scale(1.05); }
    75% { transform: rotate(7deg) scale(1.05); }
}

@media (max-width: 575.98px) {
    .container {
        --bs-gutter-x: 1.25rem;
    }

    .navbar-brand {
        max-width: calc(100vw - 5.75rem);
    }

    .brand-copy strong,
    .brand-copy small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-copy {
        min-width: 0;
        max-width: 12.5rem;
    }

    .hero-section .btn,
    .holiday-filter-panel .btn,
    .long-weekend-search-panel .btn,
    .admin-form-card .btn {
        width: 100%;
    }

    .tibur-toast {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tibur-toast,
    body.tibur-mode .brand-logo-trigger img {
        transition: none;
        animation: none;
    }
}
