:root {
  --bg: #f4e7eb;
  --bg-accent: #d8bcc6;
  --card: rgba(255, 249, 251, 0.88);
  --card-strong: rgba(255, 246, 249, 0.96);
  --ink: #25121a;
  --ink-soft: rgba(37, 18, 26, 0.72);
  --brand: #641c34;
  --brand-deep: #451224;
  --brand-soft: rgba(100, 28, 52, 0.1);
  --line: rgba(100, 28, 52, 0.15);
  --shadow: 0 24px 80px rgba(80, 22, 42, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 34%),
    radial-gradient(circle at top right, rgba(100, 28, 52, 0.18), transparent 28%),
    linear-gradient(140deg, var(--bg), var(--bg-accent));
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(35, 24, 21, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 24, 21, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
  display: grid;
  gap: 24px;
}

.page-shell--centered {
  min-height: 100vh;
  place-items: center;
}

.hero-card,
.form-card,
.payment-card,
.confirmation-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 32px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: '';
  position: absolute;
  inset: auto -60px -100px auto;
  width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100, 28, 52, 0.3), transparent 66%);
}

.hero-card--compact {
  max-width: 720px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--brand);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 0.98;
}

h1,
h2 {
  font-family: 'Instrument Serif', serif;
}

h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero-copy,
.payment-copy,
#summary-copy,
.status-text {
  color: var(--ink-soft);
}

.hero-copy {
  max-width: 56ch;
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 18px 0 0;
}

.hero-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hero-detail-card,
.hero-note {
  border: 1px solid var(--line);
  background: var(--card-strong);
}

.hero-detail-card {
  border-radius: 22px;
  padding: 20px;
  display: grid;
  gap: 10px;
}

.hero-detail-card h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 2rem;
  color: var(--brand);
}

.hero-detail-card p:last-child,
.hero-note p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.hero-note {
  margin-top: 18px;
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: inset 0 0 0 1px rgba(100, 28, 52, 0.04);
}

.price-ribbon {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.price-ribbon span,
.summary-panel,
#payment-element {
  border: 1px solid rgba(100, 28, 52, 0.16);
  background: var(--card-strong);
}

.price-ribbon span {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.form-card,
.payment-card,
.confirmation-card {
  padding: 30px;
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
}

input,
select,
textarea,
button,
.link-button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(35, 24, 21, 0.15);
  background: rgba(255, 255, 255, 0.84);
  padding: 14px 16px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

input[type="checkbox"] {
  -webkit-appearance: checkbox;
  appearance: checkbox;
  width: auto;
  padding: 0;
  border-radius: 3px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(100, 28, 52, 0.24);
  border-color: rgba(100, 28, 52, 0.42);
}

/* ─── Validació inline ──────────────────────────────────────── */

label.is-invalid > input,
label.is-invalid > select,
label.is-invalid > textarea {
  border-color: #b91c1c;
  outline: 2px solid rgba(185, 28, 28, 0.18);
}

label.is-invalid.checkbox-row {
  background: rgba(185, 28, 28, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
}

label.is-invalid.checkbox-row > span:first-of-type {
  color: #b91c1c;
}

.field-error {
  font-size: 0.82rem;
  color: #b91c1c;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 5px;
}

.field-error::before {
  content: '⚠';
  font-size: 0.78rem;
  flex: 0 0 auto;
}

/* Per checkboxes: l'error ocupa tota l'amplada sota la fila */
.checkbox-row .field-error {
  grid-column: 1 / -1;
}

.consent-stack {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 6px 12px;
  font-weight: 400;
}

.checkbox-row input {
  width: auto;
  margin-top: 4px;
}

.summary-panel {
  margin-top: 24px;
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 10px;
}

.summary-details-card {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card-strong);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.summary-details-card__header {
  margin-bottom: 0;
}

.summary-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-details-item {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(100, 28, 52, 0.12);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.summary-details-item span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.summary-details-item strong {
  font-size: 1rem;
  color: var(--ink);
}

.summary-confirmation-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

#summary-price {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--brand);
}

.actions-row {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

button,
.link-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: white;
  padding: 15px 24px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(69, 18, 36, 0.26);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status-text {
  margin: 0;
  min-height: 1.4em;
}

.status-text[data-state='error'] {
  color: #7d1412;
}

.payment-card {
  transition: opacity 180ms ease, transform 180ms ease;
}

.confirmation-card {
  display: grid;
  gap: 18px;
}

.confirmation-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.confirmation-state {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card-strong);
}

.confirmation-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(100, 28, 52, 0.18);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.confirmation-card[data-phase='confirmed'] .confirmation-spinner,
.confirmation-card[data-phase='error'] .confirmation-spinner,
.confirmation-card[data-phase='warning'] .confirmation-spinner {
  display: none;
}

.confirmation-card[data-phase='confirmed'] .confirmation-state {
  background: rgba(35, 115, 76, 0.08);
  border-color: rgba(35, 115, 76, 0.22);
}

.confirmation-card[data-phase='error'] .confirmation-state,
.confirmation-card[data-phase='warning'] .confirmation-state {
  background: rgba(125, 20, 18, 0.08);
  border-color: rgba(125, 20, 18, 0.18);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--brand);
  border: 1px solid rgba(100, 28, 52, 0.2);
  box-shadow: none;
}

.confirmation-actions {
  margin-top: 0;
}

.is-hidden {
  display: none;
}

#payment-element {
  padding: 18px;
  border-radius: 18px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .summary-details-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 12ch;
  }

  .hero-card,
  .form-card,
  .payment-card,
  .confirmation-card {
    padding: 24px;
  }
}

