:root{
  --pad: 32px;             /* margem da página */
  --gut: 8px;              /* goteira entre mídias e entre linhas */
  --top: 6vh;              /* respiro abaixo do nav, onde a página começa */
  --bg:   #EFEBE4;
  --ink:  #1C1A17;
  --soft: #5E594F;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

*{ box-sizing: border-box; }

html{ background: var(--bg); }

body{
  margin: 0;
  padding: var(--pad);
  background: var(--bg);
  color: var(--soft);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- nav ---------- */

nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 2fr;
  padding: var(--pad);
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
}
nav .right{
  display: flex;
  justify-content: space-between;
}
nav a{
  color: var(--soft);
  text-decoration: none;
}
nav a:hover,
nav a[aria-current]{ color: var(--ink); }

/* ---------- página de case ---------- */

.page{
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: auto 1fr;
  row-gap: var(--gut);
  padding-top: var(--top);
}
.page.solo{ grid-template-rows: auto; }

.rail       { grid-column: 1; grid-row: 1 / span 2; }
.media-lead { grid-column: 2; grid-row: 1; }
.media      { grid-column: 2; grid-row: 2; }

.page.solo .rail{ grid-row: 1; }

/* ---------- coluna de texto ---------- */

.rail{
  position: sticky;
  top: var(--top);
  height: calc(100vh - var(--top) - var(--pad));
  overflow-y: auto;
  scrollbar-width: none;
  padding-right: var(--gut);
}
.rail::-webkit-scrollbar{ display: none; }

.rail h1{
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 3.6vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.meta{
  margin: .7em 0 0;
  max-width: 32ch;
}

.body{ margin-top: 12vh; }

.body p{
  margin: 0 0 1em;
  max-width: 32ch;
}
.body p:last-child{ margin-bottom: 0; }

.credits{
  margin-top: 2.5em;
  max-width: 32ch;
}
.credits dt{
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .5em;
}
.credits dd{
  margin: 0;
}

/* ---------- linhas de mídia ---------- */

.media, .media-lead{
  display: flex;
  flex-direction: column;
  gap: var(--gut);
}

.row{
  display: flex;
  gap: var(--gut);
}

.row figure{
  flex: var(--ar) 1 0;   /* grow proporcional ao aspecto, basis 0 */
  margin: 0;
  min-width: 0;
  position: relative;
}

.row img,
.row video{
  display: block;
  width: 100%;
  height: auto;
}

.row video{
  aspect-ratio: var(--ar);
  background: var(--ink);
}

/* ---------- botão de som ---------- */

.sound{
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 26, 23, .62);
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.sound:hover{ background: rgba(28, 26, 23, .85); }

/* ---------- mobile ---------- */

@media (max-width: 900px){
  :root{ --pad: 18px; }

  nav{ grid-template-columns: repeat(3, 1fr); }
  nav .right{ display: contents; }
  nav .right a:last-child{ text-align: right; }

  .page{
    display: flex;
    flex-direction: column;
    gap: var(--gut);
    padding-top: 3.5rem;
  }

  .rail{
    position: static;
    height: auto;
    overflow: visible;
    padding-right: 0;
    margin: 4.5rem 0 5rem;   /* respiro fixo: em rem, pra não estourar em tela alta */
  }

  .body{ margin-top: 2.25rem; }

  .meta, .body p, .credits{ max-width: 46ch; }
}
