/*
 * Vilabot.cat v0.5 — app styles (no framework, no build step).
 *
 * Identity: the senyera (yellow #FCDD09 / red #DA121A), ink and warm paper.
 * Yellow is only ever a BACKGROUND under dark text — never text on a light
 * surface — so every pairing passes WCAG AA. The stripe motif appears in the
 * brand mark, the loading bar, the day headers and the footer.
 *
 * Shared by every page: tokens, base, header, footer, buttons, dialogs.
 * Page-specific extras live in pobles.css / refrescar.css.
 */

/* ------------------------------------------------------------ tokens */
:root {
    --red: #DA121A;
    --red-600: #B50E14;
    --red-700: #8F0B10;
    --yellow: #FCDD09;
    --yellow-600: #E5C708;
    --ink: #1a1a1a;
    --paper: #FFFEF5;

    --bg: var(--paper);
    --bg-2: #F6F2E2;
    --surface: #FFFFFF;
    --surface-2: #FBF8EC;
    --text: var(--ink);
    --text-2: #3d3a33;
    --muted: #5d594f;             /* 6.4:1 on paper */
    --line: rgba(26, 26, 26, 0.12);
    --line-2: rgba(26, 26, 26, 0.22);
    --accent: var(--red);         /* text-safe red on light surfaces (5.1:1) */
    --accent-strong: var(--red-600);
    --on-accent: #FFFFFF;
    --on-yellow: #1a1a1a;
    --stub: var(--red);
    --ok: #146C2E;
    --ok-bg: #E3F4E6;
    --warn-bg: #FFF6CC;
    --danger-bg: #FDECEC;
    --focus-ring: var(--ink);
    --focus-halo: var(--yellow);
    --shadow-1: 0 1px 2px rgba(26, 26, 26, 0.06), 0 2px 8px rgba(26, 26, 26, 0.05);
    --shadow-2: 0 10px 30px rgba(26, 26, 26, 0.12);
    --shadow-pop: 0 18px 50px rgba(26, 26, 26, 0.22);
    --backdrop: rgba(24, 20, 10, 0.48);

    --font-display: 'Fraunces Variable', 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-ui: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 22px;
    --gutter: 16px;
    --wrap: 1180px;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --senyera-h: repeating-linear-gradient(180deg, var(--yellow) 0 11.111%, var(--red) 11.111% 22.222%);
    --senyera-v: repeating-linear-gradient(90deg, var(--yellow) 0 11.111%, var(--red) 11.111% 22.222%);

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14120E;
        --bg-2: #1B1813;
        --surface: #201D17;
        --surface-2: #26221B;
        --text: #F4F0E3;
        --text-2: #DCD6C5;
        --muted: #B3AC9A;
        --line: rgba(255, 250, 235, 0.12);
        --line-2: rgba(255, 250, 235, 0.24);
        --accent: #FF6B6B;          /* lifted red: 6.3:1 on --bg */
        --accent-strong: #FF8A8A;
        --stub: #C8101A;
        --ok: #7EDC97;
        --ok-bg: rgba(46, 160, 67, 0.16);
        --warn-bg: rgba(252, 221, 9, 0.12);
        --danger-bg: rgba(218, 18, 26, 0.18);
        --focus-ring: var(--yellow);
        --focus-halo: rgba(218, 18, 26, 0.85);
        --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
        --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.6);
        --backdrop: rgba(0, 0, 0, 0.62);
    }
}

@media (min-width: 640px) {
    :root { --gutter: 24px; }
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 72px;
}

html:has(dialog[open]) { overflow: hidden; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

main { flex: 1 0 auto; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
p { text-wrap: pretty; }
ul[class], ol[class] { list-style: none; padding: 0; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic-sm { width: 1em; height: 1em; }

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

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: max(var(--gutter), env(safe-area-inset-left));
}

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--focus-halo);
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: 12px; top: -80px;
    z-index: 100;
    padding: 12px 18px;
    background: var(--ink);
    color: #fff;
    border-radius: 0 0 12px 12px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 0; color: #fff; }

/* Senyera progress bar (any request in flight). */
.progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 4px;
    z-index: 90;
    background: repeating-linear-gradient(90deg, var(--yellow) 0 22px, var(--red) 22px 44px);
    background-size: 44px 100%;
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    transition: transform 0.6s var(--ease-out), opacity 0.3s ease 0.2s;
    pointer-events: none;
}
.is-loading .progress {
    opacity: 1;
    transform: scaleX(1);
    transition: transform 1.6s var(--ease-out), opacity 0.1s ease;
    animation: stripes-move 0.7s linear infinite;
}
@keyframes stripes-move { to { background-position: 44px 0; } }

/* ------------------------------------------------------------ buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 44px;
    padding: 0.6rem 1.15rem;
    border: 2px solid transparent;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.97rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.15s var(--ease-out), background-color 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-primary:hover { background: var(--red-600); border-color: var(--red-600); color: #fff; }

.btn-yellow { background: var(--yellow); color: var(--on-yellow); border-color: var(--ink); }
.btn-yellow:hover { background: var(--yellow-600); color: var(--on-yellow); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--text); color: var(--text); }

.btn-soft { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-soft:hover { border-color: var(--text); color: var(--text); }

.btn-ink { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ink:hover { color: var(--bg); opacity: 0.9; }

.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px; height: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    transition: background-color 0.2s, transform 0.15s var(--ease-out);
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn:active { transform: scale(0.92); }

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* ------------------------------------------------------------ header */
.site-header {
    position: relative;
    z-index: 30;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    min-height: 44px;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1.5px var(--ink); }
