/* Về Phía Em — giao diện là những mẩu giấy viền mực dán lên màn hình, "boil" 6 bước/giây như nét chì trong cảnh. */
:root {
  --ink: #1a1410;
  --paper: #f2efe6;
  --paper-2: #fbf7ec;
  --red: #b5322a;
  --hl: #4da3ff;
  --f-type: 'Space Mono', ui-monospace, Menlo, monospace;
  --f-body: 'Noto Serif', Georgia, serif;
  --f-loud: 'Anton', 'Oswald', Impact, sans-serif;
  --scrap:
    repeating-linear-gradient(45deg, rgba(26, 20, 16, .07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, rgba(26, 20, 16, .05) 0 1px, transparent 1px 6px),
    url(../assets/img/paper.webp);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0b0b; overscroll-behavior: none; }
body { color: var(--ink); font: 400 16px/1.5 var(--f-body); -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--hl); outline-offset: 3px; }
.stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* chữ cắt báo trong HTML */
.rn { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .08em .3em; line-height: 1; }
.rn-w { display: inline-flex; align-items: center; gap: .03em; white-space: nowrap; }
.rn-gap { display: none; }
.rn-ch {
  display: inline-block; font-size: calc(var(--fs) * 1em); line-height: 1; padding: .07em .1em .03em; min-width: .5em; text-align: center;
  color: var(--fg); background: var(--bg); transform: rotate(var(--rot)) translateY(var(--dy)); box-shadow: .025em .045em 0 rgba(0, 0, 0, .28);
}

/* nhịp stop-motion chung: 3 tư thế, 6 bước/giây */
@keyframes boil { 0% { translate: 0 0; rotate: 0deg; } 33% { translate: .5px -.5px; rotate: .5deg; } 66% { translate: -.5px .5px; rotate: -.5deg; } }
.scrap {
  border: 2.5px solid var(--ink); border-radius: 3px; background-color: var(--paper); background-image: var(--scrap);
  background-size: auto, auto, 520px; box-shadow: 3px 3px 0 rgba(26, 20, 16, .35); color: var(--ink);
}

