/* ============================================================
   Tito Castillo Salaverry — In Memoriam
   Responsive stylesheet (mobile + desktop)
   ============================================================ */

:root {
  --bg: #F1ECE2;
  --ink: #16283F;
  --ink-soft: #55605F;
  --olive: #56654A;
  --olive-dark: #485539;
  --sage: #A7B69C;
  --sand: #CBB894;
  --cream: #F6F2E9;
  --cream-2: #FBF8F1;
  --stone: #E7E0D2;
  --muted: #7C8478;
  --clay: #A9765A;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: none; transition: color .3s ease; }
a:hover { color: var(--clay); }
::selection { background: var(--sand); color: var(--ink); }
textarea, input, button { font-family: inherit; }
textarea:focus, input:focus { outline: none; }
img { display: block; max-width: 100%; }

#root { position: relative; overflow: hidden; }

/* ---------- Reveal animation ---------- */
.reveal { transition: opacity 1.1s ease, transform 1.1s ease; }
.reveal.is-hidden { opacity: 0; transform: translateY(18px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none !important; }
  .reveal.is-hidden { opacity: 1; transform: none; }
}

/* ---------- Shared bits ---------- */
.accent { color: var(--sand); }
.rule { flex: 1; height: 1px; background: rgba(22,40,63,0.16); }
.rule--light { background: rgba(246,242,233,0.2); }

.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.eyebrow--muted { letter-spacing: 0.22em; color: #9AA096; text-transform: none; }

.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-head__num { font-size: 0.7rem; letter-spacing: 0.18em; font-weight: 600; color: rgba(246,242,233,0.45); }
.section-head__num--dark { color: #B0AB9E; }
.section-head__label {
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.section-head__label--light { color: #C3CBB4; }

.section-title {
  font-family: 'Schibsted Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(1.9rem, 4.4vw, 3.2rem); line-height: 1.06;
  letter-spacing: -0.03em; margin: 0; color: var(--ink);
}

/* ---------- Buttons ---------- */
.btn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: var(--bg);
  padding: 8px 15px; border-radius: 999px;
  font-size: clamp(0.68rem, 1.3vw, 0.78rem); font-weight: 600;
  letter-spacing: 0.01em; white-space: nowrap; flex: 0 0 auto;
}
.btn-pill:hover { color: var(--bg); background: #0F1D2E; }

.btn-solid {
  width: 100%; border: none; cursor: pointer;
  background: var(--ink); color: var(--cream);
  padding: 14px 28px; border-radius: 12px;
  font-size: 1rem; font-weight: 600; letter-spacing: 0.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .3s ease; min-height: 52px;
}
.btn-solid:hover { background: #0F1D2E; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 5vw, 56px);
  backdrop-filter: saturate(130%) blur(10px);
  background: rgba(241,236,226,0.82);
  border-bottom: 1px solid rgba(22,40,63,0.07);
}
.nav__brand {
  font-family: 'Schibsted Grotesk', sans-serif;
  font-size: clamp(0.78rem, 1.5vw, 0.92rem); font-weight: 600;
  letter-spacing: -0.01em; white-space: nowrap;
}
.nav__links {
  display: flex; align-items: center; gap: clamp(12px, 2.2vw, 26px);
  font-size: clamp(0.7rem, 1.5vw, 0.84rem); font-weight: 500; color: #55605F;
  margin-left: auto; margin-right: clamp(12px, 2.2vw, 26px);
}
.nav__links a { color: #55605F; }
.nav__links a:hover { color: var(--clay); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(110px, 16vh, 170px) clamp(16px, 5vw, 56px) clamp(50px, 8vh, 90px);
  max-width: 1280px; margin: 0 auto;
}
.hero__meta { display: flex; align-items: center; gap: clamp(14px, 2vw, 22px); margin-bottom: clamp(30px, 5vh, 52px); }
.hero__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: clamp(28px, 4vw, 64px); align-items: center;
}
.hero__copy h1 {
  font-family: 'Schibsted Grotesk', sans-serif; font-weight: 600;
  font-size: clamp(2.35rem, 6vw, 4.9rem); line-height: 1.04;
  letter-spacing: -0.032em; margin: 0 0 28px; color: var(--ink); text-wrap: balance;
}
.hero__copy p {
  font-size: clamp(1.02rem, 1.6vw, 1.24rem); line-height: 1.6;
  color: var(--ink-soft); max-width: 38ch; margin: 0; text-wrap: pretty;
}
.hero__figure { position: relative; }
.hero__frame {
  position: relative; width: 100%; aspect-ratio: 4 / 4.4;
  border-radius: 20px; overflow: hidden; background: #DED6C6;
  box-shadow: 0 40px 90px -60px rgba(22,40,63,0.75), inset 0 0 0 1px rgba(22,40,63,0.08);
}
.hero__frame img {
  position: absolute; top: -5%; left: 0; width: 100%; height: 114%;
  object-fit: cover; object-position: 50% 22%; filter: saturate(0.92) contrast(1.02);
}
.hero__frame-grad {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(22,40,63,0.28) 100%);
}
.hero__frame-tag {
  position: absolute; left: 18px; bottom: 18px;
  background: rgba(241,236,226,0.92); backdrop-filter: blur(6px);
  color: var(--ink); padding: 10px 18px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
}

/* ---------- Leave a memory ---------- */
.leave { background: var(--olive); padding: clamp(40px, 6vh, 68px) clamp(16px, 5vw, 56px); }
.leave__inner { max-width: 860px; margin: 0 auto; }
.leave__title {
  font-family: 'Schibsted Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(1.6rem, 3.3vw, 2.4rem); line-height: 1.08;
  letter-spacing: -0.03em; margin: 0 0 12px; color: var(--cream);
}
.leave__lead {
  font-size: clamp(1rem, 1.5vw, 1.15rem); line-height: 1.6;
  color: rgba(246,242,233,0.78); max-width: 56ch;
  margin: 0 0 clamp(18px, 2.6vh, 26px); text-wrap: pretty;
}
.leave__fine {
  font-size: 0.85rem; line-height: 1.6; color: rgba(246,242,233,0.6);
  margin: 14px 2px 0; max-width: 52ch;
}

.card {
  background: var(--cream); border-radius: 18px;
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: 0 40px 80px -60px rgba(0,0,0,0.7);
}
.field-label { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 6px; }
.field-input {
  width: 100%; border: none; border-bottom: 1px solid rgba(22,40,63,0.16);
  background: transparent; padding: 8px 0 12px; font-size: 1.02rem;
  color: var(--ink); margin-bottom: 18px;
}
.field-input:disabled { opacity: 0.5; cursor: not-allowed; }
.field-textarea {
  width: 100%; border: 1px solid rgba(22,40,63,0.14); border-radius: 12px;
  background: var(--cream-2); resize: vertical; padding: 16px;
  font-size: clamp(1rem, 1.6vw, 1.12rem); line-height: 1.6;
  color: var(--ink); min-height: 94px;
}
.card__row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 24px; margin: 14px 0 18px;
}
.check {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none; min-height: 44px;
}
.check__box-input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--olive);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--cream); background: transparent;
  transition: background .25s ease; flex: 0 0 auto;
}
.check__box-input:checked + .check__box { background: var(--olive); }
.check__box-input:checked + .check__box::after { content: '✓'; }
.check__box-input:focus-visible + .check__box { outline: 2px solid var(--ink); outline-offset: 2px; }
.check__text { font-size: 0.93rem; color: var(--ink-soft); }
.form-hint { font-size: 0.9rem; color: var(--clay); }
.form-hint.is-ok { color: var(--olive); }

