/* =============================================================================
   Public authentication styles (sign-in / key registration).
   -----------------------------------------------------------------------------
   - No service, organisation, region, or workflow disclosure before login.
   - Light/dark follow the device setting via color-scheme + light-dark().
   - Self-contained: this file is loaded only by the public auth page and must
     not depend on the authenticated dashboard stylesheet.
   ========================================================================== */

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

/* hidden 属性をコンポーネントの display 指定より優先させる（空アラートの誤表示防止）。 */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: light dark;

  --auth-bg: light-dark(#e9eef1, #0b1014);
  --auth-bg-2: light-dark(#dce6ea, #0f1a22);
  --auth-surface: light-dark(#ffffff, #151f27);
  --auth-surface-2: light-dark(#f3f7f8, #1b2730);
  --auth-border: light-dark(#d6e0e4, #28333c);
  --auth-border-strong: light-dark(#bfcbd1, #3a4a53);

  --auth-ink: light-dark(#152229, #e8eef1);
  --auth-ink-2: light-dark(#46555e, #b2c0c8);
  --auth-ink-3: light-dark(#5f6e77, #8a9aa3);

  --auth-brand: light-dark(#0f6e79, #2db6c4);
  --auth-brand-strong: light-dark(#0a525c, #57cdd9);
  --auth-brand-weak: light-dark(#e2f0f2, #0f3940);
  --auth-on-brand: light-dark(#ffffff, #04282d);

  --auth-danger: light-dark(#b02a1f, #f0938a);
  --auth-danger-bg: light-dark(#fbe3e0, #381512);
  --auth-danger-border: light-dark(#e6b3ac, #5a221c);

  --auth-focus: light-dark(#0a4f59, #79dbe6);

  --auth-shadow: light-dark(208deg 24% 22%, 205deg 60% 2%);
  --auth-radius: 16px;
  --auth-radius-sm: 10px;

  --auth-font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "YuGothic", "Noto Sans JP", "Meiryo", system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--auth-font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--auth-ink);
  background:
    radial-gradient(1100px 620px at 85% -8%, var(--auth-brand-weak), transparent 60%),
    radial-gradient(900px 560px at -10% 110%, var(--auth-bg-2), transparent 55%),
    var(--auth-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* Skip link --------------------------------------------------------------- */
.auth-skip {
  position: absolute;
  left: 16px;
  top: -120px;
  z-index: 10;
  background: var(--auth-surface);
  color: var(--auth-ink);
  border: 2px solid var(--auth-focus);
  border-radius: var(--auth-radius-sm);
  padding: 10px 16px;
  text-decoration: none;
  font-weight: 600;
  transition: top 180ms ease;
}
.auth-skip:focus {
  top: 16px;
}

/* Layout ------------------------------------------------------------------ */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 20px;
  padding: 32px 20px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  box-shadow:
    0 1px 2px hsl(var(--auth-shadow) / 0.10),
    0 18px 48px hsl(var(--auth-shadow) / 0.18);
  padding: 34px 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Brand mark (abstract, no business meaning) ------------------------------ */
.auth-brand {
  display: flex;
  justify-content: center;
}
.auth-brand__mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--auth-on-brand);
  background: linear-gradient(150deg, var(--auth-brand), var(--auth-brand-strong));
  box-shadow: 0 6px 18px hsl(var(--auth-shadow) / 0.22);
}
.auth-brand__mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Headings ---------------------------------------------------------------- */
.auth-title {
  margin: 0;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.auth-sub {
  margin: -6px 0 2px;
  text-align: center;
  color: var(--auth-ink-2);
  font-size: 0.92rem;
}

/* Alerts ------------------------------------------------------------------ */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--auth-radius-sm);
  background: var(--auth-danger-bg);
  border: 1px solid var(--auth-danger-border);
  color: var(--auth-danger);
  font-size: 0.86rem;
  font-weight: 600;
}
.auth-alert__icon {
  flex: 0 0 auto;
  margin-top: 2px;
}

/* Form -------------------------------------------------------------------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 4px 0 0;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--auth-ink);
}
.auth-input {
  width: 100%;
  font: inherit;
  color: var(--auth-ink);
  background: var(--auth-surface-2);
  border: 1px solid var(--auth-border-strong);
  border-radius: var(--auth-radius-sm);
  padding: 11px 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auth-input::placeholder {
  color: var(--auth-ink-3);
}
.auth-input:focus {
  outline: none;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-brand) 24%, transparent);
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--auth-on-brand);
  background: var(--auth-brand);
  border: 1px solid transparent;
  border-radius: var(--auth-radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, opacity 120ms ease;
}
.auth-submit svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-submit:hover {
  background: var(--auth-brand-strong);
}
.auth-submit:active {
  transform: translateY(1px);
}
.auth-submit[disabled],
.auth-submit[aria-disabled="true"] {
  opacity: 0.65;
  cursor: progress;
}

/* Spinner used while a ceremony is in progress ---------------------------- */
.auth-spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--auth-on-brand) 45%, transparent);
  border-top-color: var(--auth-on-brand);
  animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Footnotes --------------------------------------------------------------- */
.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 2px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-ink-2);
  font-size: 0.82rem;
}
.auth-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--auth-ink-3);
}
.auth-foot {
  margin: 0;
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--auth-ink-3);
}

/* Focus visibility -------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--auth-focus);
  outline-offset: 2px;
  border-radius: 6px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 480px) {
  body {
    font-size: 14.5px;
  }
  .auth-card {
    padding: 26px 20px 22px;
    border-radius: 14px;
  }
  .auth-title {
    font-size: 1.32rem;
  }
}

/* High contrast ----------------------------------------------------------- */
@media (prefers-contrast: more) {
  :root {
    --auth-border: light-dark(#9aa7ad, #56666f);
    --auth-ink-3: light-dark(#46545c, #aab8bf);
  }
  .auth-card,
  .auth-input,
  .auth-submit {
    border-width: 1.5px;
  }
}

/* Reduced motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
