/* ============================================================
   Kampen om Mellangården — Modern enhancement layer
   Progressive, additive polish over the existing 1940s design.
   Loaded after the inline page styles so it wins on cascade order.
   ============================================================ */

:root {
    --ms-green:        #1a3a2f;
    --ms-green-deep:   #08291e;
    --ms-gold:         #d4a54a;
    --ms-gold-deep:    #c8973a;
    --ms-rust:         #da4802;
    --ms-rust-deep:    #c23f02;
    --ms-paper:        #f5f0e6;
    --ms-line:         #c9a87c;

    /* Tinted, layered elevation — never flat black */
    --shadow-soft:
        0 1px 2px rgba(26, 58, 47, 0.04),
        0 4px 12px rgba(26, 58, 47, 0.06),
        0 14px 34px rgba(26, 58, 47, 0.07);
    --shadow-lift:
        0 2px 4px rgba(26, 58, 47, 0.05),
        0 12px 28px rgba(26, 58, 47, 0.10),
        0 28px 60px rgba(26, 58, 47, 0.13);

    /* Expressive, non-generic easing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:   cubic-bezier(0.34, 1.4, 0.5, 1);
}

/* ---------- 1. Global rendering & rhythm polish ---------- */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern", "liga", "calt";
}

::selection {
    background: var(--ms-gold);
    color: var(--ms-green-deep);
}

/* Visible, on-brand keyboard focus — modern a11y */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--ms-gold);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- 2. Typography refinement ---------- */
.story-title,
.biljetter-title,
.music-title,
.countdown-headline,
.plan-section-title {
    letter-spacing: -0.012em;
    text-wrap: balance;
}

.story-title {
    /* fluid + a touch of optical scaling so it never feels generic */
    font-size: clamp(2.4rem, 5.2vw, 3.4rem);
    line-height: 1.08;
    background: linear-gradient(180deg, #1f4536 0%, var(--ms-green) 65%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.prose p {
    text-wrap: pretty;
}

/* Animated underline reveal on inline prose links */
.prose a,
.read-more-link {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.4s var(--ease-out-expo);
    text-decoration: none;
}
.prose a:hover,
.read-more-link:hover {
    background-size: 100% 1.5px;
    opacity: 1;
}

/* ---------- 3. Ornament dividers — finer, with a center mark ---------- */
.ornament::before,
.ornament::after {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ms-line) 55%, var(--ms-line));
    opacity: 0.85;
}
.ornament::after {
    background: linear-gradient(270deg, transparent, var(--ms-line) 55%, var(--ms-line));
}
.ornament-center {
    position: relative;
}
.plan-section-title {
    background: linear-gradient(100deg, var(--ms-green) 0%, var(--ms-gold-deep) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- 4. Cards: depth, lift & cursor-tracking sheen ---------- */
.plan-card,
.event-card,
.info-panel {
    position: relative;
    overflow: hidden;
    border-color: rgba(26, 58, 47, 0.08);
    box-shadow: var(--shadow-soft);
    transition:
        transform 0.45s var(--ease-out-expo),
        box-shadow 0.45s var(--ease-out-expo),
        border-color 0.45s ease;
    will-change: transform;
}

/* Soft gold spotlight that follows the pointer */
.plan-card::before,
.event-card::before,
.info-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(
        260px circle at var(--mx, 50%) var(--my, 0%),
        rgba(212, 165, 74, 0.16),
        transparent 60%
    );
    transition: opacity 0.4s ease;
}
.plan-card > *,
.event-card > *,
.info-panel > * {
    position: relative;
    z-index: 1;
}

@media (hover: hover) {
    .plan-card:hover {
        transform: translateY(-6px);
        box-shadow: var(--shadow-lift);
        border-color: rgba(212, 165, 74, 0.55);
    }
    .event-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lift);
        border-color: rgba(212, 165, 74, 0.45);
    }
    .plan-card:hover::before,
    .event-card:hover::before,
    .info-panel:hover::before {
        opacity: 1;
    }
}

.plan-card-arrow,
.event-icon {
    transition: transform 0.45s var(--ease-spring);
}
.plan-card:hover .plan-card-arrow {
    transform: translateX(5px);
}

/* Biljetter container — richer, tinted elevation */
.biljetter-card {
    box-shadow:
        0 2px 6px rgba(26, 58, 47, 0.06),
        0 16px 40px rgba(26, 58, 47, 0.10);
    border: 1px solid rgba(26, 58, 47, 0.06);
}

/* ---------- 5. Buttons: lift + light sweep ---------- */
.btn-ticket,
.countdown-cta,
.mobile-panel-cta {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn-ticket {
    box-shadow: 0 4px 14px rgba(218, 72, 2, 0.28);
    transition:
        transform 0.35s var(--ease-out-expo),
        box-shadow 0.35s var(--ease-out-expo),
        background 0.3s ease;
}
.btn-ticket::after,
.countdown-cta::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        110deg,
        transparent 30%,
        rgba(255, 255, 255, 0.38) 50%,
        transparent 70%
    );
    transform: translateX(-130%);
    transition: transform 0.7s var(--ease-out-expo);
}
@media (hover: hover) {
    .btn-ticket:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 10px 24px rgba(218, 72, 2, 0.42);
    }
    .btn-ticket:hover::after,
    .countdown-cta:hover::after {
        transform: translateX(130%);
    }
}

