/* ============================================================
   Unspoken — public theme
   Ink-blue desk at night, warm lamplight, paper letter, wax seal.
   ============================================================ */

:root {
  --ink: #12161d;
  --ink-soft: #1b212b;
  --paper: #ece3d2;
  --paper-shadow: #d9cdb6;
  --amber: #d99c52;
  --amber-soft: #f0c98a;
  --rust: #8a3a26;
  --mist: #8b96a3;
  --line: rgba(255, 255, 255, 0.09);
  --text-on-ink: #e7e9ec;

  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--text-on-ink);
  font-family: var(--font-body);
}

body {
  position: relative;
  overflow-x: hidden;
}

/* ambient lamplight glow, fixed, subtle */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  width: 1200px;
  height: 1200px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(217, 156, 82, 0.10) 0%, rgba(217, 156, 82, 0) 60%);
  pointer-events: none;
  z-index: 0;
}

/* optional background photo (site-wide default or per-person override) */
body.has-photo-bg {
  position: relative;
  background-size: cover;
  background-position: center top;
  /* intentionally no background-attachment: fixed — it scrolls naturally with
     the page, scaling to cover however tall the letter ends up being, so a
     longer letter never needs a re-cropped image. */
}

body.has-photo-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18,22,29,0.85), rgba(18,22,29,0.92));
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mist);
  margin: 0 0 14px;
}

h1.title {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(34px, 6vw, 50px);
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--text-on-ink);
}

p.tagline {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--mist);
  margin: 0 0 48px;
  max-width: 46ch;
}

.landing-note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: #c9b896;
  border-left: 2px solid var(--amber);
  padding-left: 16px;
  margin: -18px 0 40px;
  max-width: 46ch;
  white-space: pre-wrap;
}

/* ---------- picker list ---------- */

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-on-ink);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.picker-item:hover {
  border-color: var(--amber);
  background: #20272f;
  transform: translateX(4px);
}

.picker-item .num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  min-width: 38px;
}

.picker-item .name {
  font-family: var(--font-display);
  font-size: 20px;
}

.empty-state {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--mist);
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 28px;
  text-align: center;
}

/* ---------- ambient motes (landing page only) ---------- */

.motes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.mote {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber-soft);
  opacity: 0;
  animation: float-up linear infinite;
}

@keyframes float-up {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.55; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* ---------- gate card ---------- */

.gate-card {
  background: var(--paper);
  color: #2a241c;
  border-radius: 3px;
  padding: 40px 36px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.55);
  position: relative;
}

.gate-card .num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--rust);
  text-transform: uppercase;
}

.gate-card h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 28px;
  margin: 10px 0 6px;
}

.gate-card p.hint {
  font-family: var(--font-body);
  font-size: 15px;
  color: #5a5142;
  margin: 0 0 28px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6152;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--paper-shadow);
  background: #fbf7ee;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 16px;
  color: #2a241c;
}

.field input:focus {
  outline: none;
  border-color: var(--rust);
}

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--rust);
  color: #fbf7ee;
  border: none;
  padding: 14px 26px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:hover { background: #6f2c1c; }

.btn-ghost {
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--line);
}

.btn-ghost:hover { color: var(--text-on-ink); border-color: var(--mist); }

.error-msg {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--rust);
  background: #f3e2d8;
  border: 1px solid #e3b79f;
  border-radius: 2px;
  padding: 12px 14px;
  margin-bottom: 22px;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mist);
  text-decoration: none;
}
.back-link:hover { color: var(--amber); }

/* ---------- wax seal ---------- */

.seal-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

.seal {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a8452c, var(--rust) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 40px;
  color: #f0d9c8;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.6), inset 0 -4px 10px rgba(0,0,0,0.25);
  cursor: pointer;
  border: none;
  transition: transform 0.25s ease;
}

.seal:hover { transform: scale(1.04); }

.seal.cracking {
  animation: crack 0.6s ease forwards;
}

@keyframes crack {
  0% { transform: scale(1); }
  40% { transform: scale(1.08) rotate(-3deg); }
  100% { transform: scale(0); opacity: 0; }
}

.seal-caption {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}

/* ---------- letter page ---------- */

.letter-stage {
  display: none;
}

.letter-stage.visible {
  display: block;
  animation: fadein 1s ease forwards;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.letter-card {
  background: var(--paper);
  color: #2a241c;
  border-radius: 3px;
  padding: 48px 40px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6);
}

.letter-card .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--rust);
  letter-spacing: 0.12em;
}

.dateline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: #6b6152;
  margin: 2px 0 0;
}

.letter-photo {
  margin: 18px 0 24px;
  text-align: center;
  overflow: hidden;
}

.letter-photo img {
  display: inline-block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 360px;
  border-radius: 2px;
  box-shadow: 0 10px 26px -8px rgba(0,0,0,0.35);
  border: 6px solid #fff;
  box-sizing: border-box;
  transform: rotate(-1deg);
}

.letter-card .to {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 30px;
  margin: 8px 0 28px;
}

.nickname-touch {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 15px;
  color: #6b6152;
  margin-top: 6px;
}

.letter-body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.letter-body p {
  margin: 0 0 1.2em;
}

.reveal-p {
  opacity: 0;
  animation: paragraph-in 0.9s ease forwards;
}

@keyframes paragraph-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sign-off-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  margin-top: 8px;
  color: #4a4334;
  opacity: 0;
  animation: paragraph-in 0.9s ease forwards;
}

.music-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--paper-shadow);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #6b6152;
}

.music-bar button {
  background: none;
  border: 1px solid var(--paper-shadow);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: #5a5142;
}

.edit-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #8a7d63;
  margin-top: 28px;
  font-style: italic;
}

.reply-box {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--paper-shadow);
}

.reply-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b6152;
  margin: 0 0 12px;
}

.reply-box textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--paper-shadow);
  background: #fbf7ee;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 15px;
  color: #2a241c;
  resize: vertical;
}

.reply-box textarea:focus {
  outline: none;
  border-color: var(--rust);
}

.btn-reply {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--rust);
  padding: 9px 18px;
  border-radius: 2px;
  cursor: pointer;
}

.btn-reply:hover {
  background: var(--rust);
  color: #fbf7ee;
}

.reply-sent {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #5a6b4a;
  font-style: italic;
}

footer.signoff {
  text-align: center;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mist);
  text-transform: uppercase;
}

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

@media (max-width: 480px) {
  .gate-card, .letter-card { padding: 30px 22px; }
}
