/* Editorial layout for inner pages (About first) */
body.editorial {
  --ed-font: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --ed-pad: clamp(1rem, 1.6vw, 1.5rem);
  font-family: var(--ed-font);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.ed-header {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--ed-pad);
  align-items: start;
  padding: var(--ed-pad);
  font-size: var(--fs-xs);
  line-height: 1.35;
  text-transform: uppercase;
}

.ed-header a {
  display: inline-block;
  text-decoration: none;
}

.ed-header a {
  transition: color 0.2s ease;
}

.ed-header a:hover,
.ed-header a:focus-visible {
  color: var(--accent);
}

.ed-header a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

.ed-header__name {
  grid-column: 1 / span 4;
}

.ed-header__nav {
  grid-column: 7 / span 3;
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(0.9rem, 1.4vw, 2rem);
  white-space: nowrap;
}


@media (max-width: 999px) {
  .ed-header__name {
    grid-column: 1 / span 6;
  }

  .ed-header__side {
    grid-column: 7 / span 6;
    justify-self: end;
    text-align: right;
  }

  .ed-header__nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 1.25rem;
    margin-top: 1.25rem;
  }
}

.ed-main {
  padding: 0 var(--ed-pad);
}

.ed-statement {
  max-width: 16ch;
  margin: clamp(1.5rem, 5vh, 3.5rem) 0 clamp(1.5rem, 5vh, 3.5rem);
  font-size: var(--fs-display);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.ed-split {
  display: block;
}

.ed-stage {
  display: none;
}

.ed-section {
  margin-bottom: clamp(3rem, 10vw, 6rem);
}

.ed-inline {
  margin: 0 0 2rem;
}

/* Short descriptor under the artwork (phones: under the headline) */
.ed-tagline {
  margin-top: 1.25rem;
  max-width: 34rem;
}

.ed-tagline--mobile {
  margin: 1.5rem 0 2rem;
}

.ed-tagline__lead {
  margin: 0 0 0.75rem;
  font-size: var(--fs-m);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.ed-tagline__meta {
  margin: 0.2rem 0 0;
  font-size: var(--fs-xs);
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--muted);
}

/* A fixed image that sits inside the text and scrolls with it */
.ed-static {
  margin: clamp(1.5rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 3.5rem);
}

.ed-mat {
  padding: 7%;
  background: var(--mat);
  box-shadow: 0 0 0 1px var(--mat-edge), var(--rest-shadow);
}

.ed-mat img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
}

.ed-caption {
  margin: 0.5rem 0 0;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--muted);
}

.ed-label {
  margin: 0 0 clamp(1.5rem, 3vw, 2.75rem);
  font-size: var(--fs-m);
  font-weight: 400;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.ed-section p {
  margin: 0 0 1.4em;
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

/* Header: Lisbon time, right-aligned with the same margin as the name on the left */
.ed-header__side {
  grid-column: 10 / span 3;
  justify-self: end;
  text-align: right;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 1rem;
}

.ed-header__time {
  margin: 0;
}

.ed-footer {
  display: flex;
  justify-content: space-between;
  padding: var(--ed-pad);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--muted);
}


@media (min-width: 768px) {
  .ed-split {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--ed-pad);
    align-items: start;
    /* Guarantees every image a comfortable stretch of scrolling */
    min-height: 125vh;
  }

  .ed-stage {
    position: sticky;
    /* art-about.js sets this so the whole block sits in the vertical middle of the screen */
    top: var(--stage-top, 2rem);
    transition: top 1s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    grid-column: 1 / span 5;
    justify-content: flex-start;
    /* Zero height: the artwork overflows its box, so changing image proportions
       never changes the page height (which would shift the scroll progress) */
    height: 0;
    overflow: visible;
  }

  /* Width is set by art-about.js so the full artwork always fits the viewport */
  .ed-stage .ed-mat {
    width: 68%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .ed-stage .ed-frame {
    position: relative;
    aspect-ratio: var(--ar, 2 / 3);
    transition: aspect-ratio 1s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .ed-stage .ed-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    opacity: 1;
    transition: opacity 0.9s ease;
  }

  .ed-stage .ed-frame img.is-entering {
    opacity: 0;
  }

  .ed-stage .ed-caption {
    transition: opacity 0.3s ease;
  }

  .ed-stage .ed-caption.is-fading {
    opacity: 0;
  }

  .ed-sections {
    grid-column: 7 / span 6;
  }

  .ed-section {
    min-height: 30vh;
    margin-bottom: 0;
    padding-top: 0;
  }

  .ed-section + .ed-section {
    padding-top: 2rem;
  }

  .ed-section:last-child {
    min-height: 0;
  }

  .ed-statement {
    max-width: 30ch;
    font-size: max(2.4rem, min(var(--fs-display), 8.5vh));
  }

  .ed-inline {
    display: none;
  }

  .ed-tagline--mobile {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ed-stage,
  .ed-stage .ed-mat,
  .ed-stage .ed-frame,
  .ed-stage .ed-frame img,
  .ed-stage .ed-caption {
    transition: none;
  }
}

/* Contact page */
.ct-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

.ct-body {
  order: -1;
}

.ct-figure {
  margin: 0;
}

.ct-intro {
  margin: 0 0 clamp(1.5rem, 4vw, 3rem);
  font-size: var(--fs-lead);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.ct-list {
  margin: 0;
}

.ct-row {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) 3fr;
  gap: 1rem;
  align-items: baseline;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}

.ct-row:last-child {
  border-bottom: 1px solid var(--line);
}

.ct-row dt {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--muted);
}

.ct-row dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin: 0;
  font-size: var(--fs-lead);
  line-height: 1.15;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.ct-link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ct-link:hover,
.ct-link:focus-visible {
  color: var(--accent);
  background-size: 100% 1px;
}

.ct-link--out::after {
  content: " \2197";
  font-size: 0.7em;
  color: var(--muted);
}

.ct-copy {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-xs);
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ct-copy:hover,
.ct-copy:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

@media (min-width: 768px) {
  .ct-split {
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--ed-pad);
    align-items: start;
  }

  .ct-body {
    order: 0;
    grid-column: 7 / span 6;
  }

  .ct-figure {
    grid-column: 1 / span 5;
  }

  /* The whole artwork always fits the screen */
  .ct-figure .ed-mat {
    width: min(100%, calc((100vh - 15rem) * var(--ratio, 0.75)));
  }

  .ct-figure .ed-mat img {
    max-height: none;
  }
}

