/* ============================
   Design System & Reset
   ============================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:         #0d1117;
  --color-surface:    #161b22;
  --color-surface-2:  #1c2230;
  --color-border:     rgba(255, 255, 255, 0.06);
  --color-border-hover: rgba(99, 130, 174, 0.35);

  --color-primary:    #4a6fa5;
  --color-primary-light: #6382b4;
  --color-accent:     #7ea8c4;
  --color-success:    #4a9e7a;
  --color-error:      #c0515f;

  --gradient-primary: linear-gradient(135deg, #3d5a80 0%, #5b7fa6 100%);
  --gradient-glow:    linear-gradient(135deg, rgba(61, 90, 128, 0.10) 0%, rgba(91, 127, 166, 0.10) 100%);
  --gradient-text:    linear-gradient(135deg, #8ba8cc 0%, #a8c4d8 50%, #7ab3a0 100%);

  --text-primary:   #e2e8f0;
  --text-secondary: #8896a8;
  --text-muted:     #4a5568;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  --shadow-card: 0 0 0 1px rgba(255,255,255,0.04), 0 24px 48px rgba(0,0,0,0.45), 0 6px 20px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 32px rgba(61, 90, 128, 0.18), 0 0 64px rgba(91, 127, 166, 0.08);

  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================
   Dot Grid Background Pattern
   ============================ */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;

  /* Subtle dot-grid pattern */
  background-image:
    radial-gradient(circle, rgba(99, 130, 174, 0.18) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Soft vignette overlay to fade edges */
.bg-particles::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 70% at 50% 40%,
    transparent 30%,
    rgba(13, 17, 23, 0.75) 100%
  );
}

/* Hide old particle divs visually (keep for HTML compat) */
.particle { display: none; }

/* ============================
   Navbar
   ============================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  background: rgba(13, 17, 23, 0.72);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 6px rgba(74, 111, 165, 0.6));
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(74, 111, 165, 0.6)); }
  50%       { filter: drop-shadow(0 0 14px rgba(126, 168, 196, 0.7)); }
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.4px;
}

.nav-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  background: rgba(126, 168, 196, 0.08);
  border: 1px solid rgba(126, 168, 196, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

/* Right side group */
.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* GitHub and API links */
.github-link, .api-link {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.03);
  transition: all var(--transition-normal);
  letter-spacing: 0.2px;
}

.github-link:hover, .api-link:hover {
  color: var(--text-primary);
  border-color: rgba(74, 111, 165, 0.4);
  background: rgba(74, 111, 165, 0.08);
  transform: translateY(-1px);
}

.github-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ============================
   Hero Section — shifted up
   ============================ */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 52px 24px 24px; /* reduced from 80px 24px 40px */
  max-width: 800px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 22px;
  letter-spacing: 0.3px;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  background: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(74, 158, 122, 0.7);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-title {
  font-size: clamp(38px, 6.5vw, 68px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -2px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: gradientShift 5s linear infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero-subtitle {
  font-size: clamp(14px, 1.8vw, 17px);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.75;
  font-weight: 400;
}

/* Feature pills */
.features-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--color-border);
  padding: 6px 13px;
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
  cursor: default;
}

.pill:hover {
  background: rgba(74, 111, 165, 0.07);
  border-color: rgba(74, 111, 165, 0.25);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.pill-icon { font-size: 14px; }

/* ============================
   Main Card — also pushed up
   ============================ */
.card-section {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 28px auto 0; /* reduced from 40px */
  padding: 0 24px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-slow);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
  border-radius: inherit;
}

.card:hover::before { opacity: 1; }
.card:hover { box-shadow: var(--shadow-card), var(--shadow-glow); }

.card-header {
  margin-bottom: 24px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: -0.3px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================
   Input Group
   ============================ */
.input-group { margin-bottom: 14px; }

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.input-wrapper,
.output-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(99, 130, 180, 0.12), 0 0 16px rgba(74, 111, 165, 0.08);
}

.input-wrapper.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(192, 81, 95, 0.10);
}

.input-icon,
.result-icon {
  padding: 0 13px;
  font-size: 17px;
  flex-shrink: 0;
  opacity: 0.55;
}

.url-input,
.url-output {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  padding: 14px 0;
  min-width: 0;
  caret-color: var(--color-primary-light);
}

.url-input::placeholder { color: var(--text-muted); }

