@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #eef3ec;
  --text: #101728;
  --muted: #5f6777;
  --line: #dbe3d8;
  --accent: #0f766e;
  --accent-strong: #0d5c56;
  --accent-alt: #ea580c;
  --shadow: 0 18px 40px -28px rgba(13, 20, 35, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

#projects {
  scroll-margin-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 12% 10%, rgba(15, 118, 110, 0.2), transparent 34%),
    radial-gradient(circle at 88% 2%, rgba(234, 88, 12, 0.16), transparent 38%),
    var(--bg);

  &::before {
    content: "";
    position: fixed;
    inset: auto -5rem -8rem auto;
    width: 20rem;
    height: 20rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 72%);
    pointer-events: none;
    z-index: -1;
  }
}

a {
  color: inherit;
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(219, 227, 216, 0.85);
  background: rgba(246, 248, 245, 0.86);
  backdrop-filter: blur(12px);

  .header-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 0;
  }

  .kicker {
    margin: 0;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 2.6px;
  }

  .brand {
    margin: 0.1rem 0 0;
    font-family: "DM Serif Display", "Georgia", serif;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    line-height: 1.1;
  }

  .header-action {
    display: none;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--accent-strong);
    border: 1px solid var(--line);
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: var(--surface);
    transition: 0.2s ease;

    &:hover,
    &:focus-visible {
      border-color: var(--accent);
      color: var(--accent);
    }
  }
}

.hero {
  padding: 2rem 0 1rem;

  .hero-eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
  }

  h2 {
    margin: 0.35rem 0 0.75rem;
    font-family: "DM Serif Display", "Georgia", serif;
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1.04;
    max-width: 18ch;
    text-wrap: balance;
  }

  p {
    margin: 0;
    color: var(--muted);
    max-width: 58ch;
  }
}

.controls {
  display: grid;
  gap: 0.85rem;
  margin-block: 1rem 1.3rem;

  .search-control {
    display: grid;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #243041;
  }

  input {
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.75rem 0.9rem;
    font: inherit;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: 0.2s ease;

    &::placeholder {
      color: #808897;
    }

    &:focus-visible {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    }
  }

  .control-row {
    display: grid;
    gap: 0.75rem;
  }

  .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .filter-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: #213041;
    padding: 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;

    &:hover,
    &:focus-visible {
      border-color: var(--accent);
      color: var(--accent);
    }

    &.is-active {
      background: var(--accent);
      border-color: var(--accent);
      color: #f9fdfb;
    }
  }

  .random-button {
    border: 0;
    border-radius: 0.8rem;
    background: linear-gradient(135deg, var(--accent), #0b9e92);
    color: #effffb;
    padding: 0.66rem 0.9rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    justify-self: start;
    transition: transform 0.2s ease, opacity 0.2s ease;

    &:hover,
    &:focus-visible {
      transform: translateY(-2px);
    }

    &:disabled {
      cursor: not-allowed;
      opacity: 0.5;
      transform: none;
    }
  }
}

.projects {
  padding-bottom: 4rem;

  .projects-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  h3 {
    margin: 0;
    font-size: 1.18rem;
  }

  p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
  }
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.project-card {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.92)),
    var(--surface-soft);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  animation: card-enter 0.45s ease forwards;
  animation-delay: calc(var(--card-order) * 70ms);

  &:hover,
  &:focus-visible {
    transform: translateY(-4px);
    border-color: #8bb9b3;
    box-shadow: 0 20px 46px -28px rgba(13, 20, 35, 0.5);
  }

  .card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
  }

  .card-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .card-icon {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.66rem;
    font-size: 1rem;
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.17), rgba(234, 88, 12, 0.12));
    border: 1px solid #d6e4df;
  }

  .card-tag {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-strong);
    font-weight: 700;
    background: rgba(15, 118, 110, 0.12);
    padding: 0.25rem 0.45rem;
    border-radius: 0.45rem;
  }

  .card-title {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
  }
  .health-pending { background: #6b7280; }
  .health-up { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
  .health-down { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.5); }
  .health-unknown { background: #fbbf24; }

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

  .card-url {
    margin: 0;
    color: var(--accent);
    font-size: 0.82rem;
    font-family: "JetBrains Mono", "SFMono-Regular", "Menlo", monospace;
    word-break: break-word;
  }

  .card-cta {
    color: var(--accent-alt);
    font-size: 0.85rem;
    font-weight: 700;
  }
}

.empty-state {
  margin: 1rem 0 0;
  padding: 0.95rem 1rem;
  border-radius: 0.75rem;
  border: 1px dashed #c6d4cc;
  color: #4b5568;
  background: rgba(255, 255, 255, 0.72);
}

.site-footer {
  border-top: 1px solid rgba(219, 227, 216, 0.85);
  background: rgba(246, 248, 245, 0.8);

  p {
    margin: 0;
    padding: 1.2rem 0 1.4rem;
    color: #566074;
    font-size: 0.84rem;
    text-align: center;
  }

  .footer-line {
    display: block;
  }
}

@media (min-width: 700px) {
  .site-header {
    .header-action {
      display: inline-block;
    }
  }

  .controls {
    .control-row {
      grid-template-columns: 1fr auto;
      align-items: end;
    }

    .random-button {
      justify-self: end;
    }
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  .site-footer {
    p {
      text-align: left;
    }

    .footer-line {
      display: inline;
    }

    .footer-line + .footer-line {
      margin-left: 0.25rem;
    }
  }
}

@media (min-width: 980px) {
  .hero {
    padding-top: 2.7rem;
  }

  .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@keyframes card-enter {
  from {
    transform: translateY(14px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}
