:root {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #272727;
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 35px; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

header, main, footer { max-width: 1120px; margin: auto; }
header {
  padding: 46px 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d9d9d9;
}
.brand { font-size: 25px; font-weight: 700; line-height: 1.12; letter-spacing: .01em; }
.brand span { font-weight: 400; }
.brand .brand-first { color: #cf4650; font-weight: 700; }
.brand .brand-last { color: #2c070d; font-weight: 400; }
.brand .brand-first, .brand .brand-last { transition: color 450ms ease; }

nav { display: flex; gap: 30px; font-size: 14px; }
nav button {
  border: 0;
  border-left: 1px solid #d9d9d9;
  background: none;
  padding: 0 0 0 22px;
  font-size: 14px;
  letter-spacing: .04em;
}
a:hover { text-decoration: underline; text-underline-offset: 5px; }
:focus-visible { outline: 2px solid #222; outline-offset: 6px; }

#selection {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 32px;
  row-gap: 100px;
  padding: 36px 0 110px;
}
.piece {
  border: 0;
  padding: 0;
  background: none;
  display: block;
  width: 100%;
  align-self: center;
  position: relative;
}
.piece img { display: block; width: 100%; height: auto; }
.piece:nth-child(1) { grid-column: 1 / 8; }
.piece:nth-child(2) { grid-column: 9 / 13; }
.piece:nth-child(3) { grid-column: 2 / 6; }
.piece:nth-child(4) { grid-column: 7 / 13; }
.piece:nth-child(5) { grid-column: 2 / 12; }
.piece:nth-child(6) { grid-column: 1 / 7; }
.piece:nth-child(7) { grid-column: 9 / 13; }
.piece:nth-child(8) { grid-column: 2 / 6; }
.piece:nth-child(9) { grid-column: 7 / 13; }

.piece::after {
  content: var(--view-label);
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: #fff;
  padding: 9px 12px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 180ms ease;
}
.piece:hover::after, .piece:focus-visible::after, .piece.is-negative::after { opacity: 1; }
.piece .cover-negative {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: url(#wine-negative);
  opacity: 0;
  transition: opacity 450ms ease;
  pointer-events: none;
}
.piece:focus-visible .cover-negative, .piece.is-negative .cover-negative { opacity: 1; }
body:has(.piece:focus-visible) .brand .brand-first,
body:has(.piece:focus-visible) .brand .brand-last,
body:has(.piece.is-negative) .brand .brand-first,
body:has(.piece.is-negative) .brand .brand-last { color: #111; }

#about, #sobre {
  border-top: 1px solid #d9d9d9;
  padding: 65px 0 90px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 70px;
}
.about-title { align-self: start; }
.eyebrow { display: block; margin-bottom: 22px; color: #777; font-size: 14px; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 500; margin: 0; }
.bio { font-size: 16px; line-height: 1.65; }
.bio p { margin: 0 0 20px; }
.bio .lead { font-size: 20px; line-height: 1.5; color: #2c070d; }
.bio .closing { margin-top: 38px; font-size: 20px; line-height: 1.5; color: #cf4650; }

footer {
  border-top: 1px solid #ddd;
  padding: 30px 0 50px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #555;
}

dialog {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 24px;
  background: #fafafa;
  color: #272727;
}
dialog::backdrop { background: #fafafa; }
.tools { display: flex; justify-content: space-between; height: 40px; font-size: 14px; }
.tools button, .stage button { background: none; border: 0; padding: 10px; }
.stage {
  height: calc(100dvh - 170px);
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  align-items: center;
  gap: 16px;
}
.stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: auto;
  min-height: 0;
  object-fit: contain;
}
.stage button { font-size: 14px; }
#thumbs { display: flex; justify-content: center; gap: 10px; height: 70px; padding-top: 12px; }
#thumbs button { padding: 0; background: none; border: 0; opacity: .45; }
#thumbs button.active { opacity: 1; outline: 1px solid #333; outline-offset: 3px; }
#thumbs img { height: 50px; width: auto; display: block; }

@media (hover: hover) {
  .piece:hover .cover-negative { opacity: 1; }
  body:has(.piece:hover) .brand .brand-first,
  body:has(.piece:hover) .brand .brand-last { color: #111; }
}

@media (hover: none), (pointer: coarse) {
  .piece { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 1200px) {
  header, main, footer { margin-left: 40px; margin-right: 40px; }
}

@media (max-width: 650px) {
  header, main, footer { margin-left: 20px; margin-right: 20px; }
  header {
    padding: 24px 0 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .brand {
    display: block;
    min-width: 0;
    font-size: clamp(21px, 6.6vw, 27px);
    line-height: 1.04;
  }
  .brand .brand-last { display: block; font-size: .79em; letter-spacing: .015em; }
  nav {
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    font-size: 16px;
    white-space: nowrap;
  }
  nav button { margin-left: auto; padding-left: 16px; }
  #selection {
    column-gap: 10px;
    row-gap: 32px;
    padding-top: 24px;
    padding-bottom: 72px;
  }
  .piece:nth-child(1) { grid-column: 1 / 13; }
  .piece:nth-child(2) { grid-column: 1 / 10; }
  .piece:nth-child(3) { grid-column: 3 / 13; }
  .piece:nth-child(4) { grid-column: 1 / 13; }
  .piece:nth-child(5) { grid-column: 2 / 12; }
  .piece:nth-child(6) { grid-column: 1 / 9; }
  .piece:nth-child(7) { grid-column: 4 / 13; }
  .piece:nth-child(8) { grid-column: 1 / 13; }
  .piece:nth-child(9) { grid-column: 2 / 13; }
  .piece::after { left: 10px; bottom: 10px; }
  #about, #sobre { grid-template-columns: 1fr; gap: 24px; padding: 40px 0; }
  h1 { font-size: 26px; }
  footer { gap: 20px; font-size: 13px; }
  .stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 40px;
    gap: 8px;
    height: calc(100dvh - 160px);
  }
  .stage img { grid-row: 1; grid-column: 1 / 3; max-height: 100%; min-height: 0; }
  .stage button { grid-row: 2; }
  .stage #prev { grid-column: 1; }
  .stage #next { grid-column: 2; }
  dialog { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