.brand-tld { color: var(--accent); }
.brand:hover .bm-s { animation: mark-wave 0.9s var(--ease-out); }
.brand:hover .bm-s:nth-of-type(2) { animation-delay: 0.05s; }
.brand:hover .bm-s:nth-of-type(3) { animation-delay: 0.1s; }
.brand:hover .bm-s:nth-of-type(4) { animation-delay: 0.15s; }
@keyframes mark-wave { 40% { transform: translateX(-3px); } 70% { transform: translateX(2px); } }

.site-nav { display: none; }
.nav-list { display: flex; align-items: center; gap: 0.25rem; }
.nav-list > li > a,
.menu > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0 0.85rem;
    border-radius: 999px;
    color: var(--text);
    font-weight: 550;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.nav-list > li > a:hover,
.menu > summary:hover { background: var(--bg-2); color: var(--text); }
.nav-list > li > a[aria-current="page"] {
    background: var(--text);
    color: var(--bg);
}

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--bg-2); }
.menu[open] > summary .ic-sm { transform: rotate(180deg); }
.menu > summary .ic-sm { transition: transform 0.2s var(--ease-out); }

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 260px;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    animation: pop-in 0.18s var(--ease-out);
    z-index: 40;
}
.menu-panel a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-weight: 550;
}
.menu-panel a:hover { background: var(--bg-2); color: var(--text); }
.menu-panel a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--red); }
.menu-sep { height: 1px; margin: 0.35rem 0.5rem; background: var(--line); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

.menu-mobile > summary { border: 1px solid var(--line-2); }

@media (min-width: 900px) {
    .site-nav { display: block; }
    .menu-mobile { display: none; }
}

/* ------------------------------------------------------------ hero */
.hero {
    position: relative;
    isolation: isolate;
    padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 55%, transparent);
    mask-image: linear-gradient(#000 55%, transparent);
}
.hero-flag {
    position: absolute;
    top: -30%;
    right: -38%;
    width: min(900px, 120vw);
    aspect-ratio: 1;
    background: var(--senyera-h);
    opacity: 0.13;
    transform: rotate(-14deg);
    border-radius: 48px;
    animation: flag-drift 22s ease-in-out infinite alternate;
    -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
    mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
}
.hero-glow {
    position: absolute;
    inset: -20% -10% auto auto;
    width: 70%;
    height: 90%;
    background: radial-gradient(closest-side, rgba(252, 221, 9, 0.22), transparent);
    animation: glow-pulse 9s ease-in-out infinite alternate;
}
@keyframes flag-drift {
    from { transform: rotate(-14deg) translate3d(0, 0, 0); }
    to   { transform: rotate(-10deg) translate3d(-3%, 4%, 0); }
}
@keyframes glow-pulse { from { opacity: 0.6; } to { opacity: 1; transform: scale(1.08); } }

@media (prefers-color-scheme: dark) {
    .hero-flag { opacity: 0.09; }
    .hero-glow { background: radial-gradient(closest-side, rgba(252, 221, 9, 0.08), transparent); }
}

.hero-inner { max-width: var(--wrap); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.85rem 0.35rem 0.7rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-2);
    max-width: 100%;
}
.live-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 0 rgba(218, 18, 26, 0.5);
    animation: live 2.4s ease-out infinite;
    flex: none;
}
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(218, 18, 26, 0.45); } 70%, 100% { box-shadow: 0 0 0 9px rgba(218, 18, 26, 0); } }

.hero-title {
    font-size: clamp(2.35rem, 8.2vw, 5rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.035em;
    max-width: 14ch;
    font-variation-settings: "SOFT" 50, "WONK" 1;
}
.hl {
    color: var(--accent);
    white-space: nowrap;
    background-image: linear-gradient(transparent 64%, var(--yellow) 64%, var(--yellow) 90%, transparent 90%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    animation: marker 0.9s var(--ease-out) 0.25s both;
    padding-inline: 0.04em;
}
@media (min-width: 900px) {
    .hero { padding-top: 2.75rem; }
    .hero-title { max-width: none; font-size: clamp(3.2rem, 5.6vw, 4.6rem); }
    .where-row { max-width: 720px; }
}
@media (min-width: 1100px) {
    .hero .seasonal { display: none; } /* the sidebar lists them */
}
@media (prefers-color-scheme: dark) {
    .hl { background-image: linear-gradient(transparent 70%, rgba(252, 221, 9, 0.35) 70%, rgba(252, 221, 9, 0.35) 92%, transparent 92%); }
}
@keyframes marker { from { background-size: 0% 100%; } }

.hero-sub {
    margin-top: 0.9rem;
    max-width: 38rem;
    font-size: clamp(1.02rem, 2.4vw, 1.2rem);
    color: var(--text-2);
}

/* Big natural-language search */
.search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 820px;
    margin-top: 1.6rem;
    padding: 6px 6px 6px 14px;
    background: var(--surface);
    border: 2px solid var(--ink);
    border-radius: 20px;
    box-shadow: 5px 5px 0 var(--red);
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.search:focus-within {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--yellow), 7px 7px 0 2px var(--ink);
}
@media (prefers-color-scheme: dark) {
    .search { border-color: var(--line-2); }
    .search:focus-within { box-shadow: 7px 7px 0 var(--red); border-color: var(--yellow); }
}
.search-ic { width: 22px; height: 22px; color: var(--muted); }
.search input {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: clamp(1rem, 2.6vw, 1.15rem);
    font-weight: 500;
}
.search input:focus-visible { box-shadow: none; outline: 0; }
.search input::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.kbd-hint {
    display: none;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--muted);
}
.search-btn { min-height: 52px; border-radius: 15px; padding-inline: 1.3rem; font-size: 1.02rem; }
.search-btn .ic { transition: transform 0.2s var(--ease-out); }
.search-btn:hover .ic { transform: translateX(3px); }
@media (min-width: 900px) {
    .search:not(:focus-within) .kbd-hint { display: inline-block; }
}
@media (max-width: 420px) {
    .search { padding-left: 10px; }
    .search-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .search-btn { padding-inline: 0.9rem; }
}

