/* =========================================================
   Tara Perez de Miguel - portfolio styles
   ========================================================= */

:root {
  --bg:       #ffffff;
  --ink:      #000000;
  --hover:    #555555;
  --ease:     cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding: 3.2rem 4rem 2rem 4rem;
  position: relative;
}

/* ---------- Top navigation (pages) ---------- */
nav.pages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  margin-bottom: 4rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding-top: 3.2rem;
  margin-top: -3.2rem;
  padding-bottom: 1.5rem;
  z-index: 10;
}

nav.pages button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
  padding: 0.4rem 0;
  transition: color 0.3s var(--ease);
}

nav.pages button:hover { color: var(--hover); }

/* ---------- Category labels (fixed at top-left and top-right) ---------- */
.cats {
  position: fixed;
  top: 10rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  z-index: 5;
}

.cats.left  { left: 4rem; }
.cats.right { right: 4rem; text-align: right; }

.cat {
  cursor: pointer;
  color: var(--ink);
  transition: color 0.3s var(--ease);
  display: inline-block;
  padding: 0.15rem 0;
  align-self: flex-start;
}

.cats.right .cat { align-self: flex-end; }

.cat:hover { color: var(--hover); }

/* ---------- Gallery stage ---------- */
/* Spans the full viewport width so marginLeft percentages
   position images across the whole page. */
.stage {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);  /* break out of body padding */
  margin-top: 2rem;
}

/* Gallery: images flow left-to-right, wrapping when out of space.
   Each image's width is set inline (% of viewport).
   marginLeft pushes it horizontally from where the previous image ended.
   Vertical rhythm comes from margin-top (also set inline, optional).
   Two narrow images can sit side by side; a wide one takes its own row. */
.gallery {
  display: none;
  flex-wrap: wrap;
  width: 100%;
  padding-bottom: 6rem;
  align-items: flex-start;
}

.gallery.active { display: flex; }

.gallery .shot {
  display: block;
  margin-bottom: 4rem;
  /* width, margin-left, margin-top are set inline per image */
}

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

/* ---------- Footer / signature ---------- */
footer {
  position: fixed;
  bottom: 2rem;
  right: 4rem;
  font-family: 'Inter', sans-serif;
  z-index: 10;
}

.signature {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
  font-weight: 300;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.signature:hover { color: var(--hover); border-color: var(--hover); }


/* ---------- Active category + clickable project images ---------- */
.cat.current { color: var(--hover); }

.gallery a.shot {
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.gallery a.shot img {
  transition: opacity 0.4s var(--ease);
}

.gallery a.shot:hover img { opacity: 0.85; }

.gallery .caption {
  display: block;
  margin-top: 0.7rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.gallery a.shot:hover .caption { opacity: 1; transform: none; }

.gallery .shot.framed img {
  border: 1px solid #e4e4e4;
}

.gallery .shot.video {
  aspect-ratio: 16 / 9;
  background: #000;
}

.gallery .shot.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.gallery .section-label {
  flex-basis: 100%;
  max-width: 75%;
  margin-top: 4rem;
  margin-bottom: 2rem;
  font-family: 'Inter', sans-serif;
  font-weight: 200;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  color: var(--hover);
}

.gallery .shot .note {
  display: block;
  margin-top: 0.6rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  color: var(--hover);
}

/* ---------- Identity panels (palette, type) ---------- */
.panel { font-family: 'Inter', sans-serif; font-weight: 300; }
.panel .swatches { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr; gap: 0; }
.panel .sw { aspect-ratio: 3 / 4; padding: 1rem; display: flex; flex-direction: column; justify-content: flex-end;
             font-size: 0.72rem; line-height: 1.5; }
.panel .sw:first-child { aspect-ratio: auto; }
.panel .type { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.panel .type .label { font-size: 0.72rem; color: var(--hover); margin-bottom: 1rem; }
.panel .type .big { font-size: 5.5rem; line-height: 1; margin-bottom: 1.2rem; }
.panel .type .abc { font-size: 1.15rem; line-height: 1.5; word-break: break-all; }
.panel .cabinet { font-family: 'Cabinet Grotesk', 'Inter', sans-serif; font-weight: 500; }
.panel .times { font-family: 'Times New Roman', Times, serif; font-weight: 400; }
.project-head .text a { color: inherit; }

/* ---------- Project view ---------- */
/* Title sits on the same line as the first category label,
   left edge aligned with the project images (12.5% of the page). */
.project-head {
  margin-left: 12.5%;
  width: 60%;
  margin-top: -0.6rem;
  margin-bottom: 2.2rem;
}

.project-head h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 200;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--hover);
}

.project-head .meta {
  margin-top: 0.35rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--hover);
}

.project-head .text {
  margin-top: 1.2rem;
  max-width: 36rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--hover);
}

.project-head .text p + p { margin-top: 0.8rem; }

/* ---------- About page ---------- */
.about {
  position: relative;
  min-height: 44rem;
  margin-top: -0.6rem;
}

.about .frag {
  position: absolute;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  line-height: 1.55;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  color: var(--ink);
}

.about a { color: inherit; }

.about .frag-img {
  position: absolute;
  height: auto;
  display: block;
}

