/* TFM Letter — UM login, register and password reset as a letter by candlelight
   (php/tfm-letter.php, js/tfm-letter.js). Variant F of
   docs/mocks/um-login-variants-mock.html. Build table: docs/immersion.md section 5.

   Elementor:  .tfm-letter-page   whole page (dark, spiral + vignette by JS)
                 └ .tfm-letter-stage  holds the letter(s); candle + light by JS
                     ├ .tfm-letter                     guests: texts + UM form
                     └ .tfm-letter.tfm-letter--member  logged in (login/register)
   tfm-um.css styles UM everywhere with !important; the rules here are scoped
   to body.tfm-letter-on .tfm-letter to win against them. */

/* ── Page ── */
/* UM pages belong to no area: the letter takes the Village gold (Nico, 17.11.2026) */
.tfm-letter-page {
  --area-accent: #d4a843; --area-accent-soft: #e8c97a; --area-accent-glow: rgba(212, 168, 67, .4);
  position: relative; isolation: isolate; overflow: hidden; background: #08050e;
}
.tfm-letter-spiral {
  position: absolute; left: 50%; top: 50%; width: 1100px; height: 1100px; margin: -550px 0 0 -550px;
  z-index: -3; opacity: .22; pointer-events: none; animation: tfmLetterSpin 140s linear infinite;
}
.tfm-letter-spiral path { fill: none; stroke: rgba(212, 168, 67, .6); stroke-width: 12; }
.tfm-letter-spiral path + path { stroke: rgba(150, 90, 230, .5); }
@keyframes tfmLetterSpin { to { transform: rotate(360deg); } }
.tfm-letter-vignette { position: absolute; inset: 0; z-index: -2; pointer-events: none; background: radial-gradient(ellipse 55% 60% at 50% 45%, transparent 10%, #08050e 72%); }

/* ── Stage: candle + its light at the lower right corner of the letter ── */
.tfm-letter-stage { position: relative; }
.tfm-letter-glow {
  position: absolute; right: -450px; bottom: -420px; width: 900px; height: 900px; z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 196, 110, .2) 0, rgba(212, 168, 67, .08) 28%, transparent 60%);
  animation: tfmLetterFlicker 5s ease-in-out infinite;
}
@keyframes tfmLetterFlicker { 0%, 100% { opacity: .9; transform: scale(1); } 30% { opacity: 1; transform: scale(1.02); } 55% { opacity: .82; } 70% { opacity: .96; transform: scale(.99); } }
.tfm-letter-candle { position: absolute; right: -14px; bottom: -18px; z-index: 3; width: 26px; text-align: center; pointer-events: none; filter: drop-shadow(-6px 8px 8px rgba(0, 0, 0, .55)); }
.tfm-letter-candle i { display: block; margin: 0 auto; }
.tfm-letter-flame {
  width: 14px; height: 30px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 75%, #fff6d8, #ffc46e 45%, rgba(255, 140, 60, .2) 75%, transparent 80%);
  box-shadow: 0 0 34px 10px rgba(255, 190, 100, .38); animation: tfmLetterFlame 2.6s ease-in-out infinite; transform-origin: 50% 100%;
}
@keyframes tfmLetterFlame { 50% { transform: scaleY(1.12) skewX(-3deg); } }
.tfm-letter-wick { width: 2px; height: 6px; background: #2a1d10; }
.tfm-letter-body { width: 22px; height: 48px; border-radius: 3px 3px 2px 2px; background: linear-gradient(90deg, #cdbb9a, #f1e4c8 45%, #b9a582); box-shadow: inset 0 6px 6px -4px rgba(255, 220, 160, .9); }

/* ── The letter ── */
.tfm-letter {
  position: relative; text-align: center; border-radius: 6px !important; transform: rotate(-.6deg);
  background:
    radial-gradient(ellipse 75% 55% at 100% 100%, rgba(255, 196, 110, .18), transparent 70%),
    linear-gradient(180deg, #2a1f38, #1a1226) !important;
  border: 1px solid rgba(212, 168, 67, .3) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 18px 14px 60px -20px rgba(255, 190, 100, .35), inset 0 0 60px rgba(0, 0, 0, .35);
}
/* only where a member letter exists (login, register); the reset page keeps its form */
body.logged-in .tfm-letter-stage:has(> .tfm-letter--member) > .tfm-letter:not(.tfm-letter--member),
body:not(.logged-in) .tfm-letter--member { display: none !important; }

.tfm-letter-to, .tfm-letter-to * {
  font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important;
  font-size: 1.05rem !important; color: var(--muted, #b6afc7) !important; text-align: left !important;
}
.tfm-letter-to p, .tfm-letter-intro p, .tfm-letter-switch p { margin: 0; }
.tfm-letter-title .elementor-heading-title {
  font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important; font-weight: 400 !important;
  font-size: clamp(2rem, 6vw, 2.5rem) !important; line-height: 1.1 !important; color: var(--ink, #f6f1ea) !important;
  text-shadow: 0 0 24px rgba(255, 190, 100, .25);
}
.tfm-letter-intro, .tfm-letter-intro * {
  font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important;
  font-size: 1.15rem !important; line-height: 1.5 !important; color: var(--muted, #b6afc7) !important;
}
.tfm-letter-intro { max-width: 30ch; margin-inline: auto; }
.tfm-letter-switch { border-top: 1px solid rgba(212, 168, 67, .14); padding-top: 14px; }
.tfm-letter-switch, .tfm-letter-switch p { font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important; font-size: 1.02rem !important; color: var(--muted, #b6afc7) !important; }
.tfm-letter-switch a {
  font-family: Jost, sans-serif !important; font-style: normal !important; font-size: .74rem !important; letter-spacing: .14em;
  text-transform: uppercase; text-decoration: none !important; margin-left: 6px; color: var(--area-accent-soft, #e8c97a) !important;
}

/* ── The UM form inside the letter ── */
body.tfm-letter-on .tfm-letter .um { max-width: none !important; width: 100% !important; margin: 0 !important; padding: 0 !important; opacity: 1 !important; }
body.tfm-letter-on .tfm-letter .um .um-form { background: transparent !important; }
body.tfm-letter-on .tfm-letter .um-field { padding: 0 0 12px !important; text-align: left; }
body.tfm-letter-on .tfm-letter .um-field-label,
body.tfm-letter-on .tfm-letter .um-field-label label {
  font-family: Jost, sans-serif !important; font-size: .68rem !important; letter-spacing: .14em !important; text-transform: uppercase !important;
  color: rgba(212, 168, 67, .8) !important; margin-bottom: 2px !important; border: 0 !important;
}
body.tfm-letter-on .tfm-letter .um-field-label .um-req { color: rgba(212, 168, 67, .6) !important; }
body.tfm-letter-on .tfm-letter .um-field-area input.um-form-field,
body.tfm-letter-on .tfm-letter .um-field-input input:not([type=checkbox]):not([type=radio]) {
  background: transparent !important; border: 0 !important; border-bottom: 1px dashed rgba(212, 168, 67, .45) !important; border-radius: 0 !important;
  padding: 8px 2px !important; font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important;
  font-size: 1.15rem !important; color: var(--ink, #f6f1ea) !important; box-shadow: none !important; height: auto !important;
}
body.tfm-letter-on .tfm-letter .um-field-area input.um-form-field:focus {
  border-bottom-color: var(--area-accent, #d4a843) !important; box-shadow: 0 6px 14px -10px rgba(255, 190, 100, .9) !important; outline: none !important;
}
body.tfm-letter-on .tfm-letter .um-field-area input.um-form-field::placeholder { color: transparent !important; }
body.tfm-letter-on .tfm-letter .um-field-area { position: relative; }
/* password reset: UM gives this field no label, the placeholder stands in */
body.tfm-letter-on .tfm-letter .um-field-username_b input.um-form-field::placeholder { color: rgba(182, 175, 199, .55) !important; opacity: 1; }

/* errors */
body.tfm-letter-on .tfm-letter .um-field-error {
  background: none !important; color: #f2c6cf !important; padding: 4px 0 0 !important; margin: 0 !important;
  font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important; font-size: .98rem !important;
}
body.tfm-letter-on .tfm-letter .um-field-error .um-field-arrow { display: none !important; }
body.tfm-letter-on .tfm-letter .um-notice {
  margin: 0 0 14px !important; padding: 10px 14px !important; border-radius: 10px !important; text-align: center !important;
  font-family: "Cormorant Garamond", Georgia, serif !important; font-style: italic !important; font-size: 1.02rem !important;
  color: #f2c6cf !important; background: rgba(204, 51, 85, .1) !important; border: 1px solid rgba(204, 51, 85, .35) !important;
}
body.tfm-letter-on .tfm-letter .um-notice.success { color: var(--area-accent-soft, #e8c97a) !important; background: rgba(212, 168, 67, .08) !important; border-color: rgba(212, 168, 67, .35) !important; }
body.tfm-letter-on .tfm-letter .um-notice i { display: none !important; }
/* password reset: UM's hint box is emptied by tfm-letter.php (the page says it above) */
body.tfm-letter-on .tfm-letter .um-field-type_block { display: none !important; }

/* remember me + reset link in one row (moved together by JS) */
body.tfm-letter-on .tfm-letter .tfm-letter-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 6px; }
body.tfm-letter-on .tfm-letter .tfm-letter-row .um-field { padding: 0 !important; }
body.tfm-letter-on .tfm-letter .um-field-checkbox-option,
body.tfm-letter-on .tfm-letter .um-field-checkbox .um-field-checkbox-option { font-family: Jost, sans-serif !important; font-size: .8rem !important; color: var(--muted, #b6afc7) !important; }
body.tfm-letter-on .tfm-letter label.um-field-checkbox { display: flex !important; align-items: center; gap: 8px; position: relative; margin: 0 !important; padding: 0 !important; cursor: pointer; }
body.tfm-letter-on .tfm-letter label.um-field-checkbox input[type=checkbox] { position: absolute !important; opacity: 0 !important; width: 1px !important; height: 1px !important; }
body.tfm-letter-on .tfm-letter .um-field-checkbox-state { position: static !important; display: inline-flex !important; width: auto !important; }
body.tfm-letter-on .tfm-letter .um-field-checkbox-state i { font-size: 20px !important; line-height: 1 !important; color: rgba(212, 168, 67, .8) !important; }
body.tfm-letter-on .tfm-letter .um-field-checkbox-option { padding: 0 !important; margin: 0 !important; line-height: 1.2 !important; }
body.tfm-letter-on .tfm-letter .um-col-alt-b { padding: 0 !important; margin: 0 !important; }
body.tfm-letter-on .tfm-letter .um-col-alt-b a, body.tfm-letter-on .tfm-letter a.um-link-alt {
  font-family: Jost, sans-serif !important; font-size: .8rem !important; color: var(--muted, #b6afc7) !important;
  text-decoration: none !important; border-bottom: 1px dotted rgba(212, 168, 67, .4);
}
body.tfm-letter-on .tfm-letter .um-col-alt-b a:hover { color: var(--area-accent-soft, #e8c97a) !important; }
body.tfm-letter-on .tfm-letter .um-col-alt { margin: 0 !important; }

/* ── The wax seal (button by JS; the UM input stays in the form for submitting) ── */
body.tfm-letter-on .tfm-letter .tfm-letter-seal-src {
  position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; padding: 0 !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; opacity: 0 !important; border: 0 !important;
}
body.tfm-letter-on .tfm-letter .um-center, body.tfm-letter-on .tfm-letter .um-left { float: none !important; width: 100% !important; text-align: center !important; }
.tfm-letter-seal {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 104px; height: 104px; margin: 8px auto 0; padding: 0 12px !important; border: 0 !important; border-radius: 50% !important; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, #c4485f, #8a1c32 55%, #5c0f20) !important; color: #f6dbe0 !important;
  font: 400 .66rem/1.3 Jost, sans-serif !important; letter-spacing: .16em !important; text-transform: uppercase !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5), inset 0 -4px 10px rgba(0, 0, 0, .35), inset 0 3px 6px rgba(255, 220, 160, .25) !important;
  clip-path: polygon(50% 0, 61% 4%, 72% 2%, 79% 11%, 90% 14%, 92% 26%, 100% 34%, 96% 46%, 100% 58%, 93% 67%, 92% 80%, 81% 84%, 74% 95%, 62% 94%, 50% 100%, 39% 95%, 27% 96%, 20% 86%, 9% 82%, 7% 69%, 0 60%, 4% 48%, 0 37%, 8% 27%, 9% 15%, 20% 11%, 27% 2%, 39% 5%);
  transition: transform .3s ease;
}
.tfm-letter-seal:hover, .tfm-letter-seal:focus-visible { transform: scale(1.04) rotate(-4deg); }
.tfm-letter-seal:focus-visible { outline: 2px solid var(--area-accent-soft, #e8c97a); outline-offset: 4px; }
.tfm-letter-seal b { font: italic 500 1.6rem/1 "Cormorant Garamond", Georgia, serif; letter-spacing: 0; text-transform: none; }

/* ── Logged in ── */
.tfm-letter-avatar img { width: 84px !important; height: 84px !important; border-radius: 50% !important; object-fit: cover; border: 2px solid rgba(212, 168, 67, .6) !important; box-shadow: 0 0 24px rgba(255, 190, 100, .3); }
.tfm-letter-name, .tfm-letter-name * { font-family: Jost, sans-serif !important; font-size: .7rem !important; letter-spacing: .3em !important; text-transform: uppercase !important; color: var(--area-accent-soft, #e8c97a) !important; }
.tfm-letter-name p { margin: 0; }
.tfm-letter-btn .elementor-button {
  display: flex; width: 100%; justify-content: center; border-radius: 999px !important;
  font-family: Jost, sans-serif !important; font-size: .76rem !important; letter-spacing: .18em; text-transform: uppercase;
  background: transparent !important; border: 1px solid rgba(255, 255, 255, .18) !important; color: var(--body-text, #e4ddf0) !important;
  transition: box-shadow .3s ease;
}
.tfm-letter-btn { align-self: stretch; width: 100%; }
.tfm-letter-btn--main .elementor-button { border-color: var(--area-accent, #d4a843) !important; background: rgba(212, 168, 67, .2) !important; color: var(--ink, #f6f1ea) !important; }
.tfm-letter-btn .elementor-button:hover { box-shadow: 0 0 22px rgba(255, 190, 100, .3); }
.tfm-letter-leave .elementor-button {
  background: transparent !important; border: 0 !important; box-shadow: none !important; color: var(--muted, #b6afc7) !important;
  font-family: Jost, sans-serif !important; font-size: .8rem !important; text-decoration: underline dotted rgba(212, 168, 67, .5);
}

/* ── Phone: the whole letter in one screen, a larger spiral around it ── */
@media (max-width: 767px) {
  .tfm-letter { transform: rotate(-.4deg); }
  .tfm-letter-intro, .tfm-letter-intro * { font-size: 1.05rem !important; }
  body.tfm-letter-on .tfm-letter .um-field { padding-bottom: 8px !important; }
  .tfm-letter-seal { width: 90px; height: 90px; }
  .tfm-letter-candle { right: -8px; bottom: -14px; transform: scale(.85); transform-origin: 50% 100%; }
  /* the letter covers the middle: the arms show around it, past the screen edge */
  .tfm-letter-spiral { width: 2400px; height: 2400px; margin: -1200px 0 0 -1200px; opacity: .34; }
  .tfm-letter-spiral path { stroke-width: 18; }
  .tfm-letter-vignette { background: radial-gradient(ellipse 90% 70% at 50% 50%, transparent 30%, #08050e 85%); }
}

@media (prefers-reduced-motion: reduce) {
  .tfm-letter-spiral, .tfm-letter-glow, .tfm-letter-flame { animation: none; }
}
