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

:root {
  --bg-primary: #1a1a1f;
  --bg-secondary: #22222a;
  --bg-tertiary: #2a2a34;
  --text-primary: #e8e4df;
  --text-secondary: #a8a4a0;
  --accent: #d4a04a;
  --accent-hover: #e0b060;
  --border: #333340;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ===== Layout ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
}

/* ===== Navigation ===== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: rgba(26, 26, 31, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5rem;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--accent);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--text-primary);
  margin: 4px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 3.5rem;
}

.hero-content {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s ease forwards;
  animation-delay: 0.2s;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.hero .tagline {
  font-size: 1.125rem;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero .separator {
  display: inline-block;
  width: 2rem;
  height: 1px;
  background-color: var(--accent);
  vertical-align: middle;
  margin: 0 0.75rem;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Section Headings ===== */
.section-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  color: var(--text-primary);
}

.section-heading::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  background-color: var(--accent);
  margin-top: 0.75rem;
}

/* ===== About ===== */
.about {
  background-color: var(--bg-secondary);
}

.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  align-items: start;
}

.about-photo {
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  aspect-ratio: 3 / 4;
}

.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-text p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

/* ===== Writing ===== */
.writing-content p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.8;
  max-width: 640px;
  margin-bottom: 1.25rem;
}

/* ===== Engineering ===== */
.engineering {
  background-color: var(--bg-secondary);
}

.engineering-content p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.8;
  max-width: 640px;
  margin-bottom: 1.25rem;
}

/* ===== Contact ===== */
.contact-content p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  margin-bottom: 1.5rem;
}

.contact-email {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.contact-email:hover {
  border-bottom-color: var(--accent);
}

.social-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 2rem;
  list-style: none;
}

.social-links a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

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

.social-links svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

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

.site-footer p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
}

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

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  section {
    padding: 3.5rem 0;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    background-color: rgba(26, 26, 31, 0.98);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-photo {
    max-width: 280px;
  }

  .section-heading {
    font-size: 1.625rem;
  }

  .contact-email {
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero .tagline {
    font-size: 0.9375rem;
  }

  section {
    padding: 3rem 0;
  }
}

/* ===== Focus styles for accessibility ===== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Skip link ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  z-index: 200;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  top: 0;
}