/* ---------- Lightbox ---------- */
.gallery .shot:not(.linked):not(.video) img { cursor: zoom-in; }

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
  cursor: e-resize;
}

#lightbox.left { cursor: w-resize; }
#lightbox.open { opacity: 1; pointer-events: auto; }

#lightbox img {
  max-width: 88vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

#lightbox img.ready { opacity: 1; }

#lightbox .lb-count,
#lightbox .lb-close {
  position: absolute;
  bottom: 2rem;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--hover);
}

#lightbox .lb-count { left: 4rem; }

#lightbox .lb-close {
  right: 4rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}

#lightbox .lb-close:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body { padding: 2rem 1.5rem; }
  nav.pages { padding-top: 2rem; margin-top: -2rem; margin-bottom: 2rem; }
  .cats { font-size: 0.7rem; gap: 1.2rem; top: 7rem; }
  .cats.left  { left: 1.5rem; }
  .cats.right { right: 1.5rem; }
  nav.pages button { font-size: 0.7rem; }
  .gallery { gap: 2rem; padding-bottom: 3rem; }
  .project-head { margin-left: 22%; width: 56%; }
  .project-head h1 { font-size: 1.05rem; }
  .about { min-height: 0; padding: 0 1.5rem 4rem 22%; }
  .about .frag { position: static; max-width: none !important; margin-bottom: 1.4rem; font-size: 0.75rem; }
  .about .frag:nth-child(even) { margin-left: 18%; }
  .about .frag-img { position: static; width: 70% !important; margin: 1rem 0 0 auto; }
  #lightbox img { max-width: 94vw; max-height: 80vh; }
  #lightbox .lb-count { left: 1.5rem; }
  #lightbox .lb-close { right: 1.5rem; }
  .gallery .caption { opacity: 1; transform: none; }
}


/* ---------- Mobile: one image per row, scroll down ----------
   The free composition (widths, offsets) is switched off and every
   image takes the full width. Category labels become a simple
   tappable row under the menu. */
@media (max-width: 700px) {
  body { padding: 0 1.25rem 2rem; }

  nav.pages {
    margin: 0 -1.25rem 0.6rem;
    padding: 1.4rem 1.25rem 0.9rem;
  }
  nav.pages { display: flex; gap: 1.6rem; }
  nav.pages button { font-size: 0.78rem; }

  /* categories: static row(s) instead of fixed columns */
  .cats,
  .cats.left,
  .cats.right {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    font-size: 0.78rem;
    text-align: left;
  }
  .cats.right { margin: 0.4rem 0 1.6rem; }
  .cats .cat, .cats.right .cat { align-self: auto; }

  /* gallery: full-width single column, ignore inline layout */
  .stage { width: auto; margin: 0; }
  .gallery { display: none; flex-direction: column; gap: 0; padding-bottom: 2rem; }
  .gallery.active { display: flex; }
  .gallery .shot {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 1.6rem !important;
  }
  .gallery .caption,
  .gallery .shot .note { opacity: 1; transform: none; margin-top: 0.5rem; }
  .panel .swatches { grid-template-columns: 1fr 1fr; }
  .panel .sw:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
  .panel .type { grid-template-columns: 1fr; gap: 2rem; }
  .panel .type .big { font-size: 3.5rem; }
  .gallery .section-label {
    margin: 2rem 0 1.2rem !important;
    max-width: none;
    font-size: 1.05rem;
  }

  /* project header */
  .project-head { margin: 0 0 1.6rem; width: 100%; }
  .project-head h1 { font-size: 1.05rem; }
  .project-head .text { max-width: none; }

  /* about: stacked, slightly loose */
  .about { padding: 0 0 3rem; }
  .about .frag:nth-child(even) { margin-left: 12%; }
  .about .frag-img { width: 75% !important; }

  /* signature: end of page instead of floating over images */
  footer { position: static; text-align: right; padding: 1rem 0 0.5rem; }

  #lightbox .lb-count { left: 1.25rem; }
  #lightbox .lb-close { right: 1.25rem; }
}


/* ---------- Mobile dropdown menu ---------- */
#mbar, #mmenu { display: none; }

@media (max-width: 700px) {
  nav.pages, .cats { display: none !important; }

  #mbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 60;
    margin: 0 -1.25rem 1.2rem;
    padding: 1.3rem 1.25rem 1rem;
    background: var(--bg);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
  }
  #mbar .mb-where {
    color: var(--hover);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #mbar .mb-toggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
  }

  #mmenu {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--bg);
    padding: 4.4rem 1.25rem 2rem;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-0.6rem);
    pointer-events: none;
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
  }
  body.menu-open #mmenu { opacity: 1; transform: none; pointer-events: auto; }
  body.menu-open { overflow: hidden; }

  #mmenu .mm-group { margin-bottom: 1.8rem; }
  #mmenu a { color: var(--ink); text-decoration: none; display: block; }
  #mmenu a.current { color: var(--hover); }
  #mmenu .mm-page { font-weight: 200; font-size: 1.35rem; letter-spacing: 0.01em; margin-bottom: 0.6rem; }
  #mmenu .mm-cats { padding-left: 1.4rem; }
  #mmenu .mm-cats a { font-size: 0.82rem; line-height: 2.1; }
}
