/* Build page: extends main.css and watch.css */

.build-section {
  max-width: 1000px;
  margin: 0 auto 6rem;
  padding: 0 1.125rem;
  scroll-margin-top: 6rem;
}

.build-section h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e5e5;
}

/* Specification tables */
.spec {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.spec-row {
  padding: 0.7rem 0;
  border-bottom: 1px solid #ececec;
}

.spec-row:first-child {
  border-top: 1px solid #ececec;
}

.spec dt {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.2rem;
}

.spec dd {
  margin: 0;
  color: #1a1a1a;
}

.spec dd a {
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

/* Table beside the reasons */
.build-cols {
  display: grid;
  gap: 2.5rem;
}

.build-why p {
  font-size: 1.125rem;
  line-height: 1.7;
  color: #333;
  margin: 0 0 1.25rem;
}

.build-watch {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem !important;
  letter-spacing: 0.04em;
}

.build-watch a {
  color: #666;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 3px;
}

.build-watch a:hover {
  color: #1a1a1a;
}

.build-lead {
  margin: 0 0 2.5rem;
}

.build-lead img {
  display: block;
  width: 100%;
  height: auto;
}

.build-lead figcaption,
.build-wall-drawing figcaption {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #888;
  margin-top: 0.6rem;
}

.build-lead figcaption a {
  text-decoration: underline;
  text-decoration-color: #ccc;
}

.build-strip {
  margin-top: 2.5rem;
}

.build-strip .gallery-item img {
  aspect-ratio: 1 / 1;
}

/* a low-resolution lead is held near its own size */
.build-lead--small {
  max-width: 800px;
}

/* Materials up close */
.build-upclose {
  max-width: 1200px;
  margin: 0 auto 6rem;
  padding: 0 1.125rem;
}

/* Section tiles: each photograph links to its section; the menu word shows on hover or focus,
   and always on screens without hover. */
.build-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.build-tile {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #1a1a1a;
}

.build-tile--wall {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}

.build-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, opacity 0.3s ease;
}

.build-tile-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0.75rem 0.875rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 45%);
  transition: opacity 0.3s ease, background 0.3s ease;
}

.build-tile:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}

@media (hover: hover) {
  .build-tile-label {
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
  }

  .build-tile:hover .build-tile-label,
  .build-tile:focus-visible .build-tile-label {
    opacity: 1;
  }

  .build-tile:hover img {
    transform: scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .build-tile img,
  .build-tile-label {
    transition: none;
  }
}

/* The wall */
.build-wall {
  max-width: none;
  padding-top: 4rem;
  padding-bottom: 4rem;
  background: #f4f2ee;
}

.build-wall > * {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.build-wall-cols {
  display: grid;
  gap: 2.5rem;
}

.build-wall-drawing {
  display: block;
  margin: 0;
}

.build-wall-drawing .gallery-item {
  background: #fff;
}

.build-wall-drawing .gallery-item img {
  aspect-ratio: auto;
  object-fit: contain;
}

.build-wall-layers p {
  font-size: 1.125rem;
  line-height: 1.7;
  color: #333;
  margin: 0 0 1.5rem;
}

.build-wall-layers ol {
  list-style: none;
  counter-reset: layer;
  margin: 0 0 1.75rem;
  padding: 0;
}

.build-wall-layers li {
  counter-increment: layer;
  position: relative;
  padding: 0.85rem 0 0.85rem 2.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
}

.build-wall-layers li:last-child {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.build-wall-layers li::before {
  content: counter(layer);
  position: absolute;
  left: 0;
  top: 0.8rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid #1a1a1a;
  border-radius: 50%;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  line-height: 1.7rem;
  text-align: center;
  color: #1a1a1a;
}

.build-wall-layers strong {
  font-weight: 600;
  color: #1a1a1a;
}

/* Drawings */
.build-drawings {
  grid-template-columns: repeat(2, 1fr);
}

.build-drawings .gallery-item {
  background: #fff;
  border: 1px solid #ececec;
}

.build-drawings .gallery-item img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.build-note {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #888;
  margin-top: 2.5rem;
}

/* Drawings open on white, photographs on black */
.build-page .lightbox img {
  background: #fff;
}

@media (min-width: 768px) {
  .build-section,
  .build-upclose {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .build-cols {
    grid-template-columns: 5fr 7fr;
    gap: 4rem;
  }

  .build-cols--even,
  .spec--wide {
    grid-template-columns: 1fr 1fr;
  }

  .spec--wide {
    display: grid;
    column-gap: 4rem;
  }

  .spec--wide .spec-row:nth-child(2) {
    border-top: 1px solid #ececec;
  }

  .build-wall-cols {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
  }

  .build-wall-drawing {
    position: sticky;
    top: 7rem;
  }

  .build-tiles {
    grid-template-columns: repeat(4, 1fr);
  }

  /* beside square tiles the wide tile takes the row's height */
  .build-tile--wall {
    aspect-ratio: auto;
  }

  .build-tile--wall img {
    position: absolute;
    inset: 0;
  }

  .build-drawings {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .build-tiles {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Video card: links a section to its episode on the Watch page */
.build-video {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.75rem;
  padding: 0.625rem;
  border: 1px solid #e4e1db;
  border-radius: 4px;
  background: #faf9f7;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.build-video:hover,
.build-video:focus-visible {
  border-color: #1a1a1a;
  background: #fff;
}

.build-video-thumb {
  position: relative;
  flex: 0 0 42%;
  max-width: 220px;
  overflow: hidden;
  border-radius: 2px;
  background: #1a1a1a;
}

.build-video-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.2s ease;
}

.build-video:hover .build-video-thumb img {
  transform: scale(1.04);
  opacity: 0.9;
}

.build-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.build-video-play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -5px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
}

.build-video:hover .build-video-play {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.06);
}

.build-video-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  font-family: 'Inter', sans-serif;
}

.build-video-kicker {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a8478;
}

.build-video-title {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #6b6b6b;
}

.build-video-by {
  font-size: 0.6875rem;
  color: #999;
}

@media (prefers-reduced-motion: reduce) {
  .build-video-thumb img {
    transition: none;
  }
}

/* Every section: one lead photograph, then a row of four */
.build-strip {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .build-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Video modal: plays an episode without leaving the page */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem 1.5rem;
  background: rgba(12, 12, 12, 0.92);
}

.video-modal[hidden] {
  display: none;
}

.video-modal-inner {
  position: relative;
  /* as wide as fits while the 16:9 player stays inside the viewport */
  width: min(1100px, 100%, calc((100vh - 9rem) * 16 / 9));
}

.video-modal-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-close {
  position: absolute;
  top: -3rem;
  right: -0.25rem;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}

.video-modal-close:hover,
.video-modal-close:focus-visible {
  opacity: 1;
}

.video-modal-caption {
  margin: 0.75rem 0 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #b5b5b5;
}

.video-modal-caption a {
  color: #e6e6e6;
  text-decoration: underline;
  text-decoration-color: #777;
  text-underline-offset: 2px;
}

body.video-modal-open {
  overflow: hidden;
}

/* Link from a section's film to the Watch page */
.build-why p.build-more {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #666;
  margin-top: 0.75rem;
}

.build-why p.build-more a {
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}
