/* Washi Post web viewer: the app's "Japanese nostalgic" palette (WashiColors). */
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/fonts/BeVietnamPro.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/fonts/BeVietnamPro-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('/fonts/Lora.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ivory: #f4efe5;
  --paper: #fbf8f2;
  --ink: #493d36;
  --muted: #6e6259;
  --border: #dccfbb;
  --terracotta: #a77c65;
  --terracotta-text: #8a5f49;
  --danger: #8b2f27;
  --wax: #8e4a44;
  --wax-rim: #7c3f3a;
  --env-back: #e1d2ba;
  --env-flap: #e6d9c3;
  --env-line: #d2c1a6;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--ivory);
  color: var(--ink);
  font: 400 16px/1.55 'Be Vietnam Pro', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 15px/1 'Lora', Georgia, serif;
  letter-spacing: 0.02em;
  padding: 8px 4px 20px;
}

.seal-mini {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--wax);
  color: var(--ivory);
  font-size: 13px;
  box-shadow: inset 0 0 0 2px var(--wax-rim);
}

.card { text-align: center; }
.card.enter { animation: rise 420ms cubic-bezier(.2, .8, .2, 1) both; }

h1 {
  font: 600 1.45rem/1.3 'Lora', Georgia, serif;
  margin: 24px 0 8px;
}

h1.from { margin-top: 4px; }

h2 {
  font: 600 1.15rem/1.3 'Lora', Georgia, serif;
  margin: 0 0 6px;
}

p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; padding: 48px 0; }
.error { color: var(--danger); min-height: 1.4em; margin: 8px 0; }

.question {
  margin: 12px 0 16px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: italic 1.08rem/1.5 'Lora', Georgia, serif;
}

.unlock { text-align: left; }
.unlock label { display: block; font-weight: 600; margin-bottom: 6px; }

.unlock input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.unlock input:focus { outline: 2px solid var(--terracotta); outline-offset: 1px; }

.button {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta-text);
  color: #fff;
  font: 600 1rem/1.2 'Be Vietnam Pro', system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.6; }

.link-button {
  margin-top: 12px;
  background: none;
  border: 0;
  color: var(--terracotta-text);
  font: 600 0.95rem 'Be Vietnam Pro', system-ui, sans-serif;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Envelope ---- */
.envelope {
  position: relative;
  width: min(300px, 80vw);
  aspect-ratio: 1.6;
  margin: 24px auto 8px;
  transition: margin-top 400ms ease;
}
/* Room above for the flap and the letter rising out of it. */
.envelope.open { margin-top: 120px; }
.envelope > div { position: absolute; }
.env-back {
  inset: 0;
  background: var(--env-back);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(73, 61, 54, 0.18);
}
.env-letter {
  left: 7%;
  right: 7%;
  top: 8%;
  height: 84%;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(73, 61, 54, 0.15);
  transition: transform 900ms cubic-bezier(.2, .8, .2, 1) 450ms;
}
.env-front {
  inset: 0;
  background: var(--env-flap);
  border-radius: 6px;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  display: grid;
  place-items: end start;
  padding: 0 0 14% 12%;
}
.env-to { font: italic 1rem 'Lora', Georgia, serif; color: var(--ink); }
.env-flap {
  left: 0;
  right: 0;
  top: 0;
  height: 56%;
  background: var(--env-line);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 600ms ease-in, z-index 0s 300ms;
  z-index: 2;
}
.env-stamp {
  right: 6%;
  bottom: 12%;
  width: 15%;
  aspect-ratio: 0.82;
  background: var(--ivory);
  border: 3px dotted var(--terracotta);
  outline: 2px solid var(--ivory);
}
.env-seal {
  left: 50%;
  top: 56%;
  width: 18%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--wax);
  box-shadow: inset 0 0 0 3px var(--wax-rim), 0 2px 4px rgba(0, 0, 0, 0.2);
  color: var(--ivory);
  display: grid;
  place-items: center;
  font: 600 1.1rem 'Lora', Georgia, serif;
  z-index: 3;
  transition: opacity 250ms ease;
}
.envelope.open .env-seal { opacity: 0; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-letter { transform: translateY(-48%); }

/* ---- Reading ---- */
.pages { display: grid; gap: 16px; margin: 16px 0 28px; }
.page {
  margin: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(73, 61, 54, 0.16);
}
.page img { display: block; width: 100%; height: auto; }

.reply {
  text-align: center;
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

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