@font-face { font-family: "Archivo"; src: url("../fonts/archivo-var.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Reenie Beanie"; src: url("../fonts/reenie-beanie.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* Layout: a diamond parcel paper on the bourse table. The certificate field is printed on the paper's front flap; a match lifts the flap and shows the blue liner with the PDF. Liner blue then carries the services, a ruled index runs the history. */
:root {
  --paper: #fbfcfc;
  --table: #e8edf0;
  --liner: #bcd3e4;
  --liner-2: #a6c3d8;
  --deep: #244a63;
  --ink: #142029;
  --ink-2: #4a5d6a;
  --pencil: #5d6266;
  --line: #c7d3db;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --hand: "Reenie Beanie", "Segoe Print", "Bradley Hand", cursive;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { background: var(--table); color: var(--ink); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; -webkit-font-smoothing: antialiased; }
::selection { background: var(--deep); color: var(--paper); }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--deep); }
:focus-visible { outline: 2px solid var(--deep); outline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.caps { font-stretch: 125%; text-transform: uppercase; letter-spacing: 0.14em; }

/* header */
.mast { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.mast .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 28px; padding-block: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.logo svg { width: 40px; height: 40px; flex: none; color: var(--deep); }
.logo .word { display: grid; line-height: 1; }
.logo .agr { font-size: 1.4rem; font-weight: 400; font-stretch: 125%; letter-spacing: 0.6em; margin-right: -0.6em; }
.logo .sub { font-size: 0.74rem; letter-spacing: 0.03em; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.nav { display: flex; align-items: center; gap: 4px 22px; flex-wrap: wrap; }
.nav a { font-size: 0.82rem; font-weight: 500; font-stretch: 118%; text-transform: uppercase; letter-spacing: 0.14em; text-decoration: none; padding-block: 8px; }
.lang { display: flex; gap: 2px; background: var(--table); padding: 3px; border-radius: 4px; }
.lang a { font: inherit; text-decoration: none; display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; background: none; color: var(--ink-2); border: 0; padding: 4px 9px; border-radius: 3px; cursor: pointer; transition: background-color 160ms ease, color 160ms ease; }
.lang a[aria-current="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(20,32,41,0.15); }

/* hero: the parcel on the table */
.hero { padding-block: clamp(32px, 6vw, 72px) clamp(48px, 7vw, 88px); }
.hero h1 { font-size: clamp(1.9rem, 5.2vw, 4.1rem); font-weight: 300; font-stretch: 125%; line-height: 1.02; letter-spacing: -0.01em; max-width: 15ch; }
.hero h1 b { font-weight: 600; color: var(--deep); }
.hero .claim { max-width: 62ch; color: var(--ink-2); margin-top: 18px; font-size: clamp(1rem, 1.3vw, 1.12rem); }

.parcel { margin-top: clamp(28px, 4vw, 48px); max-width: 940px; position: relative; perspective: 1800px; perspective-origin: 50% 0%; }
.parcel .shell { display: grid; filter: drop-shadow(0 18px 22px rgba(20,32,41,0.16)) drop-shadow(0 2px 3px rgba(20,32,41,0.12)); }
/* folded edges peeking out: the liner shows at the side folds */
.parcel .shell::before { content: ""; position: absolute; inset: 10px -10px 10px -10px; background: linear-gradient(90deg, var(--liner-2) 0 10px, transparent 10px calc(100% - 10px), var(--liner-2) calc(100% - 10px)); border-radius: 2px; }
.band { position: relative; background: var(--paper); padding: 18px clamp(18px, 3vw, 32px); display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; align-items: baseline; border-bottom: 1px dashed #d5dde3; }
.band .caps { font-size: 0.72rem; color: var(--deep); font-weight: 600; }
.stage { display: grid; position: relative; }
.stage > * { grid-area: 1 / 1; }
.inside { background: var(--liner); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 2px, transparent 2px 7px); padding: clamp(22px, 3.4vw, 40px); display: grid; align-content: center; gap: 14px; }
.flap { background: var(--paper); padding: clamp(22px, 3.4vw, 40px); display: grid; gap: 18px; transform-origin: 50% 0; transform: rotateX(0deg); transition: transform 560ms var(--ease-io), box-shadow 560ms var(--ease-io); backface-visibility: hidden; position: relative; z-index: 2; box-shadow: 0 -1px 0 #e6ecf0; }
.parcel.open .flap { transform: rotateX(-91deg); box-shadow: 0 30px 40px rgba(20,32,41,0.25); pointer-events: none; }
.parcel:not(.open) .inside { visibility: hidden; }
.parcel.open .inside { visibility: visible; }

.fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1.5px solid var(--deep); }
.field { display: grid; gap: 2px; padding: 10px 14px 8px; min-width: 0; }
.field label { font-size: 0.72rem; font-weight: 600; font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--deep); }
.field input { font: inherit; font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 500; font-stretch: 100%; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; text-transform: uppercase; border: 0; background: transparent; color: var(--ink); padding: 0; width: 100%; min-width: 0; caret-color: var(--deep); border-radius: 0; }
.field input::placeholder { color: #b3c0c9; text-transform: none; letter-spacing: 0.02em; }
.field input:focus { outline: none; }
.fields:focus-within { box-shadow: 0 0 0 3px rgba(36,74,99,0.22); }
.minor { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1.5px solid var(--deep); border-top: 0; }
.minor span { font-size: 0.68rem; font-weight: 600; font-stretch: 125%; letter-spacing: 0.16em; color: var(--deep); padding: 8px 12px 22px; text-transform: uppercase; }
.minor span + span { border-left: 1px solid var(--deep); }
.go { font: inherit; font-weight: 600; font-stretch: 118%; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.92rem; background: var(--deep); color: var(--paper); border: 0; border-left: 1.5px solid var(--deep); padding: 0 clamp(18px, 3vw, 34px); display: inline-flex; align-items: center; gap: 10px; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease-out); min-height: 56px; }
.go:hover { background: #193a50; }
.go:active { transform: scale(0.97); }
.go svg, .btn svg { width: 18px; height: 18px; }
.flap-foot { display: flex; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; align-items: center; }
.pencil { font-family: var(--hand); font-size: 1.7rem; line-height: 1; color: var(--pencil); background: none; border: 0; padding: 0; cursor: pointer; transform: rotate(-2deg); }
.pencil:hover { color: var(--ink); }
.note { color: var(--deep); font-size: 0.98rem; }
.note:empty { display: none; }
.miss { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
.miss svg { width: 22px; height: 22px; flex: none; margin-top: 2px; color: var(--deep); }
.miss strong { font-weight: 600; }
.miss p { color: var(--ink-2); }

.inside .found { font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 300; font-stretch: 112%; line-height: 1.15; color: var(--ink); }
.inside .found b { font-weight: 650; letter-spacing: 0.04em; }
.inside .sub { color: #2c4556; max-width: 52ch; }
.acts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.btn { font: inherit; font-weight: 600; font-stretch: 118%; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.86rem; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; background: var(--deep); color: var(--paper); border: 1.5px solid var(--deep); text-decoration: none; cursor: pointer; border-radius: 2px; transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.btn:hover { background: #193a50; color: var(--paper); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; color: var(--deep); }
.btn.ghost:hover { background: var(--paper); color: var(--deep); }

/* services: liner field */
.liner { background: var(--liner); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.16) 0 2px, transparent 2px 7px); }
section.part { padding-block: clamp(56px, 8vw, 100px); }
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px 40px; flex-wrap: wrap; margin-bottom: clamp(28px, 4vw, 44px); }
.head h2 { font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 300; font-stretch: 125%; line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; }
.head p { max-width: 44ch; color: #2c4556; }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 4vw, 56px); border-top: 1.5px solid var(--deep); }
.ledger li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 14px; padding-block: 20px; border-bottom: 1px solid rgba(36,74,99,0.35); }
.ledger svg { width: 22px; height: 22px; color: var(--deep); margin-top: 4px; grid-row: span 2; }
.ledger .t { font-size: 1.22rem; font-weight: 600; font-stretch: 105%; line-height: 1.25; }
.ledger .d { color: #2c4556; }

/* history: ruled index + entries */
.hist { background: var(--paper); }
.hist-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 48px; }
.index { position: sticky; top: 104px; align-self: start; list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--deep); }
.index a { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink-2); transition: color 160ms ease; }
.index a::after { content: ""; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: transparent; transition: background-color 160ms ease; }
.index a.on { color: var(--deep); }
.index a.on::after { background: var(--deep); }
.entries { display: grid; gap: clamp(48px, 7vw, 80px); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: 18px 40px; align-items: start; scroll-margin-top: 100px; }
.entry .y { font-size: 0.8rem; font-weight: 600; font-stretch: 125%; letter-spacing: 0.18em; color: var(--deep); }
.entry h3 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 500; font-stretch: 110%; line-height: 1.15; margin: 6px 0 14px; }
.entry .body { max-width: 64ch; color: #273640; }
.entry .body p + p { margin-top: 0.8em; }
.entry .body ol { margin: 0.8em 0; padding-left: 1.3em; }
.entry .body li + li { margin-top: 0.3em; }
.photo { margin: 0; background: var(--liner); padding: 10px; }
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; filter: grayscale(1) contrast(1.08) brightness(1.05); mix-blend-mode: multiply; }

/* contact: parcel labels */
.labels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.label { background: var(--paper); border: 1.5px solid var(--deep); display: grid; box-shadow: 0 10px 18px rgba(20,32,41,0.08); }
.label .top { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 18px; border-bottom: 1.5px solid var(--deep); gap: 12px; flex-wrap: wrap; }
.label h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 400; font-stretch: 125%; text-transform: uppercase; letter-spacing: 0.06em; }
.label .top span { font-size: 0.72rem; font-weight: 600; font-stretch: 125%; letter-spacing: 0.16em; color: var(--deep); text-transform: uppercase; }
.label .rows { display: grid; }
.label .row { display: grid; grid-template-columns: 92px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.label .row:last-child { border-bottom: 0; }
.label .k { font-size: 0.7rem; font-weight: 600; font-stretch: 125%; letter-spacing: 0.16em; text-transform: uppercase; color: var(--deep); padding: 13px 0 10px 18px; }
.label .v { padding: 10px 18px 10px 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.label .v.sel { user-select: all; }
.label .map { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.label .map svg { width: 16px; height: 16px; }

footer { background: var(--deep); color: #cfdde7; font-size: 0.92rem; }
footer .wrap { padding-block: 26px; display: flex; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .ledger { grid-template-columns: minmax(0, 1fr); }
  .hist-grid { grid-template-columns: minmax(0, 1fr); }
  .index { display: none; }
  .entry { grid-template-columns: minmax(0, 1fr); }
  .photo { max-width: 280px; }
  .labels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .go { border-left: 0; border-top: 1.5px solid var(--deep); justify-content: center; }
  .minor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .minor span:nth-child(3) { border-left: 0; }
  .minor span:nth-child(n+3) { border-top: 1px solid var(--deep); }
  .parcel .shell::before { inset: 10px -6px; background: linear-gradient(90deg, var(--liner-2) 0 6px, transparent 6px calc(100% - 6px), var(--liner-2) calc(100% - 6px)); }
}
@media (max-width: 720px) {
  .mast .nav { order: 3; width: 100%; justify-content: space-between; gap: 4px 12px; }
  .mast .lang { order: 2; }
  .nav a { font-size: 0.74rem; letter-spacing: 0.08em; font-stretch: 105%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flap { transition: opacity 200ms ease; }
  .parcel.open .flap { transform: none; opacity: 0; }
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.flap .intro { color: var(--ink-2); max-width: 56ch; }
.go[disabled] { opacity: 0.7; cursor: progress; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--deep); color: var(--paper); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 16px; }
.msgpage { padding-block: 15vh; max-width: 620px; display: grid; gap: 16px; }
.msgpage h1 { font-weight: 400; font-stretch: 110%; font-size: 2rem; }
.msgpage p { color: var(--ink-2); }
.msgpage .btn { justify-self: start; }

/* ---------- movimento su scorrimento (attivo solo con JS, una volta per elemento) ---------- */
.mast { transition: box-shadow 240ms ease; }
.mast.scrolled { box-shadow: 0 6px 18px rgba(20,32,41,0.08); }

.rv { transition: opacity 520ms var(--ease-out), transform 620ms var(--ease-out), letter-spacing 900ms var(--ease-out), clip-path 820ms var(--ease-io), filter 520ms var(--ease-out); transition-delay: var(--d, 0ms); }
.rv.pre { opacity: 0; transform: translateY(14px); }
.rv.pre.title { transform: none; letter-spacing: 0.16em; }
.rv.pre.photo { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); }
.rv.pre.photo img { transform: scale(1.06); }
.photo img { transition: transform 1100ms var(--ease-out); }
.rv.pre.label { transform: translateY(18px) rotate(var(--r, -1.2deg)); }
.rv.pre.ledger-row { transform: translateY(10px); filter: blur(2px); }
.rv.in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); filter: none; }

@media (prefers-reduced-motion: reduce) {
  .rv, .photo img, .mast { transition: opacity 200ms ease; }
  .rv.pre { transform: none !important; clip-path: none !important; filter: none !important; letter-spacing: inherit; }
  .rv.pre.photo img { transform: none; }
}

/* titolo principale: le tre parole salgono una dopo l'altra al caricamento */
.band h2.caps { margin: 0; font-size: 0.72rem; font-weight: 600; line-height: inherit; }
address { font-style: normal; }
.hero h1 .w { display: inline-block; animation: word-in 900ms var(--ease-out) both; }
.hero h1 .w:nth-child(2) { animation-delay: 80ms; }
.hero h1 .w:nth-child(3) { animation-delay: 160ms; }
.hero h1 .w:nth-child(4) { animation-delay: 240ms; }
/* nome del marchio sopra il titolo: AGR Gems */
.hero h1 .brand { display: block; width: max-content; font-size: clamp(0.9rem, 1.4vw, 1.1rem); font-weight: 600; font-stretch: 125%; letter-spacing: 0.24em; text-transform: uppercase; color: var(--deep); margin-bottom: 0.9em; }
.hero .claim { animation: claim-in 700ms var(--ease-out) 320ms both; }
@keyframes word-in { from { opacity: 0; transform: translateY(0.35em); filter: blur(6px); } }
@keyframes claim-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .hero h1 .w, .hero .claim { animation: fade-in 300ms ease both; }
  @keyframes fade-in { from { opacity: 0; } }
}

/* riquadro di verifica: la bustina viene posata sul tavolo */
.parcel { animation: parcel-land 760ms cubic-bezier(0.2, 0.9, 0.25, 1) 220ms both; transform-origin: 30% 0%; }
.parcel .shell { animation: parcel-shadow 760ms cubic-bezier(0.2, 0.9, 0.25, 1) 220ms both; }
.parcel .shell::before { animation: liner-peek 520ms var(--ease-out) 760ms both; }
.parcel .flap > * { animation: flap-ink 480ms var(--ease-out) both; }
.parcel .flap > :nth-child(1) { animation-delay: 620ms; }
.parcel .flap > :nth-child(2) { animation-delay: 690ms; }
.parcel .flap > :nth-child(3) { animation-delay: 760ms; }
@keyframes parcel-land {
  0%   { opacity: 0; transform: translateY(-28px) rotate(-1.8deg) scale(1.015); }
  35%  { opacity: 1; }
  70%  { transform: translateY(2px) rotate(0.25deg) scale(1); }
  100% { opacity: 1; transform: none; }
}
@keyframes parcel-shadow {
  0%   { filter: drop-shadow(0 44px 36px rgba(20,32,41,0.10)) drop-shadow(0 8px 10px rgba(20,32,41,0.06)); }
  100% { filter: drop-shadow(0 18px 22px rgba(20,32,41,0.16)) drop-shadow(0 2px 3px rgba(20,32,41,0.12)); }
}
@keyframes liner-peek { from { opacity: 0; transform: scaleX(0.97); } }
@keyframes flap-ink { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .parcel, .parcel .shell, .parcel .shell::before, .parcel .flap > * { animation: fade-in 300ms ease both; }
}