/* ---------- Memories ---------- */
.memories { padding: clamp(70px, 12vh, 130px) 0 clamp(50px, 8vh, 90px); }
.memories__head {
  padding: 0 clamp(16px, 5vw, 56px); max-width: 1280px;
  margin: 0 auto clamp(34px, 5vh, 56px);
}
.memories__head .section-title { max-width: 16ch; }

.carousel-mask {
  position: relative; width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.carousel {
  display: flex; gap: 20px; width: max-content;
  padding: 10px clamp(16px, 5vw, 56px); will-change: transform;
}
.mem-card {
  width: clamp(250px, 24vw, 320px); flex: 0 0 auto;
  border-radius: 14px; padding: 26px 24px;
  box-shadow: 0 22px 44px -38px rgba(22,40,63,0.6);
}
.mem-card__quote { font-size: 1.06rem; line-height: 1.56; margin: 0 0 22px; text-wrap: pretty; }
.mem-card__by { display: flex; align-items: center; gap: 10px; }
.mem-card__dash { width: 18px; height: 1px; background: currentColor; opacity: 0.32; flex: 0 0 auto; }
.mem-card__name {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0.6; font-weight: 600;
}

.memories__wall { max-width: 1280px; margin: clamp(46px, 7vh, 84px) auto 0; padding: 0 clamp(16px, 5vw, 56px); }
.memories__count { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.memories__count-rule { width: 34px; height: 1px; background: rgba(22,40,63,0.3); flex: 0 0 auto; }
.memories__count span:last-child { font-size: 0.88rem; color: var(--ink-soft); }

.masonry { column-width: 320px; column-gap: 20px; }
.masonry__item { break-inside: avoid; margin-bottom: 20px; }
.masonry__item .mem-card {
  width: auto; box-shadow: 0 18px 40px -38px rgba(22,40,63,0.55);
  transition: box-shadow .4s ease, transform .4s ease;
}
.masonry__item .mem-card:hover { box-shadow: 0 26px 52px -34px rgba(22,40,63,0.8); }
.masonry__item .mem-card__quote { font-size: 1.04rem; }

/* ---------- Quote band ---------- */
.quote-band { background: var(--ink); padding: clamp(66px, 11vh, 120px) clamp(16px, 5vw, 56px); }
.quote-band__inner { max-width: 960px; margin: 0 auto; }
.quote-band__eyebrow {
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: rgba(203,184,148,0.85); font-weight: 600; margin-bottom: 26px;
}
.quote-band blockquote {
  font-family: 'Schibsted Grotesk', sans-serif; font-weight: 600;
  font-size: clamp(1.5rem, 3.6vw, 2.7rem); line-height: 1.22;
  letter-spacing: -0.025em; margin: 0 0 22px; color: var(--cream); text-wrap: pretty;
}
.quote-band__cite { font-size: 0.92rem; color: rgba(246,242,233,0.6); }

/* ---------- Music ---------- */
.music { padding: clamp(70px, 12vh, 130px) clamp(16px, 5vw, 56px); }
.music__inner { max-width: 1080px; margin: 0 auto; }
.music__title-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: clamp(26px, 4vh, 42px);
}
.music__title { max-width: 14ch; }
.music__play {
  width: clamp(56px, 8vw, 74px); height: clamp(56px, 8vw, 74px); flex: 0 0 auto;
  border-radius: 50%; background: var(--olive);
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s ease, background .3s ease;
}
.music__play:hover { background: var(--olive-dark); transform: scale(1.05); }
.music__play-tri {
  width: 0; height: 0; border-left: 16px solid var(--cream);
  border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 5px;
}
.music__row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 4px; border-top: 1px solid rgba(22,40,63,0.14);
  font-size: clamp(0.95rem, 1.5vw, 1.08rem); color: var(--ink);
}
.music__row--link { transition: padding .3s ease; }
.music__row--link:hover { padding-left: 12px; color: var(--ink); }
.music__row--static { border-bottom: 1px solid rgba(22,40,63,0.14); }
.music__row span:first-child { display: flex; gap: 16px; }
.music__row-num { color: #9AA096; }
.music__row-arrow { color: var(--muted); }
.music__row-note { color: var(--muted); font-size: 0.9rem; }
.music__desc {
  font-size: clamp(0.98rem, 1.5vw, 1.1rem); line-height: 1.62;
  color: var(--ink-soft); margin: 30px 0 26px; max-width: 46ch; text-wrap: pretty;
}
.music__embed { background: var(--stone); border-radius: 16px; padding: 10px; }
.music__embed iframe { border-radius: 10px; display: block; border: 0; }

/* ---------- Nature ---------- */
.nature { position: relative; height: min(54vh, 500px); overflow: hidden; background: var(--ink); }
.nature img {
  position: absolute; top: -18%; left: 0; width: 100%; height: 136%;
  object-fit: cover; object-position: 50% 45%; will-change: transform;
}
.nature__grad {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(22,40,63,0.2) 0%, transparent 38%, rgba(22,40,63,0.6) 100%);
}
.nature__caption {
  position: absolute; left: 0; right: 0; bottom: clamp(32px, 7vh, 72px);
  padding: 0 clamp(16px, 5vw, 56px);
}
.nature__caption p {
  font-family: 'Schibsted Grotesk', sans-serif; font-weight: 600;
  font-size: clamp(1.4rem, 3.2vw, 2.6rem); line-height: 1.16;
  letter-spacing: -0.025em; color: var(--cream); max-width: 20ch; margin: 0; text-wrap: pretty;
}