/* Contact: a slightly broken grid. The artwork sits off the grid and tilts,
   the headline touches its mat, and the rows step across like a staircase */
.ct-title {
  order: 0;
  margin: 0;
  position: relative;
  z-index: 2;
}

.ct-body {
  order: 1;
}

.ct-figure {
  order: 2;
  transform: rotate(-1.2deg);
  transform-origin: 20% 80%;
}

.ct-row:nth-child(2) {
  margin-left: 8%;
}

.ct-row:nth-child(3) {
  margin-left: 16%;
}

@media (min-width: 768px) {
  .ct-split {
    grid-template-rows: auto auto;
    row-gap: 0;
  }

  .ct-title {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-top: clamp(1.5rem, 5vh, 3.5rem);
  }

  /* Below the headline with a clear gap; the tilt lifts the top corner a little */
  .ct-figure {
    order: 0;
    grid-column: 1 / span 5;
    grid-row: 2;
    margin-top: clamp(2rem, 6vh, 4rem);
  }

  .ct-figure .ed-mat {
    width: min(100%, calc((100vh - 20rem) * var(--ratio, 0.75)));
  }

  .ct-body {
    order: 0;
    grid-column: 8 / -1;
    grid-row: 2;
    align-self: start;
    margin-top: clamp(2rem, 6vh, 4rem);
  }

  .ct-row:nth-child(2) {
    margin-left: 14%;
  }

  .ct-row:nth-child(3) {
    margin-left: 28%;
  }
}

/* Phones: label above the value so long values never break mid-word */
@media (max-width: 767px) {
  .ct-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .ct-row dd {
    overflow-wrap: normal;
  }

  .ct-row:nth-child(2) {
    margin-left: 6%;
  }

  .ct-row:nth-child(3) {
    margin-left: 12%;
  }
}

/* About: measured broken-grid touches. Small tilts, small offsets, never an overlap */
.ed-inline .ed-mat {
  transform: rotate(-0.8deg);
}

.ed-section p:nth-of-type(even) {
  margin-left: clamp(0px, 4vw, 4rem);
}

.ed-static {
  margin-left: clamp(0px, 3.5vw, 3.5rem);
  margin-right: 0.5rem;
}

.ed-static .ed-mat {
  transform: rotate(0.7deg);
}

@media (min-width: 768px) {
  .ed-stage .ed-mat {
    transform: rotate(-1deg);
    transform-origin: 20% 80%;
  }
}

/* Tablets and landscape phones: give the Contact column more room and stack label over value */
@media (min-width: 768px) and (max-width: 1279px) {
  .ct-body {
    grid-column: 7 / -1;
  }

  .ct-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .ct-row dd {
    overflow-wrap: normal;
  }

  .ct-link {
    white-space: nowrap;
    font-size: min(var(--fs-lead), 3vw);
  }
}

/* Touch screens: larger tap targets without moving anything */
@media (pointer: coarse) {
  .ed-header__nav a,
  .ed-header__name {
    padding: 0.7rem 0;
    margin: -0.7rem 0;
  }

  .ct-copy {
    min-height: 2.75rem;
    padding-inline: 1rem;
  }

  .pr-back a {
    display: inline-block;
    padding: 0.7rem 0;
    margin: -0.7rem 0;
  }
}
