:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f0f4f8;
  --text: #1f2a37;
  --muted: #5b6777;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --border: #dbe3ec;
  --shadow: 0 10px 30px rgba(31, 42, 55, 0.08);
  --radius: 18px;
  --max-width: 1100px;
  --header-offset: 6rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #f9fbfd 0%, #f4f7fb 100%);
  color: var(--text);
  line-height: 1.65;
}
a { color: var(--primary); text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
a:hover { color: var(--primary-dark); }
a:focus-visible, button:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
  border-radius: 4px;
}
.container { width: min(100% - 2rem, var(--max-width)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 249, 252, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(219, 227, 236, 0.7);
}
.nav { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; gap: 1rem; }
.brand { font-weight: 700; letter-spacing: 0.2px; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
.nav-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.95rem; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.2s ease, background 0.2s ease; }
.nav-links a:hover, .nav-links a[aria-current="location"] { color: var(--text); }
.hero { padding: 5rem 0 4rem; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 0.9fr; gap: 2.5rem; align-items: center; }
.eyebrow {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: #e6f7f4;
  border: 1px solid #cceee9;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
h1 { font-size: clamp(2.2rem, 4vw, 4rem); line-height: 1.08; margin: 0 0 0.75rem; letter-spacing: -0.03em; }
h2, h3 { letter-spacing: -0.02em; }
.subtitle { font-size: 1.1rem; color: var(--muted); margin-bottom: 1.5rem; max-width: 60ch; }
.hero p { margin: 0 0 1rem; max-width: 62ch; }
.hero-actions { margin-top: 1.75rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.button:hover { background: var(--primary-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25); }
.button-secondary { background: #fff; color: var(--primary); border: 1px solid var(--border); box-shadow: 0 8px 20px rgba(31, 42, 55, 0.08); }
.button-secondary:hover { background: var(--surface-soft); color: var(--primary-dark); box-shadow: 0 14px 28px rgba(31, 42, 55, 0.12); }
.hero-card, .section-card, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.hero-card { text-align: center; }
.portrait {
  width: 220px;
  height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.10);
  display: block;
  margin: 0 auto 1rem;
}
.hero-card h2 { margin: 0.5rem 0 0.25rem; font-size: 1.35rem; }
.hero-card p { margin: 0; color: var(--muted); font-size: 0.98rem; }
main section[id] { scroll-margin-top: var(--header-offset); }
main section { padding: 1.25rem 0 2.5rem; }
.section-title { font-size: 1.6rem; margin: 0 0 1rem; }
.section-text { color: var(--text); max-width: 75ch; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.project-card { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px; padding: 1.35rem; }
.project-card h3 { margin: 0.35rem 0 0.8rem; font-size: 1.1rem; }
.project-card p { margin: 0 0 0.75rem; }
.project-card .project-label { color: var(--accent); font-size: 0.84rem; font-weight: 700; }
.project-card .project-link { display: inline-block; margin-top: 0.35rem; font-weight: 700; }
.list { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.list li { margin-bottom: 0.6rem; }
.muted { color: var(--muted); }
.contact-links a { display: inline-block; margin-right: 1rem; margin-bottom: 0.5rem; font-weight: 600; }
footer { padding: 2rem 0 3rem; color: var(--muted); font-size: 0.95rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Content stays visible unless JavaScript has initialized. */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.visible { opacity: 1; transform: translateY(0); }

.legal-page .container { width: min(100% - 2rem, 900px); padding: 3rem 0; }
.legal-page h1 { font-size: clamp(2rem, 4vw, 3rem); }
.legal-page h2 { margin-top: 2rem; }
.back { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; }
.error-page { min-height: 100vh; display: grid; place-items: center; }
.error-page .card { max-width: 700px; text-align: center; }
.error-code { color: var(--accent); font-size: 1rem; font-weight: 700; }

@media (max-width: 900px) {
  .hero-grid, .grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding-top: 3.5rem; }
  .hero-card { order: -1; }
  .portrait { width: 180px; height: 180px; }
}

@media (max-width: 640px) {
  :root { --header-offset: 5.5rem; }
  .nav { flex-wrap: wrap; padding: 0.75rem 0; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-links {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }
  .nav-links[data-open="true"] { max-height: 24rem; visibility: visible; pointer-events: auto; padding-top: 0.5rem; }
  .nav-links a { padding: 0.55rem 0.65rem; border-radius: 8px; }
  .nav-links a:hover, .nav-links a[aria-current="location"] { background: var(--surface-soft); }
  .section-card, .card, .hero-card { padding: 1.5rem; }
  .project-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
