/* Approved Invictus opening / account aesthetic.
   Presentation only: authentication fields, buttons, messages and handlers remain intact. */

html body #im-root #im-gate {
  --auth-ink: #f7f3ea;
  --auth-gold: #e7c793;
  --auth-muted: #b9b3a7;
  --auth-line: #d7b78566;
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(28px + env(safe-area-inset-top, 0px)) max(28px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(28px, env(safe-area-inset-left, 0px));
  color: var(--auth-ink);
  background: #010405 url('/assets/invictus-midnight-ocean.svg') center / cover no-repeat !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  isolation: isolate;
  scrollbar-width: thin;
  scrollbar-color: #c6a66a44 transparent;
}

html body #im-root #im-gate[hidden] { display: none !important; }

html body #im-root #im-gate::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, #0003, transparent 45%, #0002 73%, #0007);
}

html body #im-root #im-gate .im-gate-brand {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 390px;
  padding: 12px 0 0;
  text-align: center;
}

html body #im-root #im-gate .im-gate-brand::before {
  content: '';
  display: block;
  flex: none;
  width: clamp(210px, 34svh, 350px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  background: url('/assets/invictus-living-light.svg') center / contain no-repeat;
  pointer-events: none;
  transform-origin: center;
  animation: invictus-auth-breathe 7.5s ease-in-out infinite;
}

/* The wordmark replaces the visual prominence of the existing ornamental logo. */
html body #im-root #im-gate .im-gate-brand > img {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

html body #im-root #im-gate .im-entry-wordmark {
  margin: 12px -0.38em 0 0 !important;
  font: 300 clamp(26px, 7.6vw, 42px)/1.3 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  letter-spacing: 0.38em !important;
  text-transform: uppercase;
  color: #f5f2eb;
  text-shadow: none;
}

html body #im-root #im-gate .im-entry-tagline {
  margin: 16px 0 0 !important;
  font: 300 12px/1.8 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.21em;
  color: #e0c190;
}

html body #im-root #im-gate .im-entry-card {
  width: 100%;
  max-width: 440px;
  flex: none;
  padding: 0;
  margin: auto 0 0;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html body #im-root #im-gate #im-entry-title {
  margin: 0 0 26px;
  color: #f7f3eb;
  font: 400 clamp(34px, 9vw, 46px)/1.1 'Bodoni Moda', Didot, 'Times New Roman', serif;
  letter-spacing: -0.018em;
  text-align: center;
  text-wrap: balance;
}

html body #im-root #im-gate #im-entry-title[hidden] { display: none !important; }

html body #im-root #im-gate #im-account {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html body #im-root #im-gate :is(button, a.outline) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 22px;
  color: #f3e2c5;
  background: linear-gradient(120deg, #0a1011c2, #060a0abf) !important;
  border: 1px solid var(--auth-line) !important;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 #fff8dc0a !important;
  font: 400 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.085em;
  text-align: center;
  white-space: normal;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

html body #im-root #im-gate :is(.im-signin, .gold, button[type='submit']) {
  min-height: 56px;
  border-color: #e3c38cb0 !important;
  color: #f4e8d4 !important;
  font-weight: 400;
  letter-spacing: 0.12em;
}

html body #im-root #im-gate #im-account > .im-signin { margin: 0; }

html body #im-root #im-gate :is(.im-create, .text-button) {
  min-height: 44px;
  margin: 10px 0 0;
  padding: 10px 16px;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #e2bf86 !important;
  letter-spacing: 0.08em;
}

html body #im-root #im-gate button:disabled {
  opacity: 0.5;
  cursor: wait;
}

html body #im-root #im-gate .account-form { margin: 0; }
html body #im-root #im-gate .account-field { margin: 16px 0; }
html body #im-root #im-gate .account-field label {
  display: block;
  margin: 0 0 8px;
  color: #cdc1ae;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

html body #im-root #im-gate input {
  width: 100%;
  min-height: 52px;
  padding: 14px 17px;
  border: 1px solid #d0b58842;
  border-radius: 14px;
  background: #020606cc;
  color: #f6f2e9;
  font: 400 16px/1.4 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: inset 0 1px 0 #ffffff04;
  scroll-margin-block: 28px;
}

html body #im-root #im-gate input::placeholder { color: #928b80; opacity: 1; }

html body #im-root #im-gate .micro {
  color: var(--auth-muted);
  font: 400 11px/1.75 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-wrap: anywhere;
}

html body #im-root #im-gate :is(.account-message, .im-error, [role='alert']) {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid #c59d7040;
  border-radius: 12px;
  background: #070a0ade;
  text-align: left;
  line-height: 1.7;
}

html body #im-root #im-gate :is(.bad, .im-error) { color: #f0b9ae !important; }
html body #im-root #im-gate .good { color: #c3d8b6; }

html body #im-root #im-gate .im-gate-note {
  margin: 20px 0 0 !important;
  color: #a9a498;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.075em;
}