.try {
    display: flex;
    flex-wrap: wrap;
    max-width: 820px;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin-top: 0.85rem;
    font-size: 0.9rem;
    color: var(--muted);
}
.try-label { font-weight: 600; }
.try-btn {
    min-height: 44px;
    padding: 0.15rem 0;
    border: 0;
    background: none;
    color: var(--text-2);
    text-decoration: underline dotted var(--line-2);
    text-underline-offset: 0.25em;
    text-align: left;
}
.try-btn:hover { color: var(--accent); text-decoration-color: currentColor; }

@media (max-width: 640px) {
    /* One swipeable line of examples instead of three wrapped ones. */
    .try {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin-inline: calc(var(--gutter) * -1);
        padding-inline: var(--gutter);
        white-space: nowrap;
    }
    .try::-webkit-scrollbar { display: none; }
    .try-btn { flex: none; }
}

/* Arriving with a query: the slogan steps aside so results show above the fold. */
.is-compact .hero { padding-top: 1.25rem; }
.is-compact .eyebrow,
.is-compact .hero-title,
.is-compact .hero-sub,
.is-compact .try,
.is-compact .seasonal { display: none; }
.is-compact .search { margin-top: 0; }
.is-compact .filters { margin-top: 1.1rem; }

/* ------------------------------------------------------------ filters */
.filters {
    display: grid;
    gap: 1rem;
    margin-top: 1.6rem;
    max-width: 980px;
}

.filter-block { min-width: 0; border: 0; padding: 0; }
.filter-label {
    display: block;
    margin-bottom: 0.4rem;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.where-row { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }

.combo { position: relative; flex: 1 1 170px; min-width: 0; }
.combo-ic { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--accent); pointer-events: none; }
.combo input {
    width: 100%;
    min-height: 48px;
    padding: 0 46px 0 44px;
    border: 1.5px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 550;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.combo input::placeholder { color: var(--muted); font-weight: 400; opacity: 1; }
.combo input:hover { border-color: var(--text); }
.combo input:focus-visible { outline: 0; border-color: var(--text); box-shadow: 0 0 0 4px var(--focus-halo); border-radius: 999px; }
.combo.has-value input { border-color: var(--text); background: var(--surface); }
.combo-clear {
    position: absolute;
    right: 2px; top: 50%;
    translate: 0 -50%;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border: 0; border-radius: 999px;
    background: transparent;
    color: var(--muted);
}
.combo-clear:hover { color: var(--text); background: var(--bg-2); }

.combo-list {
    position: absolute;
    left: 0;
    width: max(100%, min(380px, calc(100vw - 2 * var(--gutter))));
    top: calc(100% + 6px);
    z-index: 25;
    max-height: min(360px, 55vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    animation: pop-in 0.15s var(--ease-out);
}
.combo-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.combo-opt[aria-selected="true"] { background: var(--yellow); color: var(--on-yellow); }
.combo-opt[aria-selected="true"] .opt-sub { color: var(--on-yellow); }
.combo-opt:hover:not([aria-selected="true"]) { background: var(--bg-2); }
.opt-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.opt-name mark { background: none; color: inherit; text-decoration: underline 2px var(--red); text-underline-offset: 0.15em; }
.opt-sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; flex: none; }
.combo-group {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.combo-empty { padding: 0.75rem; color: var(--muted); font-size: 0.92rem; }

.near-btn { flex: none; min-height: 48px; }
.near-btn[aria-busy="true"] .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.geo-status {
    margin-top: 0.55rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--warn-bg);
    font-size: 0.9rem;
    color: var(--text);
}
.geo-status.is-ok { background: var(--ok-bg); }

/* Segmented "Quan" */
.seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    border: 1.5px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    scroll-snap-type: x proximity;
}
.seg::-webkit-scrollbar { display: none; }
.seg-opt { position: relative; flex: none; scroll-snap-align: start; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt span {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.95rem;
    border-radius: 999px;
    font-size: 0.93rem;
    font-weight: 550;
    white-space: nowrap;
    color: var(--text-2);
    transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ease-out);
}
.seg-opt:hover span { background: var(--bg-2); color: var(--text); }
.seg-opt input:checked + span { background: var(--text); color: var(--bg); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus-ring); outline-offset: 1px; box-shadow: 0 0 0 6px var(--focus-halo); }
.seg-opt input:active + span { transform: scale(0.95); }

