/* ==========================================================================
   theme.css — Design System Tokens & Global Styles
   jfprojects.dev — Dark theme with green/blue accents
   ========================================================================== */

/* ---------- Color Tokens ---------- */
:root {
  /* Backgrounds */
  --bg-color: #0f1419;
  --bg-surface: #1a2332;
  --bg-elevated: #1e293b;
  --bg-card: #1e293b;

  /* Text */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Brand / Accent */
  --primary-color: #38a169;
  --primary-hover: #2f855a;
  --primary-subtle: rgba(56, 161, 105, 0.12);
  --secondary-color: #3182ce;
  --secondary-hover: #2b6cb0;
  --secondary-subtle: rgba(49, 130, 206, 0.12);
  --accent-cyan: #22d3ee;
  --accent-purple: #a78bfa;

  /* Borders */
  --border-color: #2d3748;
  --border-light: #374151;
  --border-accent: rgba(56, 161, 105, 0.3);

  /* Status */
  --status-red: #e53e3e;
  --status-yellow: #ecc94b;
  --status-green: #48bb78;
  --error-color: #e53e3e;
  --success-color: #48bb78;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(56, 161, 105, 0.15);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;
  --line-height-tight: 1.25;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --max-width: 1120px;
  --max-width-narrow: 720px;
  --nav-height: 64px;
}

/* ---------- CSS Reset / Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Override browser default blue link color globally */
a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

/* ---------- AI / Neural Background Pattern ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.04;
  background-image:
    radial-gradient(circle at 20% 30%, var(--primary-color) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, var(--secondary-color) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, var(--accent-cyan) 0.5px, transparent 0.5px);
  background-size:
    60px 60px,
    80px 80px,
    40px 40px;
  pointer-events: none;
}

/* Subtle grid overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.02;
  background-image:
    linear-gradient(var(--primary-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--primary-color) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-md);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-size-4xl);
}
h2 {
  font-size: var(--font-size-3xl);
}
h3 {
  font-size: var(--font-size-2xl);
}
h4 {
  font-size: var(--font-size-xl);
}

p {
  margin: 0 0 var(--space-md);
  color: var(--text-secondary);
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:visited {
  color: var(--secondary-color);
}

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

/* Mono accent for tech / AI vibe */
.font-mono {
  font-family: var(--font-mono);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-4xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-sm);
}

.section-header p {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.section-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-cyan));
  margin: var(--space-md) auto var(--space-xl);
  border-radius: var(--radius-full);
}

/* ---------- Buttons ---------- */
.btn,
a.btn,
a.btn:link,
a.btn:visited {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none !important;
  text-align: center;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.btn:hover,
a.btn:hover {
  text-decoration: none !important;
  transform: translateY(-1px);
}

.btn-primary,
a.btn-primary,
a.btn-primary:link,
a.btn-primary:visited {
  background-color: var(--primary-color) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:active {
  background-color: var(--primary-hover) !important;
  box-shadow: var(--shadow-glow);
  color: #fff !important;
}

.btn-secondary,
a.btn-secondary,
a.btn-secondary:link,
a.btn-secondary:visited {
  background-color: var(--secondary-color) !important;
  color: #fff !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
a.btn-secondary:hover,
a.btn-secondary:focus,
a.btn-secondary:active {
  background-color: var(--secondary-hover) !important;
  color: #fff !important;
}

.btn-outline,
a.btn-outline,
a.btn-outline:link,
a.btn-outline:visited {
  background: transparent !important;
  border: 1px solid var(--border-light) !important;
  color: var(--text-primary) !important;
}

.btn-outline:hover,
.btn-outline:focus,
.btn-outline:active,
a.btn-outline:hover,
a.btn-outline:focus,
a.btn-outline:active {
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
  background-color: var(--primary-subtle) !important;
}

.btn-ghost,
a.btn-ghost,
a.btn-ghost:link,
a.btn-ghost:visited {
  background: transparent !important;
  color: var(--text-secondary) !important;
  padding: 0.5rem 0.8rem;
}

.btn-ghost:hover,
.btn-ghost:focus,
.btn-ghost:active,
a.btn-ghost:hover,
a.btn-ghost:focus,
a.btn-ghost:active {
  color: var(--text-primary) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: 0.85rem 1.8rem;
  font-size: var(--font-size-base);
}

.btn-danger,
a.btn-danger,
a.btn-danger:link,
a.btn-danger:visited {
  background-color: var(--status-red) !important;
  color: #fff !important;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active,
a.btn-danger:hover,
a.btn-danger:focus,
a.btn-danger:active {
  background-color: #c53030 !important;
  color: #fff !important;
}

.btn-success,
a.btn-success,
a.btn-success:link,
a.btn-success:visited {
  background-color: var(--success-color) !important;
  color: #fff !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active,
a.btn-success:hover,
a.btn-success:focus,
a.btn-success:active {
  background-color: var(--primary-hover) !important;
  color: #fff !important;
}

/* ---------- Cards ---------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  background-color: var(--bg-surface);
}

.card-image-placeholder {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  border: 1px dashed var(--border-color);
}

/* ---------- Tags / Pills ---------- */
.tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.tag-ai {
  background-color: rgba(167, 139, 250, 0.15);
  color: var(--accent-purple);
}

.tag-personal {
  background-color: var(--primary-subtle);
  color: var(--primary-color);
}

.tag-active {
  background-color: rgba(72, 187, 120, 0.15);
  color: var(--status-green);
}

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: var(--nav-height);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary) !important;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-brand:hover {
  color: var(--primary-color) !important;
  text-decoration: none !important;
}

.nav-brand .brand-accent {
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a,
.nav-links a:link,
.nav-links a:visited {
  color: var(--text-secondary) !important;
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none !important;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
  color: var(--text-primary) !important;
  border-bottom-color: var(--primary-color);
  text-decoration: none !important;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-xs);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: var(--space-sm) 0;
    font-size: var(--font-size-base);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-4xl);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-brand {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.footer-tagline {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
}

.footer-links a {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-md);
    align-items: center;
  }
}

/* ---------- Forms (shared) ---------- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* ---------- Tables ---------- */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  table-layout: auto;
}

th,
td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Status Indicators ---------- */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.status-red {
  background-color: var(--status-red);
}
.status-yellow {
  background-color: var(--status-yellow);
}
.status-green {
  background-color: var(--status-green);
}
.status-grey {
  background-color: var(--text-muted);
}

/* ---------- Modal ---------- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--bg-card);
  margin: 8% auto;
  padding: var(--space-xl);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.close-btn {
  color: var(--text-secondary);
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-primary);
}

/* ---------- Message Blocks ---------- */
.error-message {
  color: var(--error-color);
  background-color: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.3);
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
  font-size: var(--font-size-sm);
}

.success-message {
  color: var(--success-color);
  background-color: rgba(72, 187, 120, 0.1);
  border: 1px solid rgba(72, 187, 120, 0.3);
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
  font-size: var(--font-size-sm);
}

/* ---------- Utility Classes ---------- */
.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;
}

.text-center {
  text-align: center;
}
.text-muted {
  color: var(--text-muted);
}
.text-small {
  font-size: var(--font-size-sm);
}
.mt-1 {
  margin-top: var(--space-md);
}
.mt-2 {
  margin-top: var(--space-xl);
}
.mt-3 {
  margin-top: var(--space-2xl);
}
.mb-1 {
  margin-bottom: var(--space-md);
}
.mb-2 {
  margin-bottom: var(--space-xl);
}
.mb-3 {
  margin-bottom: var(--space-2xl);
}