/* ---------- 6. Countdown — filmic depth ---------- */
.countdown-section {
    background:
        radial-gradient(120% 140% at 50% -20%, rgba(212, 165, 74, 0.16), transparent 55%),
        linear-gradient(160deg, #1f4536 0%, var(--ms-green) 55%, #122a21 100%);
    position: relative;
    overflow: hidden;
}
/* subtle film grain so the dark panel reads tactile, not flat */
.countdown-section::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.countdown-number {
    text-shadow: 0 2px 18px rgba(212, 165, 74, 0.3);
}

/* ---------- 7. Desktop nav pill — crisper glass ---------- */
@media (min-width: 1024px) {
    .main-nav {
        transition: box-shadow 0.4s var(--ease-out-expo);
    }
    .nav-link {
        position: relative;
    }
    .nav-link::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 0.5rem;
        width: 0;
        height: 2px;
        border-radius: 2px;
        background: var(--ms-gold);
        transform: translateX(-50%);
        transition: width 0.35s var(--ease-out-expo);
    }
    .nav-link:hover::after,
    .nav-link.active::after {
        width: 42%;
    }
    .nav-link:hover {
        background-color: transparent !important;
    }
}

/* Sticky homepage nav link underline parity */
#homepage-sticky-nav .nav-link {
    position: relative;
}

/* ---------- 8. Media: framed, lifted ---------- */
#index-reel,
#slideshow {
    transition:
        transform 0.5s var(--ease-out-expo),
        box-shadow 0.5s var(--ease-out-expo);
}
@media (hover: hover) {
    #slideshow:hover {
        box-shadow: var(--shadow-lift);
    }
}

/* ---------- 9. Scroll reveal system ---------- */
.reveals-enabled [data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.85s var(--ease-out-expo),
        transform 0.85s var(--ease-out-expo);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}
.reveals-enabled [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

/* ============================================================
   11. Cross-page enhancements
   Targets the shared Tailwind card pattern + named per-page
   components so every page gains the same tactile depth.
   ============================================================ */

/* Refined display headings site-wide */
.font-display {
    letter-spacing: -0.012em;
    text-wrap: balance;
}

/* Shared content cards (Tailwind utility pattern) */
main .rounded-xl.shadow-lg,
main .rounded-xl.shadow-md,
.place-card,
.review-card,
.character-card,
.product-card,
.info-card,
.transport-section,
.faq-item,
.premium-card,
.clip-thumb,
.photo-card {
    box-shadow: var(--shadow-soft) !important;
    transition:
        transform 0.45s var(--ease-out-expo),
        box-shadow 0.45s var(--ease-out-expo),
        border-color 0.45s ease !important;
}

/* Pointer-tracking gold spotlight for content cards */
main .rounded-xl.shadow-lg,
.place-card,
.review-card,
.character-card,
.product-card,
.info-card,
.transport-section,
.premium-card {
    position: relative;
}
main .rounded-xl.shadow-lg::after,
.place-card::after,
.review-card::after,
.character-card::after,
.product-card::after,
.info-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(
        260px circle at var(--mx, 50%) var(--my, 0%),
        rgba(212, 165, 74, 0.14),
        transparent 60%
    );
    transition: opacity 0.4s ease;
}

@media (hover: hover) {
    main .rounded-xl.shadow-lg.hover\:shadow-xl:hover,
    main .group:hover .rounded-xl.shadow-lg,
    .place-card:hover,
    .review-card:hover,
    .character-card:hover,
    .product-card:hover,
    .info-card:hover,
    .transport-section:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lift) !important;
    }
    main .rounded-xl.shadow-lg:hover::after,
    .place-card:hover::after,
    .review-card:hover::after,
    .character-card:hover::after,
    .product-card:hover::after,
    .info-card:hover::after {
        opacity: 1;
    }
}

/* Keep card content above the spotlight layer */
main .rounded-xl.shadow-lg > *,
.place-card > *,
.review-card > *,
.character-card > *,
.product-card > *,
.info-card > * {
    position: relative;
    z-index: 1;
}

/* Animated section-title underline (cookie-policy, etc.) */
.section-title::after {
    transition: width 0.5s var(--ease-out-expo);
}
@media (hover: hover) {
    .section-title:hover::after {
        width: 100px;
    }
}

/* CTA gradient boxes — softer, lifted */
main [class*="from-primary/5"] {
    transition:
        transform 0.4s var(--ease-out-expo),
        box-shadow 0.4s var(--ease-out-expo) !important;
}
@media (hover: hover) {
    main [class*="from-primary/5"]:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lift) !important;
    }
}

/* Photo gallery — smoother zoom & framing */
.photo-card img {
    transition: transform 0.6s var(--ease-out-expo) !important;
}
.sort-btn {
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        transform 0.2s var(--ease-spring) !important;
}
.sort-btn:active {
    transform: scale(0.96);
}

/* Vote / icon buttons — springy press */
.vote-btn {
    transition: transform 0.25s var(--ease-spring) !important;
}
.vote-btn:active {
    transform: scale(0.88);
}

/* Maps & embeds — framed, lifted */
.map-wrapper,
#map {
    box-shadow: var(--shadow-soft);
}

/* Leaflet & iframe rounding stays crisp during transform */
.place-card,
.review-card,
.character-card,
.product-card {
    overflow: hidden;
}

/* ---------- 10. Respect user motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    .reveals-enabled [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
    }
}