/* ---------- Photographs ---------- */
.photos { padding: clamp(70px, 12vh, 130px) clamp(16px, 5vw, 56px) clamp(50px, 8vh, 84px); }
.photos__inner { max-width: 1280px; margin: 0 auto; }
.photos__head { margin-bottom: clamp(30px, 5vh, 52px); }
.photos__head .section-title { max-width: 17ch; margin-bottom: 14px; }
.photos__lead {
  font-size: clamp(0.98rem, 1.5vw, 1.1rem); line-height: 1.6;
  color: var(--ink-soft); max-width: 46ch; margin: 0; text-wrap: pretty;
}
.photo-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(76px, 8.6vw, 106px); grid-auto-flow: dense;
  gap: clamp(12px, 1.6vw, 20px);
}
.photo {
  perspective: 1600px; cursor: pointer;
  grid-column: span var(--cw, 1); grid-row: span var(--ch, 3);
}
.photo__inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .85s cubic-bezier(.2,.7,.2,1), box-shadow .4s ease;
  transform-style: preserve-3d; box-shadow: 0 22px 48px -36px rgba(22,40,63,0.6);
}
.photo.is-flipped .photo__inner { transform: rotateY(180deg); box-shadow: 0 32px 60px -36px rgba(22,40,63,0.65); }
.photo:not(.is-flipped):hover .photo__inner { transform: translateY(-8px); }
.photo__face {
  position: absolute; inset: 0; border-radius: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.photo__front { overflow: hidden; background: #DED6C6; }
.photo__front img { width: 100%; height: 100%; object-fit: cover; }
.photo__placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px; background: #DED6C6; color: var(--muted);
}
.photo__placeholder span {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; opacity: 0.85;
}
.photo__back {
  transform: rotateY(180deg); padding: clamp(18px, 2.6vw, 28px);
  display: flex; flex-direction: column;
}
.photo__label { font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.6; font-weight: 600; margin-bottom: 16px; }
.photo__note { font-size: clamp(0.95rem, 1.4vw, 1.06rem); line-height: 1.5; margin: 0 0 auto; text-wrap: pretty; }
.photo__meta { font-size: 0.82rem; opacity: 0.7; margin-top: 18px; }
.photo__people { font-size: 0.82rem; opacity: 0.55; margin-top: 4px; }
.photo__return { margin-top: 16px; font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.5; font-weight: 600; }

/* ---------- Closing ---------- */
.closing { padding: clamp(56px, 9vh, 100px) clamp(16px, 5vw, 56px) clamp(44px, 7vh, 72px); text-align: center; }
.closing__inner { max-width: 620px; margin: 0 auto; }
.closing__line {
  width: 1px; height: clamp(36px, 6vh, 58px);
  background: linear-gradient(rgba(22,40,63,0.28), rgba(22,40,63,0));
  margin: 0 auto clamp(26px, 4vh, 38px);
}
.closing__name {
  font-family: 'Schibsted Grotesk', sans-serif; font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 14px;
}
.closing__dates { font-size: 0.76rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.closing__text {
  font-size: clamp(1rem, 1.5vw, 1.1rem); line-height: 1.65; color: var(--ink-soft);
  margin: clamp(24px, 4vh, 36px) auto 0; max-width: 34ch; text-wrap: pretty;
}
.closing__link { border-bottom: 1px solid rgba(22,40,63,0.25); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid rgba(22,40,63,0.14);
  padding: clamp(30px, 5vh, 44px) clamp(16px, 5vw, 56px) clamp(40px, 6vh, 60px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; font-size: 0.88rem; color: var(--muted);
  max-width: 1280px; margin: 0 auto; width: 100%;
}

/* ============================================================
   Responsive — tablet & mobile
   ============================================================ */
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__brand { font-size: 0.82rem; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 74px; gap: 12px; }
  .photo { --cw: 1 !important; }
  .photo.is-wide { --cw: 2 !important; }
}

@media (max-width: 560px) {
  .hero { padding-top: 96px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__copy { order: 2; }
  .hero__figure { order: 1; }
  .hero__frame { aspect-ratio: 4 / 4.6; }
  .masonry { column-width: auto; column-count: 2; column-gap: 12px; }
  .masonry__item { margin-bottom: 12px; }
  .masonry__item .mem-card { padding: 16px 14px; border-radius: 12px; }
  .masonry__item .mem-card__quote { font-size: 0.85rem; line-height: 1.5; margin-bottom: 14px; }
  .mem-card__name { font-size: 0.58rem; }
  .music__title-row { flex-wrap: nowrap; }
  .card__row { gap: 8px 16px; }
}
