/* All desktop positions are in cqw — percent of the page width — so the
   collage keeps the exact proportions of the Figma frame at any screen size. */

:root {
  --cream: #F1E7DB;
  --red: #A8322A;
  --blue: #3F7FC4;
  --ink: #1d1a17;
  --font: "Avenir Next", "AvenirNext-Bold", "Avenir", "Nunito Sans", system-ui, sans-serif;
  --radius: 2.2cqw;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { background: var(--cream); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--red);
  font-family: var(--font);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
}

/* Film-grain noise, like the Noise effect in Figma */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: .22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .35 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Animated grain (grain.js) laid over the whole page, replacing the static
   noise above. While a photo is open it moves into the viewer (main.js). */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.viewer .grain { z-index: 0; }
.has-grain body::before { display: none; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.page {
  container-type: inline-size;
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------- Header ---------- */

.masthead {
  position: relative;
  height: 18cqw;
}

.wordmark {
  position: absolute;
  left: 4.6cqw;
  top: 2.6cqw;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.wordmark__name { font-size: 3.15cqw; letter-spacing: .01em; }
.wordmark__tag { font-size: 2.75cqw; }

.logo {
  position: absolute;
  left: 35.7cqw;
  top: 2.1cqw;
  width: 26.2cqw;
  height: auto;
}

/* ---------- Plus menu (fixed, top right) ---------- */

.menu {
  position: fixed;
  z-index: 50;
  top: clamp(14px, 3.3cqw, 52px);
  right: max(16px, calc((100vw - 100cqw) / 2 + 4.1cqw));
  color: var(--blue);
  font-size: clamp(15px, 2.75cqw, 40px);
  line-height: 1;
}
.menu__links {
  position: absolute;
  right: calc(100% + clamp(8px, 1.6cqw, 26px));
  top: 50%;
  display: flex;
  gap: .4em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(.6em, -50%);
  pointer-events: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.menu.is-open .menu__links { opacity: 1; transform: translate(0, -50%); pointer-events: auto; }

/* Once scrolled over the photos, soft cream pills keep the menu readable */
.menu__links,
.menu__toggle { border-radius: 999px; transition-property: opacity, transform, background-color; }
.menu__links { padding: .3em .55em; margin-right: -.55em; }
.menu.is-scrolled .menu__links,
.menu.is-scrolled .menu__toggle { background: rgba(241, 231, 219, .85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.menu.is-scrolled .menu__toggle { box-shadow: 0 0 0 .3em rgba(241, 231, 219, .85); }
.menu__link { letter-spacing: .02em; }
.menu__link:hover { color: var(--red); }

.menu__toggle,
.contact__close,
.viewer__close {
  width: 1.1em;
  height: 1.1em;
  display: grid;
  place-items: center;
  transition: transform .35s var(--ease), color .2s;
}
.menu__toggle svg,
.contact__close svg,
.viewer__close svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 3.6;
  stroke-linecap: round;
  fill: none;
}
.menu.is-open .menu__toggle,
.contact__close,
.viewer__close { transform: rotate(45deg); }

/* ---------- Collage ---------- */

.collage {
  position: relative;
  height: calc(var(--height, 590) * 1cqw - 18cqw);
}

.tile {
  position: absolute;
  left: calc(var(--x) * 1cqw);
  top: calc((var(--y) - 18) * 1cqw);
  width: calc(var(--w) * 1cqw);
  height: calc(var(--h) * 1cqw);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  opacity: .8;
  transition: opacity .45s var(--ease), transform .55s var(--ease), box-shadow .55s var(--ease);
  background: rgba(0, 0, 0, .04);
}
.tile > img,
.tile > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile:hover,
.tile:focus-visible,
.tile.is-active {
  opacity: 1;
  transform: scale(1.045);
  z-index: 45; /* above the grain: the photo you look at is clean */
  box-shadow: 0 1.2cqw 3.5cqw rgba(40, 20, 10, .22);
  outline: none;
}

/* Category label + other photos from the same folder, shown on hover */
.tile__more {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: clamp(10px, 1.6cqw, 26px);
  padding-top: clamp(30px, 6cqw, 90px);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, .8cqw, 12px);
  background: linear-gradient(to top, rgba(20, 12, 8, .6), transparent);
  color: var(--cream);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
  pointer-events: none;
}
.tile:hover .tile__more,
.tile:focus-within .tile__more,
.tile.is-active .tile__more { opacity: 1; transform: none; pointer-events: auto; }

.tile__label {
  font-size: clamp(12px, 1.5cqw, 22px);
  letter-spacing: .08em;
}
.tile__thumbs { display: flex; gap: clamp(5px, .6cqw, 9px); }
.tile__thumb {
  width: clamp(34px, 4.6cqw, 72px);
  aspect-ratio: 1;
  border-radius: clamp(4px, .5cqw, 8px);
  overflow: hidden;
  flex: none;
  opacity: .85;
  transition: opacity .2s, transform .2s var(--ease);
}
.tile__thumb:hover, .tile__thumb:focus-visible { opacity: 1; transform: translateY(-2px); outline: none; }
.tile__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Small tiles: fewer thumbnails so they always fit */
.tile[data-size="s"] .tile__thumb:nth-child(n+3) { display: none; }

/* ---------- Signature ---------- */

.signature {
  padding: 4cqw 4.6cqw 5cqw;
  text-align: center;
  font-size: clamp(10px, 1cqw, 14px);
  letter-spacing: .04em;
  line-height: 1;
  white-space: nowrap;
}

/* ♇ (Pluto) drawn in the site's own font: an L laid over the P, sharing its stem */
.pluto { position: relative; display: inline-block; }
.pluto > span { position: absolute; left: 0; top: 0; }

/* ---------- Full-image viewer ---------- */

dialog { padding: 0; border: 0; color: inherit; }
dialog::backdrop { background: transparent; }

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  background: transparent; /* the page fades away; the cream + grain stay */
  cursor: zoom-out;
}
.viewer[open] { display: grid; place-items: center; }
.viewer__img {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - 2 * clamp(16px, 5vw, 80px));
  max-height: calc(100dvh - 2 * clamp(56px, 7vh, 90px));
  object-fit: contain;
  border-radius: 10px;
}
.viewer__close {
  position: fixed;
  z-index: 2;
  top: clamp(14px, 2.3vw, 40px);
  right: clamp(16px, 2.6vw, 44px);
  color: var(--blue);
  font-size: clamp(22px, 2.6vw, 40px);
}

/* ---------- Contact window ---------- */

.contact {
  width: min(92vw, 440px);
  background: var(--cream);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(40, 20, 10, .25);
}
.contact::backdrop { background: rgba(241, 231, 219, .6); backdrop-filter: blur(3px); }
.contact[open] { animation: rise .35s var(--ease); }
.contact__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 54px 24px 22px;
  position: relative;
}
.contact__close {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--blue);
  font-size: 22px;
}
.contact input,
.contact textarea {
  font: inherit;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--ink);
  background: rgba(255, 255, 255, .45);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
