/* Black & white palette. Light theme is the base; the dark tokens apply when the system prefers dark
   (unless the Visitor chose light) or when the Visitor chose dark. */
:root {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-bg-alt: #f5f5f5;
  --color-surface: #ffffff;
  --color-primary: #0a0a0a;
  --color-primary-dark: #404040;
  --color-on-primary: #ffffff;
  --color-text: #0a0a0a;
  --color-text-muted: #525252;
  --color-border: rgba(0, 0, 0, 0.12);
  --color-header-bg: rgba(255, 255, 255, 0.8);
  --color-grid: rgba(0, 0, 0, 0.06);
  --color-error: #0a0a0a;
  --font-heading: "Poppins", sans-serif;
  --font-body: "Inter", sans-serif;
  --max-width: 1100px;
  --radius: 6px;
  --transition: 0.25s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #0a0a0a;
    --color-bg-alt: #141414;
    --color-surface: #111111;
    --color-primary: #fafafa;
    --color-primary-dark: #d4d4d4;
    --color-on-primary: #0a0a0a;
    --color-text: #fafafa;
    --color-text-muted: #a3a3a3;
    --color-border: rgba(255, 255, 255, 0.14);
    --color-header-bg: rgba(10, 10, 10, 0.8);
    --color-grid: rgba(255, 255, 255, 0.07);
    --color-error: #fafafa;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0a0a0a;
  --color-bg-alt: #141414;
  --color-surface: #111111;
  --color-primary: #fafafa;
  --color-primary-dark: #d4d4d4;
  --color-on-primary: #0a0a0a;
  --color-text: #fafafa;
  --color-text-muted: #a3a3a3;
  --color-border: rgba(255, 255, 255, 0.14);
  --color-header-bg: rgba(10, 10, 10, 0.8);
  --color-grid: rgba(255, 255, 255, 0.07);
  --color-error: #fafafa;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

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

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
}

.logo span {
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  color: var(--color-text-muted);
  font-weight: 500;
  position: relative;
  padding: 0.25rem 0;
}

.nav-link.active,
.nav-link:hover {
  color: var(--color-text);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.header-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Hero */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  isolation: isolate;
}

/* Faint grid that fades out towards the edges */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  flex-wrap: wrap;
}

.hero-content {
  flex: 1 1 420px;
}

.hero-avatar {
  flex: 0 0 auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-on-primary);
  background: var(--color-primary);
  box-shadow: 0 0 0 10px var(--color-bg), 0 0 0 11px var(--color-border);
  overflow: hidden;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.lead {
  max-width: 60ch;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: transform var(--transition), background var(--transition), color var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-on-primary);
}

.btn-outline {
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

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

/* Sections */
.section {
  padding: 6rem 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
}

.about-text p {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.link-arrow {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 600;
}

.about-skills h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.skills-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.skills-list li {
  padding: 0.6rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* About: projects subsection */
.about-projects,
.about-employers {
  margin-top: 3rem;
}

.about-projects h3,
.about-employers h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.about-projects > p,
.about-employers > p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  max-width: 70ch;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform var(--transition), border-color var(--transition);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
}

.project-card h3 {
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.project-card p a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.project-note {
  font-size: 0.85rem !important;
}

.project-card .card-meta {
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
}

/* CV */
.cv-downloads {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.contact-direct h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.contact-direct ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 600;
}

.honeypot {
  display: none;
}

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

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.form-row input,
.form-row textarea {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--color-text);
  font-family: var(--font-body);
  resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-status {
  color: var(--color-primary);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.form-status.error {
  color: var(--color-error);
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 860px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-inner {
    justify-content: center;
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-avatar {
    width: 160px;
    height: 160px;
    font-size: 3rem;
  }
}

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

  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    gap: 1.25rem;
    border-bottom: 1px solid var(--color-border);
    transform: translateY(-150%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition), opacity var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* Reduced motion: no scroll smoothing, reveal or hover movement */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn:hover,
  .project-card:hover {
    transform: none;
  }
}
