/* =========================================================================
   MarinovOS — boot.css
   Lives in os/. The wallpaper URL below is relative to this file.

   Scope: everything is prefixed #bootOverlay, .boot- or html[data-startup].
   Motion: only opacity and transform are animated. Wallpaper blur is static
   and fades away with its layer, rather than recalculating a blur each frame.
   The cursor blink is the only ongoing
   animation and it exists only during the terminal phase.
   ====================================================================== */

/* ---- document while startup is showing -------------------------------- */
html[data-startup],
html[data-startup] body {
  overflow: hidden;
}

/* ---- overlay / stationary wallpaper ------------------------------------ */
#bootOverlay {
  --boot-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --boot-avatar: clamp(96px, 14vh, 132px);
  /* portrait crop: the face sits at (x, y) of the source photo and is placed
     at the horizontal centre / target-y of the circle at the given zoom */
  --boot-portrait-zoom: 2.5;
  --boot-portrait-x: 49%;
  --boot-portrait-y: 27%;
  --boot-portrait-target-y: 42%;
  --boot-text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38), 0 2px 16px rgba(0, 0, 0, 0.22);
  --boot-glass: linear-gradient(160deg,rgba(255,255,255,.62),rgba(255,255,255,.24) 55%,rgba(255,255,255,.44));
  --boot-glass-hover: rgba(255,255,255,.6);
  --boot-ring: #ffffff;
  --boot-ring-outer: rgba(23,49,75,.68);

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 0;
  color: #fff;
  background:#0c1119;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#bootOverlay,
#bootOverlay * {
  box-sizing: border-box;
}

.boot-links{position:fixed;bottom:max(24px,env(safe-area-inset-bottom));left:20px;right:20px;display:flex;justify-content:center;gap:28px;font-size:14px;z-index:3}
.boot-links a{color:#fff;min-height:44px;display:inline-flex;align-items:center;text-decoration:underline;text-underline-offset:5px;text-shadow:var(--boot-text-shadow)}
.boot-links a:focus-visible{outline:2px solid white;outline-offset:5px;border-radius:4px}
.boot-key-hint{margin:18px 0 0;color:#fff;font-size:13px;text-shadow:var(--boot-text-shadow)}

/* Boot begins before the wallpaper exists visually. The image is decoded
   ahead of time, then revealed as a separate compositor layer at sign-in. */
#bootOverlay::before {
  content:'';
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  background:#287ce9 url('../assets/wallpapers/window-light-blue-yellow-v1.webp') center / cover no-repeat;
  /* A soft focus behind sign-in only. Overscan keeps blurred edges offscreen.
     On entry this cached layer dissolves over the sharp desktop wallpaper. */
  filter:blur(24px);
  transform:scale(1.08);
  opacity:0;
  transition:opacity 600ms var(--boot-ease);
}
#bootOverlay[data-phase="profile"]::before,
#bootOverlay[data-phase="entering"]::before { opacity:1; }
.boot-top,.boot-terminal,.boot-stage,.boot-status { z-index:1; }

#bootOverlay button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* entering: the desktop is already live underneath, fade the overlay away */
#bootOverlay[data-phase="entering"] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 560ms var(--boot-ease);
}

/* ---- top bar: wordmark + Skip intro ------------------------------------ */
.boot-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}

.boot-wordmark {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: -0.01em;
  text-shadow: var(--boot-text-shadow);
}

.boot-wordmark b {
  font-weight: 600;
}

#bootOverlay .boot-skip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(16, 28, 52, 0.36);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  transition: opacity 200ms var(--boot-ease), visibility 0s linear 0s, background-color 160ms var(--boot-ease);
}

#bootOverlay .boot-skip:hover {
  background: rgba(16, 28, 52, 0.5);
}

.boot-skip:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--boot-ring), 0 0 0 5px var(--boot-ring-outer);
}

.boot-skip:focus:not(:focus-visible) {
  box-shadow: none;
}

.boot-skip:focus-visible {
  box-shadow: 0 0 0 2px var(--boot-ring), 0 0 0 5px var(--boot-ring-outer);
}

#bootOverlay[data-phase="profile"] .boot-skip,
#bootOverlay[data-phase="entering"] .boot-skip {
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms var(--boot-ease), visibility 0s linear 200ms;
}

