/* === CSS Custom Properties === */
/* Dark mode (default) */
:root,
[data-theme="dark"] {
  --bg: #000;
  --bg-hover: #111;
  --text: #fff;
  --text-muted: #555;
  --text-dim: #888;
  --accent-green: #008c23;
  --accent-teal: #2eafa7;
  --border: #222;
  --border-light: #333;
}

/* Light mode */
[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-hover: #e8e8e8;
  --text: #1a1a1a;
  --text-muted: #666;
  --text-dim: #888;
  --accent-green: #006b1a;
  --accent-teal: #1a7a77;
  --border: #ddd;
  --border-light: #ccc;
}

/* Theme toggle switch */
.theme-switch {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: inline-block;
  width: 52px;
  height: 28px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.theme-switch:hover {
  opacity: 1;
}
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  border: 1px solid var(--border-light);
  border-radius: 28px;
  transition: background 0.3s;
}
.slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}
.theme-switch input:checked + .slider::before {
  transform: translateX(24px);
  background: var(--accent-teal);
}
.slider-icon {
  position: absolute;
  top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.slider-icon.sun {
  right: 6px;
}
.slider-icon.moon {
  left: 6px;
}

/* Skip to content link (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--accent-green);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
}

.skip-link:focus {
  left: 0;
  color: #fff;
  text-decoration: none;
}

@media print {
  .theme-switch { display: none !important; }
  .skip-link { display: none !important; }
  .tile-content { max-height: none !important; overflow: visible !important; }
  .tile-chevron { display: none !important; }
  .tile { border: none !important; }
  .tile-header { cursor: default; }
}

/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Source Code Pro', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* === Layout === */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* === Typography === */
h1 {
  color: var(--accent-green);
  font-size: 24px;
  margin-bottom: 10px;
}

h2 {
  color: var(--accent-teal);
  font-size: 18px;
  margin: 40px 0 20px 0;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

h3 {
  color: var(--accent-green);
  font-size: 14px;
  margin: 25px 0 15px 0;
}

.tagline {
  color: var(--text-muted);
  margin-bottom: 40px;
}

.section-intro {
  color: var(--text-dim);
  margin-bottom: 15px;
}

/* === Links === */
a {
  color: var(--accent-green);
  text-decoration: none;
}

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

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--accent-teal);
  font-weight: 700;
}

tr:hover {
  background-color: var(--bg-hover);
}

.year {
  color: var(--text-muted);
  width: 60px;
}

/* === Components === */
.cve-note {
  background: var(--bg-hover);
  border-left: 3px solid var(--accent-green);
  padding: 15px;
  margin: 20px 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 15px;
}

.contact-links a {
  color: var(--text);
  background: var(--border);
  padding: 8px 16px;
  border: 1px solid var(--border-light);
}

.contact-links a:hover {
  background: var(--accent-green);
  border-color: var(--accent-green);
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--text-muted);
}

.back-link:hover {
  color: var(--accent-green);
}

/* === Hero Section === */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 8px;
}

.hero .role {
  color: var(--accent-teal);
  font-size: 16px;
  margin-bottom: 6px;
}

.hero .tagline {
  margin-bottom: 20px;
}

.hero .social-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero .social-links a {
  color: var(--text-muted);
  font-size: 13px;
}

.hero .social-links a:hover {
  color: var(--accent-green);
}

/* === Section Nav (sticky bottom) === */
.section-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-nav ul {
  display: flex;
  justify-content: center;
  gap: 0;
  list-style: none;
  max-width: 900px;
  margin: 0 auto;
}

.section-nav li a {
  display: block;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
}

.section-nav li a:hover {
  color: var(--accent-green);
  text-decoration: none;
}

/* Give body padding for the fixed nav */
body.has-nav {
  padding-bottom: 44px;
}

/* === Terminal CTA Shared === */
.terminal-cta-section {
  text-align: center;
  margin: 30px 0 10px;
}

