/* ============================================================
   TOBIRA — auth.css
   Same brand as index.html taste C-2: near-black canvas,
   warm ink #f2efe9, ONE vermilion accent #ff5b3d, gothic 900,
   hairlines, pill capsules, springy overshoot motion.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #0c0c0c;
  --line: rgba(242, 239, 233, .14);
  --line-strong: rgba(242, 239, 233, .28);
  --ink: #f2efe9;
  --ink-dim: #b3afa6;
  --ink-faint: #79766e;
  --accent: #ff5b3d;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.19, 1, .22, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.auth-body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Inter, "Noto Sans JP", sans-serif;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   HEADER — minimal top bar floating over everything
   ============================================================ */
.auth-header {
  position: fixed;
  z-index: 40;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, .78);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
}
.brand {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.04em;
  text-decoration: none;
}
.brand span { color: var(--accent); }
.back-link {
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.back-link:hover { color: #0a0a0a; background: var(--ink); border-color: var(--ink); }

/* ============================================================
   BACKDROP — muted living video wall (right side on desktop)
   ============================================================ */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #060606;
}
.backdrop-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  background: #050505;
}
.backdrop-grid video {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  filter: saturate(.7) brightness(.6);
}
/* dark gradient shading toward the panel (left) */
.backdrop-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 10, 10, .96) 0%, rgba(10, 10, 10, .78) 34%, rgba(10, 10, 10, .28) 58%, rgba(10, 10, 10, .45) 100%),
    linear-gradient(rgba(10, 10, 10, .35), rgba(10, 10, 10, .55));
  pointer-events: none;
}
.backdrop-eyebrow {
  position: absolute;
  right: 28px;
  bottom: 22px;
  margin: 0;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* ============================================================
   LAYOUT — split screen; panel occupies left ~44%
   ============================================================ */
.auth-main {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 100dvh;
  padding: 96px 0 48px clamp(20px, 5vw, 72px);
}
.auth-panel {
  position: relative;
  width: min(460px, 44vw);
  min-width: 320px;
  overflow: hidden;
  padding: clamp(28px, 3.4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 12, 12, .88);
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, .9);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
}

/* ============================================================
   TYPE — micro-label + heavy gothic heading
   ============================================================ */
.micro-label {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.auth-heading {
  margin: 0 0 28px;
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.045em;
}

/* ============================================================
   FIELDS
   ============================================================ */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.field input[type="email"],
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111110;
  color: var(--ink);
  font-size: 14px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:hover { border-color: var(--line-strong); }
.field input:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 91, 61, .22);
}
/* invalid state */
.field input[aria-invalid="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 91, 61, .4);
}
.field-error {
  margin: 7px 0 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
/* error summary / mock-fail line */
.form-status {
  margin: 0 0 14px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 91, 61, .4);
  border-radius: 10px;
  background: rgba(255, 91, 61, .08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
/* reset success confirmation */
.reset-success {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(242, 239, 233, .05);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

/* password show/hide */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.pw-toggle:hover { background: rgba(242, 239, 233, .08); color: var(--ink); }
.pw-toggle[aria-pressed="true"] { color: var(--accent); }

/* checkbox row */
.field-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.field-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.field-check label {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
  cursor: pointer;
}
.field-check .field-error { flex-basis: 100%; margin-top: 2px; }

/* ============================================================
   STRENGTH METER — 4 segments, vermilion fill
   ============================================================ */
.strength-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 9px;
}
.strength-meter i {
  height: 3px;
  border-radius: 2px;
  background: rgba(242, 239, 233, .12);
  transition: background .25s ease, box-shadow .25s ease;
}
.strength-meter i.is-on {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 91, 61, .45);
}
.strength-note {
  margin: 7px 0 0;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: .03em;
}

/* ============================================================
   CTA — vermilion pill + traveling sheen (index.html pattern)
   ============================================================ */
.cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .35s var(--spring), background .2s ease, border-color .2s ease, opacity .2s ease;
}
.cta:hover { transform: translateY(-2px); }
.cta:active { transform: translateY(0) scale(.985); }
.cta[disabled] { opacity: .6; cursor: wait; transform: none; }

.cta-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 34px -14px rgba(255, 91, 61, .55);
}
.cta-primary:hover { background: #ff6c50; }
/* traveling sheen */
.cta-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  background-size: 260% 100%;
  animation: cta-sheen 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cta-sheen {
  0%, 55% { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}

/* Google button — quiet outlined pill */
.cta-google {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}
.cta-google:hover { border-color: var(--ink); background: rgba(242, 239, 233, .05); }
.g-glyph { flex: 0 0 auto; }
/* connecting spinner state */
.cta-google.is-connecting .g-glyph { animation: g-spin .7s linear infinite; }
@keyframes g-spin { to { transform: rotate(360deg); } }

/* ============================================================
   LINKS + DIVIDER
   ============================================================ */
.form-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 16px;
}
.form-links a {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.form-links a:hover { color: var(--accent); border-color: var(--accent); }

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--ink-faint);
  font-size: 11px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ============================================================
   STATE TRANSITIONS — outgoing fades/slides, incoming springs
   ============================================================ */
.auth-form.is-leaving {
  animation: form-out .22s ease both;
  pointer-events: none;
}
.auth-form.is-entering {
  animation: form-in .5s var(--spring) both;
}
@keyframes form-out {
  to { opacity: 0; transform: translateX(-22px); }
}
@keyframes form-in {
  from { opacity: 0; transform: translateX(30px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* shake on invalid submit (subtle, ~300ms) */
.auth-form.is-shaking { animation: form-shake .3s ease both; }
@keyframes form-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* ============================================================
   RESPONSIVE — mobile: backdrop is a dim full-bleed background
   ============================================================ */
@media (max-width: 860px) {
  .auth-main {
    justify-content: center;
    padding: 92px 18px 40px;
  }
  .auth-panel {
    width: 100%;
    max-width: 460px;
    min-width: 0;
  }
  .backdrop-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
  .backdrop-grid video { filter: saturate(.6) brightness(.4); }
  .backdrop-shade {
    background:
      linear-gradient(rgba(10, 10, 10, .82), rgba(10, 10, 10, .9));
  }
  .backdrop-eyebrow { display: none; }
  .auth-header { padding: 0 18px; }
}

/* ============================================================
   REDUCED MOTION — kill all animation
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .cta-primary::after { animation: none; display: none; }
  .cta:hover { transform: none; }
}
