/* ============================================================
   MTec Electrical — Selected Works (Gallery)
   "Work on a wall" — Archivo + Hanken Grotesk
   The interface recedes; the work dominates.
   ============================================================ */

:root {
  /* Brand */
  --blue: #0e9fe0;          /* bright electric blue — used sparingly */
  --blue-bright: #2bb1ef;
  --blue-ink: #0a6fa8;      /* deeper blue — small labels/links on light (AA) */
  --char: #232427;          /* charcoal wall */
  --char-2: #161617;        /* deeper charcoal */
  --paper: #fafafa;         /* off-white gallery wall */
  --ink: #232427;           /* body text on light */
  --ink-2: #56575c;         /* secondary text on light */
  --line: #e4e6ea;          /* hairline on light */
  --line-dark: rgba(255,255,255,.13);
  --on-dark: #f2f4f7;
  --on-dark-2: #a7adb6;

  /* Spacing (4pt) */
  --space-2xs: .25rem;
  --space-xs: .5rem;
  --space-sm: .75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  /* Gallery rhythm */
  --wall: clamp(3.5rem, 8.5vh, 6.25rem);    /* vertical space between movements */

  /* Type */
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;

  /* Layout */
  --shell: 1380px;        /* collections */
  --shell-stage: 1640px;  /* hero stages — wide so the work dominates */
  --gutter: clamp(1.4rem, 6vw, 6rem);
  --radius: 7px;

  /* Motion */
  --ease-quint: cubic-bezier(.22, 1, .36, 1);
  --ease-expo: cubic-bezier(.16, 1, .3, 1);

  /* z-scale */
  --z-brand: 50;
  --z-skip: 100;

  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100%; }
img, picture, svg { display: block; max-width: 100%; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow-x: hidden;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed;
  left: 50%;
  top: -120px;
  transform: translateX(-50%);
  background: var(--char);
  color: var(--on-dark);
  padding: .7rem 1.2rem;
  border-radius: 0 0 7px 7px;
  z-index: var(--z-skip);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .85rem;
  transition: top .2s var(--ease-quint);
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ---------- Eyebrow ---------- */
.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--blue-ink);
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--blue);
}
.eyebrow--light { color: var(--blue); }
.muted { color: var(--ink-2); font-weight: 600; }

/* =====================================================
   QUIET BRAND MARK (fixed; present only over dark walls)
   ===================================================== */
.brandmark {
  position: fixed;
  top: clamp(1.1rem, 2.5vw, 2rem);
  left: clamp(1.4rem, 6vw, 4rem);
  z-index: var(--z-brand);
  display: flex;
  align-items: baseline;
  gap: .07em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -.01em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: auto;
}
/* default = over a light wall: "Mtec" charcoal, "Electrical" AA blue */
.brandmark .bm-m { color: var(--ink); transition: color .45s var(--ease-quint); }
.brandmark .bm-e { color: var(--blue-ink); transition: color .45s var(--ease-quint); }
/* over a dark wall (cover / footer): "Mtec" white, "Electrical" bright blue */
.brandmark.on-dark .bm-m { color: #fff; }
.brandmark.on-dark .bm-e { color: var(--blue); }

/* =====================================================
   STAGES — full-viewport gallery pieces
   ===================================================== */
.stage {
  display: grid;
  align-items: center;
  min-height: 0;
  padding-block: var(--wall);
}
.stage-inner {
  width: 100%;
  max-width: var(--shell-stage);
  margin-inline: auto;
  padding-inline: clamp(1.4rem, 3.5vw, 3.25rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(1.75rem, 3.5vw, 4rem);
}
/* heroes: the work dominates — image takes the remaining width, text is a calm fixed column */
@media (min-width: 921px) {
  .stage--left:not(.stage--cover)  .stage-inner { grid-template-columns: minmax(0, 1fr) clamp(19rem, 32%, 28rem); }
  .stage--right:not(.stage--cover) .stage-inner { grid-template-columns: clamp(19rem, 32%, 28rem) minmax(0, 1fr); }
  .stage--cover .stage-inner { grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); }
}
/* alternation — order independent of DOM */
.stage--left  .stage-media { order: 1; }
.stage--left  .stage-text  { order: 2; }
.stage--right .stage-media { order: 2; }
.stage--right .stage-text  { order: 1; }

/* mounted image */
.stage-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar, 3 / 2);
  max-height: 90vh;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--char-2);
  box-shadow: 0 34px 90px -46px rgba(15, 25, 40, .5), 0 4px 14px -8px rgba(15,25,40,.18);
}
.stage-media picture { display: block; width: 100%; height: 100%; }
.stage-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* text column */
.stage-text { max-width: 34rem; }
.stage--right .stage-text { margin-left: auto; }
.stage-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-top: var(--space-lg);
  text-wrap: balance;
  overflow-wrap: break-word;
}
.stage-loc {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue-ink);
  margin-top: var(--space-md);
}
.stage-caption {
  color: var(--ink-2);
  font-size: 1.075rem;
  line-height: 1.7;
  max-width: 46ch;
  margin-top: var(--space-lg);
}

