@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/nunito-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter-variable.woff2") format("woff2");
}

:root {
  --primary: #f8be9e;
  --secondary: #70d6ff;
  --accent: #ffd670;
  --bg: #ffffff;
  --surface: #ffffff;
  --foreground: #0a0a0a;
  --border: #0a0a0a;
  --up: #38d39f;
  --slow: #f2c14e;
  --down: #ff7096;
  --unknown: #d1d5db;
  --success: #bcffbe;
  --danger: #ff7096;
  --radius: 16px;
  --radius-lg: 24px;
  --content-max: 1200px;
  --gutter: 24px;
  --shadow-1: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.08), 3px 3px 0 var(--border);
  --shadow-3: 0 8px 24px -4px rgba(0,0,0,0.1), 3px 3px 0 var(--border);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #1e1e1e;
    --foreground: #f5f5f5;
    --border: #ffffff;
    --success: #bcffbe;
    --danger: #ff7096;
    --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.3), 3px 3px 0 var(--border);
    --shadow-3: 0 8px 24px -4px rgba(0,0,0,0.4), 3px 3px 0 var(--border);
  }
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--foreground);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: "Nunito", sans-serif;
}

h1 {
  font-size: 2.25rem;
  font-weight: 800;
}

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

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

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px max(var(--gutter), calc((100% - var(--content-max)) / 2));
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header h1 {
  color: var(--primary);
  white-space: nowrap;
}

.header .summary {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  opacity: 0.7;
  flex: 1;
}

/* Buttons */
button {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 20px;
  border: 3px solid var(--border);
  border-radius: 9999px;
  background: var(--primary);
  color: var(--foreground);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

button:active {
  transform: translateY(0);
}

.header form button {
  background: var(--secondary);
}

/* Error Banner */
.error-banner {
  margin: 16px auto;
  max-width: var(--content-max);
  width: calc(100% - var(--gutter) * 2);
  padding: 12px 20px;
  border: 3px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  font-weight: 500;
  font-size: 0.875rem;
}

/* Add Form */
.add-form {
  margin: 16px auto;
  max-width: var(--content-max);
  width: calc(100% - var(--gutter) * 2);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.add-form summary {
  padding: 12px 20px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.add-form summary::before {
  content: "+ ";
  color: var(--primary);
}

.add-form[open] summary::before {
  content: "- ";
}

.add-form form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 20px 20px;
}

.add-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  flex: 1 1 200px;
}

.add-form input {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  padding: 10px 16px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--foreground);
}

.add-form form button {
  align-self: flex-end;
  background: var(--accent);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px var(--gutter) 48px;
}

@media (max-width: 639px) {
  :root {
    --gutter: 16px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px var(--gutter);
  }
  .add-form {
    margin: 12px auto;
  }
  .error-banner {
    margin: 12px auto;
  }
}

/* Card */
.card {
  position: relative;
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-3);
}

.card--offline {
  border-color: var(--danger);
}

.card-link {
  display: block;
  padding: 20px;
  color: var(--foreground);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.dot {
  flex-shrink: 0;
}

.card-title {
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.card-status--up {
  background: var(--up);
  color: #0a0a0a;
}

.card-status--down {
  background: var(--down);
  color: #fff;
}

.card-status--slow {
  background: var(--slow);
  color: #0a0a0a;
}

.card-status--unknown {
  background: var(--unknown);
  color: #0a0a0a;
}

.card-host {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.6;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: 8px;
  opacity: 0.8;
}

.sparkline {
  display: block;
  width: 100%;
  height: 20px;
  margin-bottom: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.6;
  flex-wrap: wrap;
}

.card-tag {
  background: var(--accent);
  color: var(--foreground);
  padding: 1px 8px;
  border-radius: 9999px;
  border: 2px solid var(--border);
  font-size: 0.7rem;
}

/* Card Controls */
.card-control {
  position: absolute;
  top: 12px;
}

.card-control button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover .card-control button,
.card-control button:focus-visible {
  opacity: 1;
}

.card-control--check {
  right: 48px;
}

.card-control--check button {
  background: var(--secondary);
}

.card-control--delete {
  right: 12px;
}

.card-control--delete button {
  background: var(--danger);
  color: #fff;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 64px 24px;
  font-size: 1.125rem;
  color: var(--foreground);
  opacity: 0.5;
}

.empty p + p {
  margin-top: 8px;
  font-size: 0.875rem;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
