/* Homepage: brand ribbon, Premium / For Collectors photographic pair, latest arrivals,
   and the two dedicated pages (collection, history) that share the same document. */

/* Pages: the homepage hides the collection and the history; each page shows only its own section. */
html[data-view="home"] #collezione, html[data-view="home"] #storia { display: none; }
html[data-view="collection"] main > :not(#collezione), html[data-view="history"] main > :not(#storia) { display: none; }
html[data-view="collection"] #collezione { padding-top: 160px; min-height: 70vh; }
/* The collection page ends with the closing footer only: no Instagram, newsletter, enquiry or showroom bands. */
html[data-view="collection"] .footer-instagram, html[data-view="collection"] .footer-newsletter, html[data-view="collection"] .footer-request, html[data-view="collection"] .footer-visit { display: none; }
main.view-enter { animation: view-enter .6s ease both; }
@keyframes view-enter { from { opacity: 0; } to { opacity: 1; } }

/* Brands: a slow, endless ribbon. Four identical sets move by exactly one set per cycle, so the loop has
   no seam and the strip stays full even on very wide screens. */
.brand-strip { display: block; padding: 34px 0; -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent); }
.brand-track { display: flex; width: max-content; animation: brand-ribbon 52s linear infinite; will-change: transform; }
.brand-set { display: flex; align-items: center; gap: 104px; padding-right: 104px; flex-shrink: 0; }
.brand-strip:hover .brand-track { animation-play-state: paused; }
@keyframes brand-ribbon { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-25%, 0, 0); } }

/* Vertical rhythm of the homepage: one spacing step between the main sections (about 96 px on desktop,
   64 on tablets, 56 on phones). Sections joined by a photograph fading into the next keep their own transition. */
:root { --section-space: clamp(56px, 7vw, 96px); }
.experience { padding-top: var(--section-space); padding-bottom: calc(var(--section-space) * .5); }
.history-teaser-content { padding-block: calc(var(--section-space) * .85); }