/* ---------- COVER STAGE (dark wall) ---------- */
.stage--cover {
  position: relative;
  background: var(--char);
  color: var(--on-dark);
  min-height: 100vh;
  min-height: 100svh;
}
.stage--cover .stage-media {
  box-shadow: 0 40px 100px -40px rgba(0,0,0,.7);
}
.brandline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
  color: var(--on-dark);
  margin-bottom: var(--space-lg);
}
.brandline::after {
  content: "";
  display: block;
  width: 38px;
  height: 2px;
  background: var(--blue);
  margin-top: var(--space-sm);
}
.cover-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.95rem, 5.2vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin-top: var(--space-lg);
  text-wrap: balance;
  overflow-wrap: break-word;
}
.cover-sub {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  color: var(--on-dark);
  max-width: 48ch;
  margin-top: var(--space-lg);
}
.piece-label {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line-dark);
}
.piece-meta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--blue);
}
.piece-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  letter-spacing: -.01em;
  color: var(--on-dark);
  margin-top: var(--space-xs);
}
.piece-label .stage-caption { color: var(--on-dark-2); margin-top: var(--space-sm); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.4rem, 4vh, 2.6rem);
  transform: translateX(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  color: var(--on-dark-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .66rem;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.scroll-cue svg { animation: cue 2.4s var(--ease-quint) infinite; }
@keyframes cue { 0%,100% { transform: translateY(0); opacity: .65; } 50% { transform: translateY(6px); opacity: 1; } }

/* =====================================================
   SUPPORTING COLLECTIONS
   ===================================================== */
.collection { padding-block: var(--wall); }
.collection--last { padding-bottom: calc(var(--wall) * 1.1); }
.collection .eyebrow { display: inline-flex; }
.collection-note {
  color: var(--ink-2);
  font-size: 1.05rem;
  margin-top: var(--space-md);
  max-width: 40ch;
}
.works {
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.works-2 { grid-template-columns: repeat(2, 1fr); }
.works-3 { grid-template-columns: repeat(3, 1fr); }
.works-1 { grid-template-columns: minmax(0, 6.6fr) 5.4fr; }
.works-1 .work { grid-column: 1; }
.works-1--right { grid-template-columns: 5.4fr minmax(0, 6.6fr); }
.works-1--right .work { grid-column: 2; }

.work { min-width: 0; }
.work-media {
  width: 100%;
  aspect-ratio: var(--ar, 3 / 2);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--char-2);
  box-shadow: 0 22px 50px -34px rgba(15, 25, 40, .42);
}
.work-media picture { display: block; width: 100%; height: 100%; }
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease-quint); }
.work:hover .work-media img { transform: scale(1.035); }

.work figcaption { margin-top: var(--space-md); }
.work-meta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .16em;
  color: var(--blue-ink);
  font-variant-numeric: tabular-nums;
}
.work-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.08rem, 1.4vw, 1.28rem);
  line-height: 1.22;
  letter-spacing: -.01em;
  color: var(--ink);
  margin-top: var(--space-2xs);
}
.work-loc {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: var(--space-xs);
}
.work-caption {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.6;
  margin-top: var(--space-sm);
  max-width: 44ch;
}

/* =====================================================
   CLOSING WALL (CTA)
   ===================================================== */