/* ---- terminal panel ------------------------------------------------------ */
.boot-terminal {
  grid-area: 1 / 1;
  width: min(440px, calc(100vw - 32px));
  padding: 12px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 20, 28, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.18);
  color: #e6edf3;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 24px;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 360ms var(--boot-ease), transform 360ms var(--boot-ease);
}

#bootOverlay.is-live .boot-terminal {
  opacity: 1;
  transform: none;
}

#bootOverlay[data-phase="profile"] .boot-terminal,
#bootOverlay[data-phase="entering"] .boot-terminal {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.985);
  transition: opacity 300ms var(--boot-ease), transform 300ms var(--boot-ease), visibility 0s linear 300ms;
}

.boot-terminal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  line-height: 18px;
  color: rgba(230, 237, 243, 0.6);
}

.boot-dots {
  display: inline-flex;
  gap: 6px;
}

.boot-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.boot-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* reserved-height rows: the panel never grows or jumps */
.boot-line {
  display: grid;
  grid-template-columns: 1.1em minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 6px;
  height: 24px;
  line-height: 24px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 240ms var(--boot-ease), transform 240ms var(--boot-ease);
}

.boot-line.is-shown {
  opacity: 1;
  transform: none;
}

.boot-caret {
  color: rgba(230, 237, 243, 0.45);
}

.boot-line.is-done .boot-caret {
  color: rgba(230, 237, 243, 0.7);
}

.boot-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boot-mark {
  max-width: 14ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  opacity: 0;
  transition: opacity 200ms var(--boot-ease);
}

.boot-mark.is-ok {
  opacity: 1;
  color: #7ee787;
}

.boot-mark.is-pending {
  opacity: 1;
  color: #f2c94c;
}

/* single cursor, only ever inside the row being worked on */
.boot-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.35em;
  vertical-align: -0.15em;
  background: currentColor;
  animation: boot-blink 1s steps(1, end) infinite;
}

@keyframes boot-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* progress: transform based, never width */
.boot-progress {
  height: 2px;
  margin-top: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.boot-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 320ms var(--boot-ease);
}

/* ---- profile stage --------------------------------------------------------- */
.boot-stage {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 4vh;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 420ms var(--boot-ease) 100ms, transform 420ms var(--boot-ease) 100ms, visibility 0s linear 520ms;
}

#bootOverlay[data-phase="profile"] .boot-stage,
#bootOverlay[data-phase="entering"] .boot-stage {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 420ms var(--boot-ease) 180ms, transform 420ms var(--boot-ease) 180ms, visibility 0s linear 0s;
}

#bootOverlay[data-phase="entering"] .boot-stage {
  opacity:0;
  transform: translateY(-6px);
  transition: opacity 200ms var(--boot-ease), transform 380ms var(--boot-ease);
}

.boot-eyebrow {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: var(--boot-text-shadow);
}

/* ONE semantic button: photo, name, action */
.boot-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 8px;
  border-radius: 24px;
  color: #fff;
}

.boot-profile:focus {
  outline: none;
}

.boot-avatar {
  position: relative;
  width: var(--boot-avatar);
  height: var(--boot-avatar);
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  background: rgba(20, 40, 80, 0.45);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 12px 32px rgba(0, 0, 0, 0.26);
  transition: box-shadow 160ms var(--boot-ease);
}

/* the photo itself is untouched; the crop is pure CSS sizing/positioning */
.boot-portrait {
  position: absolute;
  display: block;
  width: calc(100% * var(--boot-portrait-zoom));
  height: auto;
  max-width: none;
  max-height: none;
  left: calc(50% - var(--boot-portrait-x) * var(--boot-portrait-zoom));
  top: calc(var(--boot-portrait-target-y) - var(--boot-portrait-y) * var(--boot-portrait-zoom));
  object-fit: cover;
  object-position: var(--boot-portrait-x) var(--boot-portrait-y);
  pointer-events: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity 240ms var(--boot-ease);
}

.boot-avatar.is-ready .boot-portrait {
  opacity: 1;
}

.boot-avatar.is-fallback .boot-portrait {
  display: none;
}

.boot-initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--boot-avatar) * 0.34);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  opacity: 0;
}

.boot-avatar.is-fallback .boot-initials {
  opacity: 1;
}

