/* Фарфор: белая глазурь, кобальт, тонкое золото. Сначала телефон. */
:root {
  --porcelain: #f4f2ec;
  --glaze: #fdfcf9;
  --cobalt: #1e3fa3;
  --cobalt-deep: #15296b;
  --wash: rgba(30, 63, 163, 0.08);
  --line: rgba(30, 63, 163, 0.2);
  --gold: #a9822f;
  --ink: #1c2338;
  --muted: #6a7188;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--porcelain);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body.locked { overflow: hidden; height: 100svh; }
h2, h3, p { margin: 0; }
button, textarea, input { font: inherit; color: inherit; }

/* ---------- Вход ---------- */
#gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: var(--pad);
  background: var(--porcelain);
  transition: opacity 0.9s ease 0.15s, transform 1.1s cubic-bezier(.7,0,.2,1) 0.15s, visibility 0s linear 1.3s;
}
#gate.open { opacity: 0; transform: translateY(-6%); visibility: hidden; pointer-events: none; }
.gate-inner { width: min(360px, 100%); text-align: center; }
.gate-rim { width: 104px; height: 104px; color: var(--cobalt); }
.gate-q { font: 500 27px/1.18 var(--serif); color: var(--cobalt-deep); margin: 18px 0 30px; }
.cells-wrap { position: relative; display: block; }
.cells { display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.cell {
  width: 29px; height: 46px;
  border-bottom: 1.5px solid var(--line);
  font: 500 34px/46px var(--serif); font-variant-numeric: lining-nums;
  color: var(--cobalt-deep); text-align: center;
  transition: border-color 0.2s, color 0.5s;
}
.cell.cur { border-bottom: 2.5px solid var(--cobalt); }
.cells i { font: 500 30px/40px var(--serif); font-style: normal; color: var(--muted); }
.cells.bad { animation: shake 0.42s; }
.cells.ok .cell { color: var(--gold); border-bottom-color: var(--gold); }
#gate-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; }
.gate-hint { margin-top: 18px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* ---------- Обложка ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px var(--pad) 84px; text-align: center; position: relative;
}
.plate { width: min(78vw, 340px); height: auto; filter: drop-shadow(0 18px 28px rgba(21, 41, 107, 0.16)); }
.plate-rim { transform-origin: 160px 160px; animation: turn 240s linear infinite; }
.plate-20 { font: 500 132px var(--serif); font-variant-numeric: lining-nums; fill: var(--cobalt); letter-spacing: -2px; }
.plate-let { font: italic 500 30px var(--serif); fill: var(--gold); }
@keyframes turn { to { transform: rotate(360deg); } }
.hero-names { margin-top: 34px; font: 500 38px/1.05 var(--serif); color: var(--cobalt-deep); }
.hero-names i { font-weight: 400; color: var(--gold); padding: 0 2px; }
.hero-dates { margin-top: 10px; font-size: 14px; letter-spacing: 0.14em; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticker { margin-top: 26px; font-size: 15px; color: var(--muted); }
.ticker b { font: 600 26px/1 var(--serif); font-variant-numeric: lining-nums; color: var(--cobalt); padding: 0 3px; }
.ticker .clock { display: inline-block; margin-left: 6px; font-variant-numeric: tabular-nums; color: var(--ink); }
.scroll-hint { position: absolute; bottom: 26px; left: 50%; margin-left: -22px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--cobalt); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(7px); } }

body.locked .plate, body.locked .hero-names, body.locked .hero-dates, body.locked .ticker, body.locked .scroll-hint { opacity: 0; }
.plate, .hero-names, .hero-dates, .ticker, .scroll-hint { transition: opacity 1.2s ease, transform 1.4s cubic-bezier(.2,.7,.2,1); }
body.locked .plate { transform: scale(0.9) rotate(-8deg); }
.hero-names { transition-delay: 0.5s; } .hero-dates { transition-delay: 0.7s; } .ticker { transition-delay: 0.9s; } .scroll-hint { transition-delay: 1.4s; }

