/* Garfield Kart font, free to use personally */
@font-face {
  font-family: 'Witless';
  src: local('Witless'), url('../fonts/Witless.ttf') format('truetype');
  font-display: swap;
}

:root {
  --font-title: 'Witless', cursive;
  --font-body: sans-serif;

  --bg: #0e0d0c;
  --check: #171513;
  --surface: #181614;
  --border: #2a2622;
  --text: #f1ece6;
  --muted: #a39a90;
  --accent: #ff9a1f;
  --accent-glow: rgba(255, 154, 31, 0.35);
  --link-blue: #1a84c3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 16px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), serif;
  line-height: 1.6;
}

/* Checkered background */
body::before {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: -2;
  background: repeating-conic-gradient(var(--check) 0 25%, var(--bg) 0 50%) 0 0 / 200px 200px;
  transform: rotate(-12deg);
  animation: checker-scroll 8s linear infinite;
}

/* Background scrolling (1 tile is 200px so it is seamless) */
@keyframes checker-scroll {
  to {
    background-position: 0 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

/* At least one screen tall, so the footer is always below the fold */
.page {
  min-height: 100svh;
  padding-bottom: 64px;
}

.hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 96px 0 72px;
  text-align: center;
}

.title {
  margin: 0;
  font-family: var(--font-title), serif;
  font-weight: 400;
  font-size: clamp(3.25rem, 11vw, 7rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--accent);
  text-shadow: -3px 5px 0 #7a3f00;
}

.tagline {
  margin: 24px auto 0;
  max-width: 38rem;
  font-size: 1.15rem;
  color: var(--muted);
}

main {
  max-width: 1000px;
  margin: 0 auto;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 24px;
  font-family: var(--font-title), serif;
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text);
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 40px -10px var(--accent-glow);
  outline: none;
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #221f1c;
  border-bottom: 1px solid var(--border);
  border-radius: 13px 13px 0 0;
  filter: saturate(0.85);
  transition: filter 0.2s ease;
}

.card:hover .card-image,
.card:focus-within .card-image {
  filter: saturate(1.1);
}

/* For bright images - dims them and fades the bottom into the card */
.card-image-fadein {
  filter: saturate(0.85) brightness(0.8);
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, rgba(0, 0, 0, 0.35));
  mask-image: linear-gradient(to bottom, #000 50%, rgba(0, 0, 0, 0.35));
}

.card:hover .card-image-fadein,
.card:focus-within .card-image-fadein {
  filter: saturate(1) brightness(1);
}

.card-body {
  padding: 18px 20px 22px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
}

.card-title {
  margin: 0;
  font-family: var(--font-title), serif;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.card:hover .card-title,
.card:focus-within .card-title {
  color: var(--accent);
}

/* The title link stretches over the whole card so the card is clickable */
.card-link {
  color: inherit;
  text-decoration: none;
  outline: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-description {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Links inside descriptions sit above the card link and show their URL on hover */
.inline-link {
  position: relative;
  z-index: 1;
  color: var(--accent);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.inline-link::after {
  content: attr(href);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.inline-link:hover::after,
.inline-link:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.speedrun-profile-link {
  text-decoration: none;
}

.speedrun-profile-link:hover {
  text-decoration: underline;
}

.speedrun-profile-link::after {
  content: "Don't believe me?";
}

/* Repo button, also sits above the card link */
.repo-link {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  padding: 3px 12px;
  border: 1px solid var(--link-blue);
  border-radius: 999px;
  color: var(--link-blue);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.repo-link:hover,
.repo-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

/* Same tooltip as .inline-link, but right-aligned so it stays on screen */
.repo-link::after {
  content: attr(href);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.repo-link:hover::after,
.repo-link:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  position: relative;
  margin: 0 -16px;
  padding: 48px 16px 40px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

/* Another checker pattern */
.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: repeating-conic-gradient(var(--text) 0 25%, var(--bg) 0 50%) 0 0 / 16px 16px;
  opacity: 0.15;
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.footer p {
  margin: 0 0 8px;
}

.footer-title {
  font-family: var(--font-title), serif;
  font-size: 1.5rem;
  color: var(--text);
}

.footer-small {
  font-size: 0.8rem;
}

/* "Back to home" button on the 404 page */
.home-link {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.home-link:hover,
.home-link:focus-visible {
  background: var(--accent);
  color: var(--bg);
  outline: none;
}
