/* =============================================================
   DANIEL PERLA — Eléctrico & Gaffer — Portfolio
   1. Tokens
   ============================================================= */
:root {
  --bg:          #0a0e0f;
  --bg-2:        #0d1214;
  --surface:     #131a1c;
  --surface-2:   #1a2225;
  --text:        #f2f3ef;
  --text-mute:   #9aa6a4;
  --text-dim:    #5e6b69;

  --teal:        #33c9c2;
  --teal-soft:   #7fe0da;
  --teal-deep:   #0f4c4a;
  --orange:      #ff6a3d;
  --orange-soft: #ffa07d;
  --red-deep:    #b3261e;

  --line:        rgba(242, 243, 239, 0.09);
  --line-strong: rgba(242, 243, 239, 0.18);

  --sans: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-h: 5.25rem;
  --container: 1360px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  scroll-behavior: smooth;
  background: var(--bg);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.05; letter-spacing: -0.01em; font-weight: 700; }
ul { list-style: none; padding: 0; }

::selection { background: var(--teal); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .7rem 1.2rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 4px; font-weight: 600; font-size: .9rem;
  transition: top .3s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.kicker::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--orange));
  flex: none;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), filter .9s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  filter: blur(0);
}
.reveal[data-split] { opacity: 1; transform: none; filter: none; } /* defensive: never trap content invisible */

/* =============================================================
   4. Buttons & links
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .95rem 1.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  transition: border-color .4s var(--ease-out), background-color .4s var(--ease-out), transform .4s var(--ease-out);
}
.btn:hover { border-color: var(--teal); transform: translateY(-2px); }

.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: .18em;
}
.link-underline::after {
  content: "";
  position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--teal), var(--orange));
  transition: right .5s var(--ease-out);
}
.link-underline:hover::after,
.link-underline:focus-visible::after { right: 0; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.5rem, 4vh, 3rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.scroll-cue .line {
  width: 1px; height: 34px;
  background: linear-gradient(var(--teal), transparent);
  animation: scrollcue 2.4s var(--ease-soft) infinite;
}
@keyframes scrollcue {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* =============================================================
   5. Nav
   ============================================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 500;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color .5s var(--ease-out), border-color .5s var(--ease-out), backdrop-filter .5s var(--ease-out);
}
.nav.is-scrolled {
  background: rgba(10, 14, 15, .68);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.nav-inner {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-logo em {
  font-style: normal;
  background: linear-gradient(120deg, var(--teal), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-links {
  display: none;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.75rem);
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.nav-links a { position: relative; padding-block: .3rem; }
.nav-links a::after {
  content: "";
  position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px;
  background: var(--teal);
  transition: right .4s var(--ease-out);
}
.nav-links a:hover::after, .nav-links a:focus-visible::after { right: 0; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
}
.nav-toggle span {
  display: block; width: 20px; height: 1px; margin-inline: auto;
  background: var(--text);
  transition: transform .4s var(--ease-out), opacity .3s var(--ease-out);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-3.5px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 480;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.6rem;
  padding: var(--gutter);
  background: rgba(10, 14, 15, .78);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out), visibility 0s linear .45s;
}
.mobile-menu.is-open {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}
.mobile-menu a {
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.mobile-menu-foot {
  margin-top: 2rem;
  font-size: .85rem;
  color: var(--text-mute);
}

/* =============================================================
   6. Hero
   ============================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--bg);
}
.hero-bg {
  position: absolute; inset: 0;
  overflow: hidden;
}
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.08);
  animation: heroDrift 22s var(--ease-soft) infinite alternate;
  filter: saturate(1.05) contrast(1.04);
}
@keyframes heroDrift {
  from { transform: scale(1.08) translate3d(0,0,0); }
  to   { transform: scale(1.16) translate3d(-1%, -1%, 0); }
}
.hero-bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,14,15,.35) 0%, rgba(10,14,15,.25) 38%, rgba(10,14,15,.88) 92%),
    linear-gradient(100deg, rgba(15,76,74,.35), transparent 45%, rgba(179,38,30,.22));
}
.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-kicker { margin-bottom: 1.6rem; justify-content: center; }
.hero-title {
  font-size: clamp(2.6rem, 7.2vw, 6.4rem);
  max-width: 18ch;
  margin-inline: auto;
  text-align: center;
  text-wrap: balance;
}
.hero-title .accent {
  background: linear-gradient(120deg, var(--teal-soft), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =============================================================
   7. Marquee (brands)
   ============================================================= */
