/* Sobre nosotros: collage del equipo y vista de detalle (js/pages/nosotros.js). Loaded after css/base/pages.css. */

.team-page {
  --paper-bg: #fff;
  --accent: #1E7A5D;
  --ink: #171717;
  --font-title: 'Archivo', 'Arial Narrow', Arial, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-hand: 'Caveat', 'Segoe Print', cursive;
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

html.team-page,
.team-page body,
.team-page .page {
  color: var(--ink);
  background: var(--paper-bg);
}

html.team-page {
  scrollbar-gutter: stable;
}

html.team-open {
  overflow: hidden;
}

/* Site header on the light page. */
.team-page .brand {
  color: var(--ink);
}

.team-page .brand-mark {
  color: #fff;
  background: var(--ink);
}

.team-page .topbar nav {
  background: #ffffffd9;
  border-color: #e6e6e0;
}

.team-page .topbar nav a:hover {
  color: var(--ink);
  background: #eeeee9;
}

.team-page .topbar nav a[aria-current=page] {
  color: #fff;
  background: var(--ink);
}

.team-page .menu {
  color: var(--ink);
  background: #eeeee9;
}

.team-page .socials a {
  color: var(--ink);
  background: #0000000f;
}

.team-page a:focus-visible,
.team-page button:focus-visible {
  outline-color: var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Section frame ---------- */

.team {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  grid-template-areas:
    'bar bar'
    'intro collage'
    'foot foot';
  column-gap: 4vw;
  row-gap: 40px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.team-bar,
.team-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.team-bar {
  grid-area: bar;
}

.team-foot {
  grid-area: foot;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
}

.team-counter {
  font-size: 1.15rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.team-logo {
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -.01em;
}

.team-logo strong {
  font-weight: 800;
}

.team-arrow,
.team-close,
.team-back {
  border: 0;
  background: none;
  color: inherit;
}

.team-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  transition: background .2s;
}

.team-arrow:hover,
.team-close:hover {
  background: #0000000d;
}

.team-intro {
  grid-area: intro;
  align-self: center;
}

.team-title {
  margin: 0 0 36px;
  color: var(--accent);
  line-height: .9;
  letter-spacing: 0;
}

.team-title-serif,
.team-title-sans {
  display: block;
}

.team-title-serif {
  font-family: var(--font-serif);
  font-size: clamp(3.6rem, 7.2vw, 7rem);
  font-style: italic;
  font-weight: 400;
}

.team-title-sans {
  font-family: var(--font-title);
  font-size: clamp(4.2rem, 8.6vw, 7.5rem);
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: -.02em;
}

.team-lead {
  max-width: 30ch;
  margin: 0;
  font-size: clamp(1.15rem, 1.6vw, 1.375rem);
  line-height: 1.35;
}

/* ---------- Polaroid ---------- */

.polaroid {
  --rot: 0deg;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  transform: rotate(var(--rot));
}

.paper {
  position: relative;
  display: block;
  padding: 11px;
  background: var(--paper-grain), #f3f1ea;
  box-shadow:
    0 1px 1px #0000000f,
    0 4px 8px #00000012,
    0 16px 30px -8px #0000002e;
  transition: box-shadow .35s ease;
}

.photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #deddd8;
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1);
}

/* Halftone screen over the print. */
.photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, #000 .55px, transparent 1.15px) 0 0 / 3px 3px;
  mix-blend-mode: multiply;
  opacity: .16;
  pointer-events: none;
}

/* Photos marked `color: true` in data/equipo.js keep their original colors. */
.photo--color img {
  filter: none;
}

.photo--color::after {
  display: none;
}

.paper-num {
  position: absolute;
  top: 15px;
  left: 16px;
  z-index: 1;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .04em;
}

/* ---------- Collage ---------- */

.team-collage {
  position: relative;
  grid-area: collage;
  aspect-ratio: 1 / 1.08;
}

.team-collage .polaroid {
  position: absolute;
  top: var(--y);
  left: var(--x);
  z-index: var(--z, 1);
  width: 31%;
  cursor: pointer;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

.team-collage .polaroid:hover,
.team-collage .polaroid:focus-visible {
  z-index: 20;
  transform: translateY(-6px) scale(1.04) rotate(0deg);
}

.team-collage .polaroid:hover .paper,
.team-collage .polaroid:focus-visible .paper {
  box-shadow:
    0 2px 2px #0000000f,
    0 12px 20px #00000014,
    0 34px 56px -12px #00000040;
}

.team-collage .polaroid.is-away {
  visibility: hidden;
}

/* ---------- Doodles ---------- */

.doodle {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.doodle path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.team-collage .doodle {
  z-index: 7;
}

.team-collage .doodle path {
  animation: draw 1.1s cubic-bezier(.6, 0, .3, 1) both;
  animation-delay: var(--delay, .4s);
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

/* ---------- Detail dialog ---------- */

.team-detail {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(20px, 3vw, 40px) clamp(20px, 5vw, 72px);
  border: 0;
  overflow: hidden auto;
  color: var(--ink);
  background: transparent;
}

.team-detail[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 24px;
}

/* The collage's named grid areas do not exist inside the dialog. */
.team-detail .team-bar,
.team-detail .team-foot {
  grid-area: auto;
}

.team-detail::backdrop {
  background: transparent;
}

.team-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--paper-bg);
}

.team-detail-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.team-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  color: #555;
}

