/* ============================================
   Fonts — self-hosted from /fonts/
   ============================================ */
@font-face {
  font-family: "Cabinet Grotesk";
  src: url("/fonts/CabinetGrotesk-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   Design Tokens (Propio Plaid)
   ============================================ */
:root {
  /* ── Color Primitives ── */
  --brand-500: #3A7690;
  --brand-600: #2F5F76;
  --brand-700: #24495B;

  /* ── Semantic Colors ── */
  --background: #F9FAFB;
  --surface1: #FFFFFF;
  --surface2: #F3F5F6;
  --surface3: #E3E6E8;
  --border: #E3E6E8;
  --border-visible: #D0D4D7;
  --text1: #1A1E20;
  --text2: #4D5559;
  --text3: #6B7478;
  --text4: #9CA3A8;
  --accent: #3A7690;
  --accent-subtle: #F3F6F7;
  --accent-hover: #2F5F76;
  --success: #18A34A;
  --warning: #F9A326;
  --error: #E5243B;

  /* ── Typography ── */
  --font-display: "Cabinet Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Switzer", system-ui, -apple-system, sans-serif;

  /* ── Spacing (4px grid) ── */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* ── Radii ── */
  --radius-element: 8px;
  --radius-control: 12px;
  --radius-component: 16px;
  --radius-container: 24px;
  --radius-pill: 40px;

  /* ── Elevation (Stacked Diffusion) ── */
  --shadow-color: rgb(0 0 0 / 0.06);
  --e0: none;
  --e1: 0 0 0 1px var(--shadow-color), 0 1px 1px -0.5px var(--shadow-color);
  --e2: 0 0 0 1px var(--shadow-color), 0 1px 1px -0.5px var(--shadow-color), 0 3px 3px -1.5px var(--shadow-color);
  --e3: 0 0 0 1px var(--shadow-color), 0 1px 1px -0.5px var(--shadow-color), 0 3px 3px -1.5px var(--shadow-color), 0 6px 6px -3px var(--shadow-color);
  --e4: 0 0 0 1px var(--shadow-color), 0 1px 1px -0.5px var(--shadow-color), 0 3px 3px -1.5px var(--shadow-color), 0 6px 6px -3px var(--shadow-color), 0 12px 12px -6px var(--shadow-color);
  --e5: 0 0 0 1px var(--shadow-color), 0 1px 1px -0.5px var(--shadow-color), 0 3px 3px -1.5px var(--shadow-color), 0 6px 6px -3px var(--shadow-color), 0 12px 12px -6px var(--shadow-color), 0 24px 24px -12px var(--shadow-color);

  /* ── Motion ── */
  --ease-spring: cubic-bezier(0.23, 1.2, 0.32, 1);
  --ease-standard: ease-in-out;
  --duration-fast: 100ms;
  --duration-normal: 350ms;
  --duration-slow: 500ms;

  /* ── Icons ── */
  --icon-size: 20px;
  --icon-stroke: 1.5px;
  --icon-bound: 32px;
}

/* ============================================
   Base Reset
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--text1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Layout
   ============================================ */
.page-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

/* ============================================
   Card
   ============================================ */
.card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius-component);
  box-shadow: var(--e2);
}

.static-card {
  text-align: center;
  padding: var(--space-2xl);
  max-width: 448px;
  width: 100%;
}

.static-card-icon {
  width: 40px;
  height: 40px;
  color: var(--text4);
  margin: 0 auto var(--space-md);
}

.static-card h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
  color: var(--text1);
}

.static-card p {
  font-family: var(--font-body);
  color: var(--text3);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  border: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-spring);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.btn-primary {
  background-color: var(--accent);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius-control);
  padding: 8px 12px;
}
.btn-ghost:hover {
  background-color: var(--surface2);
  color: var(--text1);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-icon {
  width: var(--icon-bound);
  height: var(--icon-bound);
  padding: 0;
  border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   Institution Card
   ============================================ */
.institution-card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: var(--space-md);
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-normal) var(--ease-spring);
}

.institution-card:hover {
  border-color: var(--accent);
  box-shadow: var(--e3);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-width: 384px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface1);
  box-shadow: var(--e4);
  animation: toast-in var(--duration-normal) var(--ease-spring) forwards;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

.toast-error {
  border-left: 3px solid var(--error);
}
.toast-error .toast-icon {
  color: var(--error);
}

.toast-success {
  border-left: 3px solid var(--success);
}
.toast-success .toast-icon {
  color: var(--success);
}

.toast-info {
  border-left: 3px solid var(--accent);
}
.toast-info .toast-icon {
  color: var(--accent);
}

.toast-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text4);
  padding: 2px;
  border-radius: var(--radius-element);
  display: flex;
  flex-shrink: 0;
  transition: color var(--duration-fast) var(--ease-standard);
}
.toast-dismiss:hover {
  color: var(--text1);
}

.toast-removing {
  animation: toast-out 200ms ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(12px); }
}

/* ============================================
   Spinner
   ============================================ */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Modal
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-in;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius-container);
  box-shadow: var(--e5);
  padding: var(--space-xl);
  max-width: 480px;
  width: calc(100% - 32px);
  transform: scale(0.95);
  opacity: 0;
  transition: transform var(--duration-normal) var(--ease-spring),
              opacity var(--duration-normal) var(--ease-spring);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-2xl) var(--space-xl);
  color: var(--text3);
}

.empty-state-icon {
  width: 40px;
  height: 40px;
  color: var(--text4);
  margin-bottom: var(--space-2xs);
}

/* ============================================
   Inline Error
   ============================================ */
.inline-error {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-element);
  color: var(--error);
  font-size: 14px;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* ============================================
   Brand Logo
   ============================================ */
.brand-logo {
  display: block;
  margin: 0 auto;
  width: 160px;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* ============================================
   Feature List (Modal)
   ============================================ */
.feature-item {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.feature-item-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================
   Link Text
   ============================================ */
.link-text {
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

.link-text:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ============================================
   Text Utilities
   ============================================ */
.text-muted {
  color: var(--text3);
}

.text-sm {
  font-size: 12px;
}

/* ============================================
   Section Label
   ============================================ */
.section-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.33;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
}

/* ============================================
   Footer
   ============================================ */
.page-footer {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text4);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ============================================
   Enter Animations
   ============================================ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.animate-enter {
  animation: fade-up var(--duration-normal) var(--ease-spring) both;
}

.animate-enter-delay-1 {
  animation: fade-up var(--duration-normal) var(--ease-spring) both;
  animation-delay: 100ms;
}

.animate-enter-delay-2 {
  animation: fade-up var(--duration-normal) var(--ease-spring) both;
  animation-delay: 200ms;
}

.animate-enter-delay-3 {
  animation: fade-up var(--duration-normal) var(--ease-spring) both;
  animation-delay: 300ms;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .toast-container {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }

  .modal-content {
    padding: var(--space-lg);
  }

  .page-center {
    padding: var(--space-md);
  }

  .static-card {
    padding: var(--space-xl);
  }
}
