/*
 * Jace's visual base: Handy a Bordo's tokens, auth card, buttons and flash
 * (rails/app/assets/stylesheets/application.css in handy-v2-poly), with Jace's
 * own brand color for the mark and the focus ring. Light theme only for now.
 */

:root {
  --background: #fdf8f3;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --muted: #f5f5f4;
  --muted-foreground: #737373;
  --border: #e7e5e4;
  --input: #d6d3d1;
  --ring: #a8a29e;
  --primary: #171717;
  --primary-foreground: #fafafa;
  /* red-700: white on it is 6.52:1 (Handy's AA fix). */
  --destructive: #b91c1c;
  --destructive-foreground: #ffffff;
  --success: #10b981;
  --danger: #ef4444;
  /* Jace: teal-700 with white is 5.47:1. */
  --brand: #0f766e;
  --brand-foreground: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(15 23 42 / 5%), 0 10px 28px rgb(15 23 42 / 6%);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  /* dvh: 100vh floors the page taller than a phone's visible area. */
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--background) 92%, var(--card)) 0, var(--background) 240px);
  color: var(--foreground);
  font-feature-settings: "rlig" 1, "calt" 1;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-12 { width: 12px; height: 12px; }
.icon-16 { width: 16px; height: 16px; }

.muted {
  color: var(--muted-foreground);
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Logo */

.jace-logo {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--logo-size) * 0.3);
}

.jace-logo__mark {
  width: var(--logo-size);
  height: var(--logo-size);
}

.jace-logo__word {
  font-size: calc(var(--logo-size) * 0.62);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Sign-in */

.auth-main {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 420px);
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  animation: auth-rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card__brand { animation: none; }
}

.auth-card__copy h1,
.auth-card__copy p {
  margin: 0;
}

.auth-card__copy h1 {
  font-size: 24px;
  line-height: 1.15;
  margin-bottom: 8px;
}

.auth-card__copy p,
.auth-card__footer {
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  margin-top: 20px;
}

.auth-card__footer {
  margin-top: 16px;
  font-size: 12px;
}

/* Buttons */

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgb(15 23 42 / 3%);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.button .icon {
  width: 14px;
  height: 14px;
}

.button--small {
  min-height: 30px;
  font-size: 12px;
}

.button--small .icon {
  width: 12px;
  height: 12px;
}

.button--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.button--primary:hover {
  background: color-mix(in srgb, var(--primary) 88%, var(--foreground));
}

/* Google's own sign-in button guidance: white, its four-color mark, a border. */
.button--google {
  width: 100%;
  min-height: 42px;
  border-color: var(--input);
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
}

.button--google:hover {
  background: var(--muted);
}

.button--google .google-mark {
  width: 18px;
  height: 18px;
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 32%, transparent);
}

/* Signed in: the welcome, centered on both axes. */

.welcome {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Flash (Handy's floating pills) */

.flash-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1000;
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: min(560px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.flash {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 8px 32px color-mix(in srgb, black 22%, transparent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: auto;
  text-align: center;
  transition: opacity 160ms ease, transform 160ms ease;
  animation: flash-pop-in 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes flash-pop-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; }
}

.flash__icon,
.flash__dismiss {
  display: inline-grid;
  place-items: center;
}

.flash__message {
  min-width: 0;
}

.flash__dismiss {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.flash__dismiss:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.flash--dismissed {
  opacity: 0;
  transform: translateY(-6px);
}

.flash--notice {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.flash--alert {
  border: 1px solid #b91c1c;
  background: #b91c1c;
  color: #ffffff;
}
