/* Melency site layer for index.html and works.html. Loaded after main.min.css; replaces mobile.css.
   Selectors were checked against main.min.css (header ~L8682, hero ~L9052, works/cards ~L10359, CTA ~L11027).
   Tokens mirror assets/style/case.css so Home, Works and case pages share gutters and type. */
:root { --g: 32px; --muted: #5c5c5c; --line: #e6e6e6; --gap-x: 32px; --gap-y: 64px; }
@media (max-width: 767px) { :root { --g: 16px; --gap-y: 48px; } }

.container-fluid { padding-left: var(--g); padding-right: var(--g); }
a:focus-visible, button:focus-visible { outline: 2px solid #000; outline-offset: 3px; }

/* ---------- Header ---------- */
header { padding-top: 24px; padding-bottom: 24px; }
header .row { align-items: center; }
header .header-item-logo a { display: block; }
header .header-item-logo img { display: block; width: 100px; height: auto; }
header .header-menu, header .header-menu ul { height: auto; }
header .header-menu ul, header .header-actions ul { margin: 0; padding: 0; }
header .header-actions ul { justify-content: flex-end; gap: 32px; }

/* ---------- Home intro: studio label + one lead statement ---------- */
.hero.hero-default { padding-top: clamp(48px, 7vw, 120px); margin-bottom: clamp(56px, 7vw, 120px); }
.hero.hero-default .hero-title { font-size: 18px; line-height: 26px; color: var(--muted); }
.hero.hero-default .hero-description { margin-bottom: 0; }
.hero.hero-default .hero-description p { max-width: 22em; margin: 0; font-size: clamp(26px, 2.5vw, 40px); line-height: 1.18; letter-spacing: -0.015em; }
@media (min-width: 992px) {
  .hero.hero-default .col-lg-4 { flex: 0 0 58.333%; max-width: 58.333%; }
}

/* Desktop restoration (>=992px): original main.min.css Home/Works look; tablet/mobile untouched */
@media (min-width: 992px) {
  body:has(main.home, main.works) header .container-fluid,
  body:has(main.home) main.home .hero .container-fluid { padding-left: 52px; padding-right: 52px; }
  body:has(main.home, main.works) header .header-actions ul { justify-content: space-between; gap: 0; }
  main.home .hero.hero-default { padding-top: 9.042vw; margin-bottom: 116px; }
  main.home .hero.hero-default .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
  main.home .hero.hero-default .hero-title { font-size: 1.4vw; line-height: 1.75vw; color: #000; }
  main.home .hero.hero-default .hero-description { margin-bottom: 2.1vw; }
  main.home .hero.hero-default .hero-description p { max-width: none; font-size: 1.4vw; line-height: 1.75vw; letter-spacing: normal; color: #000; }
}

/* Works page title (same scale as the Home lead) */
.page-title { margin: clamp(48px, 7vw, 120px) 0 clamp(40px, 5vw, 80px); font-family: HelveticaNowDisplay-Regular, Arial, sans-serif; font-weight: 400; font-size: clamp(26px, 2.5vw, 40px); line-height: 1.18; letter-spacing: -0.015em; }

/* ---------- Project grid: one system for Home and Works ---------- */
.works-body .row.gta,
header + .container-fluid > .row {
  display: grid !important; /* overrides the inline 3-column style on index.html */
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  column-gap: var(--gap-x);
  row-gap: var(--gap-y);
  align-items: start;
  margin-left: 0;
  margin-right: 0;
}
.works-body .row.gta > [class*="col-"],
header + .container-fluid > .row > [class*="col-"] { flex: none; width: auto; max-width: none; padding: 0; }
.card, .works-body .card { margin-bottom: 0; }

/* Equal 3:2 frame; Home/Works previews fill it edge to edge (cover). Case galleries are never cropped (case.css). */
.card-video { display: block; aspect-ratio: 3 / 2; overflow: hidden; margin-bottom: 16px; background: #f2f2f2; }
.card-video > a, .card-video picture { display: block; width: 100%; height: 100%; }
.card-video img, .card-video video { display: block; width: 100%; height: 100%; object-fit: cover; }

.card-body { display: block; }
.card-body-title h5, .card-body-description p { margin: 0; font-size: 18px; line-height: 24px; }
.card-body-description p { margin-top: 4px; color: var(--muted); }
.card-body-date { margin-bottom: 6px; font-size: 14px; line-height: 20px; color: var(--muted); }

.works { margin-bottom: clamp(64px, 8vw, 128px); }
.works-footer { margin-top: var(--gap-y); }
.works-footer .container-fluid { padding: 0; }
.works-footer .offset-lg-3 { margin-left: 0; }
.works-footer a { font-size: 18px; line-height: 24px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding-top: 32px; }
footer .footer-widget-body-copyright p,
footer .footer-widget-body-description,
footer .footer-widget-body-description a { font-size: 16px; line-height: 24px; }
footer .footer-widget-body-description a { overflow-wrap: anywhere; }

/* ---------- Floating Start Project / to-top ---------- */
.call-to-action { padding-right: var(--g); padding-bottom: 24px; }

@media (min-width: 600px) and (max-width: 991px) {
  .works-body .row.gta,
  header + .container-fluid > .row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 599px) {
  .works-body .row.gta,
  header + .container-fluid > .row { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 767px) {
  /* header: compact logo, 44px toggle with the original 24x11 icon */
  header { padding-top: 16px; padding-bottom: 16px; }
  header .header-item { position: relative; z-index: 2; min-height: 44px; }
  header .header-item-logo img { width: 72px; }
  header .header-item-toggle button { width: 44px; height: 44px; margin-right: -10px; padding: 0; }
  header .header-item-toggle button span { left: 10px; width: 24px; }
  header.show .header-item-logo img { filter: invert(1); } /* logo is an <img>, so the svg fill rule cannot recolour it */
  header.show button:focus-visible { outline-color: #fff; }
  /* menu overlay starts at the top, under the logo row, independent of header height */
  header .header-menu { top: 0; height: 100%; padding: 112px var(--g) 140px; z-index: 1; }
  header .header-menu ul li a { font-size: 40px; line-height: 64px; }
  header .header-actions { z-index: 2; padding-left: var(--g); padding-right: var(--g); }

  /* intro: show the studio label (main.min.css hides it) above the lead */
  .hero.hero-default { padding-left: 0; padding-right: 0; }
  .hero.hero-default .hero-title { display: block; margin-bottom: 16px; font-size: 16px; line-height: 24px; }

  .card-video { margin-bottom: 12px; }

  /* footer: stack columns so the e-mail never collides at 360px */
  footer .footer-widget .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
  footer .footer-widget .row > [class*="col-"] + [class*="col-"] { margin-top: 16px; }

  /* CTA becomes a quiet bottom bar; body padding keeps the last captions reachable */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .call-to-action { left: 0; gap: 0; justify-content: space-between; padding: 12px var(--g) calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
  .call-to-action .btn { height: 44px; padding: 0 24px; }
  .call-to-action .to-top button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; }
}

/* h1 on Home keeps the former div look */
h1.hero-title { margin: 0; }

/* Home intro type below 992px: studio title and service paragraph share one black regular style.
   Placed after the h1.hero-title reset so the 24px margin wins. */
@media (max-width: 991px) {
  main.home .hero.hero-default .hero-title,
  main.home .hero.hero-default .hero-description p {
    font-family: HelveticaNowDisplay-Regular, Arial, sans-serif;
    font-weight: 400;
    font-size: 20px;
    line-height: 26px;
    letter-spacing: normal;
    color: #000;
  }
  main.home .hero.hero-default .hero-title { margin: 0 0 24px; }
  main.home .hero.hero-default .hero-description p { max-width: none; }
}
@media (min-width: 768px) and (max-width: 991px) {
  main.home .hero.hero-default .hero-title,
  main.home .hero.hero-default .hero-description p { font-size: 24px; line-height: 31px; }
}

/* mobile menu: stationary black backdrop fades in 300ms; only the links move. Header stays transparent so no
   competing background transition; visibility flips after the fade-out so focus never lands in a hidden menu. */
@media (max-width: 767px) {
  header, header.show { background-color: transparent; transition: none; }
  header .header-item-logo, header .header-item-toggle, header .header-item:has(.header-actions) { z-index: 3; }
  header .header-item:has(.header-menu) { z-index: 2; }
  header .header-menu {
    top: 0; left: 0; width: 100%;
    height: 100vh; height: 100dvh;
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
    transform: none;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 300ms;
  }
  header.show .header-menu { transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s; }
  header .header-actions {
    margin-bottom: calc(36px + env(safe-area-inset-bottom));
    transform: none;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 300ms;
  }
  header.show .header-actions { transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s; }
  /* links: slight rise on open with a short stagger; close is immediate so nothing lingers */
  header .header-menu ul li {
    opacity: 0; transform: translateY(12px);
    transition: opacity 150ms ease, transform 150ms ease;
  }
  header.show .header-menu ul li {
    opacity: 1; transform: none;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  header.show .header-menu ul li:nth-child(2) { transition-delay: 30ms; }
  header.show .header-menu ul li:nth-child(3) { transition-delay: 60ms; }
  header.show .header-menu ul li:nth-child(n+4) { transition-delay: 60ms; }
  /* burger: constant top, only transform/background animate */
  header .header-item-toggle button span,
  header .header-item-toggle button span:nth-child(n),
  header.show .header-item-toggle button span,
  header.show .header-item-toggle button span:nth-child(n) {
    top: 21px; opacity: 1;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 300ms ease, background-color 300ms ease;
  }
  header .header-item-toggle button span:nth-child(1) { transform: translateY(-7px); }
  header .header-item-toggle button span:nth-child(2) { transform: translateY(0); }
  header .header-item-toggle button span:nth-child(3) { transform: translateY(7px); }
  header.show .header-item-toggle button span:nth-child(1) { transform: rotate(45deg); }
  header.show .header-item-toggle button span:nth-child(2) { transform: none; opacity: 0; }
  header.show .header-item-toggle button span:nth-child(3) { transform: rotate(-45deg); }
  header .header-item-logo img { transition: filter 300ms ease; }
  header .header-menu { overscroll-behavior: contain; }
  header .header-item-toggle button:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
  html.menu-open, html.menu-open body { overflow: hidden; }
  html.menu-open .call-to-action { opacity: 0; visibility: hidden; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  header, header .header-menu, header .header-actions, header .header-item-toggle button span,
  header .header-item-logo img, header .header-menu ul li, header.show .header-menu ul li,
  .call-to-action, .call-to-action .to-top button i, .btn,
  .card-body-title h5::after, .works-footer a::after { transition: none !important; transition-delay: 0s !important; }
  header .header-menu, header .header-actions, header .header-menu ul li,
  .call-to-action, .call-to-action .to-top button i, .btn,
  .card-body-title h5::after, .works-footer a::after { transform: none !important; }
  /* burger keeps its icon states (hamburger / X), just without animation */
}
