/* ============================================================
   demetriopeña.com — hoja de estilos
   Layout: a single quiet column. A full-bleed photographic opener,
   then a 38rem reading measure for the words, a wide collage for the
   photographs, and the wall. Black on warm white; inverts in dark mode.
   The only decoration is the hairline rule and the esquela frame.
   ============================================================ */

:root {
  /* Color — black and white, chosen on purpose */
  --bg: #fbfbf9;
  --fg: #121212;
  --muted: #6b6b67;
  --rule: rgba(18, 18, 18, 0.16);
  --rule-strong: #121212;
  --mark: rgba(18, 18, 18, 0.08);
  --hero-bg: #0b0b0b;
  --hero-fg: #f4f4f1;
  --hero-muted: rgba(244, 244, 241, 0.72);
  --lb-bg: rgba(8, 8, 8, 0.96);
  --lb-fg: #f4f4f1;

  /* Type */
  --font-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-body: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  --size-body: 1.2rem;
  --leading-body: 1.65;
  --measure: 38rem;
  --wide: 76rem;

  /* Space */
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section: clamp(5rem, 12vh, 9rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --fg: #ececea;
    --muted: #9b9b97;
    --rule: rgba(236, 236, 234, 0.18);
    --rule-strong: #ececea;
    --mark: rgba(236, 236, 234, 0.12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --fg: #ececea;
  --muted: #9b9b97;
  --rule: rgba(236, 236, 234, 0.18);
  --rule-strong: #ececea;
  --mark: rgba(236, 236, 234, 0.12);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  font-feature-settings: "liga", "kern", "onum";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 1.5px solid currentColor; outline-offset: 4px; }
mark { background: var(--mark); color: inherit; padding: 0 .2em; border-radius: 2px; font-style: italic; }

/* small uppercase labels */
.eyebrow {
  margin-block: 0;
  font-family: var(--font-body);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow--light {
  font-size: clamp(.92rem, 1.5vw, 1.08rem);
  letter-spacing: .22em;
  padding-left: .22em; /* optical centering of tracked text */
  color: rgba(244, 244, 241, .9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .5);
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: calc(.9rem + env(safe-area-inset-top, 0px)) var(--gutter) .9rem;
  color: var(--hero-fg);
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.topbar--solid {
  background: var(--bg);
  color: var(--fg);
  border-bottom-color: var(--rule);
}
.topbar__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: .06em;
  text-decoration: none;
  white-space: nowrap;
}
.topbar__nav { display: flex; gap: 1.75rem; }
.topbar__nav a, .lang {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: .85;
}
.topbar__nav a:hover, .lang:hover { opacity: 1; text-decoration: underline; }
.lang { display: inline-flex; align-items: center; gap: .45em; padding: .25em 0; letter-spacing: .14em; }
.lang__sep { opacity: .5; }
.lang [data-lang-opt] { opacity: .55; }
.lang [data-lang-opt].is-active { opacity: 1; text-decoration: underline; text-underline-offset: .3em; }
@media (max-width: 720px) { .topbar__nav { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--hero-bg);
  color: var(--hero-fg);
  overflow: hidden;
  isolation: isolate;
}
.hero__slides { position: absolute; inset: 0; z-index: 0; }
/* the incoming slide fades in over the outgoing one, which stays opaque underneath — no dip to black */
.hero__slide {
  position: absolute; inset: 0;
  opacity: 0;
  will-change: opacity;
}
.hero__slide.is-under { opacity: 1; }
.hero__slide.is-leaving { opacity: 1; z-index: 1; }
.hero__slide.is-active { opacity: 1; z-index: 2; transition: opacity 2.6s cubic-bezier(.45, 0, .55, 1); }
.hero__media {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: grayscale(1) contrast(1.02);
  transform: scale(1);
  backface-visibility: hidden;
}
.hero__slide:is(.is-active, .is-leaving, .is-under) .hero__media--still { animation: breathe 11s linear forwards; }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.06); } }
/* portrait photos on wide screens: show the whole photo over a blurred copy so the name never covers the face */
@media (min-aspect-ratio: 1/1) {
  .hero__slide--portrait::before {
    content: "";
    position: absolute; inset: -8%;
    background: var(--src) center / cover;
    filter: grayscale(1) blur(36px) brightness(.4);
  }
  .hero__slide--portrait .hero__media { position: relative; object-fit: contain; }
}
.hero__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.42) 0%, rgba(0,0,0,0) 22%),
    linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 38%, rgba(0,0,0,0) 62%);
}
.hero__text {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(5.5rem, 16vh, 9rem);
  padding-inline: var(--gutter);
  text-align: center;
  display: grid;
  gap: .9rem;
  justify-items: center;
}
.hero__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(3rem, 9.5vw, 7.5rem);
  line-height: .95;
  letter-spacing: .01em;
  text-wrap: balance;
}
.hero__years {
  margin: .2rem 0 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.2rem, 2.3vw, 1.7rem);
  letter-spacing: .3em;
  padding-left: .3em; /* optical centering of tracked text */
  font-variant-numeric: lining-nums;
}
.hero__qepd {
  margin: 0;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  color: var(--hero-muted);
}
.hero__scroll {
  position: absolute;
  left: 50%; bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: grid; justify-items: center; gap: .35rem;
  font-size: .66rem; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase;
  white-space: nowrap;
  color: var(--hero-muted);
  text-decoration: none;
  transition: color .3s var(--ease);
}
.hero__scroll:hover { color: var(--hero-fg); }
.hero__scroll-arrow {
  width: 1.6rem; height: 1.6rem;
  fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round;
  animation: drift 2.4s ease-in-out infinite;
}
/* each arrow sits in a tall invisible edge zone; it fades in on hover there, or briefly while navigating */
.hero__arrow {
  position: absolute; top: 18%; bottom: 18%;
  width: clamp(4.5rem, 14vw, 11rem);
  display: flex; align-items: center;
  padding-inline: 1rem;
  font-family: var(--font-display); font-weight: 300; font-size: 3.6rem; line-height: 1;
  color: var(--hero-fg);
  opacity: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .45);
  transition: opacity .5s var(--ease);
}
.hero__arrow:hover, .hero__arrow:focus-visible, .hero__arrow.is-shown { opacity: .9; transition-duration: .2s; }
.hero__arrow--prev { left: env(safe-area-inset-left, 0px); justify-content: flex-start; }
.hero__arrow--next { right: env(safe-area-inset-right, 0px); justify-content: flex-end; }
@media (max-width: 720px) { .hero__arrow { font-size: 2.8rem; padding-inline: .6rem; } }
@keyframes drift { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(.5rem); opacity: .4; } }

