:root {
  --bg: #0a0c0b;
  --surface: #101312;
  --ink: #ecf2ec;
  --ink-dim: #8a958c;
  --ink-faint: #525c54;
  --line: rgba(236, 242, 236, 0.09);
  --line-strong: rgba(236, 242, 236, 0.18);
  --green: #5ef0a0;
  --green-dim: rgba(94, 240, 160, 0.14);
  --red: #ff7a6b;
  --red-dim: rgba(255, 122, 107, 0.1);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-mono);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
}

::selection {
  background: var(--green);
  color: var(--bg);
}

button,
input {
  font: inherit;
}

/* ---------- atmosphere ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.glow {
  position: absolute;
  top: -38vh;
  left: 50%;
  width: 130vmax;
  height: 90vh;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse 46% 58% at 50% 0%,
    rgba(94, 240, 160, 0.13),
    rgba(94, 240, 160, 0.04) 45%,
    transparent 72%
  );
  animation: glow-breathe 9s ease-in-out infinite;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(
    ellipse 70% 52% at 50% 0%,
    rgba(0, 0, 0, 0.55),
    transparent 75%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 70% 52% at 50% 0%,
    rgba(0, 0, 0, 0.55),
    transparent 75%
  );
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes glow-breathe {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1.15;
  }
}

/* ---------- brand ---------- */

.brand {
  position: fixed;
  top: 26px;
  left: 30px;
  z-index: 10;
  color: var(--ink);
  font-family: "Josefin Sans", var(--font-mono);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.14em;
  text-decoration: none;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transition: text-shadow 200ms ease, color 200ms ease;
}

.brand:hover {
  color: #ffffff;
  text-shadow: 0 0 18px rgba(94, 240, 160, 0.5);
}

/* ---------- layout ---------- */

.shell {
  width: min(880px, calc(100% - 48px));
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: clamp(48px, 8vh, 80px) 0 40px;
}

/* flex spacers center the hero; the top one collapses after a search */
.shell::before,
.shell::after {
  content: "";
  flex-grow: 1;
}

.shell::before {
  transition: flex-grow 0.8s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.shell::after {
  flex-grow: 1.25;
}

.shell.searched::before {
  flex-grow: 0.001;
}

.intro {
  text-align: center;
}

/* staggered page-load reveal */
h1,
.lede,
.search {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.lede {
  animation-delay: 0.08s;
}
.search {
  animation-delay: 0.16s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes dot-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(42px, 7.6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--green);
}

.lede {
  margin-bottom: 40px;
  color: var(--ink-dim);
  font-size: 15px;
  letter-spacing: 0.02em;
}

/* ---------- search ---------- */

.search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}

.field {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(236, 242, 236, 0.03);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.field:focus-within {
  border-color: rgba(94, 240, 160, 0.55);
  box-shadow:
    0 0 0 4px rgba(94, 240, 160, 0.1),
    0 0 28px rgba(94, 240, 160, 0.12);
}

.field-prompt {
  margin-right: 10px;
  color: var(--green);
  font-weight: 500;
  animation: dot-pulse 1.4s steps(2, jump-none) infinite;
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  outline: none;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.field input::placeholder {
  color: var(--ink-faint);
}

.search button {
  position: relative;
  height: 58px;
  border: 0;
  padding: 0 28px;
  border-radius: 14px;
  color: var(--bg);
  background: var(--green);
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: transform 150ms ease, box-shadow 200ms ease, opacity 150ms ease;
}

.search button:hover {
  box-shadow: 0 0 24px rgba(94, 240, 160, 0.35);
  transform: translateY(-1px);
}

.search button:active {
  transform: scale(0.97);
}

.search button:disabled {
  cursor: wait;
  opacity: 0.85;
  transform: none;
}

.button-dots {
  display: none;
  gap: 5px;
}

.button-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bg);
  animation: thinking 0.9s ease-in-out infinite;
}

.button-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.button-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinking {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.search button.loading .button-label {
  display: none;
}

.search button.loading .button-dots {
  display: inline-flex;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--red);
  font-size: 13px;
}

/* ---------- results ---------- */

.results {
  margin-top: 72px;
}

.results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.results-heading h2 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.results-heading h2 .count {
  color: var(--green);
}

.results-heading p {
  margin-bottom: 0;
  color: var(--ink-dim);
  font-size: 13px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

/* result + skeleton cards share geometry so the swap doesn't jump */
.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(236, 242, 236, 0.025);
}

.card .domain {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .domain .tld {
  color: var(--ink-dim);
}

.card .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card .status svg {
  flex: none;
}

.card .status path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw 0.45s ease forwards;
  animation-delay: inherit;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* status flavors */
.card.available {
  border-color: rgba(94, 240, 160, 0.35);
  background: var(--green-dim);
}

.card.available .status {
  color: var(--green);
}

.card.available::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 90% at 50% -20%,
    rgba(94, 240, 160, 0.16),
    transparent 70%
  );
  pointer-events: none;
}

.card.taken .status {
  color: var(--red);
}

.card.taken .domain {
  color: var(--ink-dim);
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
  text-decoration-thickness: 1px;
}

.card.unknown .status {
  color: var(--ink-faint);
}

/* cascade reveal — delay set per-card from JS via --i */
.card.reveal {
  animation: card-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i) * 28ms);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* skeleton scan state */
.card.skeleton {
  animation: skeleton-in 0.4s ease both;
  animation-delay: calc(var(--i) * 14ms);
}

.card.skeleton .bone {
  height: 12px;
  border-radius: 6px;
  background: rgba(236, 242, 236, 0.07);
}

.card.skeleton .bone:first-child {
  width: 70%;
  height: 14px;
}

.card.skeleton .bone:last-child {
  width: 45%;
}

.card.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(94, 240, 160, 0.09) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  animation: scan 1.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 45ms);
}

@keyframes scan {
  to {
    transform: translateX(100%);
  }
}

@keyframes skeleton-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* heading shimmer while scanning */
.results.scanning .results-heading h2 {
  background: linear-gradient(
    90deg,
    var(--ink) 35%,
    var(--green) 50%,
    var(--ink) 65%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-scan 1.6s linear infinite;
}

@keyframes text-scan {
  from {
    background-position: 130% 0;
  }
  to {
    background-position: -130% 0;
  }
}

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

@media (max-width: 560px) {
  .shell {
    width: min(100% - 32px, 880px);
    padding-top: 64px;
  }

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

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