.contact input::placeholder,
.contact textarea::placeholder { color: var(--blue); opacity: .85; }
.contact input:focus,
.contact textarea:focus { border-color: var(--blue); }
.contact__trap { display: none; }
.contact__send {
  align-self: flex-end;
  color: var(--red);
  font-size: 18px;
  letter-spacing: .06em;
  padding: 6px 2px;
}
.contact__send:hover { color: var(--blue); }
.contact__send:disabled { opacity: .4; cursor: default; }
.contact__status { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--blue); }
.contact__status.is-error { color: var(--red); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Phones: same pieces, one offset column ---------- */

@media (max-width: 700px) {
  :root { --radius: 14px; }

  .masthead { height: auto; display: flex; flex-direction: column; gap: 18px; padding: 18px 16px 8px; }
  .wordmark { position: static; }
  .wordmark__name { font-size: 22px; }
  .wordmark__tag { font-size: 19px; }
  .logo { position: static; width: 58%; align-self: center; }

  .menu { top: 22px; font-size: 18px; }

  .collage {
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 18px 16px 40px;
  }
  .signature { padding: 20px 16px 48px; }
  .tile {
    position: relative;
    left: auto;
    top: auto;
    /* Keep each photo's side of the page, just bigger */
    width: min(100%, calc(var(--w) * 1.45%));
    height: auto;
    aspect-ratio: var(--w) / var(--h);
    margin-left: calc((100% - min(100%, var(--w) * 1.45%)) * var(--xr));
    cursor: pointer;
  }
  .tile.is-active { transform: scale(1.03); }
  .tile[data-size="s"] .tile__thumb:nth-child(n+3) { display: block; }
  .tile__thumb:nth-child(n+5) { display: none; }
}

/* Touch screens: no hover — first tap reveals, second tap opens */
@media (hover: none) {
  .tile:hover:not(.is-active) { opacity: .8; transform: none; box-shadow: none; }
  .tile:hover:not(.is-active) .tile__more { opacity: 0; pointer-events: none; }
}

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