/* ===== Base ===== */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--sp-4);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* ===== Layout ===== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}

.section {
  padding: var(--sp-24) 0;
}

.section-head {
  margin-bottom: var(--sp-8);
}

.eyebrow {
  display: block;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-head h2 {
  margin: 0 0 var(--sp-3);
  font-size: clamp(2rem, 2.5vw + 1rem, 3rem);
}

.lead {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  box-shadow: var(--glow);
}

.btn--ghost {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid var(--border-strong);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  border-color: var(--accent);
}

/* ===== Tags and badges ===== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.badge {
  align-self: flex-start;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.badge--warn {
  color: var(--warn);
  border-color: var(--warn);
}

.badge--soon {
  color: var(--muted-badge);
  border-color: var(--muted-badge);
}

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

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--glow);
}

.card__media {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  flex: 1;
}

.card__title {
  margin: 0;
  font-size: var(--fs-lg);
}

.card__text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: auto;
}

.card--featured {
  border-color: var(--border-strong);
}

.card--featured:hover,
.card--featured:focus-within {
  box-shadow: var(--glow-strong);
}

.card--soon {
  opacity: 0.9;
}

.card--soon .card__media {
  opacity: 0.75;
}

.card--repo {
  padding: var(--sp-6);
}

/* ===== Grid ===== */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
}

/* ===== Utilities ===== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: 999;
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-sm);
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

@media (max-width: 639px) {
  .section {
    padding: var(--sp-12) 0;
  }
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card--featured {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .card--featured .card__media {
    width: 55%;
    height: auto;
    aspect-ratio: 16/10;
  }

  .card--featured .card__body {
    justify-content: center;
  }

  .card--featured .card__title {
    font-size: var(--fs-2xl);
  }
}

/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after,
  .btn,
  .card {
    animation: none;
    transition: none;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}
