/* ============================================================================
   DoggieGPT — staging gate, Windows XP (Luna) design language
   ----------------------------------------------------------------------------
   The first screen anyone sees now wears the same OS as the desktop behind it:
   XP's blue logon field, with the passphrase sitting in a real Luna dialog
   window — gradient title bar, beige dialog face, beveled buttons.

   Structure is deliberately untouched. Every class and ID below is the one
   gate.js binds to (g-form, g-pass, g-reveal, g-msg, g-submit, g-lede), so the
   form keeps working. Only the skin changed.

   Design details carried from Windows XP, Luna default Blue:
     - logon field: vertical #7c8087 -> #585c63 with the classic lit band
       across the middle third and a soft radial bloom behind the dialog
     - dialog face: #e7e7ea — the actual Luna dialog colour, not a guess
     - title bar: the six-stop Luna active gradient, white bold Tahoma
     - buttons: raised #fdfdfd -> #ceced2 face with a lit top edge; pressing
       inverts the bevel exactly as XP did
     - text field: sunken white with the #9a9ea4 XP field border
     - type: Tahoma 11px, the real XP UI font
     - focus: the dotted 1px inset outline XP used to mark the default control
   ========================================================================== */

:root {
  /* Luna blue ramp — the logon field */
  --g-blue-1: #7c8087;
  --g-blue-2: #6e7278;
  --g-blue-3: #666a71;
  --g-blue-4: #585c63;

  /* Luna dialog face + edges */
  --g-face: #e7e7ea;
  --g-face-lit: #f2f2f4;
  --g-face-dim: #ceced2;
  --g-frame: #666a71;
  --g-frame-dim: #4a4e54;

  /* title bar gradient stops */
  --g-title-1: #8a8e95;
  --g-title-2: #666a71;
  --g-title-3: #666a71;
  --g-title-4: #6e7278;
  --g-title-5: #6e7278;
  --g-title-6: #585c63;

  /* text + controls */
  --g-ink: #000000;
  --g-ink-dim: #4a4a4a;
  --g-field-border: #9a9ea4;
  --g-line: #a8acb2;
  --g-error: #666a71;
  --g-ease: cubic-bezier(.22, .61, .36, 1);

  --g-font: Tahoma, "Segoe UI", Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body.gate-body {
  height: 100%;
  margin: 0;
}

.gate-body {
  font-family: var(--g-font);
  font-size: 11px;
  color: var(--g-ink);
  background-color: var(--g-blue-3);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 42%, rgba(255, 255, 255, .26) 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(to bottom, var(--g-blue-1) 0%, var(--g-blue-2) 38%, var(--g-blue-3) 62%, var(--g-blue-4) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the field
   The 360 build drifted eight bevelled tiles across the background. XP's
   equivalent is the logon screen's horizontal band, so those same eight
   elements become that band and its faint corner texture — markup preserved,
   meaning changed. */
.g-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* the classic XP logon divider: a lit band across the middle third */
.g-sheen {
  position: absolute;
  left: 0;
  right: 0;
  top: 33%;
  height: 34%;
  background: linear-gradient(to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .14) 22%,
    rgba(255, 255, 255, .20) 50%,
    rgba(255, 255, 255, .14) 78%,
    rgba(255, 255, 255, 0) 100%);
  border-top: 1px solid rgba(255, 255, 255, .20);
  border-bottom: 1px solid rgba(255, 255, 255, .20);
}

/* soft bloom behind the dialog so it reads as lit from the field */
.g-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 120vw);
  height: min(520px, 80vh);
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 72%);
  filter: blur(2px);
}

/* the eight tiles: barely-there corner glows. No drift — XP's logon screen
   was static, and motion here would read as a game console, not an OS. */
.g-tiles {
  position: absolute;
  inset: 0;
}

.g-tile {
  position: absolute;
  display: block;
  border-radius: 2px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  opacity: 0;
  animation: gTileIn .9s var(--g-ease) forwards;
}

.g-t1 { width: 148px; height: 148px; left: 6%;   top: 14%; animation-delay: .10s; }
.g-t2 { width: 104px; height: 104px; left: 20%;  top: 62%; animation-delay: .22s; }
.g-t3 { width: 190px; height: 128px; left: 32%;  top: 8%;  animation-delay: .16s; }
.g-t4 { width: 120px; height: 120px; right: 8%;  top: 20%; animation-delay: .28s; }
.g-t5 { width: 160px; height: 160px; right: 4%;  top: 58%; animation-delay: .34s; }
.g-t6 { width: 96px;  height: 96px;  right: 24%; top: 78%; animation-delay: .40s; }
.g-t7 { width: 132px; height: 92px;  left: 12%;  top: 84%; animation-delay: .30s; }
.g-t8 { width: 88px;  height: 88px;  right: 30%; top: 6%;  animation-delay: .46s; }

