:root {
  --paper: #f5f1e9;
  --ink: #344435;
  --muted: #72786b;
  --accent: #9c543e;
  --border: #d8dbce;
  --green: #e9ecdf;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: radial-gradient(#8c775a15 .7px, transparent .7px) 0 0 / 6px 6px, #f3eee4;
  color: var(--ink);
  font: 15px/1.7 Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, input:focus-visible, .drop-zone:focus-within {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
header {
  position: relative; z-index: 2; max-width: 1280px; margin: auto;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px clamp(16px, 5vw, 70px); border-bottom: 1px solid var(--border); background: #f5f1e9ed;
}
.brand { flex-shrink: 0; font: italic 36px Georgia, serif; letter-spacing: -4px; }
.brand span { color: var(--accent); font-size: 26px; margin: 0 5px; }
nav { display: flex; flex-wrap: wrap; gap: clamp(10px, 3vw, 32px); font-size: 12px; }
nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
nav a:hover, .text-link:hover { color: var(--accent); }
nav a[aria-current=page] { color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.eyebrow { font-size: 10px; letter-spacing: 2.2px; font-weight: 600; overflow-wrap: anywhere; }
h1, h2, h3 { font-family: Georgia, serif; font-weight: normal; }
h1 { margin: 0; }
h2 { font-size: clamp(32px, 4vw, 52px); line-height: 1.15; letter-spacing: -1px; margin: 22px 0; }
h3 { font-size: clamp(26px, 3vw, 30px); line-height: 1.2; margin: 15px 0; }
h1 em, h2 em { color: var(--accent); font-weight: normal; }
.page-title { font-size: clamp(36px, 4.5vw, 56px); line-height: 1.15; letter-spacing: -1.5px; margin: 22px 0; overflow-wrap: anywhere; }
p { overflow-wrap: anywhere; }
.button {
  border: 0; background: var(--ink); color: white; border-radius: 3px;
  padding: 15px clamp(14px, 3vw, 25px); min-height: 50px; max-width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 20px;
  font-size: 14px; line-height: 1.5; text-align: center; transition: background .2s;
}
.button:hover { background: #4b614c; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.wide { width: 100%; margin-top: 15px; justify-content: space-between; }
.skip { position: absolute; left: 10px; top: -100px; background: white; padding: 10px; z-index: 10; }
.skip:focus { top: 10px; }
/* Portada: invitació al centre i fotos al voltant en pantalles grans. */
.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 990px;
  text-align: center; padding: 65px 20px 350px;
  background: radial-gradient(ellipse at 50% 35%, #fcfaf3 5%, #f5f1e970 60%, #e2dbc988);
}
.invitation {
  position: relative; width: min(100%, 510px); margin: auto; padding: 25px 14px 28px;
  background: radial-gradient(ellipse, #f9f6ee 55%, #f9f6ee00 74%);
}
.hero h1 { font-size: clamp(62px, 6.8vw, 94px); line-height: 1.1; letter-spacing: -4px; overflow-wrap: anywhere; text-wrap: balance; }
.hero h1 em { font-size: .65em; }
.flower { font-size: 58px; color: var(--accent); line-height: 1; margin: 24px auto 20px; }
.intro { font: italic 25px Georgia, serif; margin-bottom: 8px; }
.hero-bottom { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: 13px; text-transform: uppercase; letter-spacing: 4px; margin: 14px 0; }
.line { width: 54px; height: 1px; background: var(--accent); }
.hero-copy { color: var(--muted); margin: 15px 0 26px; }
.details { font-size: 12px; letter-spacing: 1px; }
.collage { position: absolute; inset: 0; z-index: -1; max-width: 1500px; margin: auto; pointer-events: none; }
.memory {
  position: absolute; margin: 0; padding: 11px 11px 32px; width: clamp(190px, 22vw, 315px);
  background: #fffcf4; border: 1px solid #e9e0d0; box-shadow: 0 18px 35px #413b2924, 0 2px 6px #413b2915;
  transform: rotate(var(--tilt));
}
.memory:before { content: ''; position: absolute; z-index: 1; top: -12px; left: calc(50% - 36px); width: 72px; height: 25px; background: #c7b58d70; transform: rotate(-4deg); border-left: 2px dotted #f9f4e5; border-right: 2px dotted #f9f4e5; }
.memory img { display: block; width: 100%; height: auto; }
.memory figcaption { font: italic 16px/1.4 Georgia, serif; text-align: center; color: #76654e; position: absolute; bottom: 9px; left: 8px; right: 8px; }
.memory-village { --tilt: -9deg; left: 3%; top: 55px; width: clamp(175px, 19vw, 270px); }
.memory-together { --tilt: 8deg; right: 3%; top: 40px; width: clamp(175px, 19vw, 270px); }
.memory-yes { --tilt: 5deg; left: 5%; top: 555px; }
.memory-kiss { --tilt: -7deg; right: 4%; top: 555px; }
.memory-us { --tilt: -3deg; left: calc(50% - 155px); top: 680px; width: 310px; }
.collage-caption { position: absolute; bottom: 30px; left: 15px; right: 15px; font: italic 20px Georgia, serif; color: #82745f; }
/* Formulari: columnes amb amplària mínima zero per evitar desbordaments. */
.section { padding: 70px max(5%, calc((100% - 1120px) / 2)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(30px, 5vw, 70px); }
.section > *, .name-fields > * { min-width: 0; }
.rsvp { background: #e9ecdfed; border-bottom: 1px solid #d8d8c6; }
.section-intro > p { color: var(--muted); max-width: 370px; }
.small-flower { font-size: 80px; color: #859175; margin-top: 40px; }
.card { min-width: 0; background: #fcfaf5; padding: clamp(20px, 3vw, 38px); border: 1px solid var(--border); border-radius: 5px; box-shadow: 0 10px 45px #34443508; }
.card p { font-size: 13px; color: var(--muted); }
.note { font-size: 12px !important; line-height: 1.7; }
.status { font-size: 12px; border-left: 2px solid #a7af9c; padding-left: 12px; }
.text-link { display: inline-block; font-size: 12px; border-bottom: 1px solid #a7af9c; padding-bottom: 2px; margin-top: 12px; }
.name-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
#rsvp-form label, #rsvp-form legend { font-size: 14px; }
input[type=text], input[type=password] { display: block; width: 100%; min-width: 0; min-height: 48px; padding: 12px; margin-top: 6px; border: 1px solid var(--border); border-radius: 3px; background: #fffdf8; color: var(--ink); font-size: 16px; }
input[type=password] { margin-bottom: 20px; }
#rsvp-form fieldset { border: 0; border-top: 1px solid var(--border); padding: 18px 0 8px; margin: 22px 0 0; min-width: 0; }
#rsvp-form legend { max-width: 100%; font-weight: 600; padding: 0 10px 0 0; }
#rsvp-form .choice { display: flex; gap: 12px; align-items: center; cursor: pointer; border: 1px solid var(--border); border-radius: 4px; padding: 11px 13px; margin: 9px 0; background: #f7f7ef; min-height: 48px; }
#rsvp-form .choice:has(input:checked) { border-color: #708267; background: #e9efdf; }
#rsvp-form .choice input { width: 18px; height: 18px; accent-color: var(--ink); flex-shrink: 0; }
#rsvp-form fieldset:disabled { opacity: .5; }
/* Fotos: controls tàctils, miniatures flexibles i acció accessible. */
.mobile-photos { width: 100%; max-width: 680px; margin: auto; padding: 38px 20px 60px; }
.photo-heading { text-align: center; margin-bottom: 28px; }
.photo-heading > p { color: var(--muted); font-size: 14px; }
.mobile-photos .card { padding: clamp(18px, 4vw, 28px); }
.upload-card label { font-size: 14px; }
.drop-zone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 25px 15px; border: 2px dashed #88967b; border-radius: 4px; background: #e9efdf; cursor: pointer; gap: 4px; min-height: 155px; }
.drop-zone.drag { background: #dce3cc; }
.drop-zone input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-zone strong { font-size: 18px; }
.drop-zone span { font-size: 13px; }
.drop-zone .upload-icon { font: 36px Georgia, serif; }
.format-help { text-align: center; }
.selection-summary { font-size: 13px !important; font-weight: 600; }
.upload-details { margin-top: 20px; }
.upload-details > .note { margin-top: -12px; }
.consent { display: flex; align-items: start; gap: 10px; line-height: 1.5; padding: 12px 0; }
.consent input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--ink); margin-top: 3px; }
.consent span { font-size: 12px; }
#file-list { padding: 0; list-style: none; font-size: 12px; }
#file-list.photo-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#file-list li { border: 1px solid var(--border); padding: 7px; border-radius: 5px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#file-list img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.photo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.photo-state { font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.remove-photo { min-height: 44px; background: transparent; border: 0; text-decoration: underline; color: var(--accent); margin-top: auto; }
.remove-photo:disabled { opacity: .5; }
#upload-progress { width: 100%; height: 12px; accent-color: var(--ink); margin-top: 18px; }
.upload-actions .button { min-height: 54px; font-size: 16px; justify-content: center; }
.upload-actions { position: sticky; bottom: 0; padding: 5px 0 max(12px, env(safe-area-inset-bottom)); background: #fcfaf5; z-index: 2; }
.qr-block { border-top: 1px solid var(--border); padding-top: 22px; margin-top: 22px; display: flex; flex-wrap: wrap; gap: 15px; align-items: center; }
.qr-block > div { flex: 1 1 160px; min-width: 0; }
.qr-block strong { font-size: 13px; }
.qr-block p { font-size: 12px; margin: 5px 0; }
.qr-block img { border-radius: 3px; flex-shrink: 0; }
/* Peu i pàgines d’informació. */
footer { padding: 25px clamp(16px, 5vw, 70px); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
footer p { font: italic 16px Georgia, serif; }
.legal-links { display: flex; gap: 20px; flex-wrap: wrap; }
.legal-links a { font-size: 12px; min-height: 44px; }
.legal-page { width: 100%; max-width: 850px; margin: auto; padding: 45px 24px 70px; }
.legal-page article { background: #fcfaf5; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--border); border-radius: 5px; min-width: 0; }
.legal-page h2 { font-size: 26px; letter-spacing: 0; margin: 30px 0 12px; }
.legal-page p { font-size: 15px; }
.legal-page a { text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal-page code { overflow-wrap: anywhere; }
/* En tauleta i mòbil, el collage entra en el flux i creix amb les fotos i el text. */
@media (max-width: 1100px) {
  .hero { display: flex; flex-direction: column; min-height: 0; padding: 35px clamp(18px, 5vw, 50px) 30px; }
  .invitation { order: 0; width: 100%; max-width: 650px; padding: 10px 0 32px; background: none; }
  .hero h1 { font-size: clamp(48px, 10vw, 86px); letter-spacing: -2.5px; }
  .collage { order: 1; position: relative; inset: auto; z-index: 0; width: 100%; max-width: 620px; margin: 24px auto 30px; padding: 10px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(22px, 5vw, 38px); align-items: start; }
  .memory { position: relative; inset: auto; width: 100%; padding: 8px 8px 0; min-width: 0; }
  .memory figcaption { position: static; font-size: clamp(11px, 2.2vw, 16px); padding: 9px 2px 11px; }
  .memory-village { grid-column: 1; grid-row: 1; --tilt: -5deg; }
  .memory-together { grid-column: 2; grid-row: 1; --tilt: 5deg; }
  .memory-yes { grid-column: 1; grid-row: 2; --tilt: 4deg; }
  .memory-kiss { grid-column: 2; grid-row: 2; --tilt: -4deg; }
  .memory-us { grid-column: 1 / -1; grid-row: 3; width: 60%; justify-self: center; --tilt: -3deg; }
  .collage-caption { order: 2; position: static; font-size: 18px; }
}
@media (max-width: 960px) {
  .section { grid-template-columns: minmax(0, 1fr); padding: 42px max(20px, calc((100% - 650px) / 2)); gap: 24px; }
  .section-intro > p { max-width: none; }
  .small-flower { display: none; }
}
@media (max-width: 600px) {
  header { padding: 10px 16px; gap: 12px; }
  header nav { gap: clamp(6px, 2vw, 14px); font-size: 12px; }
  .hero { padding: 25px 16px; }
  .hero .eyebrow { font-size: 9px; letter-spacing: 1.5px; }
  .flower { font-size: 43px; margin: 18px auto 12px; }
  .intro { font-size: 22px; }
  .hero-copy { font-size: 14px; }
  .hero-cta { width: min(100%, 340px); gap: 12px; }
  .memory { padding: 6px 6px 0; }
  .memory:before { width: 46px; left: calc(50% - 23px); height: 18px; top: -8px; }
  .section { padding: 30px 16px; }
  .page-title { font-size: clamp(32px, 8vw, 42px); }
  .mobile-photos { padding: 24px 12px 35px; }
  .photo-heading > p { font-size: 13px; }
  .legal-page { padding: 25px 12px; }
  footer { justify-content: center; text-align: center; }
  footer .brand { display: inline-block; }
  .legal-links { width: 100%; justify-content: center; }
}
@media (max-width: 440px) {
  .name-fields { grid-template-columns: minmax(0, 1fr); }
  #file-list.photo-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Selector senzill: càmera i galeria, amb la mateixa cua de pujada. */
.photo-pickers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border-radius:5px}
.photo-pickers.drag{outline:3px dashed #88967b;outline-offset:5px}
.photo-picker{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:125px;padding:18px 10px;border:1px solid #b5bfa8;border-radius:5px;background:#edf1e4;text-align:center;cursor:pointer}
.photo-picker strong{font-size:15px;line-height:1.4}
.photo-picker input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.photo-picker:focus-within{outline:3px solid var(--accent);outline-offset:4px}
.photo-picker:has(input:disabled){opacity:.5;cursor:wait}
.picker-help{text-align:center;font-size:12px!important;margin:14px 0 20px}
.photo-help{margin-top:20px;border-top:1px solid var(--border);padding-top:12px}
.photo-help summary{cursor:pointer;min-height:44px;align-content:center;font-size:13px}
.photo-help summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.photo-help p{font-size:12px}.photo-help .qr-block{border-top:0;padding-top:0;margin-top:10px}
@media(max-width:360px){.photo-pickers{gap:8px}.photo-picker{min-height:110px;padding:15px 6px}.photo-picker strong{font-size:13px}}