html body #im-root #im-gate .im-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 8px;
  margin-top: 8px;
  color: #b4ac9b;
  font: 400 10px/1.5 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.025em;
  text-align: center;
  text-decoration: none;
}

/* Existing sign-in/create/passkey states keep their actual inputs and copy.
   Only the ornament contracts to reserve comfortable room for the form. */
html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) {
  gap: 18px;
}

html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-gate-brand {
  min-height: 0;
  flex: 0 0 auto;
  padding: 4px 0 0;
}

html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-entry-wordmark {
  order: -1;
  margin-top: 0 !important;
  font-size: 18px !important;
  letter-spacing: 0.42em !important;
}

html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-gate-brand::before {
  width: clamp(135px, 21svh, 210px);
  margin: 12px auto 0;
}

html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-entry-tagline {
  margin-top: 0 !important;
  font-size: 10px;
}

html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-entry-card {
  margin-top: 0;
}

html body #im-root #im-gate :focus-visible {
  outline: 2px solid #e8c690;
  outline-offset: 4px;
}

@media (hover: hover) {
  html body #im-root #im-gate button:not(:disabled):hover {
    border-color: #e9cca5 !important;
    color: #fff6e7 !important;
  }
}

/* Cloud retains its dashboard and all signed-in account settings. */
html body:has(> .cloud-main) .cloud-brand {
  font: 300 18px/1.4 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.32em;
  color: #f5f2eb;
}

html body .cloud-main .invictus-account:not(:has(.account-identity, #account-new-password)) {
  background: transparent;
  border-color: #d2b78338;
}

html body .cloud-main .invictus-account:not(:has(.account-identity, #account-new-password)):has(> button, .account-form)::before {
  content: '';
  display: block;
  width: 170px;
  aspect-ratio: 1;
  margin: -8px auto 18px;
  background: url('/assets/invictus-living-light.svg') center / contain no-repeat;
  pointer-events: none;
  animation: invictus-auth-breathe 7.5s ease-in-out infinite;
}

html body .cloud-main .invictus-account:not(:has(.account-identity, #account-new-password)) button {
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  border: 1px solid #d6b7867a;
  border-radius: 999px;
  background: #030708c2;
  color: #f2e2c9;
  box-shadow: none;
  font: 400 13px/1.4 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.06em;
}

html body .cloud-main .invictus-account:not(:has(.account-identity, #account-new-password)) .text-button {
  border-color: transparent;
  background: transparent;
  color: #ddbd89;
}

html body .cloud-main .invictus-account:not(:has(.account-identity, #account-new-password)) input {
  min-height: 52px;
  border: 1px solid #d0b58842;
  border-radius: 14px;
  background: #020606cc;
  color: #f6f2e9;
  font-size: 16px;
}

html body .cloud-main .account-message {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@keyframes invictus-auth-breathe {
  0%, 100% { transform: scale(0.97); opacity: 0.91; }
  50% { transform: scale(1.025); opacity: 1; }
}

@media (min-width: 761px) {
  html body #im-root #im-gate { gap: 32px; padding-inline: 48px; }
  html body #im-root #im-gate .im-gate-brand { min-height: 400px; }
  html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-gate-brand { min-height: 0; }
}

@media (max-width: 359px) {
  html body #im-root #im-gate { padding-inline: 22px; }
  html body #im-root #im-gate .im-entry-wordmark { font-size: 24px !important; letter-spacing: 0.29em !important; }
}

@media (max-height: 700px) {
  html body #im-root #im-gate { gap: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  html body #im-root #im-gate .im-gate-brand { min-height: 260px; }
  html body #im-root #im-gate .im-gate-brand::before { width: 180px; margin-bottom: 0; }
  html body #im-root #im-gate .im-entry-wordmark { font-size: 26px !important; }
  html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-gate-brand::before { width: 115px; margin-top: 8px; }
  html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-entry-wordmark { font-size: 17px !important; }
  html body #im-root #im-gate #im-entry-title { font-size: 32px; margin-bottom: 18px; }
}

/* Keyboard-sized viewports keep controls reachable by scrolling the real gate. */
@media (max-height: 480px) {
  html body #im-root #im-gate { justify-content: flex-start; }
  html body #im-root #im-gate .im-gate-brand { flex: 0 0 auto; min-height: 0; }
  html body #im-root #im-gate .im-gate-brand::before { width: 95px; }
  html body #im-root #im-gate .im-entry-card { margin-top: 0; }
  html body #im-root #im-gate:is(.is-form, :has(#im-entry-title:not([hidden]))) .im-gate-brand::before { width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  html body #im-root #im-gate .im-gate-brand::before,
  html body .cloud-main .invictus-account::before { animation: none; transform: none; opacity: 1; }
  html body #im-root #im-gate :is(button, a, input) { transition: none; }
}

html body #im-root[data-motion='off'] #im-gate .im-gate-brand::before,
html body #im-root.iv-motion-paused #im-gate .im-gate-brand::before { animation: none; }