@keyframes gTileIn {
  from { opacity: 0; }
  to   { opacity: .5; }
}

/* ------------------------------------------------------------------ stage */
.g-stage {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 18px 46px;
}

/* ------------------------------------------------------- the dialog window */
.g-panel {
  width: min(452px, 100%);
  background: var(--g-face);
  border: 1px solid var(--g-frame-dim);
  border-radius: 8px 8px 3px 3px;
  padding: 0 0 16px;
  overflow: hidden;
  box-shadow:
    0 2px 3px rgba(0, 0, 0, .20),
    0 18px 40px -18px rgba(0, 0, 0, .45);
  animation: gPanelIn .32s var(--g-ease) both;
}

@keyframes gPanelIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* error: three quick sideways taps, decaying */
.g-panel.is-shake { animation: gShake .42s cubic-bezier(.36, .07, .19, .97) both; }

@keyframes gShake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-7px); }
  30%      { transform: translateX(6px); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(3px); }
  80%      { transform: translateX(-1.5px); }
}

/* on success the dialog closes away before the redirect */
.g-panel.is-leaving { animation: gPanelOut .34s var(--g-ease) forwards; }

@keyframes gPanelOut {
  to { opacity: 0; transform: translateY(-10px) scale(.985); }
}

/* ------------------------------------------------------------------- head
   .g-head is the dialog's caption bar. Luna's six-stop active gradient, white
   bold Tahoma, rounded top corners, and a CSS-drawn close button so the
   markup needs no extra element. */
.g-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px 7px;
  min-height: 31px;
  background: linear-gradient(to bottom,
    var(--g-title-1) 0%,
    var(--g-title-2) 8%,
    var(--g-title-3) 40%,
    var(--g-title-4) 88%,
    var(--g-title-5) 95%,
    var(--g-title-6) 100%);
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid var(--g-title-6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42);
  position: relative;
}

