/* ==========================================================================
   Plataforma d'inscripcions · Pou de s'Horta
   Paleta extreta del cartell de l'esdeveniment. Els colors concrets
   s'injecten des del Panell de Gestió com a variables a :root.
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
    --pdsh-primary: #8C1027;
    --pdsh-secondary: #E8621E;
    --pdsh-accent: #F2A81D;
    --pdsh-cream: #FBF4E6;
    --pdsh-olive: #6E8A4E;
    --pdsh-ink: #20232B;

    --pdsh-surface: #FFFFFF;
    --pdsh-muted: #7A7268;
    --pdsh-line: #E6DCCB;
    --pdsh-danger: #B3261E;
    --pdsh-success: #2E7D4F;

    --pdsh-radius: 16px;
    --pdsh-radius-sm: 10px;
    --pdsh-shadow: 0 2px 4px rgba(32, 35, 43, .04), 0 12px 32px rgba(32, 35, 43, .07);
    --pdsh-shadow-sm: 0 1px 3px rgba(32, 35, 43, .07);
    --pdsh-max: 1080px;

    --pdsh-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--pdsh-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--pdsh-ink);
    background: var(--pdsh-cream);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--pdsh-primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--pdsh-secondary); }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--pdsh-max); margin: 0 auto; padding: 0 20px; }
.wrap--narrow { max-width: 720px; }

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

/* ------------------------------------------------------------ Capçalera */

.site-header {
    background: var(--pdsh-primary);
    color: var(--pdsh-cream);
    border-bottom: 4px solid var(--pdsh-accent);
}

.site-header__inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-block: 14px; flex-wrap: wrap;
}

.site-header__brand {
    display: flex; align-items: center; gap: 12px;
    color: inherit; text-decoration: none; font-weight: 800;
}
.site-header__brand:hover { color: var(--pdsh-accent); }
.site-header__logo { height: 40px; width: auto; border-radius: 6px; }

.site-header__mark {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--pdsh-accent); color: var(--pdsh-primary);
    display: grid; place-items: center; font-size: 1.1rem; font-weight: 900;
    flex: 0 0 auto;
}

.site-header__title { font-size: 1rem; line-height: 1.25; }
.site-header__title small { display: block; font-weight: 500; opacity: .85; font-size: .8rem; }

.site-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.site-nav a {
    color: var(--pdsh-cream); text-decoration: none; font-weight: 600; font-size: .92rem;
    padding: 8px 14px; border-radius: 999px; transition: background .15s ease;
}
.site-nav a:hover { background: rgba(251, 244, 230, .16); color: #fff; }
.site-nav a.is-cta { background: var(--pdsh-accent); color: var(--pdsh-ink); }
.site-nav a.is-cta:hover { background: #fff; }

/* --------------------------------------------------------------- Heroi */

.hero {
    background:
        radial-gradient(120% 130% at 15% 0%, rgba(242, 168, 29, .30) 0%, rgba(242, 168, 29, 0) 55%),
        linear-gradient(160deg, var(--pdsh-primary) 0%, #6E0C1E 60%, #4C0715 100%);
    color: var(--pdsh-cream);
    padding: clamp(40px, 8vw, 76px) 0;
    position: relative; overflow: hidden;
}

.hero__grid {
    display: grid; gap: clamp(28px, 5vw, 48px);
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: center;
}
@media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; } }

.hero__eyebrow {
    display: inline-block; background: var(--pdsh-accent); color: var(--pdsh-ink);
    font-weight: 800; font-size: .8rem; letter-spacing: .09em; text-transform: uppercase;
    padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}

.hero h1 { margin-bottom: .35em; text-wrap: balance; }
.hero__tagline {
    font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 700;
    color: var(--pdsh-accent); margin-bottom: .8em;
}
.hero__lead { font-size: 1.06rem; opacity: .92; max-width: 52ch; }

.hero__meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 30px; }
.hero__meta span {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(251, 244, 230, .13); border: 1px solid rgba(251, 244, 230, .22);
    padding: 8px 15px; border-radius: 999px; font-size: .93rem; font-weight: 600;
}

.hero__poster {
    border-radius: var(--pdsh-radius); overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
    border: 5px solid var(--pdsh-cream); transform: rotate(-1.4deg);
}