/* Premium and For Collectors: one large photograph each, mirrored, dissolving into the anthracite. */
.showcase { position: relative; isolation: isolate; overflow: hidden; min-height: 540px; display: flex; align-items: center; }
.showcase + .showcase { margin-top: -60px; }
.showcase-photo { position: absolute; top: 0; bottom: 0; width: 70%; z-index: -1; pointer-events: none; }
.showcase-photo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.05); transition: transform 9s cubic-bezier(.2, .6, .2, 1); }
.showcase.is-visible .showcase-photo img, .showcase:has(.is-visible) .showcase-photo img { transform: scale(1); }
.showcase-premium .showcase-photo { right: 0; -webkit-mask-image: linear-gradient(to left, #000 45%, rgb(0 0 0 / 55%) 72%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%); mask-image: linear-gradient(to left, #000 45%, rgb(0 0 0 / 55%) 72%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%); -webkit-mask-composite: source-in; mask-composite: intersect; }
.showcase-premium .showcase-photo img { object-position: 62% 55%; }
.showcase-collectors .showcase-photo { left: 0; -webkit-mask-image: linear-gradient(to right, #000 45%, rgb(0 0 0 / 55%) 72%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%); mask-image: linear-gradient(to right, #000 45%, rgb(0 0 0 / 55%) 72%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%); -webkit-mask-composite: source-in; mask-composite: intersect; }
.showcase-collectors .showcase-photo img { object-position: 30% 55%; }
/* a soft shade on the text side keeps the copy readable where the photograph fades */
.showcase-photo::after { content: ''; position: absolute; inset: 0; }
.showcase-premium .showcase-photo::after { background: linear-gradient(to left, transparent 55%, rgb(var(--site-bg-rgb) / 45%) 100%); }
.showcase-collectors .showcase-photo::after { background: linear-gradient(to right, transparent 55%, rgb(var(--site-bg-rgb) / 45%) 100%); }
.showcase-content { padding-block: 90px; }
.showcase-copy { max-width: 470px; }
.showcase-collectors .showcase-content { display: flex; justify-content: flex-end; }
.showcase .eyebrow { display: flex; align-items: center; color: var(--accent-text); font-size: .9375rem; }
.showcase-collectors .eyebrow::after { content: ''; width: 32px; height: 2px; margin-left: 12px; background: #e32630; }
.showcase h2 { font-size: clamp(3.2rem, 5.8vw, 5.25rem); margin-bottom: 22px; }
.showcase-copy > p:not(.eyebrow) { color: var(--text-secondary); font-size: 1rem; line-height: 1.75; margin-bottom: 32px; }
/* The section name is the headline; its motto sits below as a quieter subtitle, the same in both sections. */
.showcase h2.showcase-title { margin-bottom: 18px; font-size: clamp(3.5rem, 5vw, 4.5rem); font-weight: 500; line-height: 1; letter-spacing: .03em; color: #f6f6f3; white-space: nowrap; }
.showcase-copy > p.showcase-subtitle { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-size: 1.3125rem; font-weight: 300; line-height: 1.3; letter-spacing: .1em; text-transform: uppercase; color: #e4e4e1; }
.showcase-subtitle .red-rule { flex-shrink: 0; margin: 0; }

/* Latest arrivals: a compact carousel, three cars at a time. */
.arrivals { padding-block: 56px 64px; }
.arrivals-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 24px; }
.arrivals-side { display: flex; align-items: center; gap: 28px; }
.arrivals-head h2 { font-size: clamp(2.2rem, 3.4vw, 3.1rem); margin: 0 0 8px; }
.arrivals-lead { margin: 0; color: var(--text-muted); font-size: .9375rem; }
.arrivals-nav { display: flex; gap: 8px; }
.arrivals-viewport { overflow: hidden; touch-action: pan-y; }
.arrivals-track { --per: 3; --gap: 24px; list-style: none; margin: 0; padding: 0; display: flex; gap: var(--gap); will-change: transform; }
.arrivals-track.is-sliding { transition: transform .9s cubic-bezier(.45, .05, .2, 1); }
.arrivals-track.is-static { justify-content: center; }
.arrivals-track > li { flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); min-width: 0; }
.arrival-card { display: block; }
.arrival-photo { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); }
.arrival-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.arrival-card:hover .arrival-photo img, .arrival-card:focus-visible .arrival-photo img { transform: scale(1.04); }
.arrival-copy { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-top: 16px; }
.arrival-copy .car-brand { margin-bottom: 4px; }
.arrival-copy h3 { font-size: 1.6rem; line-height: 1.1; margin: 0; }
.arrival-meta { margin: 6px 0 0; font-size: .8125rem; color: var(--text-muted); }
.arrival-price { margin: 0; flex-shrink: 0; font-size: .9375rem; font-weight: 500; text-align: right; }
.arrival-card:hover h3 { color: #fff; }
.arrivals-all { font-size: .75rem; letter-spacing: .17em; text-transform: uppercase; white-space: nowrap; }

/* History teaser: a compact invitation to the dedicated page, the archive photograph fading into the anthracite. */
html[data-view="history"] #storia-intro { display: none; }
.history-teaser { position: relative; isolation: isolate; overflow: hidden; min-height: 420px; display: flex; align-items: center; border-top: 1px solid var(--line); }
.history-teaser-photo { position: absolute; inset: 0 0 0 auto; width: 68%; z-index: -1; pointer-events: none; -webkit-mask-image: linear-gradient(to left, #000 40%, rgb(0 0 0 / 50%) 70%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%); mask-image: linear-gradient(to left, #000 40%, rgb(0 0 0 / 50%) 70%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%); -webkit-mask-composite: source-in; mask-composite: intersect; }
.history-teaser-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 45%; filter: grayscale(1) contrast(1.05) brightness(.62); }
.history-teaser-content { padding-block: 80px; }
.history-teaser-content > * { max-width: 520px; }
.history-teaser .eyebrow { display: flex; align-items: center; text-transform: uppercase; }
.history-teaser h2 { font-size: clamp(2.2rem, 3.6vw, 3.4rem); margin-bottom: 18px; }
.history-teaser-content > p:not(.eyebrow) { color: var(--text-secondary); line-height: 1.75; margin-bottom: 30px; }

@media (max-width: 1000px) {
  .showcase { min-height: 480px; }
  .showcase-photo { width: 78%; }
  /* narrower screens: the text overlaps more of the photograph, so its side gets a deeper shade */
  .showcase-premium .showcase-photo::after { background: linear-gradient(to left, transparent 30%, rgb(var(--site-bg-rgb) / 82%) 100%); }
  .showcase-collectors .showcase-photo::after { background: linear-gradient(to right, transparent 30%, rgb(var(--site-bg-rgb) / 82%) 100%); }
  .arrivals-track { --per: 2; }
}
@media (max-width: 700px) {
  html[data-view="collection"] #collezione { padding-top: 120px; }
  .brand-strip { padding: 24px 0; overflow: hidden; }
  .brand-set { gap: 54px; padding-right: 54px; }
  /* phones: photograph on top, text below it on the anthracite */
  .showcase { min-height: 0; display: block; padding-top: 70vw; }
  .showcase + .showcase { margin-top: 0; }
  .showcase-photo { width: 100%; height: 78vw; bottom: auto; left: 0; right: 0; -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 94%); mask-image: linear-gradient(to bottom, #000 50%, transparent 94%); }
  .showcase-photo::after { display: none; }
  .showcase-content { padding-block: 0 56px; }
  .showcase-collectors .showcase-content { display: block; }
  .showcase h2 { font-size: 3.25rem; }
  .showcase h2.showcase-title { font-size: 2.625rem; margin-bottom: 14px; }
  .showcase-copy > p.showcase-subtitle { font-size: 1.0625rem; gap: 12px; margin-bottom: 20px; }
  .showcase .eyebrow { font-size: .8125rem; }
  .arrivals { padding-block: 50px 60px; }
  .history-teaser { min-height: 0; display: block; padding-top: 52vw; }
  .history-teaser-photo { width: 100%; height: 66vw; bottom: auto; -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 95%); mask-image: linear-gradient(to bottom, #000 45%, transparent 95%); }
  .history-teaser-content { padding-block: 0 var(--section-space); }
  .arrivals-head { flex-direction: column; align-items: flex-start; gap: 18px; }
  .arrivals-side { width: 100%; justify-content: space-between; }
  .arrivals-track { --per: 1; --gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-track { animation: none; }
  .brand-strip { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none; }
  .brand-set[aria-hidden="true"] { display: none; }
  .showcase-photo img { transform: none; transition: none; }
  .arrivals-track.is-sliding { transition: none; }
  main.view-enter { animation: none; }
}

/* Owner preview: a quiet reminder that drafts on screen are not public. */
.draft-banner { position: fixed; left: 50%; bottom: 16px; z-index: 70; transform: translateX(-50%); margin: 0; padding: 9px 18px; max-width: calc(100% - 32px); text-align: center; font-size: .6875rem; letter-spacing: .16em; color: #f1f1ee; background: rgb(var(--site-bg-rgb) / 92%); border: 1px solid #e32630; backdrop-filter: blur(8px); pointer-events: none; }

/* ULTIMI ARRIVI title: a link to the collection, latest arrivals first. */
.arrivals-title-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3em; }
.arrivals-title-link svg { width: .55em; height: .55em; opacity: .55; transition: transform .3s ease, opacity .3s ease; }
.arrivals-title-link:hover svg, .arrivals-title-link:focus-visible svg { transform: translateX(4px); opacity: 1; color: #e32630; }
.arrivals-title-link span { background: linear-gradient(#e32630, #e32630) left bottom / 0 2px no-repeat; transition: background-size .35s ease; }
.arrivals-title-link:hover span, .arrivals-title-link:focus-visible span { background-size: 100% 2px; }


/* Homepage photos: cinematic cross-fade with a slow zoom (public/app.js, showHeroSlide). The photo coming in starts a
   touch larger and settles on the usual framing (scale 1.025, as before) while it fades in over the one going out,
   which stays still: two photos at most are visible, only opacity and transform change. */
:root { --hero-rest: 1.025; --hero-from: 1.055; --hero-ease: cubic-bezier(.4, 0, .2, 1); }
.hero-image { transform: scale(var(--hero-rest)); transition: opacity 1.1s var(--hero-ease); }
.hero-image.is-entering { transform: scale(var(--hero-from)); transition: none; }
.hero-image.active { transition: opacity 1.1s var(--hero-ease), transform 1.8s cubic-bezier(.2, .7, .2, 1); }
/* Make and model of the photo: out quickly, then in from below, the model just after the make. */
.hero-caption { transition: none; }
.hero-caption > span { transition: opacity .6s cubic-bezier(.2, .7, .2, 1), transform .6s cubic-bezier(.2, .7, .2, 1); }
.hero-caption > .hero-caption-model { transition-delay: .12s; }
.hero-caption.is-leaving > span { opacity: 0; transition: opacity .25s ease; transition-delay: 0s; }
.hero-caption.is-entering > span { opacity: 0; transform: translate3d(0, 16px, 0); transition: none; }
@media (prefers-reduced-motion: reduce) {
  .hero-image, .hero-image.active, .hero-image.is-entering { transform: none; transition: opacity .4s ease; }
  .hero-caption > span, .hero-caption.is-entering > span { transform: none; transition: opacity .3s ease; }
}


/* ---- Entrance of titles and short texts (public/text-reveal.js), formerly reveal.css ---- */
/* Entrance of titles and short texts (public/text-reveal.js). Only opacity and transform: no layout shift.
   Without JavaScript, or with "reduce motion", nothing here applies and every text is visible at once. */
:root { --tr-ease: cubic-bezier(.2, .7, .2, 1); --tr-shift: -24px; }
@media (max-width: 700px) { :root { --tr-shift: -14px; } }

.tr-armed .tr-word { display: inline-block; opacity: 0; transform: translate3d(var(--tr-shift), 0, 0);
  transition: opacity .6s var(--tr-ease), transform .6s var(--tr-ease); transition-delay: calc(var(--w, 0) * 70ms); }
.tr-armed.tr-in .tr-word { opacity: 1; transform: none; }

[data-text-fade].tr-armed { opacity: 0; transform: translate3d(calc(var(--tr-shift) / 2), 0, 0);
  transition: opacity .6s var(--tr-ease) .15s, transform .6s var(--tr-ease) .15s; }
[data-text-fade].tr-armed.tr-in { opacity: 1; transform: none; }

/* Car pages: a plain fade in, no movement (titles only: price, data and buttons are never animated). */
[data-fade].tr-armed { opacity: 0; transition: opacity .45s ease-out; }
[data-fade].tr-armed.tr-in { opacity: 1; }

/* Homepage hero: the two lines enter from the left at once on opening, without waiting for any script. */
.hero h1 > span { display: inline-block; animation: tr-line .8s var(--tr-ease) both; }
.hero h1 > span + br + span { animation-delay: .12s; }
.hero .hero-description { animation: tr-text .7s var(--tr-ease) .3s both; }
@keyframes tr-line { from { opacity: 0; transform: translate3d(calc(var(--tr-shift) * 1.5), 0, 0); } to { opacity: 1; transform: none; } }
@keyframes tr-text { from { opacity: 0; transform: translate3d(calc(var(--tr-shift) / 2), 0, 0); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tr-armed .tr-word, [data-text-fade].tr-armed, [data-fade].tr-armed { opacity: 1; transform: none; transition: none; }
  .hero h1 > span, .hero .hero-description { animation: none; }
}