.closing {
  background: var(--char);
  color: var(--on-dark);
  padding-block: clamp(5rem, 12vh, 9rem);
}
.closing-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 4.4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -.025em;
  margin-top: var(--space-md);
  text-wrap: balance;
  overflow-wrap: break-word;
}
.closing-sub {
  color: var(--on-dark-2);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  margin-top: var(--space-md);
  max-width: 46ch;
}
.closing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--char-2);
  background: var(--blue);
  padding: .95rem 1.9rem;
  border-radius: 6px;
  transition: background .2s var(--ease-quint), transform .2s var(--ease-quint), box-shadow .2s var(--ease-quint);
  box-shadow: 0 8px 26px -10px rgba(14,159,224,.6);
}
.btn:hover { background: var(--blue-bright); transform: translateY(-2px); box-shadow: 0 14px 32px -12px rgba(14,159,224,.7); }
.btn:active { transform: translateY(0); }

.closing-contacts { display: flex; flex-direction: column; gap: var(--space-sm); }
.closing-contacts li,
.footer-contacts li { display: flex; align-items: baseline; gap: var(--space-md); }
.c-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--on-dark-2);
  min-width: 3.2em;
}
.closing-contacts a, .footer-contacts a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--on-dark);
  transition: color .2s var(--ease-quint);
}
.closing-contacts a:hover, .footer-contacts a:hover { color: var(--blue); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer { background: var(--char-2); color: var(--on-dark-2); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-xl);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line-dark);
}
.footer-logo { height: 28px; width: auto; margin-bottom: var(--space-md); }
.footer-tag {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .85rem;
  color: var(--on-dark-2);
}
.footer-contacts { display: flex; flex-direction: column; gap: var(--space-sm); }
.footer-base {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-block: var(--space-lg);
  font-size: .82rem;
}
.footer-since {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .7rem;
}

/* =====================================================
   REVEAL MOTION
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .85s var(--ease-quint), transform .85s var(--ease-quint);
}
.reveal.in-view { opacity: 1; transform: none; }
.stage-media.reveal { transform: translateY(38px) scale(.985); }
.stage-media.reveal.in-view { transform: none; }

/* =====================================================
   PARALLAX — off-main-thread, degrades to static
   ===================================================== */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .stage-media img {
      height: 106%;
      animation: drift linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
    @keyframes drift {
      from { transform: translateY(0); }
      to   { transform: translateY(-5.6%); }
    }
  }
}

/* QA capture only: relax full-viewport stages so a tall full-page screenshot fits */
.qa .stage, .qa .stage--cover { min-height: 0; }

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* Tablet */
@media (max-width: 920px) {
  .stage { min-height: 0; padding-block: clamp(4.5rem, 11vh, 8rem); }
  .stage-inner {
    grid-template-columns: 1fr;
    gap: clamp(1.75rem, 5vw, 2.75rem);
    max-width: 900px;
  }
  /* image always first on stack */
  .stage--left .stage-media, .stage--right .stage-media { order: 1; }
  .stage--left .stage-text,  .stage--right .stage-text  { order: 2; margin-left: 0; }
  .stage-media { max-height: 70vh; }
  .stage-text { max-width: none; }
  .stage--cover { min-height: 0; padding-block: clamp(5rem, 12vh, 8rem) clamp(4rem, 9vh, 6rem); }
  /* on cover, keep text first (it carries the title) */
  .stage--cover .stage-media { order: 2; }
  .stage--cover .stage-text  { order: 1; }

  .works-3 { grid-template-columns: repeat(2, 1fr); }
  .works-3 .work:last-child { grid-column: 1 / -1; max-width: 60%; }
}

/* Mobile */
@media (max-width: 600px) {
  :root { --gutter: 1.1rem; }
  .stage-media, .work-media { max-height: none; }
  .works { gap: clamp(1.75rem, 6vw, 2.5rem); }
  .works-2, .works-3 { grid-template-columns: 1fr; }
  .works-3 .work:last-child { grid-column: auto; max-width: none; }
  .works-1, .works-1--right { grid-template-columns: 1fr; }
  .works-1 .work, .works-1--right .work { grid-column: 1; }
  .scroll-cue { font-size: .6rem; }
  .closing-actions { flex-direction: column; align-items: stretch; gap: var(--space-xl); }
  .btn { text-align: center; }
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .scroll-cue svg { animation: none; }
}