.cta-label {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* --- Option A: ASCII Art Monitor --- */
.cta-ascii {
  display: inline-block;
  text-decoration: none;
  color: var(--accent-green);
  transition: filter 0.3s;
  padding: 20px;
}

.cta-ascii:hover {
  filter: drop-shadow(0 0 12px rgba(0, 140, 35, 0.6));
  text-decoration: none;
  color: var(--accent-green);
}

.cta-ascii pre {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.cta-ascii .cta-btn-text {
  display: inline-block;
  border: 1px solid var(--accent-green);
  padding: 8px 24px;
  font-size: 14px;
  margin-bottom: 6px;
}

.cta-ascii .cta-sub {
  color: var(--text-muted);
  font-size: 11px;
}

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

.cta-ascii .cursor {
  animation: blink-cursor 1s step-end infinite;
}

/* --- Option B: Retro CRT SVG --- */
.cta-crt {
  display: inline-block;
  text-decoration: none;
  padding: 20px;
  transition: filter 0.3s;
}

.cta-crt:hover {
  filter: drop-shadow(0 0 20px rgba(0, 140, 35, 0.5));
  text-decoration: none;
}

.cta-crt svg {
  display: block;
  margin: 0 auto 12px;
}

.cta-crt .cta-sub {
  color: var(--text-muted);
  font-size: 11px;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.cta-crt .scanline {
  animation: scanline 3s linear infinite;
}

/* --- Option C: Split-Screen --- */
.cta-split {
  display: flex;
  border: 1px solid var(--border);
  margin: 0 auto;
  max-width: 600px;
  overflow: hidden;
}

.cta-split a {
  flex: 1;
  display: block;
  padding: 30px 20px;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s;
}

.cta-split a:hover {
  text-decoration: none;
}

.cta-split .split-portfolio {
  background: var(--bg);
  border-right: 1px solid var(--border);
  color: var(--text);
}

.cta-split .split-portfolio:hover {
  background: var(--bg-hover);
}

.cta-split .split-portfolio .split-icon {
  color: var(--accent-teal);
  font-size: 20px;
  margin-bottom: 8px;
}

.cta-split .split-portfolio .split-title {
  font-size: 16px;
  margin-bottom: 4px;
}

.cta-split .split-portfolio .split-sub {
  color: var(--text-muted);
  font-size: 11px;
}

.cta-split .split-terminal {
  background: #001a00;
  color: var(--accent-green);
}

.cta-split .split-terminal:hover {
  background: #002200;
}

.cta-split .split-terminal .split-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.cta-split .split-terminal .split-title {
  font-size: 16px;
  margin-bottom: 4px;
}

.cta-split .split-terminal .split-sub {
  color: var(--text-dim);
  font-size: 11px;
}

/* --- Option D: Simple Button --- */
.cta-simple {
  display: inline-block;
  text-decoration: none;
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
  padding: 12px 32px;
  font-size: 16px;
  font-family: 'Source Code Pro', 'Courier New', monospace;
  transition: box-shadow 0.3s, background 0.3s;
}

.cta-simple:hover {
  box-shadow: 0 0 16px rgba(0, 140, 35, 0.5);
  background: rgba(0, 140, 35, 0.1);
  text-decoration: none;
  color: var(--accent-green);
}

.cta-simple .cursor {
  animation: blink-cursor 1s step-end infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent-green); }
  50% { border-color: rgba(0, 140, 35, 0.4); }
}

.cta-simple {
  animation: pulse-border 3s ease-in-out infinite;
}

/* === About Section === */
.about-text {
  color: var(--text-dim);
  line-height: 1.8;
}

/* === Hero Stats Bar === */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--border);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.hero-stat:hover {
  border-color: var(--accent-teal);
  background: var(--bg-hover);
  color: var(--text-muted);
  text-decoration: none;
}

.hero-stat .stat-count {
  color: var(--accent-teal);
  font-weight: 700;
}

/* === CVE Severity Badges === */
.severity-high {
  color: #ff4444;
  font-weight: 700;
  font-size: 12px;
}

.severity-medium {
  color: #ffaa00;
  font-weight: 700;
  font-size: 12px;
}

.severity-low {
  color: var(--accent-teal);
  font-weight: 700;
  font-size: 12px;
}

.cvss-vector {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Source Code Pro', monospace;
  white-space: nowrap;
}

/* === Accordion Tiles === */
.tile {
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.tile-header {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-family: 'Source Code Pro', 'Courier New', monospace;
  font-size: 16px;
  color: var(--accent-teal);
  text-align: left;
  transition: background 0.2s;
}

.tile-header:hover {
  background: var(--bg-hover);
}

.tile-title {
  flex: 1;
  font-weight: 700;
}

.tile-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 12px;
}

.tile-chevron {
  font-size: 14px;
  transition: transform 0.3s;
  color: var(--text-muted);
}

.tile.open .tile-chevron {
  transform: rotate(180deg);
}

.tile-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.tile.open .tile-content {
  max-height: 4000px;
}

.tile-content-inner {
  padding: 0 16px 16px;
}

.tile-content-inner p {
  margin: 8px 0;
}

.tile-content-inner .github-subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 10px;
}

.tile-content-inner .github-subtitle a {
  color: var(--accent-teal);
}

.tile-content-inner .github-subtitle a:hover {
  color: var(--text);
}

.github-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  fill: var(--accent-teal);
}

/* === Responsive === */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 28px;
  }

  .hero .role {
    font-size: 14px;
  }

  .tile-content-inner table,
  .tile-content-inner thead,
  .tile-content-inner tbody,
  .tile-content-inner th,
  .tile-content-inner td,
  .tile-content-inner tr {
    display: block;
  }

  .tile-content-inner thead {
    display: none;
  }

  .tile-content-inner tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    padding: 10px;
  }

  .tile-content-inner tr:hover {
    background: transparent;
  }

  .tile-content-inner td {
    border: none;
    padding: 3px 0;
  }

  .tile-content-inner td.year {
    font-size: 12px;
    width: auto;
  }

  .contact-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .contact-links a {
    text-align: center;
  }

  .cta-split {
    flex-direction: column;
  }

  .cta-split .split-portfolio {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .section-nav li a {
    padding: 10px 10px;
    font-size: 11px;
  }

  .cta-ascii pre {
    font-size: 10px;
  }
}

@media (min-width: 601px) {
  .tile {
    margin-bottom: 10px;
  }

  .tile-header {
    padding: 14px 20px;
  }

  .tile-content-inner {
    padding: 0 20px 20px;
  }
}
