/* ============================================
   PACA Lab — Design Tokens & Global Styles
   ============================================ */

:root {
  /* Backgrounds */
  --bg-primary: #0a0e17;
  --bg-card: #131a2b;
  --bg-input: #1a2235;
  --bg-hover: #1e2a42;

  /* Accent Colors */
  --accent-green: #00ff88;
  --accent-red: #ff4444;
  --accent-yellow: #ffaa00;
  --accent-blue: #4488ff;
  --accent-purple: #aa44ff;

  /* Text */
  --text-primary: #e8eaf6;
  --text-muted: #6b7db3;
  --text-bright: #ffffff;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', -apple-system, sans-serif;

  /* Spacing & Radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.15);
  --shadow-glow-red: 0 0 20px rgba(255, 68, 68, 0.15);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ============================================
   Layout
   ============================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

main.container {
  flex: 1;
}

/* ============================================
   Header
   ============================================ */

.site-header {
  padding: 48px 0 32px;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.logo-text h1 {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================
   Tool Cards Grid
   ============================================ */

.tool-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 40px 0 48px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid rgba(107, 125, 179, 0.15);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), var(--shadow-glow-green);
  border-color: rgba(0, 255, 136, 0.3);
}

.tool-card:active {
  transform: translateY(-1px);
}

.tool-card-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.tool-card h2 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
}

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

/* ============================================
   Tool Sections
   ============================================ */

.tool-section {
  background: var(--bg-card);
  border: 1px solid rgba(107, 125, 179, 0.12);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
  animation: fadeSlideIn 0.4s ease;
}

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

.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.tool-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.tool-header h2 {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.tool-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.tool-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================
   Inputs & Buttons
   ============================================ */

.input-group {
  display: flex;
  gap: 10px;
}

.input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid rgba(107, 125, 179, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-bright);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-green);
  color: #000;
  padding: 12px 24px;
}

.btn-primary:hover {
  background: #00e67a;
  box-shadow: var(--shadow-glow-green);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 12px 14px;
  border: 1px solid rgba(107, 125, 179, 0.3);
  font-size: 1.1rem;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
}

/* ============================================
   Result Area
   ============================================ */

.result-area {
  min-height: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.result-area:empty {
  display: none;
}

/* ============================================
   Loading Spinner
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid rgba(107, 125, 179, 0.3);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Score Circle
   ============================================ */

.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.score-circle-track {
  fill: none;
  stroke: rgba(107, 125, 179, 0.15);
  stroke-width: 8;
}

.score-circle-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke var(--transition);
}

.score-circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}

.score-circle-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ============================================
   Grade Badges
   ============================================ */

.grade-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.grade-a {
  color: var(--accent-green);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.25);
}

.grade-b {
  color: var(--accent-blue);
  background: rgba(68, 136, 255, 0.1);
  border: 1px solid rgba(68, 136, 255, 0.25);
}

.grade-c {
  color: var(--accent-yellow);
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.25);
}

.grade-f {
  color: var(--accent-red);
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.25);
}

/* ============================================
   Result Tables
   ============================================ */

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.result-table th,
.result-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(107, 125, 179, 0.1);
}

.result-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-table td {
  color: var(--text-primary);
}

.result-table tr:hover td {
  background: rgba(107, 125, 179, 0.05);
}

/* ============================================
   Error Display
   ============================================ */

.error-message {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: var(--accent-red);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

/* ============================================
   Turnstile Widget
   ============================================ */

.cf-turnstile {
  margin: 4px 0;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  text-align: center;
  padding: 40px 0 32px;
  margin-top: 48px;
  border-top: 1px solid rgba(107, 125, 179, 0.1);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer .powered {
  font-size: 0.78rem;
  margin-top: 6px;
  opacity: 0.6;
}

/* ============================================
   Responsive — Mobile
   ============================================ */

@media (max-width: 768px) {
  .site-header {
    padding: 32px 0 24px;
  }

  .logo-icon {
    font-size: 2.2rem;
  }

  .logo-text h1 {
    font-size: 1.8rem;
  }

  .tagline {
    font-size: 0.95rem;
  }

  .tool-cards {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 28px 0 36px;
  }

  .tool-card {
    padding: 24px 20px;
  }

  .tool-section {
    padding: 24px 18px;
    border-radius: var(--radius);
  }

  .tool-header {
    gap: 12px;
  }

  .tool-header h2 {
    font-size: 1.15rem;
  }

  .input-group {
    flex-direction: column;
  }

  .btn-primary {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .logo-text h1 {
    font-size: 1.5rem;
  }

  .tool-section {
    padding: 20px 14px;
  }
}