/* ---------- Общие блоки ---------- */
.block { max-width: 600px; margin: 0 auto; padding: 72px var(--pad); }
.eyebrow { font-size: 12.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
h2 { font: 500 40px/1.05 var(--serif); color: var(--cobalt-deep); text-wrap: balance; }
.lead { margin-top: 16px; color: var(--ink); max-width: 34em; text-wrap: pretty; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Счётчики ---------- */
.stats { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--glaze); border: 1px solid var(--line); border-radius: 4px; padding: 18px 16px 16px; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; }
.stat b { font: 500 42px/1 var(--serif); font-variant-numeric: lining-nums; color: var(--cobalt); letter-spacing: -0.5px; white-space: nowrap; }
.stat span { margin-top: 10px; font-size: 14px; line-height: 1.3; color: var(--muted); }
.stat--wide { grid-column: 1 / -1; min-height: 0; background: none; border: 0; border-top: 1px solid var(--gold); border-radius: 0; padding: 18px 0 6px; }
.stat--wide p { font: italic 500 23px/1.25 var(--serif); color: var(--cobalt-deep); text-wrap: pretty; }
.stat--wide p em { font-style: normal; color: var(--gold); white-space: nowrap; }
.stat--todo { background: none; border-style: dashed; }
.stat--todo b { color: var(--line); }

/* ---------- Год за годом ---------- */
.years { position: relative; }
.globe-wrap { position: sticky; top: 0; z-index: 3; height: 42svh; min-height: 250px; background: var(--porcelain); }
.globe-wrap::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 34px; background: linear-gradient(var(--porcelain), rgba(244, 242, 236, 0)); pointer-events: none; }
#globe { display: block; width: 100%; height: 100%; }
.globe-label { position: absolute; left: var(--pad); right: var(--pad); bottom: 8px; display: flex; align-items: baseline; gap: 12px; pointer-events: none; }
#g-year { white-space: nowrap; font: 600 50px/0.9 var(--serif); font-variant-numeric: lining-nums; color: var(--cobalt-deep); text-shadow: 0 0 12px var(--porcelain), 0 0 4px var(--porcelain); }
#g-place { font: italic 500 22px/1 var(--serif); color: var(--gold); text-shadow: 0 0 10px var(--porcelain), 0 0 3px var(--porcelain); }

