/* Four|Nine
   Layout: a one-screen app. Fixed header; two side-by-side scrolling panels
   (Digital, Clients) — the active one is 70% wide with a masonry grid, the
   other 30% with a single column; pointing at a panel makes it the active one.
   About and the project page are full-width views that fade in.
   Films, photos and catalogues open in a full-screen viewer on top. */

:root {
  --bg: #000000;
  --fg: #ffffff;
  --rule: #2e2e2e;
  --tile: #141414;
  --quiet: #8c8c8c;
  --veil: rgba(0, 0, 0, .45);   /* tint over the blurred page behind the phone menu */

  --sans: "Basis Grotesque", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "GT Super Display", "Times New Roman", Georgia, serif;

  --pad: 80px;
  --gutter: 40px;
  --header-h: 120px;
  --header-top: 30px;
  --title-h: 120px;
  --head-gap: 40px;

  --fs: 17px;
  --lh: 21px;
  --fs-title: 20px;
  --lh-title: 21px;
  --fs-sub: 19px;
  --fs-nav-on: 19px;
  --fs-label: 20px;
  --fs-big: 44px;
  --lh-big: 54px;

  --ease: cubic-bezier(.645, .045, .355, 1);
  --slow: .8s;
  color-scheme: dark;
}


*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; font-weight: 400; font-size: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.serif { font-family: var(--serif); }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; width: 100%;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 10; pointer-events: none;
}
.site-header .bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--header-top) var(--pad) 0;
}
.logo { pointer-events: auto; display: block; width: 50px; margin-top: -8px; position: relative; z-index: 2; }
.logo svg { display: block; width: 100%; height: auto; }
#menu { pointer-events: auto; display: flex; align-items: baseline; height: var(--lh); }
#menu ul { display: flex; align-items: baseline; }
#menu li { margin-right: 5px; white-space: nowrap; }
#menu li:last-child { margin-right: 0; }
#menu li:not(:last-child)::after { content: ","; }
.nav-sep { padding: 0 15px; }
/* one face for every menu item; the current page and the hovered item are underlined */
#menu a { text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 1px; text-underline-offset: 4px; transition: text-decoration-color .3s ease; }
#menu a:hover, #menu a.current { text-decoration-color: currentColor; }
.menu-toggle { display: none; }