.marquee-section {
  position: relative;
  padding-block: clamp(2rem, 5vw, 3rem);
  background: var(--bg-2);
  border-block: 1px solid var(--line);
}
.marquee-label {
  text-align: center;
  margin-bottom: 1.6rem;
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  gap: clamp(2.5rem, 6vw, 5rem);
  animation: marquee 34s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-brand {
  flex: none;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color .5s var(--ease-out);
  white-space: nowrap;
}
.marquee-brand:hover { color: var(--teal-soft); }

/* =============================================================
   8. Section headings
   ============================================================= */
.section { padding-block: clamp(4.5rem, 11vw, 8.5rem); }
.section-head {
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.section-title {
  font-size: clamp(2.1rem, 4.6vw, 3.7rem);
  margin-top: .5rem;
}

/* =============================================================
   9. Work grid
   ============================================================= */
.work-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(.75rem, 1.6vw, 1.4rem);
}
.work-item {
  position: relative;
  grid-column: span 12;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface);
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out);
  isolation: isolate;
}
.work-item.tile-md { aspect-ratio: 4 / 3; }
.work-item.tile-lg { aspect-ratio: 21 / 10; }
.work-item img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 1s var(--ease-out), filter .8s var(--ease-out);
}
.work-item::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 25%, rgba(51,201,194,.32), rgba(255,106,61,.30), transparent 75%);
  background-size: 260% 260%;
  background-position: -60% -60%;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity .55s var(--ease-out), background-position 1.2s var(--ease-out);
  pointer-events: none;
}
.work-item .work-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 2.75rem 4rem 1.1rem 1.2rem;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,.45);
  pointer-events: none;
}
.work-item .work-title::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(6,8,9,.72) 65%);
}
.work-item .work-icon {
  position: absolute;
  z-index: 3;
  right: 1.1rem; bottom: 1.1rem;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(242,243,239,.4);
  background: rgba(10,14,15,.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(.7);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-bounce);
}
.work-item .work-icon svg { width: 15px; height: 15px; }

@media (hover: hover) and (pointer: fine) {
  .work-item:hover,
  .work-item:focus-visible {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px -18px rgba(0,0,0,.6), 0 0 0 1px var(--line-strong);
  }
  .work-item:hover img, .work-item:focus-visible img { transform: scale(1.07); }
  .work-item:hover::after, .work-item:focus-visible::after { opacity: 1; background-position: 140% 140%; }
  .work-item:hover .work-icon, .work-item:focus-visible .work-icon { opacity: 1; transform: scale(1); }
}
.work-item:active { transform: translateY(-4px) scale(.995); }

@media (min-width: 720px) {
  .work-item.tile-sm  { grid-column: span 5; }
  .work-item.tile-md  { grid-column: span 6; }
  .work-item.tile-lg  { grid-column: span 12; }
}
@media (min-width: 960px) {
  .work-item.tile-sm  { grid-column: span 4; }
  .work-item.tile-md  { grid-column: span 6; }
  .work-item.tile-lg  { grid-column: span 12; }
}

/* =============================================================
   10. Lightbox
   ============================================================= */
.lightbox {
  border: 0; padding: 0; max-width: none; max-height: none;
  width: 100vw; height: 100vh; height: 100dvh;
  background: var(--bg);
  color: var(--text);
}
.lightbox::backdrop {
  background: rgba(6, 8, 9, .96);
}
.lightbox[open] { display: flex; flex-direction: column; }

.lightbox-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem var(--gutter);
}
.lightbox-count { font-size: .82rem; letter-spacing: .1em; color: var(--text-mute); }
.lightbox-close {
  width: 42px; height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .3s var(--ease-out), transform .3s var(--ease-out);
}
.lightbox-close:hover { border-color: var(--orange); transform: rotate(90deg); }