.url-output {
  color: var(--color-accent);
  font-weight: 600;
  cursor: text;
  letter-spacing: 0.2px;
}

/* Clear button */
.clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 13px;
  height: 100%;
  transition: color var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}
.clear-btn:hover { color: var(--color-error); }

/* Error text */
.error-text {
  display: block;
  font-size: 12px;
  color: var(--color-error);
  margin-top: 5px;
  min-height: 18px;
  font-weight: 500;
}

/* ============================
   Expiry Selector
   ============================ */
.expiry-group {
  margin-bottom: 18px;
}

.expiry-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.expiry-option {
  cursor: pointer;
}

/* Hide the native radio */
.expiry-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.expiry-pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-normal);
  letter-spacing: 0.2px;
  user-select: none;
}

.expiry-option:hover .expiry-pill {
  border-color: rgba(74, 111, 165, 0.4);
  color: var(--text-primary);
  background: rgba(74, 111, 165, 0.08);
}

/* Selected state */
.expiry-option input[type="radio"]:checked + .expiry-pill {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(61, 90, 128, 0.35);
}

/* ============================
   Shorten Button
   ============================ */
.shorten-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  box-shadow: 0 4px 20px rgba(61, 90, 128, 0.30);
}

.shorten-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.shorten-btn:hover:not(:disabled)::before { opacity: 1; }
.shorten-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(61, 90, 128, 0.42);
}
.shorten-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(61, 90, 128, 0.25);
}

.shorten-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-icon { font-size: 17px; transition: transform var(--transition-normal); }
.shorten-btn:hover:not(:disabled) .btn-icon { transform: translateX(4px); }

.btn-loader {
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.shorten-btn.loading .btn-text,
.shorten-btn.loading .btn-icon { display: none; }
.shorten-btn.loading .btn-loader { display: block; }

/* ============================
   Result Group
   ============================ */
.result-group {
  margin-top: 22px;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.result-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.divider-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-success);
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Output wrapper */
.output-wrapper {
  border-color: rgba(126, 168, 196, 0.2);
}

.output-wrapper:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(126, 168, 196, 0.10);
}

/* Copy button */
.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  margin: 5px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.copy-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(61, 90, 128, 0.35);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #2d7a57, #4a9e7a);
  box-shadow: 0 4px 14px rgba(74, 158, 122, 0.35);
}

.copy-icon { font-size: 13px; }

/* Result actions */
.result-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
}

.action-link {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  transition: color var(--transition-fast), opacity var(--transition-fast);
  opacity: 0.75;
  letter-spacing: 0.2px;
}

.action-link:hover { opacity: 1; text-decoration: underline; }
.action-link--secondary { color: var(--text-secondary); }
.action-link--secondary:hover { color: var(--text-primary); }

/* ============================
   Stats Row
   ============================ */
.stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 19px;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--color-border);
}

/* ============================
   How It Works Section
   ============================ */
.how-section {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 72px auto 0;
  padding: 0 24px;
  text-align: center;
}

.section-title {
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.7px;
  margin-bottom: 40px;
  color: var(--text-primary);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.step-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: default;
}

.step-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.step-card:hover { transform: translateY(-5px); border-color: var(--color-border-hover); box-shadow: var(--shadow-glow); }
.step-card:hover::before { opacity: 1; }

.step-number {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 32px;
  font-weight: 900;
  color: rgba(255,255,255,0.04);
  line-height: 1;
  letter-spacing: -2px;
}

.step-icon {
  font-size: 28px;
  margin-bottom: 14px;
  display: block;
  filter: drop-shadow(0 0 6px rgba(74, 111, 165, 0.4));
}

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 7px;
  letter-spacing: -0.2px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ============================
   Footer
   ============================ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 52px 24px 36px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 72px;
  border-top: 1px solid var(--color-border);
}

.footer-brand {
  font-weight: 700;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================
   Toast Notification
   ============================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--text-primary);
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(74, 158, 122, 0.4); color: #7ac4a0; }
.toast.error   { border-color: rgba(192, 81, 95, 0.4);  color: #d88890; }

/* ============================
   Responsive
   ============================ */
@media (max-width: 600px) {
  .card { padding: 22px 18px; }
  .stats-row { gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
  .stat-divider { display: none; }
  .hero { padding: 40px 20px 20px; }
  .features-pills { gap: 6px; }
  .steps-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; align-items: flex-start; gap: 10px; }
}
