/* ==========================================================================
   Layer 6: Components — building blocks for page sections
   5-color × 5-appearance variant system where applicable
   ========================================================================== */

/* --- Skip link (a11y) --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: var(--space-2xs) var(--space-s);
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--color-primary);
  color: var(--color-primary-content);
  z-index: 9999;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-m);
  border: 1px solid transparent;
  border-radius: var(--radius-component-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  letter-spacing: var(--tracking-body);
  line-height: var(--line-tight);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn svg { width: 1.2em; height: 1.2em; flex-shrink: 0; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Sizes */
.btn-sm { padding: var(--space-2xs) var(--space-s); font-size: var(--text-sm); border-radius: var(--radius-component-sm); }
.btn-lg { padding: var(--space-xs) var(--space-m); font-size: var(--text-lg); border-radius: var(--radius-component-lg); }

/* Filled (default appearance) */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-content);
}
.btn-primary:hover {
  background: oklch(from var(--color-primary) calc(l - 0.06) c h);
}

/* Outline */
.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-surface-alt);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-ink);
}
.btn-ghost:hover {
  background: var(--color-surface-alt);
}


/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-component-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  line-height: var(--line-tight);
  white-space: nowrap;
  background: var(--color-primary);
  color: var(--color-primary-content);
}

/* Sizes */
.badge-xs { padding: 2px var(--space-3xs); font-size: var(--text-xs); border-radius: var(--radius-component-xs); }
.badge-sm { padding: var(--space-3xs) var(--space-2xs); font-size: var(--text-xs); border-radius: var(--radius-component-sm); }
.badge-lg { padding: var(--space-2xs) var(--space-xs); font-size: var(--text-md); border-radius: var(--radius-component-lg); }

/* Shapes */
.badge-pill { border-radius: var(--radius-full); }
.badge-square { border-radius: var(--radius-xs); }

/* Appearances */
.badge-outlined { background: transparent; border: 1px solid currentColor; color: var(--color-primary); }
.badge-plain { background: var(--color-surface-alt); color: var(--color-ink); }

/* Colors */
.badge-success { background: var(--color-success); color: #fff; }
.badge-warning { background: var(--color-warning); color: #fff; }
.badge-error { background: var(--color-error); color: #fff; }
.badge-neutral { background: var(--neutral-200); color: var(--color-ink); }

/* Pulse animation */
.badge-pulse::after { content: ""; position: absolute; inset: 0; border-radius: inherit; animation: badge-pulse 2s ease-in-out infinite; }
@keyframes badge-pulse { 0%,100% { box-shadow: 0 0 0 0 currentColor; opacity: .4; } 70% { box-shadow: 0 0 0 6px currentColor; opacity: 0; } }

.badge svg { width: 1em; height: 1em; flex-shrink: 0; }


/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-component-lg);
  padding: var(--space-l);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-body { padding: var(--space-m); }


/* ==========================================================================
   Site header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--color-surface) 95%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-soft);
}

.site-header .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.site-logo {
  font-weight: var(--weight-bold);
  font-size: var(--step-1);
  color: var(--color-ink);
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-l);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  color: var(--color-ink-soft);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--color-primary);
  text-decoration: none;
}


/* ==========================================================================
   Site footer
   ========================================================================== */

.site-footer {
  background: var(--color-surface-dark);
  color: var(--neutral-200);
  padding-block: var(--space-xl) var(--space-m);
}

.site-footer a {
  color: var(--neutral-300);
  text-decoration: none;
}
.site-footer a:hover { color: #fff; }

.site-footer h4 {
  color: #fff;
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-xs);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-l);
}

.footer-brand p {
  color: var(--neutral-400);
  margin-top: var(--space-2xs);
  font-size: var(--step--1);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li a { font-size: var(--step--1); }

.footer-bottom {
  border-top: 1px solid color-mix(in srgb, #fff 10%, transparent);
  padding-top: var(--space-m);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--step--2);
  color: var(--neutral-400);
}


/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  text-align: center;
  padding-block: var(--space-m-xl);
}

.hero h1 { margin-bottom: var(--space-s); }
.hero p { margin-inline: auto; color: var(--color-ink-soft); }


/* ==========================================================================
   Mobile menu
   ========================================================================== */

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2xs);
}

.menu-icon {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-ink);
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--color-ink);
}

.menu-icon::before { top: -7px; }
.menu-icon::after  { top: 7px; }


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1023px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .menu-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: var(--space-s);
    gap: var(--space-xs);
  }

  .site-nav.open { display: flex; }

  .footer-grid { grid-template-columns: 1fr; gap: var(--space-l); }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-2xs);
    text-align: center;
  }
}