/* ---------- sections ---------- */
.section {
  padding: var(--section) var(--gutter);
  border-top: 1px solid var(--rule);
}
.section--reading > * { max-width: var(--measure); margin-inline: auto; }
.section--reading > .eyebrow { text-align: center; }
.section--wide > * { max-width: var(--wide); margin-inline: auto; }
.section__head { text-align: center; margin-bottom: 3rem; }
.section__head .eyebrow { margin-bottom: .75rem; }
.section__title {
  margin-block: .6rem 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: .005em;
  text-wrap: balance;
}
.section__hint { margin-block: 1rem 0; color: var(--muted); font-style: italic; }

/* esquela — the traditional Spanish-language notice, hairline-framed */
.esquela {
  margin-top: 2.5rem;
  padding: clamp(2.75rem, 6vw, 3.75rem) clamp(1.5rem, 5vw, 3rem) clamp(2.5rem, 5vw, 3.25rem);
  border: 1px solid var(--rule-strong);
  outline: 1px solid var(--rule-strong);
  outline-offset: 4px;
  text-align: center;
}
.esquela__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  letter-spacing: .16em;
  padding-left: .16em;
  text-transform: uppercase;
  text-wrap: balance;
}
.esquela__dates {
  margin: 1.9rem 0 0;
  display: grid;
  gap: 1.1rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.esquela__dates div { display: grid; gap: .3rem; }
.esquela__dates dt {
  font-size: .66rem; font-weight: 500; letter-spacing: .26em; padding-left: .26em;
  text-transform: uppercase; color: var(--muted);
}
.esquela__dates dd { margin: 0; font-size: 1.1rem; }
.esquela__qepd {
  margin: 2rem 0 0;
  font-size: .72rem; font-weight: 500; letter-spacing: .34em; padding-left: .34em;
  text-transform: uppercase;
}

.epigraph {
  margin: 3.5rem auto 2.75rem;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 1.95rem);
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
  color: var(--fg);
}
.epigraph:empty { display: none; }
.epigraph:empty + .prose { margin-top: 3.5rem; }

.prose p { margin: 0; }
.prose p + p { margin-top: 1.15em; }
.prose--tribute { margin-top: 0; }
.prose p.signature { margin-top: 2.25rem; }
.signature {
  margin-block: 2.75rem 0;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
}

/* ---------- collage ---------- */
.collage {
  columns: 3;
  column-gap: 1rem;
}
@media (max-width: 960px) { .collage { columns: 2; } }
@media (max-width: 420px) { .collage { column-gap: .75rem; } }
.collage__item {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0;
  break-inside: avoid;
  overflow: hidden;
  background: var(--mark);
}
@media (max-width: 420px) { .collage__item { margin-bottom: .75rem; } }
.collage__item img {
  width: 100%; height: auto;
  transition: filter .8s var(--ease), transform 1.4s var(--ease);
}
.collage--bw .collage__item img { filter: grayscale(1); }
.collage--bw .collage__item:hover img,
.collage--bw .collage__item:focus-visible img { filter: grayscale(0); }
.collage__item:hover img { transform: scale(1.02); }
.collage__item--live { position: relative; }
.collage__live {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity .5s var(--ease);
  pointer-events: none;
}
.collage__item.is-playing .collage__live { opacity: 1; }
.collage__item--live::after {
  content: "LIVE";
  position: absolute; top: .6rem; left: .6rem;
  padding: .15rem .45rem;
  font: 600 .62rem/1.4 system-ui, sans-serif;
  letter-spacing: .14em;
  color: #fff;
  background: rgba(0, 0, 0, .38);
  border-radius: 999px;
  pointer-events: none;
  transition: opacity .4s var(--ease);
}
.collage__item.is-playing::after { opacity: 0; }

