/* ============================================================
   PASSATO GARAGE (modification.html)
   Loads after styles.css + hero-b.css. Same light theme, one accent
   (logo blue), 16px surfaces + pill buttons. Nested images inside a
   padded tile use 10px so the corners stay concentric.
   Photo sections follow the homepage SEMA poster: full-bleed photo,
   copy only in the photo's headroom, a navy scrim only where the copy is.
   Motion: transform / opacity only, hover inside (hover: hover),
   everything static under prefers-reduced-motion.
   ============================================================ */

/* ---------- services: sticky intro left, six service rows in two columns right ---------- */
.g-svc { padding-top: clamp(3.5rem, 7vw, 5.5rem); }
.g-svc-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  align-items: start;
  gap: var(--s4) clamp(2rem, 5vw, 4.5rem);
}
.g-svc-head { position: sticky; top: 6rem; }
.g-svc-head .lead { margin-top: 1rem; }
.g-svc-cta { margin-top: var(--s3); gap: 0.5em; }
.g-svc-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.g-svc-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 0.6rem 1rem 0.6rem 0.6rem;
  border-radius: var(--r-surface);
  background: var(--bg-2);
  color: inherit;
  transition: background 0.25s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.g-svc-item img { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; }
.g-svc-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.g-svc-text b { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; line-height: 1.2; }
.g-svc-text span { font-size: 0.92rem; color: var(--text-dim); }
.g-svc-item .ph { color: var(--accent); font-size: 1.1rem; transition: transform 0.2s; }
.g-svc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.g-svc-item:active { transform: scale(0.98); }
@media (hover: hover) {
  .g-svc-item:hover { background: var(--bg-3); }
  .g-svc-item:hover .ph { transform: translate(2px, -2px); }
}
@media (max-width: 1000px) {
  .g-svc-grid { grid-template-columns: minmax(0, 1fr); }
  .g-svc-head { position: static; }
}
@media (max-width: 640px) {
  .g-svc-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .g-svc-item, .g-svc-item .ph { transition: none; } }

/* ---------- builds: one full-screen reel per car ----------
   The stage is a poster (photo, scrim, copy top-left). With pages/garage-reel.js running, the reel
   grows taller than the screen, the stage sticks, and the prints are dealt in one per marker.
   Prints sit top-right on wide screens and along the bottom on phones, clear of the car. */