/* ---------- màn chờ ---------- */
.hw-load {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px;
  background: #ece8de url(../assets/img/paper.webp); background-size: 620px; transition: opacity .55s ease;
}
.hw-load.is-done { opacity: 0; pointer-events: none; }
.hw-load__sheet {
  width: min(430px, 100%); padding: 22px 22px 16px; rotate: -.8deg; animation: boil .5s steps(1, end) infinite;
  border: 2.5px solid var(--ink); border-radius: 3px; background: var(--paper-2) url(../assets/img/paper.webp); background-size: 520px; box-shadow: 5px 5px 0 rgba(26, 20, 16, .35);
  position: relative;
}
.hw-load__sheet::before, .hw-load__sheet::after { content: ''; position: absolute; top: -11px; width: 74px; height: 22px; background: rgba(232, 220, 186, .85); }
.hw-load__sheet::before { left: 16px; rotate: -5deg; }
.hw-load__sheet::after { right: 20px; rotate: 4deg; }
.hw-load__title { margin: 2px 0 16px; font-size: 26px; font-weight: 400; }
.hw-load__bar { height: 12px; border: 2px solid var(--ink); background: #fffdf7; padding: 1px; }
.hw-load__bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-55deg, var(--ink) 0 2px, transparent 2px 5px); }
.hw-load__row { display: flex; justify-content: space-between; margin: 7px 0 16px; font: 700 11px/1 var(--f-type); text-transform: uppercase; letter-spacing: .06em; color: #5f5649; }
.hw-load__enter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hw-load__enter button {
  display: grid; gap: 4px; min-height: 58px; padding: 10px 8px; cursor: pointer; text-align: center;
  font: 700 12px/1.2 var(--f-type); letter-spacing: .05em; text-transform: uppercase;
  border: 2.5px solid var(--ink); border-radius: 3px; background: #fffdf7; box-shadow: 2px 2px 0 rgba(26, 20, 16, .35);
  opacity: .3; transition: opacity .3s, transform .12s;
}
.hw-load__enter button.loud { background: var(--ink); color: var(--paper); }
.hw-load__enter small { font: italic 400 11px/1.2 var(--f-body); text-transform: none; letter-spacing: 0; opacity: .85; }
.hw-load.is-ready .hw-load__enter button { opacity: 1; }
.hw-load__enter button:not(:disabled):hover { transform: translate(-1px, -2px); box-shadow: 3px 4px 0 rgba(26, 20, 16, .45); }
.hw-load__foot { margin: 14px 0 0; font: italic 400 12px/1.4 var(--f-body); color: #6b6253; }
@media (max-width: 420px) { .hw-load__enter { grid-template-columns: 1fr; } }

/* ---------- nút góc ---------- */
.hw-mute, .hw-open {
  position: fixed; z-index: 12; top: calc(18px + env(safe-area-inset-top, 0px)); cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 3px; background: var(--paper) var(--scrap); background-size: auto, auto, 400px;
  box-shadow: 3px 3px 0 rgba(26, 20, 16, .35); animation: boil .5s steps(1, end) infinite; opacity: 0; transition: opacity .6s;
}
html.is-in .hw-mute, html.is-in .hw-open { opacity: 1; }
.hw-mute { right: 22px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; }
.hw-mute svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hw-mute .spk { fill: var(--ink); }
.hw-mute[aria-pressed='true'] .off, .hw-mute[aria-pressed='false'] .on { display: none; }
.hw-open { left: 22px; padding: 7px 10px; font-size: 15px; rotate: -1.5deg; }
.hw-open:hover, .hw-mute:hover { box-shadow: 4px 4px 0 rgba(26, 20, 16, .5); }

/* ---------- gợi ý ---------- */
.hw-prompt { position: fixed; z-index: 11; pointer-events: none; }
.hw-prompt[data-prompt='bottom'] { left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; }
.hw-prompt--top { right: 80px; top: calc(18px + env(safe-area-inset-top, 0px)); }
.hw-prompt .inner {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 9px 14px 10px; white-space: nowrap;
  border: 2.5px solid var(--ink); border-radius: 3px; background-color: var(--paper); background-image: var(--scrap); background-size: auto, auto, 400px;
  box-shadow: 3px 3px 0 rgba(26, 20, 16, .35); opacity: 0; transform: rotate(-1deg) translateY(7px) scale(.96); transition: opacity .14s ease-out, transform .14s ease-out;
  font-size: 17px;
}
.hw-prompt.is-visible .inner { opacity: 1; transform: rotate(-1deg); animation: boil .5s steps(1, end) infinite; }
.hw-prompt:not(.is-visible) .inner { pointer-events: none; }
.hw-prompt .keys { display: flex; align-items: center; gap: 4px; }
.hw-prompt .keys:empty { display: none; }
.hw-prompt kbd {
  display: inline-block; min-width: 12px; padding: 4px 7px; border: 2px solid var(--ink); border-radius: 3px; background: #fffdf7;
  box-shadow: 2px 2px 0 rgba(26, 20, 16, .35); font: 700 12px/1 var(--f-type); text-transform: uppercase; rotate: -3deg;
}
.hw-prompt .sep { font: 700 11px/1 Georgia, serif; opacity: .65; }
.hw-prompt.pulse.is-visible kbd { animation: lift 1.8s ease-in-out infinite; }
@keyframes lift { 50% { translate: 0 -2px; } }

/* ---------- nhãn rê chuột ---------- */
.hw-hover { position: fixed; left: 0; top: 0; z-index: 13; pointer-events: none; }
.hw-hover span {
  position: absolute; left: 0; bottom: 0; translate: -50% 0; display: inline-flex; padding: 6px 9px; white-space: nowrap; font-size: 14px;
  border: 2px solid var(--ink); border-radius: 3px; background: var(--paper-2) var(--scrap); background-size: auto, auto, 300px; box-shadow: 2px 2px 0 rgba(26, 20, 16, .35);
  opacity: 0; transform: rotate(-1.5deg) translateY(6px); transition: opacity .12s, transform .12s;
}
.hw-hover.is-visible span { opacity: 1; transform: rotate(-1.5deg); animation: boil .5s steps(1, end) infinite; }

/* ---------- cần điều khiển ảo ---------- */
.stick { display: none; }
html.is-touch.is-in .stick {
  display: block; position: fixed; z-index: 11; left: 26px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 116px; height: 116px; border-radius: 50%;
  border: 2.5px solid var(--ink); background: rgba(251, 247, 236, .8) var(--scrap); background-size: auto, auto, 300px; box-shadow: 3px 3px 0 rgba(26, 20, 16, .35); touch-action: none;
}
.stick i {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: var(--ink); box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .15); transition: transform .08s;
}
html.is-touch .hw-prompt[data-prompt='bottom'] { left: auto; right: 18px; translate: 0 0; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
html.is-touch .hw-prompt .inner { font-size: 15px; }
html.is-touch .hw-prompt--top { right: 16px; top: calc(74px + env(safe-area-inset-top, 0px)); }

/* ---------- cửa sổ nội dung ---------- */
.hw-panel { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; visibility: hidden; opacity: 0; transition: opacity .16s ease-out, visibility 0s linear .16s; }
.hw-panel.is-open { pointer-events: auto; visibility: visible; opacity: 1; transition: opacity .16s ease-out, visibility 0s; }
.hw-panel__backdrop { position: absolute; inset: 0; background-color: rgba(26, 20, 16, .55); background-image: repeating-linear-gradient(45deg, rgba(26, 20, 16, .18) 0 1px, transparent 1px 6px); }
.hw-panel__sheet {
  position: relative; display: flex; flex-direction: column; width: min(580px, 100%); max-height: min(84vh, 720px); padding: 20px 22px 18px;
  border: 3px solid var(--ink); border-radius: 3px; background-color: var(--paper); background-image: repeating-linear-gradient(45deg, rgba(26, 20, 16, .05) 0 1px, transparent 1px 6px), url(../assets/img/paper.webp);
  background-size: auto, 560px; box-shadow: 7px 7px 0 rgba(26, 20, 16, .4); transform: rotate(-.6deg) translateY(10px) scale(.97); transition: transform .16s ease-out; outline: none;
}
.hw-panel.is-open .hw-panel__sheet { transform: rotate(-.6deg); animation: boil .5s steps(1, end) infinite; }
.hw-panel__sheet::before, .hw-panel__sheet::after { content: ''; position: absolute; top: -12px; width: 86px; height: 24px; background: rgba(232, 220, 186, .85); }
.hw-panel__sheet::before { left: 22px; rotate: -6deg; }
.hw-panel__sheet::after { right: 26px; rotate: 5deg; }
.hw-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 2px dashed rgba(26, 20, 16, .35); }
.hw-panel__kicker { margin: 0 0 8px; font: 700 11px/1 var(--f-type); letter-spacing: .1em; text-transform: uppercase; color: #6b6253; }
.hw-panel__title { margin: 0; font-size: 25px; font-weight: 400; }
.hw-panel__close { flex: none; width: 38px; height: 38px; cursor: pointer; border: 2.5px solid var(--ink); border-radius: 3px; background: #fffdf7; box-shadow: 2px 2px 0 rgba(26, 20, 16, .35); font-size: 15px; }
.hw-panel__close:hover { background: var(--ink); color: var(--paper); }
.hw-panel__body { overflow: auto; overscroll-behavior: contain; padding: 14px 2px 2px; scrollbar-width: thin; }
.hw-panel__body p { margin: 0 0 10px; }
.lead { font-size: 17px; }
.names { font: 400 34px/1.05 var(--f-loud); text-transform: uppercase; letter-spacing: .02em; margin: 2px 0 6px !important; }
.names i { font: italic 400 .6em var(--f-body); }
.pic { display: block; width: min(320px, 80%); height: auto; margin: 4px auto 8px; filter: drop-shadow(3px 4px 0 rgba(26, 20, 16, .25)); }
.facts { margin: 0 0 12px; display: grid; gap: 6px; }
.facts div { display: grid; grid-template-columns: 70px 1fr; gap: 10px; border-bottom: 1.5px dashed rgba(26, 20, 16, .3); padding-bottom: 6px; }
.facts dt { font: 700 11px/1.6 var(--f-type); text-transform: uppercase; letter-spacing: .08em; }
.facts dd { margin: 0; font-weight: 700; }
.facts small { font-weight: 400; color: #5f5649; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; margin: 4px 0 14px; padding: 8px; border: 2px solid var(--ink); background: #fffdf7; }
.cd p { margin: 0 !important; }
.cd b { display: block; font: 400 30px/1 var(--f-loud); }
.cd span { font-size: 12px; color: #6b6253; }
.row { display: flex; flex-wrap: wrap; gap: 9px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 13px; cursor: pointer; text-decoration: none;
  font: 700 12px/1 var(--f-type); letter-spacing: .05em; text-transform: uppercase; border: 2.5px solid var(--ink); border-radius: 3px;
  background: var(--ink); color: var(--paper); box-shadow: 2px 2px 0 rgba(26, 20, 16, .35); transition: transform .12s;
}
.btn:hover { transform: translate(-1px, -2px); }
.btn.ghost { background: #fffdf7; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.timeline { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: start; }
.timeline .when { font: 400 24px/1 var(--f-loud); padding: 4px 6px 2px; background: var(--ink); color: var(--paper); text-align: center; rotate: -2deg; }
.timeline b { display: block; }
.timeline p { margin: 2px 0 0 !important; font-size: 14px; color: #3d362d; }
.fam { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 10px; border-top: 2px dashed rgba(26, 20, 16, .3); }
.fam p { font-size: 14px; }
.notes { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 6px; }
.album { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 10px; }
.album figure { margin: 0; padding: 8px 8px 6px; background: #fffdf7; border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(26, 20, 16, .3); rotate: var(--r); }
.album img { display: block; width: 100%; height: auto; }
.album figcaption { font: 700 11px/1.4 var(--f-type); text-align: center; padding-top: 5px; }
.tiny { font-size: 12px; color: #6b6253; }
.controls { display: grid; gap: 10px; }
.control { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 2px solid var(--ink); background: #fffdf7; }
.control p { margin: 0 !important; font-size: 13px; color: #5f5649; }
.switch { display: inline-flex; border: 2px solid var(--ink); }
.switch button { border: 0; padding: 7px 11px; min-height: 36px; cursor: pointer; background: transparent; font: 700 11px/1 var(--f-type); text-transform: uppercase; }
.switch button.on { background: var(--ink); color: var(--paper); }
.bin { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bin li { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 10px; border: 2px solid var(--ink); background: #fffdf7; }
.bin b { font: 700 13px/1.3 var(--f-type); word-break: break-all; }
.bin p { margin: 2px 0 0 !important; font-size: 12px; color: #6b6253; }
.bin .status { grid-column: 1 / -1; margin: 0 !important; font-size: 13px; color: #2a6b38; }
.bin .status.denied { color: var(--red); }
.rsvp { display: grid; gap: 12px; }
.rsvp fieldset { margin: 0; padding: 0; border: 0; }
.rsvp legend, .field > span { display: block; margin-bottom: 6px; font: 700 11px/1.2 var(--f-type); text-transform: uppercase; letter-spacing: .08em; }
.field small { font: italic 400 12px var(--f-body); text-transform: none; letter-spacing: 0; }
.field input, .field textarea { width: 100%; padding: 9px 10px; border: 2px solid var(--ink); border-radius: 0; background: #fffdf7; font: 400 16px/1.3 var(--f-body); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-block; padding: 9px 12px 8px; border: 2px solid var(--ink); background: #fffdf7; font: 700 12px/1 var(--f-type); text-transform: uppercase; }
.choice input:checked + span { background: var(--ink); color: var(--paper); rotate: -2deg; }
.choice input:focus-visible + span { outline: 3px solid var(--hl); outline-offset: 2px; }
.stepper { display: inline-flex; border: 2px solid var(--ink); background: #fffdf7; }
.stepper button { width: 42px; min-height: 40px; border: 0; background: transparent; font-size: 19px; cursor: pointer; }
.stepper input { width: 3em; border: 0; border-inline: 2px solid var(--ink); text-align: center; -moz-appearance: textfield; font: 700 15px var(--f-type); background: transparent; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.hint, .demo { font-size: 13px; color: #5f5649; }
.err { color: var(--red); margin: 0 !important; }
.thanks { text-align: center; padding: 12px 0; }
.thanks .big { font: 400 28px/1.1 var(--f-loud); text-transform: uppercase; }
@media (max-width: 560px) {
  .hw-panel { padding: 12px; }
  .hw-panel__sheet { padding: 16px 14px 14px; max-height: 88vh; }
  .fam { grid-template-columns: 1fr; }
  .hw-prompt--top { right: 76px; }
  .hw-open { left: 16px; } .hw-mute { right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .hw-load__sheet, .hw-mute, .hw-open, .hw-prompt.is-visible .inner, .hw-hover.is-visible span, .hw-panel.is-open .hw-panel__sheet { animation: none; }
}