/* the close button, drawn in CSS — three inner strokes on a red face */
.g-head::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 21px;
  height: 21px;
  margin-top: -10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .55);
  background:
    linear-gradient(135deg, transparent 42%, #fff 42%, #fff 50%, transparent 50%) center/10px 10px no-repeat,
    linear-gradient(45deg,  transparent 50%, #fff 50%, #fff 58%, transparent 58%) center/10px 10px no-repeat,
    linear-gradient(to bottom, #a8acb2 0%, #7c8087 50%, #585c63 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}

.g-avatar {
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(to bottom, #a8acb2 0%, #666a71 100%);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.g-avatar svg { width: 15px; height: 15px; display: block; }

.g-headtext { min-width: 0; padding-right: 28px; }

.g-eyebrow {
  margin: 0;
  font-size: 9px;
  font-weight: normal;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .80);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
  line-height: 1.2;
}

.g-head h1 {
  margin: 0;
  font-family: var(--g-font);
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------- body copy */
.g-lede {
  margin: 0;
  padding: 15px 16px 12px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--g-ink);
}

/* ------------------------------------------------------------------- form */
.g-form {
  margin: 0;
  padding: 0 16px;
}

.g-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: normal;
  color: var(--g-ink);
}

.g-inputwrap { position: relative; }

/* the sunken XP text field */
.g-inputwrap input {
  width: 100%;
  height: 26px;
  padding: 2px 30px 2px 6px;
  font: inherit;
  font-size: 12px;
  color: var(--g-ink);
  background: #fff;
  border: 1px solid var(--g-field-border);
  border-radius: 2px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .12);
  outline: none;
}

.g-inputwrap input:focus {
  border-color: #6e7278;
  box-shadow:
    inset 1px 1px 2px rgba(0, 0, 0, .12),
    0 0 0 1px rgba(110, 114, 120, .40);
}

.g-panel.has-error .g-inputwrap input {
  border-color: var(--g-error);
  box-shadow:
    inset 1px 1px 2px rgba(0, 0, 0, .12),
    0 0 0 1px rgba(102, 106, 113, .28);
}

/* reveal toggle — a flat glyph button inside the field, as XP did */
.g-reveal {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 22px;
  height: 21px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  color: #585c63;
  cursor: pointer;
}
.g-reveal svg { width: 13px; height: 13px; }
.g-reveal:hover {
  background: linear-gradient(to bottom, #fdfdfd, #dedfe2);
  border-color: #9a9ea4;
}
.g-reveal[aria-pressed="true"] {
  background: linear-gradient(to bottom, #ceced2, #c2c5ca);
  border-color: #8a8e95;
  color: #1a1a1a;
}
.g-reveal:focus-visible { outline: 1px dotted #000; outline-offset: 1px; }

/* message slot: reserved so the dialog does not jump when an error lands */
.g-msg {
  margin: 7px 0 0;
  min-height: 15px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--g-ink-dim);
}
.g-msg.is-error { color: var(--g-error); font-weight: normal; }
.g-msg.is-error::before { content: "\26A0\FE0E  "; }

/* ---------------------------------------------------------------- submit
   An XP default button: raised beige face, lit top edge, and the dotted
   focus ring. Blue-tinged border marks it as the default action. */
.g-submit {
  position: relative;
  width: 100%;
  height: 27px;
  margin-top: 13px;
  padding: 0 14px;
  font: inherit;
  font-size: 11px;
  font-weight: normal;
  color: #000;
  background: linear-gradient(to bottom, #fdfdfd 0%, #f2f2f4 45%, #e7e7ea 46%, #ceced2 100%);
  border: 1px solid #7c8087;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -1px 0 rgba(0, 0, 0, .05);
}

.g-submit:hover {
  background: linear-gradient(to bottom, #ffffff 0%, #f7f7f8 45%, #e7e7ea 46%, #d2d3d7 100%);
  border-color: #585c63;
}

.g-submit:active {
  background: linear-gradient(to bottom, #ceced2 0%, #d2d3d7 55%, #eeeff1 100%);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .22);
}

/* the XP default-button focus ring */
.g-submit:focus-visible { outline: none; }
.g-submit:focus-visible::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px dotted #000;
  border-radius: 2px;
}

.g-submit[disabled] { color: #7c8087; cursor: default; }

.g-submit-label { display: inline-block; }

/* spinner, shown while the credential check runs */
.g-submit-spin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border: 2px solid rgba(0, 0, 0, .16);
  border-top-color: #6e7278;
  border-radius: 50%;
  opacity: 0;
  animation: gSpin .7s linear infinite;
  animation-play-state: paused;
}

@keyframes gSpin { to { transform: rotate(360deg); } }

/* gate.js puts is-busy on the BUTTON, not the panel */
.g-submit.is-busy .g-submit-label { opacity: 0; }
.g-submit.is-busy .g-submit-spin { opacity: 1; animation-play-state: running; }

/* ------------------------------------------------------------------- foot */
.g-foot {
  margin: 13px 16px 0;
  padding-top: 10px;
  border-top: 1px solid var(--g-line);
}
.g-foot p {
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--g-ink-dim);
}

/* ------------------------------------------------------------ small screens */
@media (max-width: 520px) {
  .g-stage { padding: 16px 12px 40px; }
  .g-panel { border-radius: 6px 6px 3px 3px; }
  .g-lede { padding: 13px 12px 10px; }
  .g-form { padding: 0 12px; }
  .g-foot { margin: 12px 12px 0; }
  .g-head h1 { font-size: 12px; }
  /* 16px stops iOS zooming the page when the field takes focus */
  .g-inputwrap input { font-size: 16px; height: 30px; }
  .g-tile { opacity: .3 !important; }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .g-panel, .g-tile, .g-submit, .g-inputwrap input, .g-reveal {
    animation: none !important;
    transition: none !important;
  }
  .g-tile { opacity: .4 !important; }
}

/* ---------------------------------------------------- bottom hint bar
   The 360 dashboard anchored a controller-prompt strip to the bottom edge.
   In XP that job belonged to the status bar, so the strip wears that face. */
.g-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 26px;
  padding: 0 10px;
  font-size: 10px;
  color: #3c3f44;
  background: linear-gradient(to bottom, #f5f5f6 0%, #e7e7ea 45%, #ceced2 100%);
  border-top: 1px solid #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  pointer-events: none;
}

.g-hint .g-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.g-hint kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  font: inherit;
  font-size: 9px;
  text-align: center;
  color: #1a1a1a;
  background: linear-gradient(to bottom, #fdfdfd, #ceced2);
  border: 1px solid #9a9ea4;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

/* the hint strip is desktop chrome; phones get the space back */
@media (max-width: 520px) {
  .g-hint { display: none; }
}

/* ---------------------------------------------------------- accessibility */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