.hero__highlights { display: grid; gap: 12px; }
.hero__highlight {
    display: flex; align-items: center; gap: 14px;
    background: rgba(251, 244, 230, .1); border: 1px solid rgba(251, 244, 230, .2);
    border-radius: var(--pdsh-radius-sm); padding: 14px 18px; font-weight: 700;
}
.hero__highlight i {
    width: 34px; height: 34px; border-radius: 50%; background: var(--pdsh-accent);
    color: var(--pdsh-primary); display: grid; place-items: center;
    font-style: normal; font-weight: 900; flex: 0 0 auto;
}

/* -------------------------------------------------------------- Seccions */

.section { padding: clamp(40px, 7vw, 68px) 0; }
.section--tight { padding: clamp(28px, 4vw, 40px) 0; }
.section__head { margin-bottom: 28px; max-width: 60ch; }
.section__head p { color: var(--pdsh-muted); margin: 0; }

.card {
    background: var(--pdsh-surface); border: 1px solid var(--pdsh-line);
    border-radius: var(--pdsh-radius); box-shadow: var(--pdsh-shadow-sm);
}
.card__body { padding: clamp(20px, 3vw, 28px); }

/* ---------------------------------------------------- Tipus d'inscripció */

.ticket-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.ticket-card {
    background: var(--pdsh-surface); border: 2px solid var(--pdsh-line);
    border-radius: var(--pdsh-radius); padding: 24px;
    display: flex; flex-direction: column; gap: 14px;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.ticket-card:has(.qty-input:not([value="0"]):not(:placeholder-shown)),
.ticket-card.is-selected { border-color: var(--pdsh-secondary); box-shadow: var(--pdsh-shadow); }
.ticket-card.is-unavailable { opacity: .62; }

.ticket-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.ticket-card__name { font-size: 1.22rem; font-weight: 800; margin: 0; }
.ticket-card__price { font-size: 1.5rem; font-weight: 900; color: var(--pdsh-primary); white-space: nowrap; }
.ticket-card__price small { display: block; font-size: .7rem; font-weight: 600; color: var(--pdsh-muted); text-align: right; }
.ticket-card__desc { color: var(--pdsh-muted); margin: 0; font-size: .96rem; }

.includes { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.includes li { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.includes li::before {
    content: ""; width: 8px; height: 8px; border-radius: 2px; margin-top: .5em;
    background: var(--pdsh-secondary); flex: 0 0 auto;
}

.ticket-card__foot {
    margin-top: auto; padding-top: 16px; border-top: 1px dashed var(--pdsh-line);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.stock { font-size: .85rem; font-weight: 700; color: var(--pdsh-muted); }
.stock--low { color: var(--pdsh-secondary); }
.stock--out { color: var(--pdsh-danger); }

/* Selector de quantitat */
.qty { display: inline-flex; align-items: center; border: 2px solid var(--pdsh-line); border-radius: 999px; overflow: hidden; }
.qty button {
    width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer;
    font-size: 1.3rem; line-height: 1; color: var(--pdsh-primary); font-weight: 700;
}
.qty button:hover:not(:disabled) { background: var(--pdsh-cream); }
.qty button:disabled { opacity: .3; cursor: not-allowed; }
.qty-input {
    width: 46px; height: 40px; border: 0; text-align: center;
    font-size: 1.05rem; font-weight: 800; font-family: inherit; color: var(--pdsh-ink);
    background: transparent; -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Barra de resum fixa */
.cart-bar {
    position: sticky; bottom: 0; z-index: 20; margin-top: 26px;
    background: var(--pdsh-ink); color: var(--pdsh-cream);
    border-radius: var(--pdsh-radius); padding: 16px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    box-shadow: 0 -6px 28px rgba(32, 35, 43, .22); flex-wrap: wrap;
}
.cart-bar__total { font-size: 1.05rem; }
.cart-bar__total strong { font-size: 1.55rem; display: block; line-height: 1.1; }
.cart-bar__count { font-size: .88rem; opacity: .75; }
/* El botó inhabilitat ha de continuar sent llegible sobre el fons fosc. */
.cart-bar .btn:disabled,
.cart-bar .btn.is-disabled {
    opacity: 1; background: rgba(251, 244, 230, .16); color: rgba(251, 244, 230, .55); box-shadow: none;
}

/* --------------------------------------------------------------- Botons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1.2;
    padding: 13px 26px; border-radius: 999px; border: 2px solid transparent;
    cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
    text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn--primary { background: var(--pdsh-secondary); color: #fff; box-shadow: 0 4px 14px rgba(232, 98, 30, .32); }
.btn--primary:hover { background: #d0541a; color: #fff; }

.btn--accent { background: var(--pdsh-accent); color: var(--pdsh-ink); }
.btn--accent:hover { background: #ffbe3d; color: var(--pdsh-ink); }

.btn--dark { background: var(--pdsh-primary); color: var(--pdsh-cream); }
.btn--dark:hover { background: #6E0C1E; color: #fff; }

.btn--ghost { background: transparent; border-color: currentColor; color: var(--pdsh-primary); }
.btn--ghost:hover { background: rgba(140, 16, 39, .07); }

.btn--light { background: var(--pdsh-surface); border-color: var(--pdsh-line); color: var(--pdsh-ink); }
.btn--light:hover { border-color: var(--pdsh-secondary); color: var(--pdsh-primary); }

.btn--danger { background: transparent; border-color: var(--pdsh-danger); color: var(--pdsh-danger); }
.btn--danger:hover { background: var(--pdsh-danger); color: #fff; }

.btn--block { width: 100%; }
.btn--sm { padding: 9px 18px; font-size: .9rem; }
.btn--lg { padding: 16px 34px; font-size: 1.08rem; }

/* -------------------------------------------------------------- Formularis */

.field { margin-bottom: 18px; }
.field > label, .field__label {
    display: block; font-weight: 700; font-size: .93rem; margin-bottom: 6px;
}
.field__hint { display: block; font-size: .84rem; color: var(--pdsh-muted); margin-top: 5px; }
.field__error { display: block; font-size: .86rem; color: var(--pdsh-danger); margin-top: 5px; font-weight: 600; }

.input, .select, .textarea {
    width: 100%; font-family: inherit; font-size: 1rem; color: var(--pdsh-ink);
    background: var(--pdsh-surface); border: 2px solid var(--pdsh-line);
    border-radius: var(--pdsh-radius-sm); padding: 12px 14px; transition: border-color .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--pdsh-secondary);
    box-shadow: 0 0 0 4px rgba(232, 98, 30, .13);
}
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--pdsh-danger); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237A7268' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.field-row { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.check { display: flex; gap: 11px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input[type="checkbox"], .check input[type="radio"] {
    width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--pdsh-secondary); flex: 0 0 auto; cursor: pointer;
}

fieldset { border: 0; margin: 0 0 26px; padding: 0; }
legend { font-weight: 800; font-size: 1.05rem; padding: 0; margin-bottom: 4px; }

/* ------------------------------------------------------------- Missatges */

.alert {
    border-radius: var(--pdsh-radius-sm); padding: 14px 18px; margin-bottom: 16px;
    border-left: 5px solid; font-size: .96rem; display: flex; gap: 11px; align-items: flex-start;
}
.alert--success { background: #EAF6EE; border-color: var(--pdsh-success); color: #1D5637; }
.alert--error   { background: #FCEDEC; border-color: var(--pdsh-danger); color: #7F1D18; }
.alert--warning { background: #FFF6E3; border-color: var(--pdsh-accent); color: #7A5405; }
.alert--info    { background: #EEF3FA; border-color: #3F6FA8; color: #24435F; }

.badge {
    display: inline-block; padding: 3px 11px; border-radius: 999px;
    font-size: .78rem; font-weight: 800; letter-spacing: .02em;
    background: var(--pdsh-cream); color: var(--pdsh-muted); border: 1px solid var(--pdsh-line);
}
.badge--ok      { background: #EAF6EE; color: #1D5637; border-color: #BCE0C9; }
.badge--warn    { background: #FFF6E3; color: #7A5405; border-color: #F3DEAF; }
.badge--danger  { background: #FCEDEC; color: #7F1D18; border-color: #F0C7C3; }
.badge--muted   { background: #F1EDE5; color: var(--pdsh-muted); }

/* -------------------------------------------------- Confirmació i entrades */

.success-hero {
    text-align: center; padding: clamp(36px, 7vw, 60px) 0 clamp(24px, 4vw, 34px);
}
.success-hero__icon {
    font-size: clamp(3.4rem, 11vw, 5.2rem); line-height: 1;
    display: block; margin-bottom: 14px;
    animation: pdsh-pop .6s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pdsh-pop {
    0%   { transform: scale(.4) rotate(-14deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.success-hero h1 { color: var(--pdsh-primary); margin-bottom: .3em; }
.success-hero p { color: var(--pdsh-muted); font-size: 1.05rem; max-width: 54ch; margin-inline: auto; }

.action-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 30px; }

.action-tile {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    text-align: center; text-decoration: none; padding: 24px 18px;
    background: var(--pdsh-surface); border: 2px solid var(--pdsh-line);
    border-radius: var(--pdsh-radius); color: var(--pdsh-ink);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.action-tile:hover { border-color: var(--pdsh-secondary); transform: translateY(-2px); box-shadow: var(--pdsh-shadow); color: var(--pdsh-ink); }
.action-tile__icon { font-size: 1.9rem; line-height: 1; }
.action-tile strong { font-size: 1rem; }
.action-tile span { font-size: .86rem; color: var(--pdsh-muted); }

.ticket-list { display: grid; gap: 14px; }

.ticket-row {
    display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
    background: var(--pdsh-surface); border: 1px solid var(--pdsh-line);
    border-left: 6px solid var(--pdsh-secondary);
    border-radius: var(--pdsh-radius-sm); padding: 16px 20px;
}
.ticket-row.is-cancelled { border-left-color: var(--pdsh-danger); opacity: .68; }
.ticket-row.is-used { border-left-color: var(--pdsh-olive); }
.ticket-row__main { flex: 1 1 220px; min-width: 0; }
.ticket-row__name { font-weight: 800; margin: 0; }
.ticket-row__type { color: var(--pdsh-muted); font-size: .9rem; }
.ticket-row__code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.05rem; font-weight: 700; letter-spacing: .06em;
    background: var(--pdsh-cream); padding: 6px 12px; border-radius: 8px;
}

.qr-box { text-align: center; }
.qr-box img {
    width: min(240px, 62vw); margin: 0 auto; background: #fff;
    padding: 12px; border-radius: var(--pdsh-radius-sm); border: 1px solid var(--pdsh-line);
}

.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { text-align: left; padding: 11px 0; border-bottom: 1px solid var(--pdsh-line); font-size: .96rem; vertical-align: top; }
.summary-table th { color: var(--pdsh-muted); font-weight: 600; width: 42%; }
.summary-table tr:last-child th, .summary-table tr:last-child td { border-bottom: 0; }
.summary-table td.is-total { font-size: 1.2rem; font-weight: 900; color: var(--pdsh-primary); }

/* Passes de la compra */
.steps { display: flex; gap: 8px; align-items: center; margin-bottom: 26px; flex-wrap: wrap; font-size: .88rem; }
.steps span { display: inline-flex; align-items: center; gap: 8px; color: var(--pdsh-muted); font-weight: 600; }
.steps span::before {
    content: attr(data-step); width: 24px; height: 24px; border-radius: 50%;
    background: var(--pdsh-line); color: var(--pdsh-muted);
    display: grid; place-items: center; font-size: .78rem; font-weight: 800;
}
.steps span.is-current { color: var(--pdsh-primary); }
.steps span.is-current::before { background: var(--pdsh-primary); color: var(--pdsh-cream); }
.steps span.is-done::before { background: var(--pdsh-olive); color: #fff; content: "✓"; }
.steps i { color: var(--pdsh-line); font-style: normal; }

.attendee-block {
    border: 2px solid var(--pdsh-line); border-radius: var(--pdsh-radius-sm);
    padding: 18px 20px; margin-bottom: 14px; background: var(--pdsh-surface);
}
.attendee-block__head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.attendee-block__head strong { font-size: 1rem; }
.attendee-block__head span { font-size: .85rem; color: var(--pdsh-muted); }

/* ------------------------------------------------------------------ Peu */

.site-footer {
    background: var(--pdsh-ink); color: rgba(251, 244, 230, .78);
    padding: 40px 0 30px; margin-top: auto; font-size: .92rem;
}
.site-footer a { color: var(--pdsh-accent); }
.site-footer__grid { display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.site-footer h4 { color: var(--pdsh-cream); font-size: .95rem; margin-bottom: .6em; }
.site-footer__bottom {
    margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(251, 244, 230, .14);
    display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: .85rem;
}

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }

/* --------------------------------------------------------------- Confeti */

#confetti-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------ Impressió */

@media print {
    .site-header, .site-footer, .cart-bar, .btn, .action-grid, #confetti-canvas { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
}