.boot-name {
  font-size: clamp(24px, 3.6vh, 34px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color:#17314b;
  text-shadow:0 1px 0 rgba(255,255,255,.2);
}

.boot-enter {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 22px 0 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--boot-glass);
  box-shadow:0 5px 16px rgba(85,70,9,.14),inset 0 1px 1px rgba(255,255,255,.8);
  backdrop-filter:blur(8px) saturate(1.1);
  -webkit-backdrop-filter:blur(8px) saturate(1.1);
  font-size: 16px;
  font-weight: 500;
  color:#17314b;
  text-shadow:none;
  transition: background-color 160ms var(--boot-ease), transform 160ms var(--boot-ease), box-shadow 160ms var(--boot-ease);
}

.boot-enter-arrow {
  flex: none;
}
.boot-enter.optical-glass { backdrop-filter:var(--optical-lens) blur(2px) saturate(1.1); }

.boot-profile:hover .boot-enter {
  background: var(--boot-glass-hover);
}

.boot-profile:active .boot-enter {
  transform: scale(0.98);
}

/* visible keyboard focus on the action pill and the portrait ring */
.boot-profile:focus .boot-enter {
  box-shadow: 0 0 0 2px var(--boot-ring), 0 0 0 5px var(--boot-ring-outer), 0 8px 24px rgba(0, 0, 0, 0.18);
}

.boot-profile:focus .boot-avatar {
  box-shadow: 0 0 0 3px var(--boot-ring), 0 0 0 6px var(--boot-ring-outer), 0 12px 32px rgba(0, 0, 0, 0.26);
}

.boot-profile:focus:not(:focus-visible) .boot-enter {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.boot-profile:focus:not(:focus-visible) .boot-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 12px 32px rgba(0, 0, 0, 0.26);
}

.boot-profile:focus-visible .boot-enter {
  box-shadow: 0 0 0 2px var(--boot-ring), 0 0 0 5px var(--boot-ring-outer), 0 8px 24px rgba(0, 0, 0, 0.18);
}

.boot-profile:focus-visible .boot-avatar {
  box-shadow: 0 0 0 3px var(--boot-ring), 0 0 0 6px var(--boot-ring-outer), 0 12px 32px rgba(0, 0, 0, 0.26);
}

/* ---- assistive status (visually hidden) ---------------------------------- */
.boot-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- small screens (375x667 and similar) --------------------------------- */
@media (max-width: 480px) {
  #bootOverlay {
    --boot-avatar: 96px;
  }

  .boot-wordmark {
    font-size: 18px;
  }

  .boot-terminal {
    padding: 10px 14px 14px;
    font-size: 12px;
    line-height: 22px;
  }

  .boot-line {
    height: 22px;
    line-height: 22px;
  }

  .boot-name {
    font-size: 26px;
  }

  .boot-enter {
    height: 44px;
    padding: 0 20px 0 22px;
    font-size: 15px;
  }

  .boot-profile {
    gap: 16px;
  }
}

/* Match the desktop's phone crop so entering never shifts the light field. */
@media (max-width:760px) {
  #bootOverlay::before { background-position:24% center;filter:blur(18px);transform:scale(1.18); }
  .boot-mark { max-width:11ch; }
}

/* Keep keyboard and text contrast when the visitor requests opaque controls. */
@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
  .boot-terminal { background:#10141c; }
  .boot-enter { background:#f7f9fc;backdrop-filter:none;-webkit-backdrop-filter:none; }
}
:root[data-transparency="reduced"] .boot-terminal { background:#10141c; }
:root[data-transparency="reduced"] .boot-enter { background:#f7f9fc;backdrop-filter:none;-webkit-backdrop-filter:none; }
@media (forced-colors:active) {
  #bootOverlay { background:Canvas;color:CanvasText; }
  #bootOverlay::before { display:none; }
  .boot-enter,.boot-terminal { background:Canvas;color:CanvasText;border:1px solid ButtonText; }
}

@media (max-height: 560px) {
  .boot-stage {
    padding-bottom: 0;
  }

  .boot-eyebrow {
    margin-bottom: 12px;
  }

  .boot-profile {
    gap: 12px;
  }
}

/* ---- reduced motion ------------------------------------------------------- */
/* JS adds .boot-reduced when the OS setting, marinovos:prefs.motion or
   MarinovOS.motion.reduced asks for it; the media query covers the OS
   setting even if the class were ever missing. Phase swaps become instant. */
#bootOverlay.boot-reduced,
#bootOverlay.boot-reduced::before,
#bootOverlay.boot-reduced * {
  transition: none !important;
  animation: none !important;
}

#bootOverlay.boot-reduced .boot-cursor {
  display: none;
}

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

  #bootOverlay .boot-cursor {
    display: none;
  }
}