/* ---------- views ---------- */
main {
  position: fixed; left: 0; right: 0;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  bottom: env(safe-area-inset-bottom, 0px);
}
.section {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--slow) var(--ease), visibility 0s linear var(--slow);
}
.section.enabled { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.scroll {
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  scrollbar-width: none; -ms-overflow-style: none;
}
.scroll::-webkit-scrollbar { display: none; }

/* big serif wordmarks: the box is exactly one cap-height tall */
.wordmark {
  font-family: var(--serif); font-weight: 400; text-transform: uppercase;
  white-space: nowrap; line-height: .7; letter-spacing: -.01em;
  font-size: calc(var(--title-h) / .7);
  transition: font-size var(--slow) var(--ease);
}

/* ---------- work: two panels ---------- */
#work { display: flex; flex-direction: column; }
.mobile-tabs { display: none; }
.panels { position: relative; flex: 1; min-height: 0; }
.panel {
  position: absolute; top: 0; bottom: 0; width: 30%;
  display: flex; flex-direction: column;
  transition: width var(--slow) var(--ease);
}
.panel.active { width: 70%; }
.panel[data-panel="digital"] { left: 0; }
.panel[data-panel="clients"] { right: 0; }
.separator {
  position: absolute; top: 0; bottom: 0; left: 70%; width: 1px; background: var(--rule);
  transition: left var(--slow) var(--ease);
}
.panels[data-active="clients"] .separator { left: 30%; }
.panels.instant .panel, .panels.instant .separator, .panels.instant .wordmark, .panels.instant .panel-desc { transition: none; }

.panel-header {
  flex: none; display: flex; justify-content: space-between; align-items: flex-start; gap: 30px;
  padding: 0 var(--pad); margin-bottom: var(--head-gap);
}
.panel:not(.active) .wordmark { font-size: calc(var(--title-h) * .5 / .7); }
.panel-desc {
  max-width: 300px; text-align: right; opacity: 0; max-height: 0; overflow: hidden;
  transition: opacity var(--slow) var(--ease);
}
.panel.active .panel-desc { opacity: 1; max-height: 200px; }
.panel-desc a:hover { font-family: var(--serif); }

.panel .scroll { flex: 1; min-height: 0; padding: 0 var(--pad); }
/* tiles are placed absolutely by layout() in main.js; column-gap is read there as the gutter */
.grid { position: relative; column-gap: var(--gutter); }
.grid > .item { position: absolute; left: 0; top: 0; }

.item { margin-bottom: 40px; }
.item a { display: block; }
.frame {
  position: relative; overflow: hidden; background: var(--tile);
  margin-bottom: 25px; max-width: 100%;
  aspect-ratio: var(--nr, var(--r, 1.5714));   /* the picture's own shape (no crop); --r only when unknown */
}
.frame img, .frame video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--slow) var(--ease), opacity .4s ease;
}
.frame video { opacity: 0; }
.item.playing .frame video { opacity: 1; }
.item a:hover .frame img, .item a:hover .frame video { transform: scale(1.04); }
.frame.outline { background: var(--bg); }
.frame.outline::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--rule); pointer-events: none; }
.frame.contain img { object-fit: contain; }
.frame.empty { display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; }
.frame.empty .ph-name { font-family: var(--serif); font-size: clamp(26px, 3.2vw, 46px); line-height: 1.05; }
.frame.empty .ph-note { color: var(--quiet); }
.item-title { font-size: var(--fs-title); line-height: var(--lh-title); }
.item-sub {
  font-family: var(--serif); font-size: var(--fs-sub); line-height: var(--lh-title);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.copyright { padding: 10px 0 50px; }

/* ---------- full-width views (About, project page) ---------- */
.view { position: absolute; inset: 0; padding: 0 var(--pad) 50px; }

/* ---------- about ---------- */
.about { display: flex; flex-wrap: wrap; padding-top: 30px; }
.about-side { width: 50%; display: flex; padding-right: 25px; }
.about-side > div { width: 50%; padding-right: 25px; min-width: 0; }
.about-side p { margin-bottom: 20px; overflow-wrap: anywhere; }
.about-side .label {
  display: block; font-family: var(--serif); font-size: var(--fs-label);
  margin: 0 0 5px 30px;
}
.about-side .block { margin-bottom: 40px; }
.about-side a:hover { font-family: var(--serif); }
.about-side figure { margin-bottom: 40px; }
.about-side figure img { width: 100%; height: auto; }
.about-main {
  width: 50%; padding-left: 25px; min-width: 0;
  font-family: var(--serif); font-size: var(--fs-big); line-height: var(--lh-big);
}
.about-main p { margin-bottom: .5em; text-wrap: pretty; }

/* ---------- project page ---------- */
.project-top { display: flex; justify-content: space-between; padding-top: 4px; }
.project-top a:hover, .project-nav a:hover { font-family: var(--serif); }
.project-header { text-align: center; padding: 20px 0 50px; }
.project-title { font-family: var(--serif); font-size: var(--fs-big); line-height: var(--lh-big); text-wrap: balance; }
.project-services { max-width: 620px; margin: 12px auto 0; }
.project-text { max-width: 900px; margin: 0 auto 50px; columns: 2; column-gap: var(--gutter); }
.project-text p { margin-bottom: 1em; break-inside: avoid; }
.project-text.quiet { columns: 1; text-align: center; color: var(--quiet); }
.project-section { margin-bottom: 50px; }
.project-label { font-family: var(--serif); font-size: var(--fs-label); margin-bottom: 20px; }
.project-films, .project-cats { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 40px var(--gutter); }
.project-films .item { width: calc((100% - 3 * var(--gutter)) / 4); margin: 0; }
.project-cats .item { width: calc((100% - var(--gutter)) / 2); margin: 0; }
.project-photos { columns: 3; column-gap: var(--gutter); }
.project-photos.n2 { columns: 2; }
.project-photos.n1 { columns: 1; }
.project-photos .photo { display: block; overflow: hidden; margin-bottom: var(--gutter); break-inside: avoid; background: var(--tile); }
.project-photos img { width: 100%; height: auto; transition: transform var(--slow) var(--ease); }
.project-photos .photo:hover img { transform: scale(1.04); }
.project-photos.n1 .photo { width: fit-content; max-width: 100%; margin: 0 auto var(--gutter); }
.project-photos.n1 img { width: auto; max-width: 100%; max-height: calc(100vh - var(--header-h) - 40px); }
.project-nav { display: flex; justify-content: space-between; gap: 20px; padding: 30px 0 0; }

/* ---------- viewer (films, photos, catalogue pages) ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .5s var(--ease), visibility 0s linear .5s;
}
.viewer.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.viewer-bar, .viewer-foot {
  flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 20px;
  padding: var(--header-top) var(--pad) 20px;
}
.viewer-foot { padding: 20px var(--pad) 30px; }
.viewer-title { grid-column: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title .serif { font-size: var(--fs-sub); }
.viewer-count { grid-column: 2; }
.viewer-close, .viewer-next { grid-column: 3; justify-self: end; }
.viewer-prev { grid-column: 1; justify-self: start; }
.viewer-link { grid-column: 2; }
.viewer-close:hover, .viewer-prev:hover, .viewer-next:hover, .viewer-link:hover { font-family: var(--serif); font-size: var(--fs-nav-on); }
.viewer.single .viewer-prev, .viewer.single .viewer-next { visibility: hidden; }
.viewer-stage { position: relative; flex: 1; min-height: 0; }
.viewer-stage img, .viewer-stage video {
  position: absolute; inset: 0; margin: auto;
  max-width: calc(100% - 2 * var(--pad)); max-height: 100%; width: auto; height: auto;
}
.viewer:not(.single) .viewer-stage img { cursor: pointer; }
.viewer-stage::after {
  content: "Loading"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 4px 10px; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.viewer.loading .viewer-stage::after { opacity: 1; }

/* ---------- breakpoints (desktop first) ---------- */
@media (max-width: 1820px) {
  :root { --title-h: 100px; --fs-big: 40px; --lh-big: 50px; }
}
@media (max-width: 1680px) {
  :root { --fs: 16px; --lh: 19px; --fs-title: 18px; --lh-title: 20px; --fs-sub: 17px; --fs-nav-on: 17px; --fs-label: 17px; }
}
@media (max-width: 1480px) {
  :root { --pad: 60px; --gutter: 30px; --header-h: 70px; --header-top: 20px; --title-h: 80px; --head-gap: 30px; }
  .logo { width: 44px; margin-top: -4px; }
}
@media (max-width: 1300px) {
  :root { --title-h: 70px; }
  .panel-desc { display: none; }
  .project-films .item { width: calc((100% - 2 * var(--gutter)) / 3); }
}
@media (max-width: 1225px) { :root { --title-h: 60px; } }
@media (max-width: 1130px) { :root { --title-h: 50px; } }

@media (max-width: 1040px) {
  :root { --fs: 15px; --lh: 18px; --fs-sub: 15px; --lh-title: 18px; --fs-title: 17px; --fs-nav-on: 16px; --fs-big: 26px; --lh-big: 36px; --title-h: 70px; }
  .mobile-tabs {
    flex: none; display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px var(--pad) 0; height: calc(var(--title-h) + 40px);
  }
  .mobile-tabs .wordmark { font-size: calc(var(--title-h) * .5 / .7); }
  .mobile-tabs .wordmark.active { font-size: calc(var(--title-h) / .7); }
  .panel, .panel.active { width: 100%; left: 0; right: 0; transition: opacity var(--slow) var(--ease); }
  .panel { opacity: 0; visibility: hidden; pointer-events: none; }
  .panel.active { opacity: 1; visibility: visible; pointer-events: auto; }
  .panel-header, .separator { display: none; }
  .about-side p { margin-bottom: 30px; }
}

@media (max-width: 860px) {
  :root { --title-h: 60px; }
  .about { flex-direction: column-reverse; }
  .about-side, .about-main { width: 100%; padding: 0; }
  .about-main { margin-bottom: 40px; }
  .project-text { columns: 1; }
}

@media (max-width: 820px) {
  :root { --pad: 20px; --gutter: 20px; --header-h: 75px; --fs-big: 25px; --lh-big: 35px; --head-gap: 25px; }
  .item { margin-bottom: 25px; }
  .frame { margin-bottom: 14px; }
  .site-header .bar { justify-content: center; }
  .logo { width: 46px; margin-top: 0; }
  .menu-toggle {
    display: block; pointer-events: auto; position: absolute; z-index: 2;
    right: var(--pad); top: calc(env(safe-area-inset-top, 0px) + 24px); width: 28px; height: 22px;
  }
  .menu-toggle span {
    position: absolute; left: 0; right: 0; height: 1.5px; background: var(--fg);
    transition: transform .4s var(--ease), top .4s var(--ease);
  }
  .menu-toggle span:first-child { top: 6px; }
  .menu-toggle span:last-child { top: 15px; }
  .menu-open .menu-toggle span:first-child { top: 10px; transform: rotate(45deg); }
  .menu-open .menu-toggle span:last-child { top: 10px; transform: rotate(-45deg); }
  #menu {
    position: fixed; inset: 0; z-index: 1; height: auto;
    flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    background: var(--veil); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--slow) var(--ease), visibility 0s linear var(--slow);
  }
  .menu-open #menu { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #menu { background: var(--bg); }
  }
  #menu ul { flex-direction: column; align-items: center; gap: 20px; }
  #menu li { margin: 0; }
  #menu li::after { content: none !important; }
  #menu a, #menu a:hover, #menu a.current { font-size: 25px; line-height: 35px; }
  .nav-sep { display: none; }
  .about-side { flex-direction: column; }
  .about-side > div { width: 100%; padding-right: 0; }
  .project-header { padding: 16px 0 30px; }
  .project-films, .project-cats { gap: 25px var(--gutter); }
  .project-films .item { width: calc((100% - var(--gutter)) / 2); }
  .project-cats .item { width: 100%; }
  .project-photos { columns: 2; }
  .project-photos .photo { margin-bottom: var(--gutter); }
  .viewer-bar { padding-top: 26px; }
  .viewer-stage img, .viewer-stage video { max-width: 100%; }
}

@media (max-width: 600px) {
  :root { --title-h: min(44px, 10.5vw); }
  .mobile-tabs { height: calc(var(--title-h) + 30px); }
  .frame.empty { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01s !important; }
}
