/* El Velorio — dark candlelit theme */
:root {
  --ataud: #1c0f0c;      /* page base: dark oxblood wood */
  --sombra: #120907;     /* deepest shadow */
  --terciopelo: #6e1419; /* velvet red */
  --vela: #d69e68;       /* copper gold, from the logo */
  --vela-hi: #efc292;
  --cera: #efe2c6;       /* wax: body text */
  --humo: #b9a68a;       /* smoke: secondary text */
  --linea: rgba(214, 158, 104, 0.35);

  --f-text: "IM Fell English", Georgia, serif;
  --f-ui: "Karla", system-ui, sans-serif;

  --gutter: clamp(16px, 5vw, 64px);
  --max: 1180px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ataud);
  color: var(--cera);
  font-family: var(--f-text);
  font-size: 1.1875rem;
  line-height: 1.6;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--vela); text-underline-offset: 3px; }
a:hover { color: var(--vela-hi); }
:focus-visible { outline: 2px solid var(--vela-hi); outline-offset: 3px; }

/* Language: show only the active language */
html[data-lang="es"] [lang="en"]:not(html),
html[data-lang="en"] [lang="es"]:not(html) { display: none !important; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--vela); color: var(--sombra);
  padding: 8px 14px; font-family: var(--f-ui); font-weight: 700;
}
.skip:focus { top: 12px; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  background: linear-gradient(rgba(18, 9, 7, 0.92), rgba(18, 9, 7, 0));
  transition: background-color 0.3s, box-shadow 0.3s;
}
.top.is-scrolled {
  background: rgba(18, 9, 7, 0.94);
  box-shadow: 0 1px 0 var(--linea);
}
.mark { margin-right: auto; display: block; line-height: 0; }
.mark img { height: 44px; width: auto; }
.top nav { display: flex; gap: 22px; font-family: var(--f-ui); font-size: 0.95rem; }
.top nav a { color: var(--cera); text-decoration: none; }
.top nav a:hover { color: var(--vela-hi); }
.lang { display: flex; border: 1px solid var(--linea); border-radius: 999px; overflow: hidden; }
.lang button {
  font: 700 0.8rem var(--f-ui); letter-spacing: 0.04em;
  background: none; color: var(--humo); border: 0; padding: 6px 11px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--vela); color: var(--sombra); }

/* Hero */
.hero {
  position: relative; min-height: 100svh;
  display: grid; align-items: end;
  padding: 120px var(--gutter) clamp(48px, 9vh, 96px);
  overflow: hidden; isolation: isolate;
}
.hero-img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 25% 72%, rgba(18, 9, 7, 0.85), rgba(18, 9, 7, 0) 100%),
    radial-gradient(ellipse at 50% 35%, rgba(28, 15, 12, 0.25), rgba(28, 15, 12, 0.75) 70%),
    linear-gradient(transparent 35%, var(--ataud));
}
.hero-inner { max-width: var(--max); width: 100%; margin: 0 auto; }
.hero-kicker { font-family: var(--f-ui); font-size: 1rem; color: var(--humo); margin: 0 0 4px; }
.wordmark { margin: 0 0 6px; line-height: 0; }
.wordmark img {
  width: min(640px, 100%); height: auto;
  filter: drop-shadow(0 0 22px rgba(240, 170, 90, 0.28)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9));
  animation: flicker 6s ease-in-out infinite;
}
/* candlelight on the sign: the only ambient motion on the page */
@keyframes flicker {
  0%, 100% { filter: drop-shadow(0 0 22px rgba(240, 170, 90, 0.28)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)); }
  45% { filter: drop-shadow(0 0 30px rgba(240, 170, 90, 0.42)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)); }
  50% { filter: drop-shadow(0 0 16px rgba(240, 170, 90, 0.2)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)); }
  55% { filter: drop-shadow(0 0 26px rgba(240, 170, 90, 0.36)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)); }
}
.hero-tag { font-style: italic; font-size: clamp(1.4rem, 3vw, 2rem); margin: 10px 0 28px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 1rem var(--f-ui); text-decoration: none;
  padding: 13px 22px; border-radius: 999px; border: 1px solid var(--vela);
}
.btn-gold { background: var(--vela); color: var(--sombra); }
.btn-gold:hover { background: var(--vela-hi); color: var(--sombra); }
.btn-ghost { color: var(--cera); background: rgba(18, 9, 7, 0.45); }
.btn-ghost:hover { color: var(--vela-hi); }
.btn-ink { color: var(--vela); background: transparent; margin-top: 8px; }
.btn-ink:hover { background: var(--vela); color: var(--sombra); }

/* Shared section rhythm */
main > section:not(.hero) {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(64px, 10vw, 128px) var(--gutter);
}
h2 {
  font-family: var(--f-text); font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.1;
  color: var(--vela); margin: 0 0 24px;
}

