/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: #555;
  background: #ffffff;
}

body {
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  color: #111;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: #2563eb; }
a:hover { color: #1d4ed8; }

/* ============================================
   HEADER
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  height: 56px;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #111;
}

.header-logo img { height: 32px; display: block; }

.header-logo .site-name {
  font-size: 15px;
  font-weight: 600;
  color: #111;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-nav { display: flex; gap: 28px; }

.header-nav a {
  font-size: 14px;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.header-nav a:hover { color: #111; }
.header-nav a.active { color: #111; font-weight: 500; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: #111;
  border-radius: 2px;
  display: block;
  transition: all 0.2s ease;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
  padding: 20px 24px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left { display: flex; align-items: center; gap: 12px; }
.footer-logo img { height: 24px; display: block; }
.footer-copy { font-size: 13px; color: #888; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-nav a { font-size: 13px; color: #888; text-decoration: none; }
.footer-nav a:hover { color: #111; }

/* ============================================
   AUTH CARD
   ============================================ */

.auth-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 24px 96px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #ffffff;
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  color: #111;
  margin: 0 0 8px;
}

.auth-sub {
  font-size: 14px;
  color: #888;
  margin: 0 0 24px;
  line-height: 1.5;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 13px;
  font-weight: 500;
  color: #111;
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #111;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus { border-color: #2563eb; }

.field-error {
  font-size: 13px;
  color: #dc2626;
  margin-top: 2px;
  min-height: 1em;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.checkbox-row input { margin-top: 2px; }

.btn-primary {
  display: inline-block;
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }

.btn-secondary {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: #ffffff;
  color: #111;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s;
}

.btn-secondary:hover { border-color: #111; }

.auth-links {
  margin-top: 20px;
  font-size: 14px;
  color: #555;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-links a { color: #2563eb; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.form-banner {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  display: none;
}

.form-banner.visible { display: block; }
.form-banner.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.form-banner.success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   OAUTH BUTTON (Continue with Google)
   Styled to Google's branding requirements: white background, 4-color G,
   neutral border, "Continue with Google" wording.
   ============================================ */

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #ffffff;
  color: #3c4043;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-oauth:hover { background: #f8f9fa; border-color: #c6c9cc; }
.btn-oauth:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-oauth .oauth-icon { display: block; flex-shrink: 0; }

.oauth-divider {
  position: relative;
  text-align: center;
  margin: 16px 0;
  font-size: 13px;
  color: #888;
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 28px);
  height: 1px;
  background: #e5e5e5;
}

.oauth-divider::before { left: 0; }
.oauth-divider::after { right: 0; }
.oauth-divider span { background: #ffffff; padding: 0 8px; position: relative; }

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* Password field with show/hide toggle */
.password-field { position: relative; }
.field .password-field input { padding-right: 40px; }

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.password-toggle:hover { color: #111; }
.password-toggle:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.password-toggle svg { width: 18px; height: 18px; display: block; }

/* Caps Lock warning */
.caps-warning {
  font-size: 13px;
  color: #d97706;
  margin-top: 4px;
  display: none;
}
.caps-warning.visible { display: block; }

/* Field hint (password requirements etc.) */
.field-hint {
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

/* Inbox state */
.inbox-icon {
  display: flex;
  justify-content: center;
  color: #2563eb;
  margin-bottom: 12px;
}
.inbox-icon svg { display: block; }

.inbox-divider {
  border: 0;
  border-top: 1px solid #e5e5e5;
  margin: 20px 0;
}

.resend-block {
  text-align: center;
}

.resend-prompt {
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
}

.resend-timer {
  font-size: 14px;
  color: #888;
}

.resend-confirm {
  font-size: 13px;
  color: #16a34a;
  margin-top: 8px;
  display: none;
}
.resend-confirm.visible { display: block; }

.use-different {
  text-align: center;
  font-size: 14px;
}

/* ============================================
   STATIC PAGES
   ============================================ */

.page-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.page-content h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  color: #111;
  margin: 0 0 24px;
}

.page-content h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #111;
  margin: 32px 0 10px;
}

.page-content p {
  font-size: 1rem;
  line-height: 1.75;
  color: #555;
  margin-bottom: 16px;
}

.page-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.page-content li {
  font-size: 1rem;
  line-height: 1.75;
  color: #555;
}

.last-updated {
  font-size: 0.875rem;
  color: #888;
  margin-bottom: 32px;
}

/* ============================================
   404
   ============================================ */

.notfound-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 64px 24px;
  text-align: center;
}

.notfound-code {
  font-size: 96px;
  font-weight: 700;
  color: #e5e5e5;
  letter-spacing: -4px;
  margin-bottom: 8px;
}

.notfound-title {
  font-size: 28px;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px;
}

.notfound-desc {
  font-size: 16px;
  color: #555;
  margin: 0 0 24px;
}

/* ============================================
   MEDIA QUERIES
   ============================================ */

@media (max-width: 640px) {
  .hamburger { display: flex; }
  .header-nav { display: none; }
  .header-right { gap: 12px; }

  .site-header.nav-open .header-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 16px 24px;
    gap: 16px;
  }

  .site-header.nav-open .header-nav a { font-size: 15px; color: #111; }

  .site-header.nav-open .hamburger span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .site-header.nav-open .hamburger span:nth-child(2) { opacity: 0; }
  .site-header.nav-open .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-nav { gap: 12px; }

  .auth-wrap { padding: 32px 16px 64px; }
  .auth-card { padding: 24px; }
}

/* Two-factor (TOTP / backup code) challenge UI */
.totp-challenge {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.totp-challenge h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.totp-challenge .totp-desc {
  font-size: 14px;
  color: #555;
  margin: 0 0 4px 0;
}
.totp-challenge input[type="text"] {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  font-family: 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.15em;
  text-align: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
}
.totp-challenge input[type="text"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.totp-error {
  margin: 0;
  color: #dc2626;
  font-size: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 6px;
}
.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
  text-align: center;
}
.btn-link:hover { text-decoration: underline; }

/* ===== /2fa dedicated challenge page ===== */

.auth-card-2fa {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-subtitle {
  color: #555;
  font-size: 14px;
  margin: 0 0 20px;
}

.code-input {
  display: block;
  width: 100%;
  text-align: center;
  font-family: 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
  font-size: 28px;
  letter-spacing: 0.4em;
  padding: 16px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 150ms;
}

.code-input:focus {
  border-color: #2563eb;
}

.code-input-recovery {
  font-size: 18px;
  letter-spacing: 0.1em;
}

.code-input.shake {
  animation: shake-x 0.4s ease-in-out;
  border-color: #dc2626;
}

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-full { width: 100%; }

.btn-with-spinner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.auth-error {
  color: #dc2626;
  font-size: 13px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 8px 0 0;
}

.auth-options {
  margin-top: 24px;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
}

.auth-options summary {
  cursor: pointer;
  color: #888;
  font-size: 13px;
  list-style: none;
  user-select: none;
}

.auth-options summary::-webkit-details-marker { display: none; }

.auth-options summary::after {
  content: ' ▾';
  font-size: 11px;
}

.auth-options[open] summary::after {
  content: ' ▴';
}

.auth-options-content {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-back-link {
  display: inline-block;
  margin-top: 20px;
  color: #888;
  font-size: 13px;
  text-decoration: none;
}

.auth-back-link:hover { color: #111; }

