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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: #0f0d0f;
  color: #fff;
  font-family: 'Roboto Condensed', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

/* ==========================================
   Wall — 4 columns on desktop, 2 on mobile.
   Columns are built by main.js; until it runs (or without JS) the tiles
   fall back to CSS multi-column.
   ========================================== */
.wall {
  padding: 32px 32px 60px;
}

.wall:not(.is-ready) {
  column-count: 4;
  column-gap: 20px;
}

.wall:not(.is-ready) .tile {
  break-inside: avoid;
  margin-bottom: 20px;
}

.wall.is-ready {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.wall-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================
   Tile
   Per-tile variables (set inline in index.html):
     --ar          aspect ratio of the media box
     --w/--h/--l/--t   image size + offset inside the box (Figma crop), default fill
     --bg          media background
     --r           media corner radius (default 4px)
     --ia          inset aspect ratio (inset variant only)
     --m-*         mobile override of any of the above
   ========================================== */
.tile {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  border-radius: 4px;
  overflow: clip;
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.2));
}

.tile-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar);
  border-radius: var(--r, 4px);
  background: var(--bg, transparent);
  overflow: hidden;
}

.tile-media img {
  position: absolute;
  left: var(--l, 0);
  top: var(--t, 0);
  width: var(--w, 100%);
  height: var(--h, 100%);
  max-width: none;
  object-fit: cover;
  pointer-events: none;
}

/* Inset: a box as tall as the media, centered horizontally, holding the image */
.tile-inset {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  aspect-ratio: var(--ia);
  transform: translateX(-50%);
  overflow: hidden;
}

.tile-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.1;
  color: #fff;
}

.tile-meta {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.5;
  color: #808080;
}

/* ==========================================
   Presentation
   ========================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 17.182px;
}

.brand-icon {
  width: 48.032px;
  height: 57.275px;
  object-fit: cover;
}

.brand-name {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 30.069px;
  line-height: 0.953;
  white-space: nowrap;
}

.bio {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
}

.role {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-title {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}

.role-meta {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.5;
  color: #808080;
}

/* Desktop presentation: first tile of column 1 */
.tile--intro {
  padding-bottom: 20px;
}

.intro-top {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 400px;
  padding: 20px 0;
}

.tile--intro .bio {
  width: min(306px, 100%);
}

/* Mobile presentation is only for < 900px */
.hero {
  display: none;
}

/* ==========================================
   Dock — floating About / Contact
   ========================================== */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
}

.dock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 36px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.dock-btn:hover {
  opacity: 0.85;
}

.dock-btn--ghost {
  background-color: rgba(20, 20, 20, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #fff;
  border-color: #cccccc;
  border-width: 0,4px;
}

.dock-btn--solid {
  background-color: #fff;
  color: #141414;
}

/* ==========================================
   Lightbox — image viewer
   ========================================== */
.tile:not(.tile--intro) {
  cursor: zoom-in;
}

.tile:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(8, 6, 8, 0.9);
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
}

/* Fit the screen (94% of it), upscaling small images. --ratio is set by lightbox.js */
.lightbox-img {
  --ratio: 1;
  width: min(94vw, calc(94vh * var(--ratio)));
  width: min(94vw, calc(94dvh * var(--ratio)));
  height: auto;
  max-width: none;
  aspect-ratio: var(--ratio);
  object-fit: contain;
  border-radius: 4px;
  -webkit-user-drag: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background-color 0.2s;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background-color: rgba(255, 255, 255, 0.24);
}

.lightbox-close::before,
.lightbox-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  margin: -1px 0 0 -9px;
  border-radius: 1px;
  background-color: #fff;
  transform: rotate(45deg);
}

.lightbox-close::after {
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .contact,
  .contact-content {
    transition: none;
  }
}

/* ==========================================
   Contact modal
   ========================================== */
.contact {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  overflow-y: auto;
  padding: 72px 16px;
  background-color: #0f0d0f;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.contact[hidden] {
  display: none;
}

.contact.is-open {
  opacity: 1;
}

/* Stay in the corner even when the content scrolls */
.contact .lightbox-close {
  position: fixed;
}

/* margin: auto centers the content and still lets it scroll when taller than the screen */
.contact-content {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 8vw, 80px);
  width: 100%;
  max-width: 825px;
  margin: auto;
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.contact.is-open .contact-content {
  transform: none;
}

.contact-title {
  max-width: 704px;
  margin: 0 auto;
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(44px, 8vw, 88.92px);
  line-height: 0.953;
  text-align: center;
  text-wrap: balance;
}

.contact-list {
  display: flex;
  flex-direction: column;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-top: 1px solid #707070;
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 600;
  font-size: 21px;
  line-height: 1.5;
}

.contact-label {
  flex-shrink: 0;
  width: 160px;
  color: #fff;
}

.contact-value {
  color: #808080;
  white-space: nowrap;
  transition: color 0.2s;
}

.contact-row:hover .contact-value,
.contact-row:focus-visible .contact-value {
  color: #fff;
}

.contact-row:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

@media (max-width: 560px) {
  .contact-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 16px;
    font-size: 18px;
  }

  .contact-label {
    width: auto;
  }
}

/* ==========================================
   Mobile — fewer columns
   ========================================== */
@media (max-width: 899px) {
  .hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    min-height: 375px;
    padding: 60px 16px 20px;
  }

  .hero .brand {
    gap: 12.739px;
  }

  .hero .brand-icon {
    width: 35.61px;
    height: 42.462px;
  }

  .hero .brand-name {
    font-size: 22.293px;
  }

  .hero-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .hero .role-title {
    font-size: 24px;
  }

  .hero .role-meta {
    font-size: 14px;
  }

  .tile--intro {
    display: none;
  }

  .wall {
    padding: 40px 12px 60px;
  }

  .wall:not(.is-ready) {
    column-count: 2;
    column-gap: 12px;
  }

  .wall:not(.is-ready) .tile {
    margin-bottom: 16px;
  }

  .wall.is-ready {
    gap: 12px;
  }

  .wall-col {
    gap: 16px;
  }

  .tile-caption {
    gap: 4px;
  }

  .tile-title {
    font-size: 16px;
  }

  .tile-meta {
    font-size: 14px;
  }

  /* Mobile overrides fall back to the desktop value when not set */
  .tile-media {
    aspect-ratio: var(--m-ar, var(--ar));
  }

  .tile-media img {
    left: var(--m-l, var(--l, 0));
    top: var(--m-t, var(--t, 0));
    width: var(--m-w, var(--w, 100%));
    height: var(--m-h, var(--h, 100%));
  }

  .tile-inset {
    aspect-ratio: var(--m-ia, var(--ia));
  }
}
