/* The front door: logging in, accepting an invitation, starting a family.
 *
 * Built on app.css — same tokens, same inputs and buttons — so the page you
 * log in on and the app you land in are visibly the same product. What this
 * adds is the one thing the app itself never needs: a moment of arrival. The
 * app icon is the hero, because it is the thing that will sit on the phone's
 * home screen afterwards, and the invitation draws the two people it is about
 * joined by a line — you, and him.
 */

.door {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--safe-top) + 28px) 18px calc(var(--safe-bottom) + 28px);
}

.door-inner {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── The mark ────────────────────────────────────────────────────────────── */
.door-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.door-icon {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: block;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 40px rgba(31, 157, 85, 0.35);
  animation: door-rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.door-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
  text-wrap: balance;
}

.door-lede {
  margin: 0;
  max-width: 32ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

/* ── The card ────────────────────────────────────────────────────────────── */
.door-card {
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 40%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 50px rgba(0, 0, 0, 0.35);
  animation: door-rise 0.45s 0.06s ease-out both;
}

.door-card .field { margin-bottom: 14px; }

.door-card input[type="text"],
.door-card input[type="email"],
.door-card input[type="password"] {
  min-height: 50px;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.door-card input:focus {
  box-shadow: 0 0 0 3px rgba(79, 127, 232, 0.22);
}

.door-card .btn-primary {
  min-height: 52px;
  font-size: 16px;
  border-radius: 13px;
  margin-top: 4px;
}

/* A section inside a longer form: "A criança", "Tu". */
.door-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.door-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.door-section + .field { margin-top: 0; }
.door-card .door-section:not(:first-child) { margin-top: 20px; }

/* ── Password with a way to see it ───────────────────────────────────────── */
.pw {
  position: relative;
}

.pw input { padding-right: 76px; }

/* Edge and old IE draw their own reveal eye inside a password field, which
   would sit next to "Ver" and do the same thing. */
.pw input::-ms-reveal,
.pw input::-ms-clear { display: none; }

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  min-height: 38px;
  border-radius: 9px;
  cursor: pointer;
}

.pw-toggle:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }

.pw-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 12.5px;
  transition: color 0.15s ease;
}

.pw-hint::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pw-hint.is-ok { color: #5fd694; }
.pw-hint.is-ok::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--accent);
}

/* ── Who you are to him: a picker, not a dropdown ────────────────────────── */
.relations {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.relation {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: 13px;
  padding: 10px 6px 8px;
  min-height: 72px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

/* Children placed in a plain inner element, never laid out on the button
   itself — Safari ignores grid and flex centring on a <button>. */
.relation-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.relation:active { transform: scale(0.97); }

.relation[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.relation:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── The invitation: you, joined to him ──────────────────────────────────── */
.bond {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  animation: door-rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.bond-face {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  flex: none;
}

.bond-face.is-kid {
  background: radial-gradient(circle at 35% 30%, #7c86f0, #3c40a8);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(79, 91, 213, 0.4);
}

.bond-line {
  width: 58px;
  height: 2px;
  background-image: linear-gradient(90deg, var(--ink-soft) 50%, transparent 50%);
  background-size: 8px 2px;
  opacity: 0.55;
  position: relative;
}

.bond-line::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px var(--bg);
}

/* What they will be able to do — said as two plain lines, not a permission
   matrix. */
.door-can {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.door-can li { display: flex; gap: 9px; align-items: baseline; }
.door-can li::before { content: '✓'; color: #5fd694; font-weight: 800; flex: none; }

/* ── Messages ────────────────────────────────────────────────────────────── */
/* The entry pages (login, sign-up, invite) hide their error box and their
   optional blocks with this class. It used to live in grownups/app.css and
   went with the 2026-11-02 rebuild, after which every one of them showed:
   an empty red box on sign-up, "Email ou password errados." before anyone
   had typed, the invite card before it had loaded. It belongs here, with
   the pages that use it. tests/pages.test.js holds it. */
.hidden { display: none !important; }

.door-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(224, 69, 107, 0.12);
  border: 1px solid rgba(224, 69, 107, 0.45);
  color: #ffb3c5;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  animation: door-nudge 0.3s ease;
}

.door-error::before {
  content: '!';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bad);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  flex: none;
}

.door-foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

.door-foot a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 235, 242, 0.3);
  padding-bottom: 1px;
}

.door-foot a:hover { border-bottom-color: var(--ink); }

/* The kid's side never needs a password; say so where a parent looks for it. */
.door-aside {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 0;
}

.door-aside img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
}

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

@keyframes door-nudge {
  0%, 100% { transform: none; }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .door-icon, .door-card, .bond, .door-error { animation: none; }
}
