/**
 * Mobile & touch optimizations (safe areas, iOS form zoom, tap feedback).
 * Loaded after meta viewport with viewport-fit=cover.
 */
:root {
  color-scheme: dark;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Media never overflows small screens (hero layers stay within parents). */
img,
video,
iframe {
  max-width: 100%;
}

picture {
  display: block;
  width: 100%;
  height: 100%;
}

/* Masonry thumbs / project cards must keep intrinsic height or gaps collapse */
.project-gallery-masonry-item,
.project-gallery-masonry picture,
.project-card-hero picture {
  height: auto;
}

/* iOS Safari: avoid auto-zoom on focus when font-size < 16px */
@media screen and (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 1rem !important;
    line-height: 1.5;
  }
}

/* Subtle tap highlight on interactive elements */
a,
button,
label[for],
input[type="checkbox"],
input[type="radio"] {
  -webkit-tap-highlight-color: rgba(255, 85, 64, 0.12);
}

/* Faster tap response (no 300ms delay on legacy WebKit where applicable) */
a,
button,
[role="button"] {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Contact: logo alb + punct REC animat (acoperă punctul din GIF) */
.contact-logo-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 20rem;
}

.contact-logo-rec-mask,
.contact-logo-rec-dot {
  position: absolute;
  left: 88.09%;
  top: 28.86%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.contact-logo-rec-mask {
  width: 6.4%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #131313;
}

.contact-logo-rec-dot {
  width: 5.2%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fe0000;
  box-shadow: 0 0 5px rgba(254, 0, 0, 0.45);
}

@keyframes logo-rec-blink {
  0%,
  50% {
    opacity: 1;
  }

  50.01%,
  100% {
    opacity: 0;
  }
}

/* Header: logo + punct REC animat */
.header-logo-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.header-logo-rec-mask,
.header-logo-rec-dot {
  position: absolute;
  left: 87.65%;
  top: 27.42%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.header-logo-rec-mask {
  width: 6.8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #131313;
}

.header-logo-rec-dot {
  width: 5.5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fe0000;
  box-shadow: 0 0 3px rgba(254, 0, 0, 0.45);
}

/* Footer: logo inversat + punct REC animat */
.footer-logo-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.footer-logo-rec-mask,
.footer-logo-rec-dot {
  position: absolute;
  left: 87.65%;
  top: 27.42%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.footer-logo-rec-mask {
  width: 6.8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #0e0e0e;
}

.footer-logo-rec-dot {
  width: 5.5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fe0000;
  box-shadow: 0 0 3px rgba(254, 0, 0, 0.45);
}

@media (prefers-reduced-motion: no-preference) {
  .contact-logo-rec-dot,
  .header-logo-rec-dot,
  .footer-logo-rec-dot {
    animation: logo-rec-blink 1s step-end infinite;
  }
}

/* Project galleries: masonry, keep original aspect ratio */
.project-gallery-masonry {
  column-count: 2;
  column-gap: 1rem;
}

@media (min-width: 640px) {
  .project-gallery-masonry {
    column-count: 3;
    column-gap: 1rem;
  }
}

.project-gallery-masonry-item {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: block;
  margin: 0;
  /* padding (not margin) — gap-ul nu colapsează în CSS columns pe WebKit/mobil */
  padding: 0 0 1rem;
  width: 100%;
}

@media (min-width: 640px) {
  .project-gallery-masonry-item {
    padding-bottom: 1rem;
  }
}

@media (max-width: 639px) {
  .project-gallery-masonry {
    column-gap: 1rem;
  }

  .project-gallery-masonry-item {
    padding-bottom: 1rem;
  }

  .project-gallery-dialog {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }
}

.project-gallery-masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
  border-radius: 0.5rem;
}

.project-gallery-dialog .grid > picture {
  height: auto;
  display: block;
}

/* Nav brand — evită overflow pe mobil */
nav > div > a.flex.items-center {
  min-width: 0;
}

/* Footer — linkuri sociale pe 2 rânduri pe ecrane înguste */
@media screen and (max-width: 639px) {
  footer .footer-social-links {
    max-width: 100%;
  }
}

/* YouTube click-to-play facade */
.yt-facade {
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: #000;
  appearance: none;
  -webkit-appearance: none;
}

.yt-facade-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4.25rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: rgba(255, 85, 64, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.yt-facade-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.55rem 0 0.55rem 0.95rem;
  border-color: transparent transparent transparent #fff;
}

.yt-facade:hover .yt-facade-play,
.yt-facade:focus-visible .yt-facade-play {
  transform: scale(1.06);
  background: rgba(255, 85, 64, 1);
}

.yt-facade:focus-visible {
  outline: 2px solid #ff5540;
  outline-offset: 2px;
}
