/* Full-screen entry portal. Authenticated screens keep the oracle app layout. */
body.oracle-portal-body {
  --portal-ink: #fff6e7;
  --portal-muted: #bdb1c9;
  --portal-coral: #ff858a;
  --portal-rail: #15101d;
  --portal-rail-height: 94px;
  padding: 0;
  background: #0b0711;
  color: var(--portal-ink);
}

.oracle-portal-body > .topbar { display: none; }
.oracle-portal-body .main-content { padding: 0; }
.astro-portal {
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.portal-scene {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100svh - var(--portal-rail-height) - env(safe-area-inset-bottom, 0px));
  min-height: 430px;
  overflow: hidden;
  isolation: isolate;
}
.portal-login {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 3;
  display: grid;
  min-height: 44px;
  align-items: center;
  color: var(--portal-ink);
  font-size: 14px;
  text-underline-offset: 5px;
}
.portal-brand {
  z-index: 2;
  padding: max(62px, calc(env(safe-area-inset-top, 0px) + 36px)) 16px 0;
  text-align: center;
}
body.oracle-portal-body .portal-brand h1 {
  margin: 0;
  color: var(--portal-ink);
  font: 400 clamp(62px, 19.5vw, 86px)/1.08 'Fraunces', Georgia, serif;
  letter-spacing: -.055em;
}
.portal-brand p {
  margin: 6px 0 0;
  color: var(--portal-ink);
  font: 400 clamp(18px, 4.9vw, 22px)/1.4 'Fraunces', Georgia, serif;
  letter-spacing: -.025em;
}
.portal-art {
  position: relative;
  z-index: -1;
  min-height: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.portal-art img {
  position: absolute;
  width: min(118vw, 55svh);
  max-width: none;
  height: auto;
  margin-top: -24px;
  object-fit: contain;
  mask-image: radial-gradient(ellipse, #000 47%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse, #000 47%, transparent 72%);
  animation: portal-breathe 12s ease-in-out infinite;
}
.portal-actions {
  z-index: 2;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 24px 40px;
  text-align: center;
}
.portal-cta {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--portal-coral);
  color: #260e1a;
  font: 600 16px/1.3 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.portal-cta i { font-size: 24px; flex-shrink: 0; }
.portal-cta span { flex: 1; }
.portal-cta:hover { background: #ff9da1; transform: translateY(-2px); }
.portal-actions > p {
  margin: 14px -6px 0;
  color: var(--portal-muted);
  font-size: 11.5px;
  line-height: 1.5;
}
.portal-actions > p span { margin-inline: 3px; }
.portal-nav {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: calc(var(--portal-rail-height) + env(safe-area-inset-bottom, 0px));
  padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  border-top: 1px solid rgba(255, 246, 231, .05);
  background: var(--portal-rail);
}
.portal-nav a,
.portal-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  min-height: 68px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--portal-ink);
  font: 400 13px/1.3 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.portal-nav i { font-size: 25px; }
.portal-nav a:hover,
.portal-nav button:hover { color: var(--portal-coral); background: rgba(255, 255, 255, .025); }
body.oracle-portal-body :is(a, button, textarea):focus-visible {
  outline: 2px solid var(--oracle-teal);
  outline-offset: 4px;
}
.portal-dialog-open { overflow: hidden; }
.portal-dialog {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 520px);
  max-width: 100%;
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top, 0px)));
  margin: auto auto 0;
  padding: 24px 24px max(28px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid rgba(255, 246, 231, .12);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: #17101f;
  color: var(--portal-ink);
  box-shadow: 0 -20px 80px #0006;
}
.portal-dialog[open] { animation: portal-sheet-in .24s ease-out; }
.portal-dialog::backdrop { background: rgba(5, 3, 9, .7); backdrop-filter: blur(8px); }
.portal-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.portal-sheet-label { color: var(--oracle-teal); font-size: 11px; letter-spacing: .07em; }
.portal-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--oracle-line);
  border-radius: 50%;
  background: transparent;
  color: var(--portal-ink);
  font-size: 21px;
  cursor: pointer;
}
body.oracle-portal-body .portal-dialog h2 {
  margin: 0;
  color: var(--portal-ink);
  font: 400 clamp(30px, 8.4vw, 39px)/1.1 'Fraunces', Georgia, serif;
  letter-spacing: -.035em;
}
.portal-dialog h2:focus { outline: none; }
.portal-sheet-intro { margin: 18px 0 24px; color: #c7bbd0; font-size: 14px; line-height: 1.65; }
.portal-sheet-symbol { color: var(--portal-coral); font-size: 28px; }
.portal-dialog .oracle-public-doors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 16px; overflow: visible; }
.portal-dialog .oracle-public-door { flex-direction: column; min-height: 66px; padding: 9px 2px; border-radius: 14px; gap: 7px; font-size: 11px; }
.portal-dialog .oracle-public-door i { font-size: 19px; }
.portal-dialog textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  max-height: 180px;
  resize: vertical;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid #47384f;
  border-radius: 16px;
  background: #0e0a14;
  color: var(--portal-ink);
  font: 400 16px/1.6 'DM Sans', sans-serif;
}
.portal-dialog textarea::placeholder { color: #a99bb4; }
.portal-sheet-note { margin: 20px 0 0; color: #afa1ba; font-size: 11.5px; line-height: 1.7; }
.portal-sheet-note i { color: var(--oracle-teal); margin-right: 4px; }
.portal-secondary-link { display: block; padding: 16px 0 0; color: var(--portal-ink); text-align: center; font-size: 12px; text-underline-offset: 4px; }
.portal-form-error { color: #ffb9b9; font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.portal-steps { display: grid; gap: 18px; margin: 0 0 26px; padding: 0; list-style: none; }
.portal-steps li { display: flex; gap: 15px; align-items: baseline; }
.portal-steps li > span { color: var(--portal-coral); font: 400 18px 'Fraunces', Georgia, serif; }
.portal-steps strong { font-size: 13px; font-weight: 600; }
.portal-steps p { margin-top: 4px; color: #afa1ba; font-size: 12px; line-height: 1.5; }
.portal-menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; margin: 20px 0; }
.portal-menu-links a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--oracle-line); color: var(--portal-ink); font-size: 13px; text-decoration: none; }
.portal-legal { display: flex; gap: 0 18px; flex-wrap: wrap; margin-top: 14px; }
.portal-legal a { display: grid; align-items: center; min-height: 44px; color: #c4b6cf; font-size: 11px; text-underline-offset: 4px; }
.oracle-portal-body .install-banner { bottom: calc(var(--portal-rail-height) + env(safe-area-inset-bottom, 0px) + 8px); }
.oracle-portal-body:has(dialog[open]) .install-banner { visibility: hidden; }

@media (min-width: 700px) {
  body.oracle-portal-body { --portal-rail-height: 100px; }
  .portal-brand { padding-top: 40px; }
  body.oracle-portal-body .portal-brand h1 { font-size: clamp(76px, 8vw, 112px); }
  .portal-brand p { font-size: 23px; }
  .portal-login { top: 20px; right: 40px; }
  .portal-art img { width: min(74svh, 700px); }
  .portal-actions { position: absolute; right: 36px; bottom: 30px; width: 330px; padding: 0; }
  .portal-nav { padding-inline: max(24px, calc((100% - 1000px) / 2)); }
  .portal-nav a + *, .portal-nav button + * { border-left: 1px solid rgba(255, 246, 231, .08); border-radius: 0; }
  .portal-dialog { inset: 0; max-height: calc(100dvh - 64px); margin: auto; border-bottom: 1px solid var(--oracle-line); border-radius: 28px; padding: 28px; }
}
@media (max-width: 699px) and (max-height: 700px) {
  .portal-brand { padding-top: 44px; }
  body.oracle-portal-body .portal-brand h1 { font-size: 58px; }
  .portal-brand p { font-size: 17px; }
  .portal-actions { padding-bottom: 22px; }
  .portal-cta { min-height: 54px; padding-block: 13px; }
  .portal-art img { width: min(103vw, 52svh); }
}
@media (max-height: 500px) and (min-width: 700px) {
  body.oracle-portal-body { --portal-rail-height: 76px; }
  .portal-scene { min-height: 280px; }
  .portal-brand { padding-top: 24px; padding-right: 50%; }
  body.oracle-portal-body .portal-brand h1 { font-size: 58px; }
  .portal-brand p { font-size: 18px; }
  .portal-art { position: absolute; inset: 0 0 0 42%; }
  .portal-art img { width: min(70vw, 88svh); }
  .portal-actions { left: 28px; right: auto; bottom: 18px; width: 310px; }
  .portal-nav { padding-block: 2px; }
  .portal-nav a, .portal-nav button { min-height: 66px; gap: 5px; }
}
@keyframes portal-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes portal-sheet-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .portal-art img, .portal-dialog[open] { animation: none; }
  .portal-cta, .portal-nav a, .portal-nav button { transition: none; }
}
