@font-face {
  font-family: Noto Serif Display;
  src: url("./assets/tipografia/NotoSerifDisplay-Regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Noto Serif Display;
  src: url("./assets/tipografia/NotoSerifDisplay-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8f6ed;
  --paper-white: #fffdf6;
  --forest: #203b30;
  --forest-deep: #1b3028;
  --ink: #283c32;
  --muted: #526254;
  --olive: #c3cb9f;
  --line: #d3d8c7;
  --serif: "Noto Serif Display", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --edge: clamp(1rem, 4.1vw, 4.25rem);
  --section: clamp(3.75rem, 7.6vw, 7rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, p, figure, blockquote { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.02; text-wrap: balance; }
h2 { font-size: clamp(2.3rem, 4.4vw, 4.1rem); letter-spacing: -.052em; }
h2[id] { scroll-margin-top: 3.75rem; }
:focus-visible { outline: 2px solid #7c5e35; outline-offset: 4px; }
[tabindex="-1"]:focus { outline: none; }
.skip { position: absolute; z-index: 10; top: .5rem; left: .75rem; padding: .65rem 1rem; background: var(--paper-white); transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }

.site-header { position: relative; z-index: 2; }
.bar {
  width: min(100%, 100rem);
  min-height: 5.1rem;
  margin: auto;
  padding: .8rem var(--edge);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
}
.brand, .index a, .birthday-link { text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font: 1.28rem var(--serif); white-space: nowrap; }
.monogram, .seal {
  display: grid;
  place-items: center;
  border: 1px solid #83977b;
  font: italic 1.1rem/1 var(--serif);
}
.monogram { width: 2.2rem; height: 2.2rem; color: #30513d; border-radius: 50%; }
.index { display: flex; align-items: center; gap: clamp(.65rem, 1.7vw, 1.55rem); }
.index a, .birthday-link, .index-toggle { min-height: 2.75rem; display: inline-flex; align-items: center; font-size: .89rem; }
.index a:hover, footer a:hover { text-decoration: underline; text-underline-offset: .25em; }
.birthday-link { background: #e5e9d9; border-radius: 999px; padding-inline: .98rem; }
.index-toggle { display: none; }

.cover {
  isolation: isolate;
  position: relative;
  width: min(calc(100% - var(--edge) * 2), 92rem);
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1.04fr;
  min-height: clamp(34rem, 47vw, 43rem);
  color: var(--paper);
  background: radial-gradient(ellipse at 0 10%, #334a3c 0%, transparent 62%), var(--forest-deep);
  overflow: hidden;
}
.cover::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: .78rem;
  border: 1px solid #e7ebcb50;
  pointer-events: none;
}
.cover-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(2.65rem, 5.6vw, 6rem) clamp(2.4rem, 5.2vw, 5.85rem);
}
.cover-figure {
  min-width: 0;
  background: #697760 url("./assets/libro-verde.webp") center 54% / cover no-repeat;
  position: relative;
}
.cover-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1b302864 0%, transparent 22%);
}
.eyebrow {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .15em;
}
.cover-kicker { display: flex; align-items: center; gap: .7rem; color: var(--olive); }
.ornament { font-size: .9rem; }
.cover h1 {
  margin-block: 1.1rem 1.5rem;
  font-size: clamp(3.65rem, 7.95vw, 8.25rem);
  letter-spacing: -.065em;
}
.cover h1 span, .cover h1 em { display: block; }
.cover h1 em {
  color: #d3d9b5;
  margin-top: .11em;
  font-size: .66em;
  letter-spacing: -.062em;
  text-wrap: nowrap;
}
.cover-intro { max-width: 32ch; color: #f0efdc; font-size: 1rem; line-height: 1.68; }
.cover .button { margin-top: 1.8rem; }
.cover-byline, .cover-date { margin-top: 1.15rem; color: #d3d9b5; font: italic 1.05rem/1.4 var(--serif); }
.birthday-cover .cover-figure { background-image: url("./assets/capibara.webp"); background-position: center 52%; }
.birthday-cover h1 { font-size: clamp(2.9rem, 5.7vw, 6.1rem); }
.birthday-cover h1 em { font-size: 1.34em; margin-top: .1em; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 3rem;
  padding: .6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 2rem;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: background-color .2s, border-color .2s, color .2s;
}
.button-light { background: #e1e4c8; color: var(--forest-deep); }
.button-light:hover { background: #f6f1dc; }
.button-light:focus-visible, .future .button:focus-visible { outline-color: #f4e3af; }
.button-dark { background: var(--forest); color: var(--paper-white); }
.button-dark:hover { background: #365344; }
.button-outline { background: transparent; color: var(--paper); border-color: #b6c5a6; }
.button-outline:hover { background: #ffffff1f; }
.icon { display: inline-block; position: relative; flex: none; }
.icon-book { width: 1.15rem; height: .87rem; }
.icon-book::before, .icon-book::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 53%;
  height: 100%;
  border: 1px solid currentColor;
}
.icon-book::before { left: 0; border-radius: 2px 4px 0 2px; }
.icon-book::after { right: 0; border-radius: 4px 2px 2px 0; }
.icon-lock { width: 1.19rem; height: .9rem; border: 1.5px solid currentColor; border-radius: .24rem; margin-top: .35rem; }
.icon-lock::before {
  content: "";
  position: absolute;
  width: .68rem;
  height: .58rem;
  top: -.6rem;
  left: 50%;
  transform: translateX(-50%);
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: .65rem .65rem 0 0;
}
.icon-lock::after { content: ""; position: absolute; width: 2px; height: 4px; top: 3px; left: calc(50% - 1px); background: currentColor; border-radius: 2px; }

.chapter { padding: var(--section) var(--edge); }
.chapter-heading { text-align: center; margin: 0 auto 2.65rem; }
.chapter-heading p, .closing-copy { max-width: 47ch; margin: .9rem auto 0; color: var(--muted); }
.chapter-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  width: 6.75rem;
  margin: 0 auto 1.15rem;
  color: #677f5c;
}
.chapter-rule::before, .chapter-rule::after { content: ""; height: 1px; flex: 1; background: #a4af91; }
.chapter-rule span { line-height: 1; }

.memories { padding-bottom: calc(var(--section) + .5rem); }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2.5rem); max-width: 63rem; margin: auto; align-items: start; }
.polaroid {
  background: var(--paper-white);
  padding: .68rem .68rem 1.23rem;
  min-width: 0;
  box-shadow: 0 .35rem .9rem #26382b16, 0 0 0 1px #deded1;
  transform: rotate(-2.5deg);
}
.polaroid:nth-child(3n + 2) { transform: rotate(1.45deg) translateY(.55rem); }
.polaroid:nth-child(3n + 3) { transform: rotate(-.65deg); }
.photo-frame { aspect-ratio: 5/4; position: relative; overflow: hidden; }
.photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: .45rem;
  background: radial-gradient(ellipse at top right, #f1f1e6, transparent 75%), #dfe5d4;
  color: #435943;
  border: 1px dashed #a9b59e;
  text-align: center;
  padding: .4rem;
  font-size: .82rem;
}
.polaroid:nth-child(2n) .photo-placeholder { background-color: #e9e6d5; }
.photo-icon {
  position: relative;
  width: 1.72rem;
  height: 1.28rem;
  border: 1px solid currentColor;
  border-radius: .2rem;
}
.photo-icon::before { content: ""; position: absolute; bottom: .15rem; left: .25rem; width: .63rem; height: .56rem; border-top: 1px solid currentColor; border-left: 1px solid currentColor; transform: rotate(45deg) translate(.05rem, .15rem); }
.photo-icon::after { content: ""; position: absolute; top: .22rem; right: .22rem; width: .26rem; height: .26rem; border: 1px solid currentColor; border-radius: 50%; }
.photo-button { position: absolute; inset: 0; border: 0; width: 100%; padding: 0; background: var(--paper-white); }
.photo-button img { width: 100%; height: 100%; object-fit: cover; }
.photo-button:focus-visible { outline-offset: -4px; }
.photo-caption { display: flex; flex-direction: column; gap: .25rem; padding: .8rem .2rem 0; text-align: center; font-family: var(--serif); }
.photo-caption time { font: .82rem var(--sans); color: var(--muted); }

.details { background: #e5eadc; }
.detail-layout {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  align-items: start;
  gap: clamp(2rem, 8vw, 8rem);
  max-width: 66rem;
  margin: auto;
}
.details .chapter-heading { text-align: left; margin: 0; }
.details .chapter-rule, .details .chapter-heading p { margin-left: 0; }
.detail { border-top: 1px solid #aebca8; }
.detail:last-child { border-bottom: 1px solid #aebca8; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.detail summary {
  display: grid;
  grid-template-columns: 1.65rem 1fr auto;
  align-items: center;
  gap: .65rem;
  min-height: 4rem;
  padding: .55rem .35rem;
  color: var(--forest);
  font: clamp(1.27rem, 2.4vw, 1.7rem)/1.3 var(--serif);
}
.detail summary:hover { background: #f8fbf048; }
.detail-ornament { color: #57734f; font-size: 1rem; }
.detail-plus { position: relative; width: 1.2rem; height: 1.2rem; color: #435943; }
.detail-plus::before, .detail-plus::after { content: ""; position: absolute; width: .8rem; height: 1px; left: .2rem; top: .55rem; background: currentColor; transition: transform .2s; }
.detail-plus::after { transform: rotate(90deg); }
.detail[open] .detail-plus::after { transform: rotate(0); }
.detail p { max-width: 44ch; padding: .05rem .6rem 1.2rem 2.65rem; color: var(--muted); }
.detail[open] p { animation: unfold .25s ease-out both; }

.letter { background: #eff0e3; }
.envelope { max-width: 39rem; margin: auto; }
.envelope summary {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .9rem;
  min-height: clamp(12rem, 27vw, 19rem);
  color: var(--paper-white);
  background:
    linear-gradient(29deg, transparent 49.7%, #9cb09585 50%, transparent 50.3%) 0 0 / 50% 67% no-repeat,
    linear-gradient(-29deg, transparent 49.7%, #9cb09585 50%, transparent 50.3%) 100% 0 / 50% 67% no-repeat,
    linear-gradient(155deg, #49634e, #263e32 68%);
  border: 1px solid #71876c;
  box-shadow: 0 .65rem 1.3rem #26382b20;
  font-size: .92rem;
}
.envelope summary:focus-visible { outline-offset: 5px; }
.seal {
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid #c6c698;
  outline: 1px solid #c6c698;
  outline-offset: -4px;
  color: #f4efcf;
  border-radius: 50%;
  background: #61744d;
  box-shadow: 0 .2rem .35rem #14201983;
  font-size: 1.7rem;
  transition: transform .2s;
}
.envelope summary:hover .seal { transform: rotate(-8deg); }
.envelope[open] summary { min-height: 6.8rem; background: var(--forest); box-shadow: none; }
.envelope[open] .seal { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
.envelope[open] .open-label, .envelope:not([open]) .close-label { display: none; }
.letter-sheet {
  padding: clamp(1.4rem, 6vw, 3.9rem);
  border: 1px solid #d9d6c5;
  border-top: 0;
  background: var(--paper-white);
  box-shadow: 0 .65rem 1.3rem #26382b16;
  line-height: 1.8;
}
.envelope[open] .letter-sheet { animation: unfold .32s ease-out both; }
.letter-sheet p + p { margin-top: 1rem; }
.letter-greeting, .signature { font: italic 1.9rem/1.3 var(--serif); }
.letter-greeting { margin-bottom: 1.1rem; }
.signature { margin-top: 1.5rem; }

.letter-access { display: grid; gap: .75rem; }
.letter-access p { color: var(--muted); }
.letter-access button:disabled { cursor: wait; opacity: .7; }
.envelope > div.letter-sheet { white-space: pre-line; }

.family-grid { max-width: 45rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.family-messages { max-width: 45rem; margin: 2rem auto 0; display: grid; gap: .85rem; }
.family-message { border-left: 2px solid #9aaa8c; padding: .8rem 1rem; background: #e9eddf; }
.family-message figcaption { margin-top: .5rem; color: var(--muted); font-size: .92rem; }

.future { padding: 0 var(--edge) var(--section); }
.future-card {
  position: relative;
  max-width: 65rem;
  margin: auto;
  padding: clamp(2.25rem, 6.8vw, 5.25rem) 1.35rem;
  text-align: center;
  color: var(--paper);
  background: radial-gradient(ellipse at 25% 25%, #3c5947, var(--forest-deep) 80%);
}
.future-card::after { content: ""; position: absolute; inset: .68rem; pointer-events: none; border: 1px solid #cad1aa57; }
.future-card p { max-width: 38ch; color: #e2e6ce; margin: .85rem auto 1.35rem; }
.lock-emblem {
  width: 3.15rem;
  height: 3.15rem;
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #d5dcac;
}
.closing { text-align: center; }
.closing .button { margin-top: 1.4rem; }
.wish { margin: 1.3rem auto 0; color: #355540; max-width: 29ch; font: italic 1.65rem/1.4 var(--serif); animation: unfold .3s ease-out both; }
@keyframes unfold { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: translateY(0); } }

footer {
  max-width: 92rem;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 1.3rem var(--edge) 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  color: var(--muted);
}
footer span { font: italic 1.05rem var(--serif); }
footer a { display: inline-flex; min-height: 2.75rem; align-items: center; font-size: .85rem; text-underline-offset: .16em; }

.dialog {
  width: min(25rem, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
  padding: 0;
  border: 1px solid #a1ae96;
  border-radius: .75rem;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1rem 3rem #16251a55;
  overscroll-behavior: contain;
}
.dialog::backdrop { background: #172b22b9; }
.dialog[open] { animation: unfold .22s ease-out both; }
.dialog-inner { position: relative; padding: clamp(1.15rem, 4vw, 1.7rem); text-align: center; }
.dialog .lock-emblem { color: #587354; margin-bottom: .75rem; }
.lock-dialog h2 { font-size: 2rem; padding-inline: .6rem; }
.dismiss { position: absolute; z-index: 1; top: .15rem; right: .15rem; }
.dismiss button {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--forest);
  background: var(--paper);
  font-size: 1.6rem;
  line-height: 1;
}
.dismiss button:hover { background: #e1e6d6; }
.lock-hint, .code-status { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.lock-hint { margin: .55rem auto .85rem; max-width: 29ch; }
.pin-panel {
  width: min(100%, 19rem);
  margin-inline: auto;
  padding: .85rem clamp(.5rem, 3vw, 1.25rem) 1rem;
  text-align: center;
  border: 1px solid #c4af82;
  border-radius: .85rem;
  background: linear-gradient(165deg, #fffaf0, #f1e8d2);
  box-shadow: .08rem .22rem 0 #9e845a27, inset 0 1px #fffaf5;
}
.code-label { display: block; margin-bottom: .55rem; font-size: .93rem; font-weight: 600; }
.code-display { position: relative; width: 100%; max-width: 15.5rem; margin: auto; border-radius: .45rem; }
.code-display:focus-within { outline: 2px solid #7c5e35; outline-offset: 3px; }
.code-display input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: text; }
.code-slots { display: grid; grid-template-columns: repeat(var(--digitos, 4), minmax(0, 1fr)); gap: .23rem; pointer-events: none; }
.code-slots span {
  display: grid;
  place-items: center;
  min-height: 2.3rem;
  border: 1px solid #9a9e78;
  border-radius: .32rem;
  background: var(--paper-white);
}
.code-slots span::after { content: ""; width: .36rem; aspect-ratio: 1; border: 1px solid #91977f; border-radius: 50%; }
.code-slots span[data-filled] { background: #e4ebd7; border-color: #66815e; }
.code-slots span[data-filled]::after { background: #304c39; border-color: #304c39; }
.code-display input[aria-invalid="true"] + .code-slots span { border-color: #a65c46; }
.code-status { min-height: 1.27rem; margin: .32rem auto; max-width: 32ch; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .44rem; max-width: 13rem; margin: auto; }
.keypad button {
  min-width: 0;
  min-height: 2.75rem;
  border: 1px solid #9dAD8e;
  border-radius: 999px;
  background: #e8eddc;
  box-shadow: 0 2px 0 #64785147;
  color: var(--forest);
  font: 600 1.23rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}
.keypad button[data-clear], .keypad button[data-delete] { box-shadow: none; background: #f6f0df; }
.keypad button[data-clear] { font-size: .83rem; }
.keypad button:hover { background: #d9e4cd; }
.keypad button:active { background: #bacbad; transform: translateY(1px); }
.submit-code { width: min(100%, 13rem); justify-content: center; margin-top: .85rem; }
.unlocked {
  display: grid;
  gap: .8rem;
  margin-top: 1rem;
  padding: clamp(1rem, 4vw, 1.4rem);
  border: 1px solid #cfbd95;
  border-radius: .45rem;
  background: #fffaf0;
  color: #394f3b;
  line-height: 1.65;
  text-align: left;
}
#candado .code-display { max-width: 11rem; }
#candado .code-slots { gap: .4rem; }
.photo-dialog { width: fit-content; max-width: calc(100% - 1.5rem); background: var(--paper-white); }
.photo-dialog figure { padding: .55rem; }
.photo-dialog img { max-height: 74dvh; max-width: min(85vw, 58rem); object-fit: contain; }
.photo-dialog figcaption { padding: .6rem 1rem; text-align: center; }
.music { display: grid; justify-items: center; gap: .45rem; padding: 1rem; border-top: 1px solid var(--line); }
.music p { font-size: .875rem; }
.music audio { max-width: 100%; }

@media (max-width: 58rem) {
  .bar { min-height: 4.25rem; }
  .index-toggle {
    display: inline-flex;
    gap: .6rem;
    color: var(--forest);
    padding: .35rem .72rem;
    border: 1px solid #b9c2ad;
    border-radius: 2rem;
    background: transparent;
  }
  .menu-icon { width: .86rem; height: .52rem; border-block: 1px solid currentColor; }
  .index {
    display: none;
    position: absolute;
    top: 100%;
    right: var(--edge);
    max-height: calc(100dvh - 5rem);
    overflow: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 13rem;
    padding: .45rem;
    background: var(--paper-white);
    border: 1px solid var(--line);
    border-radius: .5rem;
    box-shadow: 0 .65rem 1.5rem #203b3025;
  }
  .index-toggle[aria-expanded="true"] + .index { display: flex; }
  .index a { padding-inline: .7rem; }
}

@media (max-width: 44rem) {
  .cover { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .cover::after { inset: .55rem; }
  .cover-copy { padding: clamp(2rem, 8vw, 3.5rem) clamp(1.6rem, 6.8vw, 3rem); }
  .cover h1 { font-size: clamp(3.2rem, 13.4vw, 6rem); margin-block: .75rem 1.05rem; }
  .cover h1 em { font-size: .73em; text-wrap: wrap; }
  .cover .button { margin-top: 1.25rem; }
  .cover-byline, .cover-date { margin-top: .85rem; }
  .cover-figure { aspect-ratio: 15/11; background-position: center 56%; }
  .cover-figure::after { background: linear-gradient(#1b302834 0%, transparent 23%); }
  .birthday-cover h1 { font-size: clamp(2.9rem, 11.5vw, 5.1rem); }
  .birthday-cover h1 em { font-size: 1.25em; }
  .detail-layout { grid-template-columns: minmax(0, 1fr); gap: 1.45rem; }
  .chapter-heading { margin-bottom: 1.9rem; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .polaroid { padding: .45rem .45rem .85rem; }
}

@media (max-width: 22rem) {
  .cover-copy { padding-inline: 1.2rem; }
  .cover h1 { font-size: 3rem; }
  .birthday-cover h1 { font-size: 2.6rem; }
  .photo-grid { grid-template-columns: minmax(0, 1fr); max-width: 14rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