/* ─── Layout amb barra lateral ─────────────────────────────── */

.site-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 249, 251, 0.86);
  backdrop-filter: blur(16px);
  padding: 28px 12px 24px;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.sidebar-eyebrow {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand);
  font-weight: 700;
}

.sidebar-year {
  font-family: 'Instrument Serif', serif;
  font-size: 2.8rem;
  line-height: 1;
  color: var(--ink);
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

/* Reset button defaults + estils de nav */
.nav-item {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink-soft);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 130ms ease, color 130ms ease;
}

.nav-item:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-item.is-active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(100, 28, 52, 0.22);
}

.sidebar-footer {
  padding: 18px 10px 0;
  border-top: 1px solid var(--line);
  margin-top: 18px;
}

.sidebar-footer p {
  margin: 0;
  font-size: 0.73rem;
  color: var(--ink-soft);
}

/* ─── Àrea de contingut ─────────────────────────────────────── */

.content-area {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* ─── Pestanyes ─────────────────────────────────────────────── */

.tab-pane {
  display: none;
}

.tab-pane.is-active {
  display: block;
}

/* ─── Section card (seccions no-formulari) ──────────────────── */

.section-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 30px;
}

/* ─── Info grid (Inici) ─────────────────────────────────────── */

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.info-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-strong);
  padding: 18px 20px;
  display: grid;
  gap: 4px;
}

.info-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand);
  font-weight: 700;
}

.info-value {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.45;
}

/* ─── FAQ (pestanya FAQs) ───────────────────────────────────── */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-strong);
  overflow: hidden;
}

.faq-question {
  padding: 18px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  flex: 0 0 auto;
  font-size: 1.2rem;
  color: var(--brand);
  transition: transform 180ms ease;
}

.faq-item[open] .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 0.93rem;
}

/* ─── Placeholder (seccions en preparació) ──────────────────── */

.placeholder-state {
  text-align: center;
  padding: 56px 24px;
  display: grid;
  gap: 14px;
}

.placeholder-title {
  margin: 0;
  font-family: 'Instrument Serif', serif;
  font-size: 2.2rem;
  color: var(--brand);
}

.placeholder-copy {
  margin: 0 auto;
  max-width: 48ch;
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ─── PDF embed ─────────────────────────────────────────────── */

.section-card--flush {
  padding: 0;
  overflow: hidden;
}

.pdf-embed {
  display: block;
  width: 100%;
  height: 90vh;
  min-height: 600px;
  border: none;
}

.pdf-pages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}

.pdf-loading {
  text-align: center;
  padding: 48px;
  color: var(--ink-soft);
}

/* ─── Àlbums de fotografies ─────────────────────────────────── */

.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.album-card {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-strong);
  text-decoration: none;
  color: var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.album-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(80, 22, 42, 0.18);
}

.album-cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-accent);
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}

.album-card:hover .album-cover img {
  transform: scale(1.04);
}

.album-info {
  padding: 16px 18px 18px;
  display: grid;
  gap: 4px;
}

.album-photographer {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.album-instagram {
  margin: 0;
  font-size: 0.82rem;
  color: var(--brand);
  font-weight: 500;
}

.album-count {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ─── Banner de xarxes socials ──────────────────────────────── */

.social-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 249, 251, 0.9);
  padding: 20px 32px;
}

.social-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
}

.social-footer-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-footer-label {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand);
  font-weight: 700;
}

.social-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-strong);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}

.social-link:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.social-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.social-footer-divider {
  width: 1px;
  height: 40px;
  background: var(--line);
  align-self: center;
}

@media (max-width: 600px) {
  .social-footer {
    padding: 18px 20px;
  }

  .social-footer-divider {
    display: none;
  }
}

/* ─── Botó hamburguesa (mòbil) ──────────────────────────────── */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(80, 22, 42, 0.12);
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

/* ─── Overlay (mòbil) ───────────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(37, 18, 26, 0.42);
  z-index: 90;
}

.sidebar-overlay.is-visible {
  display: block;
}

/* ─── Responsiu amb barra lateral ──────────────────────────── */

@media (max-width: 820px) {
  .site-layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 240ms ease;
    z-index: 100;
    background: #fff8fa;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    isolation: isolate;
    padding-top: 72px;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .content-area .page-shell {
    padding-top: 72px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .section-card {
    padding: 24px;
  }
}