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

:root {
  --bg: #020617;
  --bg-soft: #050816;
  --bg-card: #020617;
  --fg: #e5e7eb;
  --fg-muted: #9ca3af;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.2);
  --border-soft: rgba(148, 163, 184, 0.25);
  --shadow-accent: 0 0 18px rgba(34, 197, 94, 0.55);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 999px;
}

html,
body {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  background: radial-gradient(circle at top, #0b1120 0, #020617 45%, #000 100%);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* Layout helpers */
.section {
  padding: 4rem 1.5rem;
}

.section-inner {
  max-width: 960px;
  margin: 0 auto;
}

h1,
h2,
h3 {
  margin-top: 0;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

p {
  line-height: 1.6;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(to bottom, #020617ee, #020617aa, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--accent);
}

.logo-blink {
  animation: blink 1s steps(2, start) infinite;
}

.nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--fg-muted);
  text-decoration: none;
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.15s ease;
}

.nav a:hover {
  color: var(--fg);
}

.nav a:hover::after {
  width: 100%;
}

/* Hero */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 1.5rem 3rem;
}

.hero-content {
  max-width: 960px;
  width: 100%;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  margin-bottom: 0.4rem;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--fg-muted);
  min-height: 1.8em;
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease,
    transform 0.1s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background: var(--accent);
  color: #020617;
  font-weight: 600;
  box-shadow: var(--shadow-accent);
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-soft);
}

.btn.small {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
}

/* Terminal block */
.terminal {
  max-width: 520px;
  margin-top: 2rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--accent-soft);
  box-shadow: 0 0 12px rgba(15, 23, 42, 0.9);
  font-family: "Fira Code", Menlo, Monaco, Consolas, "Courier New", monospace;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: #020617;
  border-bottom: 1px solid #0f172a;
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red {
  background: #f97373;
}

.dot.yellow {
  background: #facc15;
}

.dot.green {
  background: #4ade80;
}

.terminal-title {
  margin-left: auto;
  opacity: 0.7;
}

.terminal-body {
  padding: 0.7rem 0.9rem 0.9rem;
  font-size: 0.82rem;
}

/* hero terminal letter-by-letter lines */
.hero-line {
  margin: 0.1rem 0;
  font-size: 0.82rem;
  white-space: pre-wrap;
  color: #e5e7eb;
}

.hero-line.prompt {
  color: #22c55e;
}

/* interactive terminal */
#terminal-lab .terminal {
  margin-top: 1.5rem;
}

#emu-output {
  max-height: 260px;
  overflow-y: auto;
}

/* Section backgrounds */
#about {
  background: rgba(15, 23, 42, 0.6);
}

#skills {
  background: rgba(15, 23, 42, 0.85);
}

#projects {
  background: rgba(15, 23, 42, 0.6);
}

#labs {
  background: rgba(15, 23, 42, 0.85);
}

#certs {
  background: rgba(15, 23, 42, 0.6);
}

#thm {
  background: rgba(15, 23, 42, 0.85);
}

#writing {
  background: rgba(15, 23, 42, 0.6);
}

#changelog {
  background: rgba(15, 23, 42, 0.85);
}

#contact {
  background: rgba(15, 23, 42, 0.6);
}

/* Skills */
.skills-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
}

.skills-card {
  background: linear-gradient(to bottom right, #020617, #020617);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.1rem;
  border: 1px solid var(--border-soft);
}

.skills-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.skills-card ul {
  padding-left: 1.1rem;
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.current-focus {
  margin-top: 1.75rem;
}

.current-focus h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.current-focus ul {
  padding-left: 1.1rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Projects */
.section-intro {
  color: var(--fg-muted);
  font-size: 0.94rem;
  margin-bottom: 1.5rem;
}

.projects-grid {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  background: #020617;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  padding: 1.3rem 1.1rem;
  box-shadow: 0 0 14px rgba(15, 23, 42, 0.9);
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.project-card h3 {
  font-size: 1.02rem;
  margin-bottom: 0.4rem;
}

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

.project-card ul {
  padding-left: 1.1rem;
  margin: 0.7rem 0 0.7rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

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

/* Writing / generic cards */
.writing-cards {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
}

.writing-card {
  background: #020617;
  border-radius: var(--radius-md);
  padding: 1.2rem 1.1rem;
  border: 1px solid var(--border-soft);
}

.writing-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

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

.writing-card ul {
  padding-left: 1.1rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Contact */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-soft);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  background: #020617;
  transition: border-color 0.12s ease, color 0.12s ease,
    background 0.12s ease, transform 0.1s ease;
}

.social-link:hover {
  color: var(--fg);
  border-color: var(--accent-soft);
  transform: translateY(-1px);
}

/* Contact form */
.contact-layout {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.contact-form-wrapper {
  background: #020617;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 1.25rem 1.1rem;
}

.contact-form-wrapper h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.form-row label {
  color: #e5e7eb;
}

.form-row input,
.form-row textarea {
  background: #020617;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.5rem 0.6rem;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
  color: #6b7280;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.btn-submit {
  margin-top: 0.4rem;
  background: #22c55e;
  color: #020617;
  border-color: #22c55e;
  font-weight: 600;
}

/* Quote */
.footer-quote {
  margin-top: 2rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-muted);
  font-style: italic;
}

/* Footer */
.site-footer {
  padding: 1rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Animations */
@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* Responsive */
@media (min-width: 720px) {
  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .projects-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .writing-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .terminal {
    margin-top: 1.5rem;
  }
}
