:root {
  color-scheme: dark;
  --background: #0c1018;
  --foreground: #e5f1ff;
  --muted: #94a3b8;
  --accent: #32d5ff;
  --card-bg: rgba(18, 24, 36, 0.85);
  --border: rgba(50, 213, 255, 0.35);
  --shadow: 0 24px 48px -32px rgba(50, 213, 255, 0.6);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(50, 213, 255, 0.15), transparent 45%),
    radial-gradient(circle at bottom right, rgba(50, 213, 255, 0.1), transparent 50%),
    var(--background);
  color: var(--foreground);
  font-family: 'IBM Plex Mono', monospace;
}

a {
  color: inherit;
  text-decoration: none;
}

.hero {
  padding: clamp(3rem, 5vw, 5rem) clamp(1.5rem, 6vw, 7rem) 2rem;
}

.hero__content {
  max-width: 720px;
}

.hero__title {
  font-size: clamp(3rem, 8vw, 7rem);
  margin: 0;
  letter-spacing: -0.04em;
}

.hero__baseline {
  margin: 0.5rem 0 2rem;
  color: var(--muted);
  font-size: clamp(1.125rem, 2vw, 1.75rem);
}

.search {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search__label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.search input {
  background: rgba(13, 18, 30, 0.85);
  border: 1px solid rgba(50, 213, 255, 0.35);
  border-radius: 12px;
  padding: 0.85rem 1.2rem;
  color: var(--foreground);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(50, 213, 255, 0.2);
}

.layout {
  padding: 0 clamp(1.5rem, 5vw, 6rem) clamp(4rem, 6vw, 7rem);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.card {
  position: relative;
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  min-height: 240px;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(50, 213, 255, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.75rem;
  gap: 1.25rem;
}

.card__title {
  margin: 0;
  font-size: 1.4rem;
}

.card__summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.card__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
}

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

.card:hover::before,
.card:focus-within::before {
  opacity: 1;
}

/* Experiment page */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 2rem) clamp(1.5rem, 5vw, 6rem) 0;
  gap: 1.5rem;
}

.topbar__titles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.75rem;
}

.experiment {
  padding: 0 clamp(1.5rem, 5vw, 6rem) clamp(4rem, 6vw, 7rem);
}

.experiment__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: clamp(2rem, 6vw, 4rem);
  align-items: start;
}

.experiment__text {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title {
  margin-top: 0;
  font-size: 1.25rem;
}

.experiment__resume {
  color: var(--muted);
  margin: 0;
}

.experiment__text p {
  line-height: 1.8;
  font-size: 1rem;
  margin: 0;
  color: var(--foreground);
}

.experiment__visual {
  display: grid;
  gap: 1.5rem;
}

.canvas-wrapper {
  position: relative;
  background: rgba(12, 16, 24, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  min-height: 320px;
}

.animation canvas {
  width: 100% !important;
  height: auto !important;
  border-radius: 12px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control {
  background: rgba(12, 16, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.control__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
}

.control input[type='range'] {
  appearance: none;
  height: 6px;
  border-radius: 6px;
  background: rgba(50, 213, 255, 0.2);
  outline: none;
}

.control input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.control input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .hero,
  .layout,
  .experiment {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .hero__title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
}
