/* ============================================================
   SANE SEVEN — DESIGN SYSTEM
   White ground. Black type. Images carry everything.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400&display=swap');

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --white:       #FFFFFF;
  --black:       #0F0F0F;
  --mid:         #6B6B6B;
  --rule:        #E0E0E0;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --space-xs:    0.5rem;
  --space-s:     1rem;
  --space-m:     2rem;
  --space-l:     4rem;
  --space-xl:    8rem;

  --nav-h:       4rem;
  --transition:  0.3s ease;
}

/* ── Base ───────────────────────────────────────────────── */
body {
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Navigation ─────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-m);
  background: var(--white);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.site-nav.scrolled {
  border-color: var(--rule);
}

.site-nav__wordmark {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.125rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.site-nav__links {
  display: flex;
  gap: var(--space-m);
  list-style: none;
}

.site-nav__links a {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  transition: color var(--transition);
}

.site-nav__links a:hover,
.site-nav__links a.active {
  color: var(--black);
}

/* ── Page wrapper ───────────────────────────────────────── */
.site-main {
  padding-top: var(--nav-h);
}

/* ── Homepage: Masonry ──────────────────────────────────── */
/* No-JS fallback: CSS multi-column flow. JS upgrades to positioned
   masonry (.masonry--js): tile heights are computed from each image's
   own aspect ratio + a fixed caption height, so placement is exact and
   reshuffles instantly with no overlaps or gaps. */
.masonry {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-m) 24px var(--space-xl);
  column-count: 2;
  column-gap: 16px;
}

.masonry--js {
  position: relative;
  column-count: 1;
  column-gap: 0;
}

.tile {
  display: block;
  width: 100%;
  margin: 0 0 24px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.masonry--js .tile {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  break-inside: auto;
  will-change: transform;
}

/* Reshuffle animation — enabled after first placement */
.masonry--ready .tile {
  transition: transform 0.42s cubic-bezier(.22,.61,.36,1);
}

.tile__frame {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #EFECE7;
  opacity: 0;
  transform: scale(0.986);
  transition: opacity 0.7s cubic-bezier(.22,.61,.36,1),
              transform 0.7s cubic-bezier(.22,.61,.36,1);
}

.tile.is-in .tile__frame {
  opacity: 1;
  transform: none;
}

.tile__img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 1.1s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}

/* In JS mode the frame height is set explicitly; image fills it.
   The height equals the image's own ratio, so nothing is cropped. */
.masonry--js .tile__img {
  height: 100%;
  object-fit: cover;
}

@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile__img { transform: scale(1.038); }
}

.tile__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #A8A29A;
}

/* Caption beneath the image — fixed height so every tile is deterministic */
.tile__cap {
  height: 52px;
  padding: 10px 2px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.tile__name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile__meta {
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .masonry { column-count: 3; column-gap: 18px; padding-left: 32px; padding-right: 32px; }
  .tile__frame { border-radius: 8px; }
  .tile__name { font-size: 1.1rem; }
}

@media (min-width: 1080px) {
  .masonry { column-count: 4; column-gap: 20px; padding-left: 40px; padding-right: 40px; }
}

/* ── Single Project ─────────────────────────────────────── */
.project-header {
  padding: var(--space-l) var(--space-m) var(--space-m);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--space-m);
}

.project-header__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-style: italic;
  line-height: 1.1;
}

.project-header__details {
  text-align: right;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  line-height: 2;
}

.project-gallery {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--space-m);
}

/* Images are never full-bleed — displayed at a considered column width,
   which also keeps the on-screen file well below print resolution. */
.project-gallery img,
.tile__img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Single column, full editorial width */
.project-gallery__item {
  margin-bottom: var(--space-l);
}

/* Optional: two-up layout for supporting frames */
.project-gallery__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-s);
  margin-bottom: var(--space-l);
}

.project-nav {
  padding: var(--space-l) var(--space-m);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
}

.project-nav a {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  transition: color var(--transition);
}

.project-nav a:hover { color: var(--black); }

/* ── Info Page ──────────────────────────────────────────── */
.info-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-m);
}

.info-page__name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-style: italic;
  margin-bottom: var(--space-l);
  line-height: 1;
}

.info-page__bio {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--black);
  margin-bottom: var(--space-l);
  max-width: 52ch;
}

.info-page__section-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: var(--space-s);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--rule);
}

.info-page__clients {
  list-style: none;
  margin-bottom: var(--space-l);
}

.info-page__clients li {
  font-size: 0.875rem;
  line-height: 2.4;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--rule);
}

.info-page__press {
  list-style: none;
  margin-bottom: var(--space-l);
}

.info-page__press li {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  line-height: 2.2;
}

/* ── Contact Page ───────────────────────────────────────── */
.contact-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-m);
}

.contact-page__heading {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-style: italic;
  margin-bottom: var(--space-l);
  line-height: 1.1;
}

.contact-page__intro {
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--mid);
  margin-bottom: var(--space-l);
  max-width: 48ch;
}

.contact-page__email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--black);
  padding-bottom: 2px;
  transition: opacity var(--transition);
}

.contact-page__email:hover { opacity: 0.5; }

.contact-page__representation {
  margin-top: var(--space-l);
  padding-top: var(--space-m);
  border-top: 1px solid var(--rule);
}

.contact-page__rep-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: var(--space-xs);
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  padding: var(--space-m);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer__copy {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
}

/* ── Utilities ──────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Lazy load fade ─────────────────────────────────────── */
img.lazy {
  opacity: 0;
  transition: opacity 0.4s ease;
}
img.lazy.loaded { opacity: 1; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --space-m: 1.25rem;
    --space-l: 2.5rem;
    --space-xl: 4rem;
  }

  .site-nav {
    padding: 0 var(--space-m);
  }

  .masonry {
    column-gap: 12px;
    padding: var(--space-s) var(--space-s) var(--space-xl);
  }

  .project-gallery__pair {
    grid-template-columns: 1fr;
  }

  .project-header {
    flex-direction: column;
    gap: var(--space-s);
    align-items: flex-start;
  }

  .project-header__details { text-align: left; }

  .site-footer {
    flex-direction: column;
    gap: var(--space-s);
    text-align: center;
  }
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