.chapters { list-style: none; margin: 0 auto; padding: 44px var(--pad) 30px; max-width: 600px; display: grid; gap: 84px; }
.chapter { min-height: 56svh; }
.ch-tag { display: flex; align-items: center; gap: 10px; font-size: 12.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--cobalt); }
.chapter--mark .ch-tag { color: var(--gold); }
.chapter--mark .ch-tag::before { background: var(--gold); border-color: var(--gold); }
.ph { margin: 14px 0 0; aspect-ratio: 4 / 5; background: #fff; padding: 9px; box-shadow: 0 1px 2px rgba(21, 41, 107, 0.08), 0 22px 36px -22px rgba(21, 41, 107, 0.35); }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph[data-key] { cursor: zoom-in; }
/* Кадр «проявляется»: сначала кобальтовый, как роспись по фарфору, потом в цвете */
.reveal .ph img { filter: grayscale(1) sepia(1) hue-rotate(185deg) saturate(1.5) brightness(1.06); transition: filter 2.2s ease 0.35s; }
.reveal.in .ph img { filter: none; }
.strip { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.th { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: var(--wash); overflow: hidden; cursor: zoom-in; display: block; }
.th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.th-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(21, 41, 107, 0.62); color: #fff; font: 500 30px var(--serif); font-variant-numeric: lining-nums; }
.ph--empty { display: grid; }
.ph--empty span { display: grid; place-items: center; border: 1px dashed var(--line); background: var(--wash); font: italic 500 22px var(--serif); color: var(--cobalt); opacity: 0.75; }
.chapter:nth-child(odd) .ph { transform: rotate(-0.6deg); }
.chapter:nth-child(even) .ph { transform: rotate(0.5deg); }
.ch-title { margin-top: 22px; font: 500 32px/1.1 var(--serif); color: var(--cobalt-deep); }
.ch-text { margin-top: 8px; text-wrap: pretty; }
.ch-trips { margin-top: 12px; padding-left: 16px; position: relative; font-size: 14px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.ch-trips::before { content: ""; position: absolute; left: 1px; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--cobalt); }
.todo { color: var(--muted); border-left: 2px dashed var(--line); padding-left: 12px; font-size: 15px; }

.memory { margin-top: 16px; }
.memory summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: italic 500 20px var(--serif); color: var(--cobalt); }
.memory summary::-webkit-details-marker { display: none; }
.memory summary::before { content: "+"; font: 400 22px/1 var(--serif); font-style: normal; color: var(--gold); transition: transform 0.25s; }
.memory[open] summary::before { transform: rotate(45deg); }
.memory textarea { display: block; width: 100%; min-height: 96px; margin-top: 4px; padding: 12px 14px; font-size: 16px; line-height: 1.45; background: var(--glaze); border: 1px solid var(--line); border-radius: 4px; resize: vertical; }
.memory textarea:focus, .letter textarea:focus { outline: 2px solid var(--cobalt); outline-offset: 1px; }
.memory-saved { margin-top: 14px; padding-left: 14px; border-left: 2px solid var(--gold); font: italic 500 21px/1.3 var(--serif); color: var(--cobalt-deep); white-space: pre-wrap; }
.memory-saved small { display: block; margin-top: 4px; font: 400 13px var(--sans); color: var(--muted); }
.btn { margin-top: 10px; min-height: 46px; padding: 0 20px; border: 1px solid var(--cobalt); border-radius: 999px; background: var(--cobalt); color: #fff; font-weight: 500; font-size: 15px; cursor: pointer; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: none; color: var(--cobalt); }

/* ---------- Просмотр фото ---------- */
body.viewing { overflow: hidden; }
#viewer { position: fixed; inset: 0; z-index: 40; background: #0e1838; color: #fff; display: flex; flex-direction: column; }
#viewer[hidden] { display: none; }
.v-top { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 8px 4px 18px; font-size: 14px; font-variant-numeric: tabular-nums; opacity: 0.9; }
#v-close { width: 46px; height: 46px; border: 0; background: none; color: #fff; display: grid; place-items: center; cursor: pointer; }
.v-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.v-track::-webkit-scrollbar { display: none; }
.v-track figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; scroll-snap-stop: always; display: grid; place-items: center; min-width: 0; }
.v-track img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.v-cap { margin: 0; padding: 10px 18px max(16px, env(safe-area-inset-bottom)); text-align: center; font: italic 500 20px var(--serif); color: #e9d9b0; }
.v-nav { display: none; position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; place-items: center; cursor: pointer; }
#v-prev { left: 14px; } #v-next { right: 14px; }
@media (hover: hover) and (min-width: 700px) { .v-nav { display: grid; } }

/* ---------- Шторка ---------- */
.compare { position: relative; margin-top: 28px; aspect-ratio: 4 / 5; background: #fff; padding: 9px; box-shadow: 0 1px 2px rgba(21, 41, 107, 0.08), 0 22px 36px -22px rgba(21, 41, 107, 0.35); overflow: hidden; }
.cmp { position: absolute; inset: 9px; display: grid; place-items: center; text-align: center; background-size: cover; background-position: center; }
.cmp span { font: 500 25px/1.1 var(--serif); font-variant-numeric: lining-nums; }
.cmp-then { place-items: center start; padding-left: 5%; }
.cmp-now { place-items: center end; padding-right: 5%; }
.cmp small { display: block; margin-top: 6px; font: 400 13px var(--sans); letter-spacing: 0.06em; opacity: 0.8; }
.cmp-now { background: linear-gradient(160deg, #dfe6f7, #b9c7ea); color: var(--cobalt-deep); }
.cmp-then { background: linear-gradient(160deg, #efe6d3, #d8c59c); color: #5b4518; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-handle { position: absolute; top: 9px; bottom: 9px; left: calc(9px + (100% - 18px) * var(--p, 0.5)); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(21, 41, 107, 0.25); pointer-events: none; }
.cmp-handle i { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: #fff; color: var(--cobalt); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(21, 41, 107, 0.3); }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }

/* ---------- Капсула ---------- */
.capsule { padding-bottom: 40px; }
.future { list-style: none; margin: 30px calc(var(--pad) * -1) 0; padding: 4px var(--pad) 12px; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.future::-webkit-scrollbar { display: none; }
.future li { flex: 0 0 auto; width: 92px; height: 112px; border: 1px dashed var(--line); border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.future b { font: 500 26px/1 var(--serif); font-variant-numeric: lining-nums; color: var(--cobalt); }
.future small { font-size: 11px; letter-spacing: 0.04em; }
.future li.last { border: 1px solid var(--gold); background: var(--glaze); }
.future li.last b { color: var(--gold); }

.letters { margin-top: 26px; display: grid; gap: 18px; }
.letter { background: var(--glaze); border: 1px solid var(--line); border-radius: 4px; padding: 20px 18px 22px; position: relative; overflow: hidden; }
.letter h3 { font: 500 27px/1.1 var(--serif); color: var(--cobalt-deep); }
.letter h3 i { color: var(--gold); font-weight: 400; }
.letter .note { margin-top: 6px; font-size: 14px; color: var(--muted); }
.letter textarea { display: block; width: 100%; min-height: 150px; margin-top: 14px; padding: 12px 14px; font-size: 16px; line-height: 1.5; background: #fff; border: 1px solid var(--line); border-radius: 4px; resize: vertical; }
.letter .sealed { display: none; text-align: center; padding: 8px 0 2px; }
.letter.is-sealed .draft { display: none; }
.letter.is-sealed .sealed { display: block; }
.envelope { width: 168px; height: auto; margin: 6px auto 0; display: block; }
.envelope .wax { transform-origin: 84px 66px; }
.letter.is-sealed.just .envelope .wax { animation: stamp 0.7s cubic-bezier(.2,1.4,.4,1) both; }
.letter.is-sealed.just .envelope .flap { animation: flap 0.5s ease both; transform-origin: 84px 14px; }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flap { from { transform: scaleY(-0.6); opacity: 0.3; } to { transform: none; opacity: 1; } }
.sealed p { margin-top: 14px; font: italic 500 22px/1.25 var(--serif); color: var(--cobalt-deep); }
.sealed small { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.demo-reset { margin-top: 10px; background: none; border: 0; padding: 8px; font-size: 12px; color: var(--muted); text-decoration: underline; cursor: pointer; }

.foot { padding: 30px var(--pad) 70px; text-align: center; color: var(--cobalt); }
.foot p { margin-top: 10px; font: italic 500 22px var(--serif); color: var(--gold); }

/* ---------- Широкий экран ---------- */
@media (min-width: 900px) {
  .block { padding: 110px var(--pad); }
  h2 { font-size: 52px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .years { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 0 40px; align-items: start; }
  .globe-wrap { height: 100vh; }
  .globe-wrap::after { display: none; }
  .globe-label { bottom: 12vh; }
  #g-year { font-size: 84px; }
  #g-place { font-size: 30px; }
  .chapters { padding: 22vh 0 30vh; margin: 0; gap: 120px; }
  .letters { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .plate-rim, .scroll-hint { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  #gate { transition: opacity 0.3s; }
}