.g-builds { padding-top: var(--s6); }
.g-builds-head { padding-bottom: var(--s4); }
.g-reel { position: relative; background: rgb(var(--scrim)); color: #fff; }
.g-reel-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  min-height: 100svh;
}
.g-reel picture, .g-reel-bg { position: absolute; inset: 0; z-index: -2; }
.g-reel-bg { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.g-reel-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(var(--scrim), 0.72) 0%, rgba(var(--scrim), 0.45) 32%, rgba(var(--scrim), 0) 55%),
    linear-gradient(90deg, rgba(var(--scrim), 0.55) 0%, rgba(var(--scrim), 0.2) 34%, rgba(var(--scrim), 0) 52%);
}
.g-reel-copy { position: relative; z-index: 2; align-self: flex-start; width: 100%; padding-top: clamp(6rem, 11vh, 8rem); padding-bottom: 2rem; pointer-events: none; }
.g-reel-copy > * { max-width: 32rem; pointer-events: auto; }
.g-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.g-reel-name {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(var(--scrim), 0.35);
}
.g-reel-name:first-child { margin-top: 0; }
.g-reel-text { margin-top: 1rem; max-width: 40ch; font-size: 1.05rem; color: rgba(255, 255, 255, 0.9); text-wrap: pretty; }
.g-reel-go { margin-top: 1.5rem; }
/* BMW Passato: its press coverage sits in the reel, under the button */
.g-reel-press { margin-top: 1.75rem; }
.g-reel-press-title { font-size: 0.9rem; font-weight: 600; color: rgba(255, 255, 255, 0.75); }
.g-reel-press-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-top: 0.45rem; }
.g-reel-press-list a { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: #fff; text-shadow: 0 1px 12px rgba(var(--scrim), 0.5); }
@media (hover: hover) { .g-reel-press-list a:hover { text-decoration: underline; text-underline-offset: 3px; } }
/* short phones (about 667px tall): tighter copy so the press line clears the prints */
@media (max-width: 800px) and (max-height: 720px) {
  .g-reel-copy { padding-top: 5rem; }
  .g-reel-text { margin-top: 0.6rem; }
  .g-reel-go { margin-top: 1rem; }
  .g-reel-press { margin-top: 1rem; }
}

/* prints: white-edged photos with a soft drop shadow; position and size come from --x/--y/--w */
.g-reel-prints { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.g-print {
  position: absolute;
  top: var(--y, 14%);
  right: var(--x, 6%);
  width: var(--w, clamp(150px, 14vw, 230px));
  margin: 0;
  padding: 6px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 26px 50px -14px rgba(var(--scrim), 0.6);
  rotate: calc(var(--r, 0deg) * var(--tilt, 1));
  pointer-events: auto;
}
.g-print img { display: block; width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
.g-print img:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.g-print:nth-child(1) { --x: 27%; --y: 14%; --w: min(clamp(170px, 16vw, 270px), 30svh); }
.g-print:nth-child(2) { --x: 12%; --y: 21%; --w: min(clamp(140px, 13vw, 220px), 22svh); }
.g-print:nth-child(3) { --x: 3.5%; --y: 40%; --w: min(clamp(140px, 12vw, 200px), 20svh); }
@media (hover: hover) {
  .g-print { transition: rotate 0.35s cubic-bezier(0.16, 1, 0.3, 1), scale 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
  .g-print:hover { --tilt: 0; scale: 1.05; z-index: 1; }
}

/* live: taller reel, sticky stage, prints wait below the screen until their marker passes */
.g-reel--live { height: calc(100svh + var(--prints, 3) * 22svh); }
.g-reel--live .g-reel-stage { position: sticky; top: 0; height: 100svh; }
.g-reel-mark { position: absolute; left: 0; top: calc(60svh + var(--i, 0) * 16.5svh); width: 1px; height: 1px; pointer-events: none; }
.g-reel--live .g-print {
  will-change: translate, rotate, opacity; /* own layer: the shadow is drawn once, not every frame */
  --tilt: 4;
  translate: 0 70svh;
  opacity: 0;
  transition: translate 0.9s cubic-bezier(0.16, 1, 0.3, 1), rotate 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s, scale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.g-reel--live .g-print.is-dealt,
.g-reel--live .g-reel-prints:focus-within .g-print { --tilt: 1; translate: 0 0; opacity: 1; }
@media (hover: hover) {
  .g-reel--live .g-print.is-dealt:hover { --tilt: 0; }
}

/* scroll-linked dealing (Chrome, Edge, Safari): each print follows the scroll itself instead of
   waiting for a trigger, so it is never early or late. The timeline is the reel's locked phase
   ("contain": the stage fills the screen); prints arrive over its first 80%, a little overlapped,
   then the stage holds. Browsers without view timelines keep the marker + transition fallback. */
@supports (animation-timeline: view()) {
  .g-reel--live { view-timeline: --reel block; view-timeline-inset: 0; }
  .g-reel--live .g-print {
    transition: scale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: g-deal cubic-bezier(0.25, 0.8, 0.35, 1) both;
    animation-timeline: --reel;
  }
  .g-reel--live .g-print:nth-child(1) { animation-range: contain 0% contain 32%; }
  .g-reel--live .g-print:nth-child(2) { animation-range: contain 24% contain 56%; }
  .g-reel--live .g-print:nth-child(3) { animation-range: contain 48% contain 80%; }
  @keyframes g-deal {
    from { translate: 0 70svh; rotate: calc(var(--r, 0deg) * 4); opacity: 0; }
    30%  { opacity: 1; }
    to   { translate: 0 0; rotate: var(--r, 0deg); opacity: 1; }
  }
}

/* narrower laptops and tablets: smaller copy column so it never runs under the prints */
@media (max-width: 1100px) {
  .g-reel-copy > * { max-width: 24rem; }
}
/* phones and portrait tablets: copy over the sky, prints dealt along the bottom */
@media (max-width: 800px), (max-aspect-ratio: 3/4) {
  .g-reel-stage::before {
    background:
      linear-gradient(180deg, rgba(var(--scrim), 0.75) 0%, rgba(var(--scrim), 0.35) 38%, rgba(var(--scrim), 0) 56%),
      linear-gradient(0deg, rgba(var(--scrim), 0.45) 0%, rgba(var(--scrim), 0) 30%);
  }
  .g-reel-bg { object-position: 50% 50%; }
  #sema .g-reel-bg { object-position: 40% 50%; } /* the car's face and the PASSATO livery */
  .g-reel-copy { padding-top: 5.5rem; }
  .g-reel-copy > * { max-width: none; }
  .g-reel-name { font-size: clamp(2.2rem, 10vw, 3rem); }
  .g-reel-text { font-size: 1rem; }
  .g-print { top: auto; right: auto; padding: 4px; border-radius: 8px; }
  .g-print img { border-radius: 5px; }
  .g-print:nth-child(1) { left: 5%; bottom: 8%; --w: min(36vw, 24svh); }
  .g-print:nth-child(2) { left: 38%; bottom: 15%; --w: min(28vw, 15svh); }
  .g-print:nth-child(3) { left: auto; right: 5%; bottom: 5%; --w: min(27vw, 15svh); }
}
@media (prefers-reduced-motion: reduce) {
  .g-print { transition: none; }
}

/* ---------- more builds: one swipe row per car, every photo at its own shape ---------- */
.g-rowcar + .g-rowcar { margin-top: clamp(2.5rem, 5vw, 4rem); }
.g-row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); margin-bottom: 1.1rem; }
.g-row-name { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.g-row-meta { margin-top: 0.35rem; color: var(--text-dim); }
.g-row-ctl { display: flex; align-items: center; gap: 0.6rem; flex: none; }
.g-row-all { display: inline-flex; align-items: center; gap: 0.45em; margin-right: 0.6rem; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.g-row-btn {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--text); font-size: 1.1rem; cursor: pointer;
}
.g-row-btn:disabled { opacity: 0.35; cursor: default; }
.g-row {
  --row-pad: calc(max(0px, (100% - var(--wrap)) / 2) + clamp(1.25rem, 4vw, 3rem)); /* lines up with .wrap content; % ignores the scrollbar */
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--row-pad);
  padding: 0 var(--row-pad) 0.25rem;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.g-row::-webkit-scrollbar { display: none; }
.g-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.g-card { flex: none; height: clamp(340px, 58svh, 580px); margin: 0; border-radius: var(--r-surface); overflow: hidden; background: var(--bg-3); scroll-snap-align: start; }
.g-card img { display: block; width: auto; height: 100%; }
@media (hover: hover) {
  .g-row-all:hover span { text-decoration: underline; text-underline-offset: 3px; }
  .g-row-btn:not(:disabled):hover { background: var(--bg-3); }
  .g-card img { transition: scale 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
  .g-card:hover img { scale: 1.03; }
}
@media (max-width: 760px) {
  .g-row-head { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .g-row-btn { display: none; } /* phones swipe */
  .g-row-all { margin-right: 0; }
  /* --ar is the row's photo shape (width / height): cap each card at 80% of the screen width so the
     next photo always peeks in, whatever the shape (4:5 CR-V photos would otherwise fill the screen) */
  .g-card { height: min(56svh, calc(80vw / var(--ar, 0.8))); }
}
@media (prefers-reduced-motion: reduce) { .g-card img { transition: none; } }

/* ---------- process: five steps on one rail ---------- */
.g-steps {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s3);
  margin-top: var(--s4);
}
.g-steps::before {
  content: "";
  position: absolute;
  left: 24px; top: 23px;
  right: calc((100% - 4 * var(--s3)) / 5 - 24px); /* the rail stops at the last step */
  height: 2px;
  background: rgba(36, 64, 216, 0.28);
  transform-origin: left center;
}
.g-steps li { position: relative; }
.g-step-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid rgba(36, 64, 216, 0.3);
  color: var(--accent);
  font-size: 1.35rem;
}
.g-steps h3 { margin-top: 1.1rem; }
.g-steps p { margin-top: 0.4rem; color: var(--text-dim); font-size: 0.95rem; max-width: 24ch; }
@media (prefers-reduced-motion: no-preference) {
  .g-steps.rv::before { transform: scaleX(0); transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s; }
  .g-steps.rv-in::before { transform: none; }
}
@media (max-width: 900px) {
  .g-steps { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .g-steps::before { left: 23px; right: auto; top: 24px; bottom: 24px; width: 2px; height: auto; transform-origin: center top; }
  .g-steps li { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 1.1rem; }
  .g-step-icon { grid-row: 1 / 3; }
  .g-steps h3 { margin-top: 0.55rem; }
  .g-steps p { max-width: 40ch; }
}
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .g-steps.rv::before { transform: scaleY(0); }
  .g-steps.rv-in::before { transform: none; }
}

/* ---------- instagram: copy left, 3x2 photo grid right ---------- */
.g-ig-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: var(--s4) clamp(2.5rem, 6vw, 6rem);
}
.g-ig-copy .h-sec { text-wrap: balance; }
.g-ig-handle {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  font-weight: 700;
  color: var(--accent);
}
.g-ig-handle .ph { font-size: 1.25em; }
.g-ig-btn { display: flex; width: max-content; margin-top: var(--s3); }
.g-ig-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
.g-ig-tile { position: relative; display: block; overflow: hidden; border-radius: 10px; background: var(--bg-3); }
.g-ig-tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}
/* live posts: a small corner mark for reels and albums, the way Instagram's own grid shows them */
.g-ig-kind {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #fff;
  font-size: 1.1rem;
  filter: drop-shadow(0 1px 3px rgba(var(--scrim), 0.6));
}
.g-ig-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .g-ig-photos:hover .g-ig-tile img { opacity: 0.85; }
  .g-ig-photos .g-ig-tile:hover img { opacity: 1; transform: scale(1.03); }
}
@media (max-width: 800px) {
  .g-ig-grid { grid-template-columns: minmax(0, 1fr); }
  .g-ig-photos { gap: 0.4rem; }
  .g-ig-tile { border-radius: 8px; }
}

/* ---------- contact: Garage rows need a wider title column ---------- */
#kontak .contact-row { grid-template-columns: 14rem minmax(0, 1fr) auto; }
@media (max-width: 800px) {
  #kontak .contact-row { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (prefers-reduced-motion: reduce) {
  .g-ig-tile img { transition: none; }
}
