/* Vault: sign-in, sign-out and account pages (served by mubaruk-auth). Pure CSS steel - no images, no web fonts, CSP-safe (no inline styles). */
:root {
  --bg: #09090a;
  --ink: #ecebe8;
  --muted: #8f8c88;
  --warm: 255 214 170;
  --deny: 255 92 72;
  --d: min(72vw, 58vh, 480px);          /* door diameter */
  --bezel: calc(var(--d) * .085);
  --ease: cubic-bezier(.65, 0, .25, 1);
  --sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }


/* the room: a dim wall with one light above the door */
.room {
  position: fixed; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(ellipse 55% 45% at 50% 38%, rgba(var(--warm) / .075), transparent 70%),
    radial-gradient(ellipse 120% 60% at 50% 110%, #000 20%, transparent 70%),
    linear-gradient(#121214, #070708);
}
.room::before {                            /* plaster grain */
  content: ""; position: absolute; inset: 0; opacity: .5; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(22px, 4vh, 40px); padding: 24px 16px; }

/* ---------- the vault ---------- */
.vault {
  position: relative;
  width: calc(var(--d) + 2 * var(--bezel));
  aspect-ratio: 1;
  perspective: 1400px;
  perspective-origin: 30% 50%;
}
.frame {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(255,255,255,.022) 0 1px, rgba(0,0,0,.035) 1px 2.5px),
    conic-gradient(from 210deg, #26292d, #5d6268, #24272a, #4c5157, #1e2023, #62676d, #26292d);
  box-shadow:
    0 50px 90px -30px #000,
    0 0 0 1px rgba(0,0,0,.8),
    inset 0 1px 0 rgba(255,255,255,.14),
    inset 0 -2px 3px rgba(0,0,0,.6);
}
.frame::before {                           /* the opening the door sits in */
  content: ""; position: absolute; inset: calc(var(--bezel) * .62); border-radius: 50%;
  background: radial-gradient(circle, #060606 60%, #000);
  box-shadow: inset 0 calc(var(--d) * .02) calc(var(--d) * .05) #000, 0 1px 0 rgba(255,255,255,.08);
}
.rivets { position: absolute; inset: 0; }
.rivets i {
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--d) * .022); aspect-ratio: 1; margin: calc(var(--d) * -.011);
  border-radius: 50%;
  transform: rotate(var(--a)) translateY(calc((var(--d) / 2 + var(--bezel) * .8) * -1));
  background: radial-gradient(circle at 35% 30%, #c8ccd1, #61666c 45%, #1b1d20 80%);
  box-shadow: 0 1px 1px rgba(0,0,0,.7);
}
.hinge {
  position: absolute; left: calc(var(--bezel) * -.55); top: 50%; translate: 0 -50%;
  height: 46%; width: calc(var(--d) * .07);
  display: flex; flex-direction: column; justify-content: space-between;
}
.hinge i {
  display: block; height: 36%; border-radius: calc(var(--d) * .02);
  background: linear-gradient(90deg, #191b1e, #6a7076 40%, #9aa0a6 50%, #3b3f44 75%, #141517);
  box-shadow: 0 6px 14px rgba(0,0,0,.6);
}
.inside {                                  /* what's behind the door */
  position: absolute; inset: calc(var(--bezel) * .62); border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(var(--warm) / 1), rgba(var(--warm) / .55) 35%, rgba(120 80 40 / .25) 70%, transparent 100%);
  opacity: 0; transition: opacity 1.2s ease .2s;
}

.door {
  position: absolute; inset: var(--bezel); border-radius: 50%;
  transform-style: preserve-3d;
  transform-origin: calc(var(--bezel) * -.4) 50%;
  transition: transform 1.7s var(--ease);
}
.thickness, .bolts, .face { position: absolute; inset: 0; border-radius: 50%; transform-style: preserve-3d; }
.thickness i {                             /* stacked discs give the door depth when it swings */
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(90deg, #15171a, #3c4045 50%, #15171a);
  transform: translateZ(calc(var(--z) * -1px));
}
.bolts { transform: translateZ(-4px); }
.bolts i {
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--d) * .056); height: calc(var(--d) * .12);
  margin-left: calc(var(--d) * -.028);
  border-radius: 3px;
  transform-origin: 50% 0;
  transform: rotate(var(--a)) translateY(calc(var(--d) * .44));
  background: linear-gradient(90deg, #2a2d31, #b7bcc2 45%, #8b9096 55%, #2a2d31);
  box-shadow: 0 2px 4px rgba(0,0,0,.6);
  transition: transform .45s cubic-bezier(.5, 0, .2, 1);
}
.unbolted .bolts i { transform: rotate(var(--a)) translateY(calc(var(--d) * .34)); }

.face {
  background:
    radial-gradient(circle closest-side, transparent 0 77%, rgba(0,0,0,.45) 77.4%, rgba(255,255,255,.07) 78%, transparent 78.6%),
    radial-gradient(circle closest-side, transparent 0 56%, rgba(0,0,0,.35) 56.3%, rgba(255,255,255,.05) 56.9%, transparent 57.4%),
    radial-gradient(ellipse 70% 55% at 34% 22%, rgba(255,255,255,.16), transparent 60%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.028) 0 1px, rgba(0,0,0,.04) 1px 2px),
    conic-gradient(from 200deg, #3a3e43, #858b92, #3b3f44, #6f757c, #2d3135, #8a9097, #3a3e43);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.09),
    inset 0 3px 2px rgba(255,255,255,.18),
    inset 0 -8px 16px rgba(0,0,0,.55),
    0 0 0 calc(var(--d) * .01) #111214,
    0 18px 40px rgba(0,0,0,.6);
  transform: translateZ(0);
}

/* combination dial, outer band of the face */
.dial {
  position: absolute; inset: 6.5%; border-radius: 50%;
  transform: rotate(var(--turn, 0deg));
  transition: transform .22s cubic-bezier(.3, 1.5, .55, 1);
}
.dial::before {                            /* dark band */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle closest-side, transparent 0 81%, #1a1c1f 81.3% 99%, transparent 99.4%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.ticks { position: absolute; inset: 0; border-radius: 50%; }
.ticks::before, .ticks::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.ticks::before {
  background: repeating-conic-gradient(rgba(225,228,232,.55) 0 .45deg, transparent .45deg 3.6deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 93%, #000 93.2% 97.5%, transparent 97.7%);
          mask: radial-gradient(circle closest-side, transparent 0 93%, #000 93.2% 97.5%, transparent 97.7%);
}
.ticks::after {
  background: repeating-conic-gradient(from -.45deg, rgba(240,242,245,.9) 0 .9deg, transparent .9deg 36deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 90%, #000 90.2% 97.5%, transparent 97.7%);
          mask: radial-gradient(circle closest-side, transparent 0 90%, #000 90.2% 97.5%, transparent 97.7%);
}
.numbers b {
  position: absolute; left: 50%; top: 50%;
  font: 600 calc(var(--d) * .028)/1 var(--sans); color: rgba(235,237,240,.75); letter-spacing: .04em;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--d) * -.372));
}
.index {                                   /* fixed marker the dial turns against */
  position: absolute; left: 50%; top: 3.4%; translate: -50% 0;
  width: 0; height: 0;
  border-left: calc(var(--d) * .016) solid transparent;
  border-right: calc(var(--d) * .016) solid transparent;
  border-top: calc(var(--d) * .026) solid rgba(var(--warm) / .9);
  filter: drop-shadow(0 0 6px rgba(var(--warm) / .5));
}

/* spoked handle */
.wheel {
  position: absolute; inset: 21%;
  transform: rotate(var(--spin, 0deg));
  transition: transform 1.1s var(--ease);
}
.wheel i {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 7.5%; margin-left: -3.75%;
  border-radius: 99px;
  transform: rotate(calc(var(--n) * 60deg));
  background: linear-gradient(90deg, #202326, #6f747a 25%, #d3d7dc 48%, #8b9096 60%, #2a2d31);
  box-shadow: 0 4px 10px rgba(0,0,0,.45);
}
.wheel i:nth-child(1) { --n: 0; }
.wheel i:nth-child(2) { --n: 1; }
.wheel i:nth-child(3) { --n: 2; }
.wheel i::before, .wheel i::after {        /* knobs */
  content: ""; position: absolute; left: 50%; width: 210%; aspect-ratio: 1; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #f4f6f8, #9aa0a6 35%, #3c4045 70%, #191b1e);
  box-shadow: 0 4px 10px rgba(0,0,0,.55);
}
.wheel i::before { top: -6%; }
.wheel i::after { bottom: -6%; }

/* centre hub = the passkey button */
.hub {
  position: absolute; inset: 35.5%; border-radius: 50%;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 0; color: rgba(var(--warm) / .62);
  background:
    radial-gradient(circle closest-side, transparent 0 86%, rgba(0,0,0,.4) 88%, transparent 92%),
    radial-gradient(ellipse 80% 60% at 38% 25%, rgba(255,255,255,.35), transparent 60%),
    repeating-radial-gradient(circle, rgba(255,255,255,.04) 0 1px, rgba(0,0,0,.05) 1px 2px),
    conic-gradient(from 160deg, #51565c, #b4b9bf, #474b50, #9ea4aa, #3e4247, #b9bec4, #51565c);
  box-shadow:
    0 0 0 calc(var(--d) * .012) #1a1c1f,
    0 0 0 calc(var(--d) * .016) rgba(255,255,255,.08),
    0 14px 28px rgba(0,0,0,.6),
    inset 0 2px 1px rgba(255,255,255,.4),
    inset 0 -4px 8px rgba(0,0,0,.4);
  transition: color .35s, box-shadow .35s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.hub svg {
  width: 54%; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.6));
  transition: filter .35s;
}
.hub:hover, .hub:focus-visible, .waiting .hub {
  color: rgba(var(--warm) / 1);
  box-shadow:
    0 0 0 calc(var(--d) * .012) #1a1c1f,
    0 0 0 calc(var(--d) * .016) rgba(var(--warm) / .35),
    0 0 calc(var(--d) * .12) rgba(var(--warm) / .28),
    0 14px 28px rgba(0,0,0,.6),
    inset 0 2px 1px rgba(255,255,255,.4),
    inset 0 -4px 8px rgba(0,0,0,.4);
}
.hub:hover svg, .hub:focus-visible svg, .waiting .hub svg { filter: drop-shadow(0 0 6px rgba(var(--warm) / .8)); }
.hub:focus-visible { outline: none; }
.hub:active { transform: scale(.97); }
.hub:disabled, div.hub { cursor: default; }
.switch[hidden] { display: none; }
.waiting .hub svg { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

/* ---------- states ---------- */
.denied .door { animation: rattle .5s cubic-bezier(.36, .07, .19, .97); }
.denied .hub { color: rgb(var(--deny)); }
.denied .index { border-top-color: rgb(var(--deny)); filter: drop-shadow(0 0 6px rgba(var(--deny) / .7)); }
@keyframes rattle {
  10%, 90% { translate: -1px 0; }
  20%, 80% { translate: 3px 0; }
  30%, 50%, 70% { translate: -6px 0; }
  40%, 60% { translate: 6px 0; }
}
.unlocking .hub, .unbolted .hub { color: rgba(var(--warm) / 1); }
.opening .door, .ajar .door { transform: rotateY(-112deg); }
.opening .inside, .ajar .inside { opacity: 1; }
.opening .controls { opacity: 0; translate: 0 10px; }

.flood {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff3e3, #f3dcc0 60%, #e4c39d);
  opacity: 0; transition: opacity .7s ease;
}
.flooded .flood { opacity: 1; }

/* ---------- controls under the door ---------- */
.controls {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(100%, 340px); min-height: 118px;
  transition: opacity .5s, translate .5s;
}
.status { margin: 0; min-height: 1.5em; text-align: center; color: var(--muted); font-size: 14px; letter-spacing: .01em; }
.denied-text { color: rgb(var(--deny)); }

.plaque {
  position: relative; display: flex; align-items: center; width: 100%;
  padding: 5px; border-radius: 14px;
  background: linear-gradient(#1e2023, #141517);
  box-shadow: 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.06), 0 12px 30px rgba(0,0,0,.5);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1);
}
.plaque[hidden] { display: none; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }
.plaque input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 0; border-radius: 10px; outline: none;
  background: #0b0b0c; color: var(--ink);
  font: 16px var(--sans); letter-spacing: .08em;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.04);
  transition: box-shadow .25s;
}
.plaque input::placeholder { color: #5f5c59; letter-spacing: .01em; }
.plaque input:focus { box-shadow: inset 0 2px 4px rgba(0,0,0,.8), inset 0 0 0 1px rgba(var(--warm) / .35); }
.plaque button {
  width: 44px; height: 44px; margin-left: 5px; flex: none;
  display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer;
  color: #1a1408;
  background: linear-gradient(#ffe3bf, #e8bf8c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 8px rgba(var(--warm) / .2);
  transition: filter .2s, transform .1s;
}
.plaque button:hover { filter: brightness(1.06); }
.plaque button:active { transform: scale(.96); }
.plaque button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.switch {
  border: 0; background: none; padding: 6px 10px; cursor: pointer;
  color: #b9b5b0; font: 14px var(--sans);
  text-decoration: underline; text-decoration-color: rgba(255,255,255,.2); text-underline-offset: 4px;
  transition: color .2s, text-decoration-color .2s;
}
.switch:hover, .switch:focus-visible { color: var(--ink); text-decoration-color: rgba(var(--warm) / .6); outline: none; }

/* sign-out: the door starts open; it swings shut when you confirm */
.still, .still * { transition: none !important; }
.ajar .wheel { --spin: -300deg; }
.stage:has(#signout-form) .status { font: 400 26px/1.2 ui-serif, "New York", Georgia, serif; letter-spacing: -.01em; color: var(--ink); }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
  border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  font: 500 15px var(--sans); color: #1a1408;
  background: linear-gradient(#ffe3bf, #e8bf8c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 10px rgba(var(--warm) / .2);
  transition: filter .2s, transform .1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn.quiet {
  color: var(--ink); background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
}
.btn.quiet:hover { background: rgba(255,255,255,.1); filter: none; }
.btn:focus-visible { outline: 2px solid rgba(var(--warm) / .7); outline-offset: 3px; }
.fine { margin: 0; font-size: 13px; color: var(--muted); }
.fine a { color: #b9b5b0; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.2); }
.fine a:hover { color: var(--ink); }

/* plain account pages (passkeys, errors) on the same wall */
body.sheet-page { overflow: auto; }
.sheet-page .room { position: fixed; z-index: -1; }
.sheet {
  width: min(560px, calc(100% - 32px)); margin: clamp(32px, 10vh, 96px) auto 48px; padding: 28px 28px 24px;
  border-radius: 22px; background: linear-gradient(#18191b, #121314);
  box-shadow: 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.05), 0 30px 80px rgba(0,0,0,.55);
}
.sheet .mark { display: inline-block; margin-bottom: 18px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -.01em; }
.sheet .mark span { color: #5d5b58; font-weight: 500; }
.sheet h2 { margin: 0 0 8px; font: 400 34px/1.1 ui-serif, "New York", Georgia, serif; letter-spacing: -.02em; }
.sheet h3 { margin: 28px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sheet h4 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.sheet p { color: #b9b5b0; margin: 0 0 12px; }
.sheet section { padding: 16px; margin: 0 0 10px; border-radius: 14px; background: rgba(255,255,255,.03); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.sheet label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.sheet input:not([type=hidden]) {
  height: 44px; padding: 0 14px; border: 0; border-radius: 10px; outline: none;
  background: #0b0b0c; color: var(--ink); font: 16px var(--sans);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.06);
}
.sheet input:focus { box-shadow: inset 0 2px 4px rgba(0,0,0,.8), inset 0 0 0 1px rgba(var(--warm) / .4); }
.sheet button {
  height: 42px; padding: 0 18px; border: 0; border-radius: 11px; cursor: pointer;
  font: 500 15px var(--sans); color: #1a1408; background: linear-gradient(#ffe3bf, #e8bf8c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.sheet .passkey-remove button { color: var(--ink); background: rgba(255,92,72,.14); box-shadow: inset 0 0 0 1px rgba(255,92,72,.35); }
.sheet button:disabled { opacity: .5; cursor: default; }
.sheet a { color: rgb(var(--warm)); text-underline-offset: 3px; }
.sheet a.btn { color: #1a1408; text-decoration: none; margin-top: 6px; }
#passkey-status:empty { display: none; }
.sheet #passkey-status { padding: 10px 14px; border-radius: 10px; background: rgba(var(--warm) / .08); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .door, .wheel, .dial, .bolts i, .inside { transition-duration: .01s; }
  .denied .door { animation: none; }
}