.when-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-top: 0.6rem;
    animation: pop-in 0.2s var(--ease-out);
}
.date-field { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 600; color: var(--text-2); }
.date-field input {
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

/* Category chips (scroll horizontally on every width) */
.chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 2px 6px;
    margin-inline: -2px;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chips.at-end { -webkit-mask-image: none; mask-image: none; }
.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1rem;
    border: 1.5px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.93rem;
    font-weight: 550;
    white-space: nowrap;
    scroll-snap-align: start;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s var(--ease-spring), box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--text); }
.chip:active { transform: scale(0.94); }
.chip[aria-pressed="true"] {
    background: var(--yellow);
    color: var(--on-yellow);
    border-color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
}
.chip[aria-pressed="true"]::after {
    content: "";
    width: 0.55rem; height: 0.3rem;
    margin-left: 0.1rem;
    border: solid currentColor;
    border-width: 0 0 2px 2px;
    transform: translateY(-2px) rotate(-45deg);
}
.chip-free { border-style: dashed; }
@media (min-width: 900px) and (pointer: fine) {
    /* Mouse users can't swipe: show every category at once. */
    .chips { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
    .chip { min-height: 40px; padding: 0 0.9rem; }
}

.seasonal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}
.seasonal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 0.95rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    transition: transform 0.2s var(--ease-out), border-color 0.2s;
}
.seasonal-link:hover { transform: translateY(-2px); color: var(--text); border-color: var(--text); }
.seasonal-water { background: linear-gradient(120deg, rgba(14, 165, 233, 0.14), rgba(34, 211, 238, 0.1)); }
.seasonal-fire { background: linear-gradient(120deg, rgba(249, 115, 22, 0.14), rgba(252, 221, 9, 0.14)); }

/* ------------------------------------------------------------ layout */
.layout {
    display: grid;
    gap: 2.5rem;
    padding-top: 0.5rem;
    padding-bottom: 4rem;
}
@media (min-width: 1100px) {
    .layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 3.5rem; }
    .side { position: sticky; top: 1.5rem; align-self: start; }
}

/* ------------------------------------------------------------ results head */
.results { min-width: 0; outline: 0; }
.results-head {
    padding-top: 1.25rem;
    border-top: 3px solid var(--text);
    view-transition-name: results-head;
}
.results-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}
.results-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.results-heading { min-width: 0; }
.share-search { flex: none; min-height: 44px; padding: 0 1rem; font-size: 0.9rem; }
@media (max-width: 520px) {
    .share-search { width: 44px; padding: 0; }
    .share-search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.results-title {
    margin-top: 0.2rem;
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    font-weight: 750;
    letter-spacing: -0.025em;
    outline: 0;
}
.results-title::first-letter { text-transform: uppercase; }
.results-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.9rem;
    margin-top: 0.45rem;
    font-size: 0.9rem;
    color: var(--muted);
}
.results-meta .count { color: var(--text); font-weight: 700; }
.results-meta .trust { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ok); font-weight: 600; text-decoration: none; }
.results-meta .trust:hover { text-decoration: underline; }

.pills { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.pills:empty { display: none; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0 0.4rem 0 0.85rem;
    border: 1.5px solid var(--text);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
    font-weight: 600;
    animation: pill-in 0.3s var(--ease-spring) both;
    animation-delay: calc(var(--i, 0) * 50ms);
}
.pill button {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px; height: 32px;
    margin-left: 0.1rem;
    border: 0;
    border-radius: 999px;
    background: var(--bg-2);
    color: var(--text);
}
.pill button:hover { background: var(--red); color: #fff; }
.pill button::after { content: ""; position: absolute; inset: -6px; } /* 44px hit area */
.pill-static { padding-right: 0.85rem; border-style: dashed; border-color: var(--line-2); }
@keyframes pill-in { from { opacity: 0; transform: scale(0.85); } }

/* ------------------------------------------------------------ notices */
.notice {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    background: var(--warn-bg);
    border: 1px solid var(--line);
}
.notice-emoji { font-size: 1.6rem; line-height: 1; }
.notice p { margin-top: 0.15rem; }
.notice .btn { margin-top: 0.7rem; }

.widen {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding: 1.25rem 1.25rem 1.25rem 1.6rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1.5px solid var(--text);
    box-shadow: 5px 5px 0 var(--yellow), 5px 5px 0 1.5px var(--text);
    animation: rise 0.45s var(--ease-out) both;
}
.widen::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--senyera-h);
}
.widen-text { font-family: var(--font-display); font-size: clamp(1.15rem, 3vw, 1.4rem); font-weight: 650; line-height: 1.25; }
.widen-text strong { color: var(--accent); }
.widen .btn { justify-self: start; }

/* ------------------------------------------------------------ timeline */
.timeline { margin-top: 0.75rem; }
.day { position: relative; }
.day-head {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0.85rem var(--gutter) 0.7rem;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    font-family: var(--font-display);
    font-size: clamp(1.12rem, 3vw, 1.32rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.day-head::before {
    content: "";
    flex: none;
    width: 12px;
    height: 1.35em;
    border-radius: 3px;
    background: var(--senyera-v);
    box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.25);
}
.day-head .day-rel { color: var(--accent); }
.day-head .day-count {
    margin-left: auto;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--bg-2);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
}
.cards { display: grid; gap: 0.85rem; padding: 0.35rem 0 1.4rem; }

