/* Tokens taken from the Master Repo Figma frames (1440px wide). */
:root {
  --paper: #faf9f6;
  --ink: #000;
  --sand: #d2cbb7;   /* open-menu bar */
  --muted: #6b675e;

  --font: "Inter", system-ui, sans-serif;

  --edge: clamp(16px, 1.75vw, 25px);        /* 25px page margin at 1440 */
  --gap: clamp(10px, 1.46vw, 21px);         /* 21px between images */
  --row-gap: clamp(24px, 4.4vw, 64px);      /* 64px between mosaic rows */
  --header-h: clamp(72px, 7.5vw, 108px);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
}

main { flex: 1; }

img, video { display: block; max-width: 100%; }

a { color: inherit; }

button { font: inherit; color: inherit; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Header + menu ---------- */

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: clamp(20px, 3.6vw, 52px);
  min-height: var(--header-h);
  padding: 0 clamp(16px, 2.7vw, 39px) 0 clamp(16px, 2.1vw, 30px);
  transition: background-color .2s ease;
}

.wordmark {
  margin-right: auto;
  font-size: clamp(22px, 2.36vw, 34px);
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.menu { display: none; gap: clamp(20px, 3.6vw, 52px); }

.menu a {
  font-size: clamp(20px, 2.1vw, 30px);
  line-height: 1;
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.menu a:hover,
.menu a:focus-visible { text-decoration-line: underline; }

.menu-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -2px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}

.menu-bars { position: relative; }
.menu-bars::before,
.menu-bars::after { content: ""; position: absolute; left: 0; }
.menu-bars::before { top: -10px; }
.menu-bars::after { top: 10px; }

.menu-close { display: none; font-size: clamp(26px, 2.4vw, 34px); line-height: 1; }

.site-header.is-open { background: var(--sand); color: var(--paper); }
.site-header.is-open .menu { display: flex; }
.site-header.is-open .menu-bars { display: none; }
.site-header.is-open .menu-close { display: block; }
.site-header.is-open :focus-visible { outline-color: var(--paper); }

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(40px, 6vw, 80px) clamp(16px, 3.2vw, 46px) clamp(32px, 3.9vw, 56px) clamp(16px, 1.9vw, 28px);
}

.copyright { margin: 0; font-size: clamp(16px, 1.32vw, 19px); }

.socials { display: flex; gap: 16px; }

.socials a { display: block; line-height: 0; }

/* ---------- Home ---------- */

.home main {
  display: flex;
  align-items: center;
  padding: clamp(24px, 6vh, 64px) var(--edge);
}

.doors {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.door { text-decoration: none; }

/* height: auto lets aspect-ratio win over the height attribute. */
.door img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.caption {
  margin: 14px 0 0;
  font-size: clamp(18px, 1.53vw, 22px);
  font-weight: 400;
  line-height: 1.2;
}

.door:hover .caption,
.door:focus-visible .caption {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}

.door:focus-visible { outline-offset: 6px; }

/* ---------- Project mosaics (stills + motion) ---------- */

.work { padding: clamp(24px, 4.4vw, 63px) var(--edge) 0; }

.project + .project { margin-top: var(--row-gap); }

.project-title {
  margin: 0 0 18px;
  font-size: clamp(18px, 1.53vw, 22px);
  font-weight: 400;
  line-height: 1.2;
}

/* 12 columns: wide tiles span 6 (two per row), narrow tiles span 4 (three per row). */
.mosaic {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: var(--row-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile { grid-column: span 6; margin: 0; }
.tile--third { grid-column: span 4; }

.tile-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #e9e6df;
  cursor: zoom-in;
  text-align: left;
}

.tile img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.tile--tall img { aspect-ratio: 2 / 3; }

.tile .caption { margin-top: 12px; }

.tile-btn:hover img,
.tile-btn:focus-visible img { opacity: .92; }

.tile-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 2;
  background: #1d1c1a;
  color: var(--paper);
  font-size: clamp(18px, 1.53vw, 22px);
}

/* ---------- Viewer (full-size still or video) ---------- */

.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}

.viewer[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.viewer::backdrop { background: var(--paper); }

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0 clamp(16px, 2.7vw, 39px) 0 clamp(16px, 2.1vw, 30px);
}

.viewer-title { margin: 0; font-size: clamp(18px, 1.53vw, 22px); font-weight: 400; }

.viewer-controls { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 36px); }

.viewer-controls button {
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: clamp(18px, 1.53vw, 22px);
  cursor: pointer;
}

.viewer-controls button:hover { text-decoration: underline; text-underline-offset: 5px; }

.viewer-controls .viewer-close { font-size: clamp(26px, 2.4vw, 34px); line-height: 1; }

.viewer-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0 var(--edge);
}

.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer-stage video { background: #000; }

.viewer-note {
  margin: 0;
  padding: 16px var(--edge) 24px;
  text-align: center;
  font-size: 1rem;
}

.viewer-note[hidden] { display: none; }

/* ---------- About ---------- */

.about { padding: clamp(24px, 4.4vw, 63px) var(--edge) 0; max-width: 46rem; }

.about h1,
.about h2 { margin: 0 0 12px; font-size: clamp(22px, 2.36vw, 34px); font-weight: 400; line-height: 1.2; }

.about h2 { margin-top: 48px; }

.about p { margin: 0; font-size: clamp(17px, 1.39vw, 20px); color: var(--muted); }

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .doors { grid-template-columns: 1fr; row-gap: 32px; }

  .tile, .tile--third { grid-column: span 12; }
  .tile--tall { grid-column: span 6; }

  .site-header.is-open { flex-wrap: wrap; row-gap: 0; padding-bottom: 20px; }
  .site-header.is-open .menu {
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    gap: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
