/* public/css/gate.css
   导航页访问密码页（/gate）——与后台登录页同一套视觉语言，但独立成文件，
   这样门禁页不必加载登录页那套体积更大的样式。 */

:root {
  color-scheme: light;
  --ink: #2a2438;
  --ink-soft: #5a5268;
  --muted: #857c93;
  --line: #e9e3f1;
  --card: #fffffff7;
  --field: #fbf9fd;
  --field-hover: #f6f2fb;
  --accent: #7952b3;
  --accent-strong: #67439f;
  --accent-soft: #f1ecf9;
  --ring: #9870bf26;
  --danger-bg: #fdf3f5;
  --danger-line: #f1d8df;
  --danger-ink: #b14f68;
  --shadow: 0 30px 80px #53416726, 0 3px 12px #5341670f;
  --blob-one: #e6dcf6;
  --blob-two: #f2e6ef;
  --blob-three: #e3ecf3;
  --dot: #c3b6d4;
  --aurora-opacity: .9;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #ece8f3;
    --ink-soft: #c8c2d4;
    --muted: #9d95ab;
    --line: #342e41;
    --card: #1d1a26f2;
    --field: #16131e;
    --field-hover: #1b1725;
    --accent: #b79bd8;
    --accent-strong: #c9b2e4;
    --accent-soft: #b79bd814;
    --ring: #b79bd833;
    --danger-bg: #b14f681f;
    --danger-line: #b14f6859;
    --danger-ink: #e79bb0;
    --shadow: 0 32px 90px #00000073, 0 2px 10px #00000040;
    --blob-one: #3a2b52;
    --blob-two: #4a2c3f;
    --blob-three: #24384a;
    --dot: #6d6183;
    --aurora-opacity: .75;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background: #f8f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

@media (prefers-color-scheme: dark) {
  body { background: #121017; }
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ==== 背景光晕 ==== */
.gate-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--aurora-opacity);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}

.blob-one {
  width: 46vw;
  height: 46vw;
  min-width: 320px;
  min-height: 320px;
  top: -12vw;
  left: -8vw;
  background: var(--blob-one);
  animation: blob-drift 22s ease-in-out infinite;
}

.blob-two {
  width: 38vw;
  height: 38vw;
  min-width: 280px;
  min-height: 280px;
  right: -10vw;
  top: 6vh;
  background: var(--blob-two);
  animation: blob-drift 26s ease-in-out infinite reverse;
}

.blob-three {
  width: 44vw;
  height: 44vw;
  min-width: 300px;
  min-height: 300px;
  left: 24vw;
  bottom: -20vw;
  background: var(--blob-three);
  animation: blob-drift 30s ease-in-out infinite;
}

.grid-mask {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) .8px, transparent .8px);
  background-size: 26px 26px;
  opacity: .38;
  mask-image: radial-gradient(ellipse at 50% 42%, #000 0, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 42%, #000 0, transparent 72%);
}

/* ==== 布局 ==== */
.gate-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  padding: 40px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

/* ==== 卡片 ==== */
.gate-card {
  position: relative;
  width: 100%;
  max-width: 424px;
  padding: 42px 36px 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  text-align: center;
  animation: card-arrive .6s cubic-bezier(.22, .68, .32, 1) both;
}

/* 顶部一道渐变高光，和后台登录卡片的细节呼应 */
.gate-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 46px;
  right: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .55;
}

.gate-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 20px;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(150deg, #9b76c8, #67439f);
  /* 第二层阴影是贴合圆角的外发光，比再画一个方形描边干净 */
  box-shadow:
    0 14px 28px #7952b33d,
    0 0 0 9px #7952b314,
    0 0 0 18px #7952b309,
    inset 0 1px 0 #ffffff33;
}

.gate-badge .icon { width: 28px; height: 28px; stroke-width: 1.55; }

.gate-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.6px;
}

.gate-title {
  margin: 0 0 10px;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.4px;
  line-height: 1.4;
}

.gate-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.85;
}

.gate-site { color: var(--ink-soft); font-weight: 550; }

form { margin-top: 28px; text-align: left; }

/* ==== 输入框 ==== */
.field { margin-bottom: 16px; }

.field-wrap { position: relative; }

.field-icon {
  position: absolute;
  top: 17px;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  opacity: .8;
  pointer-events: none;
  transition: color .2s, opacity .2s;
}

.field-wrap input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: .3px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.field-wrap input::placeholder { color: var(--muted); font-size: 12.5px; letter-spacing: 0; opacity: .85; }
.field-wrap input:hover { border-color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.field-wrap input:focus {
  border-color: var(--accent);
  background: var(--field-hover);
  box-shadow: 0 0 0 4px var(--ring);
}
.field-wrap:focus-within .field-icon { color: var(--accent); opacity: 1; }
.field-wrap input[aria-invalid="true"] { border-color: var(--danger-line); }
.field-wrap input[aria-invalid="true"]:focus {
  border-color: var(--danger-ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-ink) 18%, transparent);
}

.field-wrap input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--field) inset;
  -webkit-text-fill-color: var(--ink);
}

.field-toggle {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  transition: color .2s, background .2s;
}

.field-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.field-toggle .icon { width: 18px; height: 18px; }
.eye-slash { display: none; }
.field-toggle[aria-pressed="true"] .eye-slash { display: block; }

/* ==== 错误提示 ==== */
.gate-error {
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  animation: error-in .28s ease-out both;
}

/* ==== 按钮 ==== */
.gate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  border: 1px solid #7952b3;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(115deg, #8a63b9, #65419b);
  box-shadow: 0 9px 20px #7952b329, inset 0 1px 0 #ffffff2e;
  font-size: 14.5px;
  font-weight: 550;
  letter-spacing: .6px;
  transition: transform .18s, box-shadow .18s, filter .18s;
}

.gate-button .icon { width: 17px; height: 17px; transition: transform .18s; }
.gate-button:hover { filter: brightness(1.07); box-shadow: 0 12px 24px #7952b336; transform: translateY(-1px); }
.gate-button:hover .icon { transform: translateX(3px); }
.gate-button:active { transform: translateY(1px); }
.gate-button:disabled { cursor: wait; opacity: .85; transform: none; filter: none; }
.gate-button.is-loading .icon { display: none; }
.gate-button.is-loading::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 1.5px solid #ffffff59;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.gate-hint {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

/* ==== 卡片页脚 ==== */
.gate-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .2px;
}

.gate-footer .icon { width: 13px; height: 13px; opacity: .8; }

.gate-copyright {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .8px;
  opacity: .75;
}

/* ==== 焦点可见性 ==== */
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

button:focus-visible { outline-color: color-mix(in srgb, var(--accent) 70%, transparent); }

/* ==== 动画 ==== */
@keyframes card-arrive {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blob-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3vw, -3vh, 0) scale(1.06); }
}

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

/* ==== 响应式 ==== */
@media (max-width: 480px) {
  .gate-shell { padding: 26px 16px; gap: 16px; }
  .gate-card { padding: 34px 22px 20px; border-radius: 22px; }
  .gate-badge { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 16px;
    box-shadow: 0 12px 24px #7952b338, 0 0 0 7px #7952b314, inset 0 1px 0 #ffffff33; }
  .gate-badge .icon { width: 25px; height: 25px; }
  .gate-title { font-size: 20px; }
  .gate-sub { font-size: 12px; }
  form { margin-top: 22px; }
  .field-wrap input { font-size: 16px; }
  .gate-button { height: 50px; }
}

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