/* ------------------------------------------------------------ event card (ticket) */
.card-item {
    --cat: #6B7280;
    --stub-w: 74px;
    position: relative;
    animation: rise 0.5s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 45ms);
    transition: transform 0.25s var(--ease-out), filter 0.25s;
}
.card-item:hover { transform: translateY(-3px); filter: drop-shadow(0 10px 18px rgba(26, 26, 26, 0.12)); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card {
    position: relative;
    display: grid;
    grid-template-columns: var(--stub-w) minmax(0, 1fr);
    min-height: 132px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    overflow: hidden;
    /* Ticket notches punched out where the stub meets the body. */
    -webkit-mask:
        radial-gradient(circle 9px at var(--stub-w) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 9px at var(--stub-w) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
    mask:
        radial-gradient(circle 9px at var(--stub-w) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 9px at var(--stub-w) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
}
.card:focus-within { border-color: var(--text); }

.stub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.75rem 0.25rem;
    background: var(--stub);
    color: #fff;
    text-align: center;
    border-right: 2px dashed rgba(255, 255, 255, 0.55);
}
.stub-pre { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.92; }
.stub-day { font-family: var(--font-display); font-size: 2.15rem; font-weight: 800; line-height: 0.95; font-variant-numeric: lining-nums; }
.stub-mon { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; }
.stub-wd { margin-top: 0.15rem; font-size: 0.7rem; opacity: 0.9; }

.card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "body thumb" "foot foot";
    gap: 0.35rem 0.85rem;
    padding: 0.85rem 0.85rem 0.6rem 1rem;
    border-top: 3px solid var(--cat);
}
.card-body { grid-area: body; min-width: 0; }
.cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.55rem 0.1rem 0.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cat) 14%, transparent);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-2);
}
.card-title {
    text-wrap: pretty;
    margin-top: 0.35rem;
    font-size: clamp(1.08rem, 2.6vw, 1.22rem);
    font-weight: 700;
    line-height: 1.22;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-link { color: var(--text); text-decoration: none; }
.card-link:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-link:focus-visible { outline: 0; box-shadow: none; }
.card-link:focus-visible::after { outline: 3px solid var(--focus-ring); outline-offset: -3px; border-radius: var(--radius); }

.card-meta { display: grid; gap: 0.2rem; margin-top: 0.45rem; font-size: 0.9rem; color: var(--text-2); }
.meta-line { display: flex; align-items: flex-start; gap: 0.4rem; min-width: 0; }
.meta-line .ic { width: 1em; height: 1em; margin-top: 0.22em; color: var(--muted); }
.meta-line > span { min-width: 0; overflow-wrap: anywhere; }
.muni {
    display: inline-block;
    margin-left: 0.15rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--bg-2);
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text);
    white-space: nowrap;
}