/* ---------- wall ---------- */
.wall { margin-top: 3rem; }
.wall__frame {
  width: 100%;
  max-width: 500px;
  margin-inline: auto;
  border: 1px solid var(--rule);
  background: var(--bg);
  overflow: hidden;
}
.wall__card {
  display: grid;
  max-width: 500px;
  margin-inline: auto;
  border: 1px solid var(--rule);
  background: var(--bg);
  text-decoration: none;
  overflow: hidden;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.wall__card:hover, .wall__card:focus-visible { border-color: var(--rule-strong); box-shadow: 0 18px 40px rgba(0, 0, 0, .1); }
.wall__head { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.25rem; }
.wall__fb { flex: none; width: 2.4rem; height: 2.4rem; fill: currentColor; }
.wall__who { display: grid; gap: .1rem; line-height: 1.25; }
.wall__group { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; text-wrap: balance; }
.wall__kind { font-size: .9rem; color: var(--muted); }
.wall__mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--rule); }
.wall__mosaic img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.wall__open {
  padding: .9rem 1.25rem;
  font-size: .72rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  text-align: center;
}
.wall__card:hover .wall__open { text-decoration: underline; text-underline-offset: .3em; }
.wall__placeholder {
  min-height: 22rem;
  display: grid;
  place-content: center;
  gap: .75rem;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, var(--mark) 14px 15px);
}
.wall__placeholder-mark {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--fg);
  opacity: .5;
}
.wall__actions { margin-top: 2rem; text-align: center; display: grid; gap: .9rem; justify-items: center; }
.button {
  display: inline-block;
  padding: .95rem 1.8rem;
  border: 1px solid var(--rule-strong);
  font-size: .74rem; font-weight: 500; letter-spacing: .2em; padding-left: 2rem; /* letter-spacing optical */
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.button:hover, .button:focus-visible { background: var(--fg); color: var(--bg); }
.wall__how { margin: 0; color: var(--muted); max-width: 30rem; }

/* ---------- services ---------- */
.services { list-style: none; margin: 2.5rem auto 0; padding: 0; }
.services li {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr;
  gap: .4rem 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.services li:last-child { border-bottom: 1px solid var(--rule); }
.services__kind {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1.1;
}
.services__detail { margin: 0; display: grid; gap: .15rem; }
.services__when { font-variant-numeric: lining-nums; }
.services__where { color: var(--muted); }
.services__map { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; margin-top: .4rem; }
@media (max-width: 520px) { .services li { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding: calc(var(--section) * .8) var(--gutter) calc(var(--section) * .6 + env(safe-area-inset-bottom, 0px));
  text-align: center;
  display: grid;
  gap: .35rem;
  justify-items: center;
}
.footer p { margin: 0; }
.footer__name { font-family: var(--font-display); font-size: 1.9rem; font-weight: 300; letter-spacing: .04em; }
.footer__years { font-family: var(--font-display); letter-spacing: .3em; padding-left: .3em; font-size: 1.05rem; }
.footer__line { margin-top: 1.25rem !important; font-style: italic; }
.footer__domain { margin-top: 2rem !important; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: var(--lb-bg);
  color: var(--lb-fg);
  display: grid;
  place-items: center;
  padding: 3.5rem var(--gutter) calc(2rem + env(safe-area-inset-bottom, 0px));
}
.lightbox__figure { margin: 0; display: grid; gap: 1rem; justify-items: center; max-width: 100%; }
/* --r/--w (ratio, native width) keep the size steady while the sharp copy replaces the preview */
.lightbox__img {
  width: min(92vw, 1400px, 78vh * var(--r), var(--w));
  aspect-ratio: var(--r);
  max-width: min(92vw, 1400px);
  max-height: 78vh;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lightbox__caption { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; text-align: center; min-height: 1.5em; }
.lightbox__close, .lightbox__arrow {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1;
  color: var(--lb-fg);
  opacity: .75;
  padding: .5rem .9rem;
}
.lightbox__close:hover, .lightbox__arrow:hover { opacity: 1; }
.lightbox__close { top: calc(.75rem + env(safe-area-inset-top, 0px)); right: 1rem; font-size: 2.6rem; }
.lightbox__arrow { top: 50%; transform: translateY(-50%); font-size: 4rem; }
.lightbox__arrow--prev { left: .5rem; }
.lightbox__arrow--next { right: .5rem; }
@media (max-width: 720px) { .lightbox__arrow { font-size: 3rem; top: auto; bottom: 1rem; transform: none; } }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__slide.is-active { transition-duration: .9s; }
  .hero__slide:is(.is-active, .is-leaving, .is-under) .hero__media--still { animation: none; }
  .hero__scroll-arrow { animation: none; }
  .collage__item img { transition: filter .3s; }
  .collage__item:hover img { transform: none; }
}