/* La casa */
.casa { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.casa-text p { max-width: 34em; margin: 0 0 18px; }
.casa-invite { font-style: italic; font-size: 1.35rem; color: var(--vela-hi); }
.casa-photo { margin: 0; }
.casa-photo img { border-radius: 220px 220px 4px 4px; border: 1px solid var(--linea); }
.cartas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.carta {
  display: grid; gap: 2px; padding: 18px 20px;
  border: 1px solid var(--linea); border-radius: 6px;
  text-decoration: none; color: var(--cera);
  background: linear-gradient(rgba(110, 20, 25, 0.28), rgba(110, 20, 25, 0.08));
  transition: border-color 0.2s, background-color 0.2s;
}
.carta:hover { border-color: var(--vela); color: var(--cera); }
.carta-name { font-family: var(--f-text); font-size: 1.35rem; color: var(--vela); }
.carta-desc { font-family: var(--f-ui); font-size: 0.92rem; color: var(--humo); }

/* Historia: Oller's painting, framed like a museum piece */
.historia { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.oller { margin: 0; }
.oller img {
  width: 100%;
  background: var(--sombra);
  border: 10px solid #3a2410;
  box-shadow: inset 0 0 0 1px var(--vela), 0 0 0 1px var(--vela), 0 30px 70px rgba(0, 0, 0, 0.55);
}
.oller figcaption { font-family: var(--f-ui); font-size: 0.9rem; color: var(--humo); margin-top: 14px; }
.historia-text p { max-width: 34em; margin: 0 0 18px; }
.historia-close { font-style: italic; font-size: 1.35rem; color: var(--vela-hi); }

/* La contraseña */
.contrasena { text-align: center; }
.contrasena h2 { font-style: italic; }
.pw-lede { font-size: clamp(1.3rem, 2.6vw, 1.75rem); line-height: 1.45; max-width: 30em; margin: 0 auto 22px; }
.pw-note { font-family: var(--f-ui); font-size: 0.98rem; color: var(--humo); margin: 0; }

/* Velación: hours as a funeral notice */
.velacion { display: grid; grid-template-columns: 1fr 0.8fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.esquela {
  position: relative; text-align: center;
  padding: clamp(36px, 5vw, 56px) clamp(22px, 4vw, 52px);
  background: var(--sombra);
  border: 1px solid var(--vela);
  outline: 1px solid var(--linea); outline-offset: -10px;
  box-shadow: 0 0 0 6px var(--sombra), 0 0 0 7px var(--linea), 0 30px 80px rgba(0, 0, 0, 0.5);
}
.esquela-cross {
  width: 18px; height: 28px; margin: 0 auto 18px; position: relative;
}
.esquela-cross::before, .esquela-cross::after { content: ""; position: absolute; background: var(--vela); }
.esquela-cross::before { left: 8px; top: 0; width: 2px; height: 28px; }
.esquela-cross::after { left: 0; top: 8px; width: 18px; height: 2px; }
.esquela h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.hours { margin: 0 0 28px; display: grid; gap: 16px; }
.hours dt { font-family: var(--f-text); font-size: 1.2rem; }
.hours dd { margin: 0; font-family: var(--f-ui); font-weight: 500; font-size: 1.15rem; color: var(--vela); letter-spacing: 0.02em; }
.hours .closed dt, .hours .closed dd { color: var(--humo); }
.esquela-rule { height: 1px; width: 60%; margin: 0 auto 24px; background: var(--linea); }
.esquela address { font-style: normal; display: grid; gap: 4px; margin-bottom: 18px; }
.esquela address a { font-family: var(--f-ui); font-size: 1rem; }
.velacion-photo { margin: 0; }
.velacion-photo img { border: 1px solid var(--linea); border-radius: 4px; }
.velacion-photo figcaption { font-style: italic; color: var(--humo); margin-top: 10px; font-size: 1.05rem; }

/* Fotos */
.fotos h2 { text-align: center; }
.mosaic {
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, minmax(180px, 26vw));
  max-height: 760px;
}
.mosaic img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.m-a { grid-column: 1 / 3; grid-row: 1 / 3; }
.m-b { grid-column: 3; grid-row: 1; }
.m-c { grid-column: 4; grid-row: 1 / 3; }
.m-d { grid-column: 3; grid-row: 2; }

/* Footer */
.foot {
  text-align: center; padding: 72px var(--gutter) 40px;
  background: var(--sombra); border-top: 1px solid var(--linea);
}
.foot-mark { width: 240px; height: auto; margin: 0 auto; }
.foot-tag { font-style: italic; color: var(--humo); margin: 4px 0 26px; }
.social { list-style: none; padding: 0; margin: 0 0 24px; display: flex; justify-content: center; gap: 12px; }
.social a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--linea); border-radius: 50%; color: var(--vela);
}
.social a:hover { border-color: var(--vela); }
.social svg { width: 20px; height: 20px; fill: currentColor; }
.social a[data-soon] { opacity: 0.4; cursor: default; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-family: var(--f-ui); font-size: 0.98rem; margin: 0 0 22px; }
.foot-small { font-family: var(--f-ui); font-size: 0.85rem; color: var(--humo); margin: 0; }
.foot-credit { font-family: var(--f-ui); font-size: 0.75rem; color: var(--humo); opacity: 0.75; margin: 14px 0 0; }
.foot-credit a { color: inherit; }
.foot-credit a:hover { color: var(--vela-hi); }

/* Responsive */
@media (max-width: 900px) {
  .top nav { display: none; }
  .casa, .velacion, .historia { grid-template-columns: 1fr; }
  .casa-photo { max-width: 460px; }
  .velacion-photo { max-width: 460px; margin: 0 auto; }
  .mosaic { grid-template-columns: 1fr 1fr; grid-template-rows: none; max-height: none; }
  .mosaic img { aspect-ratio: 3 / 4; height: auto; }
  .m-a, .m-b, .m-c, .m-d { grid-column: auto; grid-row: auto; }
}
@media (max-width: 520px) {
  .cartas { grid-template-columns: 1fr; }
  .btn { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wordmark { animation: none; }
}
