@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.7c87a648293f.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  --paper: #fafaf8;
  --card: #fff;
  --ink: #202621;
  --muted: #4b554d;
  --accent: #284739;
  --accent-hover: #1d392c;
  --line: #dedfda;
  --track: #e8ede7;
  --fill: #628772;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

[data-theme="natale"] {
  --paper: #fbf8f3;
  --accent: #733831;
  --accent-hover: #582720;
  --line: #e6ddd1;
  --track: #eee5db;
  --fill: #976158;
}

[data-theme="compleanno"] {
  --paper: #fbf7fb;
  --accent: #674164;
  --accent-hover: #502d4d;
  --line: #e8dce8;
  --track: #eee4ee;
  --fill: #94658e;
}

[data-theme="ricorrenza"] {
  --paper: #f6f8fb;
  --accent: #2e506e;
  --accent-hover: #223b52;
  --line: #dce4ec;
  --track: #e2eaf3;
  --fill: #5b7f9e;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.frame { width: min(840px, calc(100% - 48px)); margin-inline: auto; }
.preview-strip { padding: .25rem 1rem; text-align: center; background: var(--track); color: var(--muted); font-size: .8125rem; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { font-weight: 700; text-decoration: none; line-height: 1.2; }
.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; width: 1.1rem; height: 1.1rem; }
.skip-link { position: absolute; z-index: 3; left: 1rem; top: 1rem; background: var(--card); padding: .75rem; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

.button, .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  max-width: 100%;
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.button { border: 1px solid transparent; border-radius: 7px; padding: .6rem .9rem; text-decoration: none; text-align: center; cursor: pointer; }
.button-primary { background: var(--accent); color: white; }
.button-primary:hover { background: var(--accent-hover); }
.button-primary:disabled { opacity: .6; cursor: default; }
.button-outline { border-color: var(--line); background: var(--card); color: var(--accent); }
.button-outline:hover { background: var(--track); border-color: var(--accent); }
.header-share { border-color: transparent; background: transparent; padding-right: 0; }
.header-share:hover { border-color: transparent; background: transparent; text-decoration: underline; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem 1rem; }
.text-link { color: var(--accent); text-underline-offset: .2em; }

.hero { padding: clamp(2.15rem, 5vw, 3.8rem) 0 clamp(1.7rem, 4vw, 2.8rem); }
.hero h1, .gift-panel h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 700; letter-spacing: -.045em; line-height: 1.08; }
.hero h1 span { display: block; }
.hero p { margin: .7rem 0 1.15rem; color: var(--muted); max-width: 44ch; white-space: pre-line; }

.section-heading { margin-bottom: .85rem; }
h2 { font-size: 1.32rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.section-heading p { margin-top: .35rem; color: var(--muted); }
.project-grid { display: grid; gap: .7rem; }
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: .8rem 1rem;
  min-width: 0;
  padding: .8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.project-with-photo { grid-template-columns: 102px minmax(0, 1fr) max-content; }
.project-photo { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.project-body { min-width: 0; }
.project h3 { font-size: 1.125rem; line-height: 1.25; }
.project p { margin-top: .16rem; font-size: .9375rem; color: var(--muted); white-space: pre-line; }
.project-action { justify-self: start; font-size: .875rem; }
.project-state { display: inline-block; margin-top: .4rem; border-radius: 4px; padding: .12rem .45rem; color: var(--accent); background: var(--track); font-size: .875rem; }
.project-progress { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .4rem; margin-top: .55rem; color: var(--muted); font-size: .875rem; }
.percentage { margin-left: auto; font-weight: 700; color: var(--accent); }
progress { appearance: none; width: 100%; height: 6px; border: 0; border-radius: 20px; background: var(--track); color: var(--fill); }
progress::-webkit-progress-bar { background: var(--track); border-radius: 20px; }
progress::-webkit-progress-value { background: var(--fill); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--fill); border-radius: 20px; }

.contributors { margin-top: 2rem; }
.contributor-list { list-style: none; margin: 0; padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.contributor-list li { display: grid; grid-template-columns: minmax(78px, .7fr) minmax(0, 2fr); align-items: center; gap: .9rem; min-height: 46px; }
.contributor-list li + li { border-top: 1px solid var(--line); }
.contributor-list span { overflow-wrap: anywhere; }
.contributor-list progress { height: 8px; }

.share-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "copy qr" "actions qr"; align-items: center; gap: .4rem .8rem; margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.share-copy { grid-area: copy; }
.share-panel .actions { grid-area: actions; }
.qr { grid-area: qr; width: 92px; height: 92px; border-radius: 6px; background: #fff; image-rendering: pixelated; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-block: .85rem 1.6rem; color: var(--muted); font-size: .875rem; }
.payment-note { display: inline-flex; align-items: center; gap: .35rem; }
.payment-note .icon { width: .95rem; height: .95rem; }

.gift-panel { max-width: 570px; padding: clamp(1.75rem, 6vw, 3.75rem) 0 1.5rem; }
.gift-panel p { margin-top: .8rem; max-width: 42ch; color: var(--muted); }
.gift-panel [data-copy] { margin-top: .8rem; }
.copy-feedback { display: block; margin-top: .35rem; color: var(--accent); font-size: .875rem; }
.copy-feedback:empty { display: none; }
.gift-payment { margin: 1rem 0 .35rem; padding-top: .15rem; border-top: 1px solid var(--line); }
.gift-payment .button { margin-top: .75rem; }

@media (max-width: 580px) {
  .frame { width: calc(100% - 32px); }
  .header-inner { min-height: 57px; }
  .brand { font-size: .9375rem; }
  .project { grid-template-columns: minmax(0, 1fr); gap: .55rem .7rem; }
  .project-with-photo { grid-template-columns: 68px minmax(0, 1fr); }
  .project-photo { align-self: start; }
  .project-action { grid-column: -2 / -1; }
  .share-panel { grid-template-areas: "copy qr" "actions actions"; }
  .qr { width: 78px; height: 78px; }
  .share-panel .actions { gap: 0 .65rem; }
  .share-panel .button { padding-inline: .55rem; }
}