.thumb {
    grid-area: thumb;
    width: 84px;
    height: 84px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-foot {
    grid-area: foot;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 48px;
    padding-top: 0.2rem;
    border-top: 1px dashed var(--line);
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge-free { background: var(--ok-bg); color: var(--ok); }
.badge-price { background: var(--bg-2); color: var(--text); }
.card-src {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    font-weight: 550;
    color: var(--muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.card-src .ic { color: var(--ok); }
.card-actions { display: flex; gap: 0.15rem; margin-left: auto; position: relative; z-index: 2; }
.card-actions .icon-btn { color: var(--text-2); }
.card-actions .icon-btn:hover { color: var(--text); }

@media (min-width: 640px) {
    .card-item { --stub-w: 88px; }
    .stub-day { font-size: 2.5rem; }
    .thumb { width: 112px; height: 112px; }
}
@media (max-width: 380px) {
    .card-item { --stub-w: 64px; }
    .stub-day { font-size: 1.85rem; }
    .thumb { display: none; } /* too little room for text beside it; the detail shows the image */
    .card-main { padding-left: 0.8rem; }
    .day-head { font-size: 1.05rem; flex-wrap: wrap; gap: 0.35rem 0.6rem; }
}

/* Category accents (borders/tints only — text stays ink for contrast). */
.cat-musica { --cat: #7C3AED; }
.cat-teatre { --cat: #DB2777; }
.cat-dansa { --cat: #E11D48; }
.cat-exposicions { --cat: #0284C7; }
.cat-cinema { --cat: #475569; }
.cat-familia { --cat: #F59E0B; }
.cat-festes { --cat: #DA121A; }
.cat-cultura-popular { --cat: #EA580C; }
.cat-fires { --cat: #16A34A; }
.cat-gastronomia { --cat: #9F1239; }
.cat-esports { --cat: #0891B2; }
.cat-natura { --cat: #15803D; }
.cat-xerrades { --cat: #4F46E5; }
.cat-tallers { --cat: #CA8A04; }
.cat-literatura { --cat: #92400E; }
.cat-visites { --cat: #0F766E; }
.cat-altres { --cat: #6B7280; }

/* ------------------------------------------------------------ ongoing / nearby */
.ongoing {
    margin: 0.5rem 0 1.5rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}
.ongoing > summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius-lg);
}
.ongoing > summary::-webkit-details-marker { display: none; }
.ongoing-emoji { font-size: 1.5rem; }
.ongoing-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.ongoing-sub { display: block; font-family: var(--font-ui); font-size: 0.85rem; font-weight: 450; color: var(--muted); }
.ongoing-count { margin-left: auto; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 0.8rem; font-weight: 700; }
.ongoing > summary .ic { transition: transform 0.25s var(--ease-out); }
.ongoing[open] > summary .ic { transform: rotate(180deg); }
.ongoing .cards { padding: 0.25rem 0.85rem 1rem; }

.section-head { margin: 2rem 0 0.25rem; display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.section-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.section-title { font-size: clamp(1.35rem, 3.6vw, 1.75rem); font-weight: 750; width: 100%; }
.section-head .btn { min-height: 44px; }

.more { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin: 0.5rem 0 1.5rem; }
.more .btn { min-width: 240px; }
.more-note { font-size: 0.85rem; color: var(--muted); }

/* ------------------------------------------------------------ states */
.skeleton-list { display: grid; gap: 0.85rem; margin-top: 1.25rem; }
.sk-card {
    display: grid;
    grid-template-columns: 74px 1fr;
    height: 132px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.sk-stub { background: color-mix(in srgb, var(--red) 22%, var(--surface)); }
.sk-lines { display: grid; align-content: center; gap: 0.6rem; padding: 1rem; }
.sk-lines span { height: 0.85rem; border-radius: 6px; }
.sk-lines span:nth-child(1) { width: 28%; }
.sk-lines span:nth-child(2) { width: 82%; height: 1.15rem; }
.sk-lines span:nth-child(3) { width: 55%; }
.sk-stub, .sk-lines span {
    background-image: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
    background-size: 220% 100%;
    animation: shimmer 1.3s linear infinite;
}
.sk-lines span { background-color: var(--bg-2); }
.sk-stub { background-color: color-mix(in srgb, var(--red) 22%, var(--surface)); }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-color-scheme: dark) {
    .sk-stub, .sk-lines span { background-image: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.07) 50%, transparent 80%); }
}

.state {
    margin-top: 1.25rem;
    padding: 2.25rem 1.25rem;
    text-align: center;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}
.state-emoji { font-size: 2.8rem; line-height: 1; }
.state-title { margin-top: 0.75rem; font-size: 1.45rem; font-weight: 750; }
.state p { margin: 0.5rem auto 0; max-width: 34rem; color: var(--text-2); }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.1rem; }
.state-error { background: var(--danger-bg); border-style: solid; border-color: color-mix(in srgb, var(--red) 35%, transparent); }

/* ------------------------------------------------------------ web fallback */
.web-offer {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1.25rem;
    border: 2px dashed var(--line-2);
    border-radius: var(--radius-lg);
}
.web-offer h3 { font-size: 1.2rem; }
.web-offer p { color: var(--text-2); font-size: 0.95rem; }
.web-offer .btn { justify-self: start; white-space: normal; text-align: left; }

.web {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 2.5px dashed color-mix(in srgb, var(--text) 45%, transparent);
    border-radius: var(--radius-lg);
    background:
        repeating-linear-gradient(-45deg, transparent 0 14px, color-mix(in srgb, var(--text) 3%, transparent) 14px 28px),
        var(--bg);
    view-transition-name: web-section;
}
.web-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.web-title { font-size: 1.35rem; font-weight: 750; display: flex; align-items: center; gap: 0.5rem; }
.web-tag {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.web-disclaimer { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-2); }
.web-loading { display: grid; justify-items: center; gap: 0.85rem; padding: 2rem 0.5rem 1.25rem; text-align: center; }
.web-bar {
    width: min(320px, 80%);
    height: 8px;
    border-radius: 999px;
    background: repeating-linear-gradient(90deg, var(--yellow) 0 16px, var(--red) 16px 32px);
    background-size: 32px 100%;
    animation: stripes-move-sm 0.6s linear infinite;
    box-shadow: 0 0 0 1px var(--line-2);
}
@keyframes stripes-move-sm { to { background-position: 32px 0; } }
.refrany {
    min-height: 3em;
    max-width: 30rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--accent);
    transition: opacity 0.35s ease;
}
.refrany.is-fading { opacity: 0; }
.web-group-title { margin: 1.25rem 0 0.5rem; font-size: 1.05rem; font-family: var(--font-ui); font-weight: 700; }
.web-list { display: grid; gap: 0.65rem; }
.web-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
    padding: 0.9rem 1rem;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
    animation: rise 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 50ms);
}
.web-emoji { grid-column: 1; grid-row: 1 / span 4; font-size: 1.4rem; line-height: 1.2; }
.web-item > :not(.web-emoji) { grid-column: 2; }
.web-item h4 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.web-meta { font-size: 0.85rem; color: var(--muted); }
.web-desc { font-size: 0.92rem; color: var(--text-2); overflow-wrap: anywhere; }
.web-link { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 44px; font-size: 0.88rem; font-weight: 600; }
.web-unsafe { font-size: 0.82rem; color: var(--muted); }

/* ------------------------------------------------------------ side */
.side { display: grid; gap: 1rem; align-content: start; }
.side-card {
    padding: 1.25rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.side-card p { margin-top: 0.5rem; font-size: 0.93rem; color: var(--text-2); }
.side-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; font-weight: 750; }
.side-title .ic { color: var(--ok); }
.side-link { display: inline-block; margin-top: 0.5rem; padding: 0.6rem 0; font-weight: 650; font-size: 0.93rem; }
.side-link .ic { display: inline-block; vertical-align: -0.15em; margin-left: 0.2rem; }
.council-card {
    position: relative;
    overflow: hidden;
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}
.council-card::after {
    content: "";
    position: absolute;
    right: -50px; bottom: -60px;
    width: 140px; height: 140px;
    background: var(--senyera-h);
    border-radius: 50%;
    opacity: 0.22;
    transform: rotate(-20deg);
}
.council-card p { color: #fff; }
.council-kicker { margin: 0 !important; font-size: 0.72rem !important; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.95; }
.council-card .side-title { margin-top: 0.25rem; }
.council-card .btn { margin-top: 1rem; position: relative; z-index: 1; }
.specials { display: grid; gap: 0.35rem; margin-top: 0.6rem; }
.specials a {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.2s;
}
.specials a:hover { background: var(--bg-2); color: var(--text); }
.sp-emoji { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--bg-2); font-size: 1.35rem; }
.specials strong { display: block; font-size: 0.95rem; }
.specials small { display: block; font-size: 0.82rem; color: var(--muted); }

/* ------------------------------------------------------------ footer */
.site-footer {
    flex: none;
    margin-top: 2rem;
    background: var(--ink);
    color: #EDE9DA;
}
.footer-flag { height: 10px; background: var(--senyera-v); background-size: 180px 100%; }
.footer-inner {
    display: grid;
    gap: 1.5rem;
    padding-top: 2.25rem;
    padding-bottom: max(2.25rem, env(safe-area-inset-bottom));
}
.footer-love { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: #fff; }
.footer-data { margin-top: 0.4rem; font-size: 0.88rem; color: #C9C3B1; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; }
.footer-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(252, 221, 9, 0.6);
    text-underline-offset: 0.25em;
}
.footer-nav a:hover { color: var(--yellow); }
.site-footer :focus-visible { outline-color: var(--yellow); box-shadow: 0 0 0 6px rgba(218, 18, 26, 0.9); }
@media (min-width: 800px) {
    .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
}

/* ------------------------------------------------------------ FAB */
.fab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    place-items: center;
    width: 56px; height: 56px;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background: var(--yellow);
    color: var(--on-yellow);
    box-shadow: 3px 3px 0 var(--ink);
    animation: pop-in 0.25s var(--ease-spring);
}
.fab:active { transform: scale(0.94); }
@media (min-width: 1100px) { .fab { display: none; } }

/* ------------------------------------------------------------ dialogs / sheets */
dialog.sheet {
    margin: 0;
    padding: 0;
    border: 0;
    max-width: none;
    max-height: none;
    background: var(--surface);
    color: var(--text);
    overscroll-behavior: contain;
    box-shadow: var(--shadow-pop);
}
dialog.sheet::backdrop {
    background: var(--backdrop);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: fade-in 0.25s ease both;
}
dialog.sheet.is-closing::backdrop { animation: fade-out 0.2s ease both; }

/* Phones: bottom sheets. */
dialog.sheet[open] {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up 0.38s var(--ease-out) both;
}
dialog.sheet.is-closing { animation: sheet-down 0.22s ease-in both; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.sheet-inner { display: flex; flex-direction: column; min-height: 0; }
.sheet-bar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 56px;
    padding: 6px 8px 6px 18px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.sheet-handle {
    position: absolute;
    left: 50%; top: 7px;
    width: 42px; height: 5px;
    margin-left: -21px;
    border-radius: 999px;
    background: var(--line-2);
}
.sheet-title { font-size: 1.2rem; font-weight: 750; }
.sheet-close { margin-left: auto; background: var(--bg-2); }

/* Desktop: drawer on the right; small menus centred. */
@media (min-width: 900px) {
    dialog.detail[open] {
        inset: 0 0 0 auto;
        width: min(560px, 94vw);
        height: 100dvh;
        max-height: 100dvh;
        border-radius: var(--radius-lg) 0 0 var(--radius-lg);
        animation-name: drawer-in;
    }
    dialog.detail.is-closing { animation-name: drawer-out; }
    dialog.detail .sheet-handle { display: none; }

    dialog.menu-sheet[open] {
        inset: 0;
        margin: auto;
        width: min(480px, 92vw);
        height: fit-content;
        max-height: 86dvh;
        border-radius: var(--radius-lg);
        animation-name: pop-center;
    }
    dialog.menu-sheet.is-closing { animation-name: pop-center-out; }
    dialog.menu-sheet .sheet-handle { display: none; }
}
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
@keyframes pop-center { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes pop-center-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ------------------------------------------------------------ detail */
.detail-body { padding: 0 1.25rem 1.5rem; }
.detail-hero {
    margin: 0 -1.25rem 1rem;
    aspect-ratio: 16 / 9;
    background: var(--bg-2);
    overflow: hidden;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-date-strip {
    display: flex;
    align-items: stretch;
    gap: 0.9rem;
    margin-top: 0.75rem;
}
.detail-stub {
    flex: none;
    align-self: flex-start;
    min-height: 88px;
    display: grid;
    place-content: center;
    width: 72px;
    padding: 0.5rem 0.25rem;
    border-radius: var(--radius);
    background: var(--stub);
    color: #fff;
    text-align: center;
}
.detail-stub .stub-day { font-size: 2.1rem; }
.detail-title { text-wrap: pretty; font-size: clamp(1.5rem, 4.4vw, 2rem); font-weight: 780; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.detail-facts { display: grid; gap: 0.15rem; margin-top: 1.1rem; }
.fact {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}
.fact-ic {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--bg-2);
    color: var(--accent);
}
.fact-main { padding-top: 0.15rem; overflow-wrap: anywhere; }
.fact-main strong { display: block; font-weight: 650; }
.fact-main span { display: block; font-size: 0.9rem; color: var(--muted); }
.detail-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 1.1rem;
}
.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 74px;
    padding: 0.6rem 0.35rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 650;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.2s, transform 0.15s var(--ease-out), background-color 0.2s;
}
.action-tile .ic { width: 22px; height: 22px; color: var(--accent); }
.action-tile:hover { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.action-tile:active { transform: scale(0.96); }
.action-tile.primary { background: var(--red); border-color: var(--red); color: #fff; }
.action-tile.primary .ic { color: #fff; }
.action-tile.primary:hover { background: var(--red-600); color: #fff; }
.detail-source-link { margin-top: 0.75rem; }
.detail-desc { margin-top: 1.4rem; display: grid; gap: 0.75rem; font-size: 1rem; line-height: 1.65; color: var(--text-2); overflow-wrap: anywhere; }
.detail-desc .sk-line { height: 0.9rem; border-radius: 6px; background: var(--bg-2); }
.detail-desc .sk-line:nth-child(2) { width: 92%; }
.detail-desc .sk-line:nth-child(3) { width: 70%; }
.detail-source {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 0.9rem;
    color: var(--text-2);
}
.detail-source strong { color: var(--text); }
.detail-source .src-line { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.detail-source .ic { color: var(--ok); }
.detail-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 1rem; }
.report-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0 0.25rem; border: 0; background: none; color: var(--muted); font-size: 0.9rem; font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; }
.report-btn:hover { color: var(--accent); }
.detail-error { margin-top: 1rem; }

/* ------------------------------------------------------------ action sheet (share / calendar) */
.action-body { padding: 0.25rem 1.25rem 1.5rem; }
.action-preview { font-family: var(--font-display); font-size: 1.05rem; font-weight: 650; color: var(--text-2); overflow-wrap: anywhere; }
.share-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem 0.5rem; margin-top: 1.1rem; }
.share-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.25rem 0;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
}
.share-target:hover { color: var(--text); }
.share-ico {
    display: grid; place-items: center;
    width: 54px; height: 54px;
    border-radius: 18px;
    color: #fff;
    transition: transform 0.2s var(--ease-spring);
}
.share-target:hover .share-ico { transform: translateY(-3px) scale(1.05); }
.share-ico .ic { width: 24px; height: 24px; }
.s-whatsapp { background: #1FAF54; }
.s-telegram { background: #229ED9; }
.s-x { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.s-facebook { background: #1877F2; }
.s-bluesky { background: #0A7AFF; }
.s-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.s-email { background: #5B5649; }
.s-copy { background: var(--red); }
.copy-row { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.copy-row input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-2);
    font-size: 0.88rem;
}
.cal-list { display: grid; gap: 0.5rem; margin-top: 1rem; }
.cal-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 60px;
    padding: 0.6rem 1rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-weight: 650;
}
.cal-option:hover { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.cal-option .ic { color: var(--accent); width: 24px; height: 24px; }
.cal-option small { display: block; font-weight: 450; font-size: 0.83rem; color: var(--muted); }

/* ------------------------------------------------------------ report form */
.report-body { padding: 0.25rem 1.25rem 1.5rem; }
.report-event { font-family: var(--font-display); font-weight: 650; color: var(--text-2); overflow-wrap: anywhere; }
.report-reasons { margin-top: 1rem; padding: 0; border: 0; display: grid; gap: 0.4rem; }
.report-reasons legend { margin-bottom: 0.5rem; font-weight: 700; }
.radio-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.radio-row:hover { border-color: var(--text); }
.radio-row:has(input:checked) { border-color: var(--text); background: var(--warn-bg); }
.radio-row input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.note-field { display: grid; gap: 0.4rem; margin-top: 1rem; font-weight: 600; }
.note-field textarea {
    min-height: 88px;
    padding: 0.65rem 0.8rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-weight: 400;
    resize: vertical;
}
.form-msg { min-height: 1.5em; margin-top: 0.6rem; font-size: 0.92rem; font-weight: 600; }
.form-msg.is-error { color: var(--accent); }
.form-msg.is-ok { color: var(--ok); }
.report-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ------------------------------------------------------------ toast */
.toast {
    position: fixed;
    inset: auto auto max(24px, env(safe-area-inset-bottom)) 50%;
    margin: 0;
    border: 0;
    overflow: visible;
    z-index: 200;
    max-width: calc(100vw - 32px);
    padding: 0.75rem 1.1rem;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    font-weight: 600;
    font-size: 0.93rem;
    box-shadow: var(--shadow-pop);
    transform: translateX(-50%);
    animation: toast-in 0.3s var(--ease-spring) both;
}
@media (prefers-color-scheme: dark) { .toast { background: var(--yellow); color: var(--ink); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }

/* ------------------------------------------------------------ view transitions */
::view-transition-group(root) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
#resultsBody { view-transition-name: results-body; }
::view-transition-old(results-body) { animation: 0.18s ease both fade-out; }
::view-transition-new(results-body) { animation: 0.28s var(--ease-out) both vt-rise; }
@keyframes vt-rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .hero-flag, .hero-glow, .live-dot { animation: none !important; }
    .card-item:hover { transform: none; }
}

/* ------------------------------------------------------------ print */
@media print {
    .site-header, .hero-bg, .filters, .search, .try, .seasonal, .side, .site-footer, .fab, .card-actions, .progress { display: none !important; }
    .card { -webkit-mask: none; mask: none; }
    body { background: #fff; color: #000; }
}