.lightbox-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(1rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem);
  min-height: 0;
}
.lightbox-stage figure {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-stage img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 2px;
  opacity: 0;
  transform: scale(.98);
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out);
}
.lightbox-stage video {
  max-width: 100%; max-height: 100%;
  border-radius: 2px;
}
.lightbox-stage img.is-shown { opacity: 1; transform: none; }

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,14,15,.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: border-color .3s var(--ease-out), background-color .3s var(--ease-out);
}
.lightbox-nav:hover { border-color: var(--teal); background: rgba(19,26,28,.85); }
.lightbox-prev { left: clamp(.5rem, 2vw, 1.5rem); }
.lightbox-next { right: clamp(.5rem, 2vw, 1.5rem); }
@media (max-width: 719px) {
  .lightbox-nav { width: 42px; height: 42px; }
}

/* =============================================================
   11. About
   ============================================================= */
.about-grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.about-figure {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 3px;
  overflow: hidden;
}
.about-figure img {
  width: 100%; height: 100%; object-fit: cover;
}
.about-figure--main { box-shadow: 0 40px 90px -30px rgba(0,0,0,.7); }
.about-visual { position: relative; }

.about-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.2rem;
  margin: 1.4rem 0 2rem;
  font-size: .86rem;
  color: var(--text-mute);
}
.about-meta span { display: inline-flex; align-items: center; gap: .5rem; }
.about-meta span:not(:last-child)::after {
  content: "";
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-dim);
  margin-left: 1.2rem;
}
.about-text p { max-width: 56ch; color: var(--text-mute); font-size: 1.06rem; }
.about-text p + p { margin-top: 1.2rem; }
.about-text p strong { color: var(--text); font-weight: 600; }

/* =============================================================
   12. Contact
   ============================================================= */
.contact-section { text-align: center; }
.contact-title {
  font-size: clamp(2rem, 5.4vw, 4rem);
  max-width: 18ch;
  margin: .6rem auto 0;
}
.contact-links {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  align-items: center;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: .9rem;
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  font-weight: 700;
  padding-bottom: .2rem;
}
.contact-link svg { width: 26px; height: 26px; flex: none; color: var(--teal); }
.contact-link .link-underline::after { height: 2px; }
.contact-sub {
  margin-top: 1.6rem;
  color: var(--text-dim);
  font-size: .9rem;
}

/* Contact form */
.contact-form {
  max-width: 640px;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  text-align: left;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.form-field { margin-top: 1.5rem; }
.form-row .form-field { margin-top: 0; }
.contact-form > .form-field:first-of-type { margin-top: 1.5rem; }
.form-label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: .65rem;
}
.form-input {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: .7rem .05rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  transition: border-color .4s var(--ease-out);
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  outline: none;
  border-color: var(--teal);
}
.form-textarea { resize: vertical; min-height: 130px; line-height: 1.5; }
.form-honey {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.was-validated .form-input:invalid {
  border-color: var(--orange);
}
.form-foot {
  margin-top: 2.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.form-submit {
  min-width: 160px;
  justify-content: center;
  text-align: center;
}
.form-submit[disabled] {
  opacity: .55;
  cursor: progress;
}
.form-status {
  font-size: .9rem;
  color: var(--text-mute);
  min-height: 1.3em;
}
.form-status[data-state="ok"] { color: var(--teal-soft); }
.form-status[data-state="error"] { color: var(--orange-soft); }

@media (min-width: 720px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}

/* =============================================================
   13. Footer
   ============================================================= */
.site-footer {
  padding: clamp(2rem, 5vw, 3rem) var(--gutter);
  text-align: center;
  border-top: 1px solid var(--line);
}
.site-footer p {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* =============================================================
   14. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .contact-links { flex-direction: row; gap: 3rem; }
}
@media (min-width: 960px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1280px) {
  .section { padding-block: clamp(5rem, 9vw, 9rem); }
}

/* =============================================================
   15. Reduced motion — only the genuinely intrusive bits
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .hero-bg img { animation: none; }
  .scroll-cue .line { animation: none; }
}
