/* ==========================================================================
   BEEPKIT — Design System
   Ultra-minimalist SaaS · CSS Variables · Auto Light/Dark · Mobile-first
   ========================================================================== */

:root {
  /* Brand */
  --indigo-900: #1e1b4b;
  --indigo-700: #4338ca;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --indigo-100: #e0e7ff;

  /* Light theme (default) */
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: var(--indigo-600);
  --accent-hover: var(--indigo-700);
  --accent-soft: var(--indigo-100);
  --accent-text: #ffffff;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 12px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 12px 32px rgb(15 23 42 / 0.12);
  --radius: 14px;
  --radius-lg: 20px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --bg-elevated: #131a30;
    --bg-subtle: #1a2240;
    --text: #e6eaf5;
    --text-muted: #9aa5c4;
    --text-faint: #5b6690;
    --border: #232c4d;
    --border-strong: #323d66;
    --accent: var(--indigo-500);
    --accent-hover: var(--indigo-400);
    --accent-soft: #26295c;
    --accent-text: #ffffff;
    --success: #34d399;
    --success-soft: #0c2f25;
    --warning: #fbbf24;
    --warning-soft: #33270a;
    --danger: #f87171;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.55);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

button, input, select { font: inherit; color: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover { text-decoration: none; }

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-400));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.logo .tld { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 0.25rem;
}

.main-nav a {
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}
.main-nav a:hover {
  background: var(--bg-subtle);
  color: var(--text);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

.hero .badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  max-width: 21ch;
  margin-inline: auto;
}

.hero h1 .grad {
  background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  max-width: 62ch;
  margin: 1.25rem auto 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.125rem);
}

/* ---------- Tools grid ---------- */
.tools {
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.section-title {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.section-sub {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.1rem;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1),
              box-shadow 0.25s ease, border-color 0.25s ease;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}

.tool-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tool-card .tag {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.tag.live { background: var(--success-soft); color: var(--success); }
.tag.soon { background: var(--bg-subtle); color: var(--text-faint); }

.tool-card.disabled {
  opacity: 0.65;
  pointer-events: none;
}

/* ---------- Calculator ---------- */
.calc-section {
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--border);
}

.calc-panel {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 860px) {
  .calc-panel { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
}

.field { margin-bottom: 1.15rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.field .hint {
  display: block;
  font-weight: 400;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.input-wrap { position: relative; }

.input-wrap .suffix {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}

input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 0.9rem 3.2rem 0.9rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

select { padding-right: 2.5rem; }

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  margin-bottom: 1.15rem;
  cursor: pointer;
}
.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 0.2rem;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-row span { font-size: 0.88rem; color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn:active { transform: scale(0.98); }

/* ---------- Results ---------- */
.results { min-height: 200px; }

.results .placeholder {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--text-faint);
  text-align: center;
  padding: 2rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  margin-bottom: 0.9rem;
  background: var(--bg);
  transition: border-color 0.2s ease;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.result-card.winner {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success-soft) 45%, var(--bg));
}

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

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.result-head h4 {
  font-size: 0.98rem;
  font-weight: 700;
}

.result-head .win-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--success);
}

.result-net {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.result-net small {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bar {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.55rem 0 0.45rem;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo-600), var(--indigo-400));
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.winner .bar-fill { background: linear-gradient(90deg, #059669, #34d399); }

.result-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.breakdown {
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.breakdown summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  user-select: none;
}
.breakdown summary::-webkit-details-marker { display: none; }
.breakdown summary::after { content: " ▸"; }
.breakdown[open] summary::after { content: " ▾"; }

.breakdown table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.breakdown td {
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border);
}
.breakdown td:last-child { text-align: right; font-weight: 600; color: var(--text); }
.breakdown tr:last-child td { border-bottom: none; }
.breakdown tr.total td { font-weight: 700; color: var(--text); }

.note-box {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--warning-soft);
  color: var(--warning);
  border-radius: var(--radius);
  font-size: 0.83rem;
  line-height: 1.5;
}

/* ---------- SEO / info ---------- */
.info-section {
  padding: clamp(2rem, 5vw, 3rem) 0;
  border-top: 1px solid var(--border);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.info-grid h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.info-grid p { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 3rem;
  margin-top: 2rem;
}

.footer-brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.footer-brand .tld { color: var(--accent); }

.disclaimer {
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1.65;
  max-width: 80ch;
}

.footer-meta {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---------- Utilities ---------- */
.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 (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