.team-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  column-gap: 4vw;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.team-name {
  margin: 0 0 22px;
  color: var(--accent);
  font-family: var(--font-title);
  font-size: clamp(3.4rem, 6.6vw, 6rem);
  font-weight: 800;
  font-stretch: 85%;
  line-height: .9;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.team-name span {
  display: block;
}

.team-role {
  margin: 0 0 22px;
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2vw, 1.6rem);
  font-style: italic;
}

.team-desc {
  max-width: 45ch;
  margin: 0;
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  line-height: 1.4;
}

.team-detail-stage {
  position: relative;
  justify-self: center;
  width: min(400px, 30vw);
  margin: 48px 0 24px;
}

.team-detail-stage .polaroid {
  position: relative;
  z-index: 1;
}

.team-detail-foot {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.team-back {
  padding: 10px 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: .06em;
}

.team-back:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.team-arrows {
  display: flex;
  gap: 6px;
}

/* ---------- Handwritten notes ---------- */

.note {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: clamp(1.6rem, 2.3vw, 2.1rem);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(var(--tilt, -4deg));
  pointer-events: none;
}

.note-text {
  position: relative;
  display: inline-block;
  padding: 4px 6px;
}

.note .oval {
  position: absolute;
  inset: -14px -18px;
  width: calc(100% + 36px);
  height: calc(100% + 28px);
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.note .doodle {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  stroke: currentColor;
  stroke-width: 6.5;
}

.note--arriba {
  bottom: 100%;
  left: 14%;
  margin-bottom: 8px;
  --tilt: -6deg;
}

.note--derecha {
  top: 36%;
  left: calc(100% + 18px);
  --tilt: 5deg;
}

.note--izquierda {
  top: 48%;
  right: calc(100% + 18px);
  flex-direction: row-reverse;
  --tilt: -5deg;
}

.note--sobre-foto {
  bottom: 9%;
  left: 12%;
  color: #fff;
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
  /* Keeps the marker legible over light clothes in color photos. */
  text-shadow: 0 1px 2px #0000008c, 0 0 14px #00000059;
  --tilt: -3deg;
}

/* ---------- Fit the whole section in the first screen (desktop) ---------- */

@media (min-width: 701px) {
  .team-page .page {
    padding-top: 96px;
    padding-bottom: 16px;
  }

  .team {
    grid-template-rows: auto 1fr auto;
    row-gap: 10px;
    min-height: calc(100svh - 112px);
  }

  .team-collage {
    align-self: center;
    justify-self: center;
    /* As wide as the column allows, but never taller than the space left on screen. */
    width: min(100%, calc((100svh - 212px) / 1.08));
  }

  .team-title {
    margin-bottom: min(36px, 4svh);
  }

  .team-title-serif {
    font-size: clamp(3.2rem, min(7.2vw, 13svh), 7rem);
  }

  .team-title-sans {
    font-size: clamp(3.6rem, min(8.6vw, 15svh), 7.5rem);
  }

  .team-lead {
    font-size: clamp(1.05rem, min(1.6vw, 2.9svh), 1.375rem);
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 1050px) {
  .team-detail-stage {
    width: min(360px, 34vw);
  }
}

@media (max-width: 700px) {
  .team {
    grid-template-columns: 1fr;
    grid-template-areas:
      'bar'
      'intro'
      'collage'
      'foot';
    row-gap: 28px;
  }

  .team-title {
    margin-bottom: 20px;
  }

  .team-collage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px 18px;
    aspect-ratio: auto;
    padding: 6px 4px 12px;
  }

  .team-collage .polaroid {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
  }

  /* Slight overlap, like prints dropped in two piles. */
  .team-collage .polaroid:nth-of-type(even) {
    margin-top: 26px;
    margin-left: -10px;
  }

  .team-collage .doodle {
    display: none;
  }

  .team-detail {
    padding: 18px 20px 20px;
  }

  .team-detail-body {
    grid-template-columns: 1fr;
    align-content: start;
    row-gap: 8px;
  }

  .team-detail-stage {
    order: -1;
    width: min(64vw, 300px);
    margin: 56px 0 36px;
  }

  .team-name {
    margin-bottom: 14px;
    font-size: clamp(2.4rem, 10vw, 3.4rem);
    overflow-wrap: anywhere;
  }

  .team-close,
  .team-arrow {
    min-width: 44px;
    min-height: 44px;
  }

  .team-role {
    margin-bottom: 12px;
  }

  .note {
    font-size: 1.45rem;
  }

  .note--sobre-foto {
    font-size: 1.6rem;
  }

  /* No room beside the photo: lean the side notes on its edges, on a scrap of paper. */
  .note--derecha {
    left: auto;
    right: -10%;
  }

  .note--izquierda {
    right: auto;
    left: -10%;
  }

  .note--derecha .note-text,
  .note--izquierda .note-text {
    background: #ffffffe6;
  }

  .note .doodle {
    width: 26px;
    height: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-collage .polaroid,
  .paper,
  .team-arrow {
    transition: none;
  }

  .team-collage .polaroid:hover,
  .team-collage .polaroid:focus-visible {
    transform: rotate(var(--rot));
  }

  .team-collage .doodle path {
    animation: none;
  }
}
