:root {
  --primary: #003366;
  --primary-foreground: #ffffff;
  --secondary: #007bff;
  --background: #f7f9fc;
  --foreground: #1f2c3d;
  --muted: #eff3f8;
  --muted-foreground: #596779;
  --card: #ffffff;
  --border: #dde5ee;
  --shadow: 0 18px 40px rgba(0, 22, 44, 0.08);
  --shadow-soft: 0 10px 24px rgba(0, 22, 44, 0.06);
  --container: 1280px;
  --header-height: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--foreground);
  background: var(--background);
  line-height: 1.6;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, ul { margin-top: 0; }
ul { margin-bottom: 0; padding-left: 1.2rem; }
button, input, textarea { font: inherit; }
input, textarea, button { border-radius: 0; }
:focus-visible {
  outline: 3px solid rgba(0, 123, 255, 0.35);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(var(--container), calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: 6rem 0;
}

.section-muted {
  background: linear-gradient(180deg, rgba(0, 51, 102, 0.04), rgba(0, 51, 102, 0.02));
}

.section-border {
  border-top: 1px solid rgba(0, 51, 102, 0.08);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-height);
  backdrop-filter: blur(12px);
  background: rgba(247, 249, 252, 0.9);
  border-bottom: 1px solid rgba(0, 51, 102, 0.12);
}

.header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  min-width: 0;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-text {
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.site-nav a {
  color: var(--muted-foreground);
  transition: color 180ms ease;
}
.site-nav a:hover,
.site-nav a.is-active {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border);
  background: #fff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.25rem;
}
.menu-toggle span:not(.sr-only) {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: var(--primary);
}

.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    linear-gradient(var(--primary) 1px, transparent 1px),
    linear-gradient(90deg, var(--primary) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 4rem;
  align-items: center;
  padding: 4rem 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(0, 51, 102, 0.2);
  color: var(--primary);
  background: rgba(0, 51, 102, 0.05);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
}

.hero h1 {
  margin-bottom: 1.5rem;
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 900;
  color: var(--primary);
}

.text-foreground { color: var(--foreground); }
.text-secondary { color: var(--secondary); }

.hero-text {
  max-width: 40rem;
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
  color: var(--muted-foreground);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.2rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.button-primary:hover { background: #002952; }
.button-outline {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}
.button-outline:hover {
  background: rgba(0, 51, 102, 0.05);
}
.button-block { width: 100%; }

.hero-media { display: flex; justify-content: center; }
.portrait-frame {
  position: relative;
  width: min(28rem, 100%);
  aspect-ratio: 1 / 1;
}
.frame-outline,
.frame-shadow,
.portrait-card {
  position: absolute;
  inset: 0;
}
.frame-outline {
  transform: translate(-1rem, -1rem);
  border: 2px solid rgba(0, 123, 255, 0.3);
}
.frame-shadow {
  transform: translate(1rem, 1rem);
  background: rgba(0, 51, 102, 0.06);
}
.portrait-card {
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--muted);
  box-shadow: var(--shadow);
}
.portrait-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 250ms ease, transform 250ms ease;
}
.portrait-card:hover img {
  filter: grayscale(0%);
  transform: scale(1.01);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 3rem;
}

.section-heading,
.projects-header {
  margin-bottom: 3rem;
}

.section-lead h2,
.section-heading h2,
.projects-header h2,
.contact-copy h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--primary);
}
.section-rule {
  width: 5rem;
  height: 0.28rem;
  background: var(--secondary);
  margin-bottom: 1.5rem;
}
.small-mono {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
}

.profile-content {
  font-size: 1.08rem;
  color: rgba(31, 44, 61, 0.9);
}
.profile-content strong { color: var(--primary); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}
.stat-card {
  padding: 1.2rem;
  border: 1px solid var(--border);
  background: #fff;
  text-align: center;
  transition: border-color 180ms ease, transform 180ms ease;
}
.stat-card:hover {
  border-color: rgba(0, 51, 102, 0.4);
  transform: translateY(-2px);
}
.stat-card strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 2rem;
  color: var(--primary);
}
.stat-card span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}
.skill-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.skill-card-accent {
  border-top-color: var(--secondary);
  background: rgba(0, 51, 102, 0.04);
}
.card-icon {
  margin-bottom: 0.8rem;
  color: var(--secondary);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
}
.skill-card h3 {
  margin-bottom: 0.9rem;
  font-size: 1.3rem;
  color: var(--foreground);
}
.skill-card ul {
  display: grid;
  gap: 0.45rem;
  color: var(--muted-foreground);
}
.language-list {
  display: grid;
  gap: 0.95rem;
}
.language-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-solid {
  background: rgba(0, 123, 255, 0.12);
  border-color: transparent;
  color: var(--secondary);
}
.status-tag {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 123, 255, 0.12);
  color: var(--secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.projects-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}
.projects-header p {
  max-width: 28rem;
  margin: 0;
  color: var(--muted-foreground);
  text-align: right;
}
.projects-list {
  display: grid;
  gap: 2rem;
}
.project-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.3fr);
  gap: 2rem;
  padding: 2rem;
  border: 1px solid var(--border);
  background: #fff;
  transition: border-color 180ms ease, transform 180ms ease;
}
.project-card:hover {
  border-color: rgba(0, 51, 102, 0.4);
  transform: translateY(-3px);
}
.project-meta h3 {
  margin-bottom: 0.75rem;
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--primary);
}
.meta-date,
.meta-role {
  margin-bottom: 0.4rem;
}
.meta-date {
  color: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
}
.meta-role {
  font-weight: 700;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.project-content {
  padding-left: 2rem;
  border-left: 1px solid var(--border);
}
.project-content h4 {
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}
.project-content p,
.project-content li {
  color: var(--muted-foreground);
}
.project-content ul {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.contact-section {
  color: var(--primary-foreground);
  background: var(--primary);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 3rem;
  align-items: center;
}
.contact-copy h2,
.contact-copy p,
.contact-copy a,
.contact-copy div {
  color: inherit;
}
.contact-copy p {
  max-width: 36rem;
  font-size: 1.1rem;
  opacity: 0.85;
}
.contact-links {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}
.contact-links a,
.contact-links div {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.05rem;
}
.contact-links a:hover { color: #99c7ff; }
.contact-icon {
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-weight: 800;
}

.contact-panel {
  padding: 2rem;
  background: #fff;
  color: var(--foreground);
  box-shadow: var(--shadow);
}
.contact-panel h3 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  color: var(--primary);
}
.contact-form {
  display: grid;
  gap: 1rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.contact-form label {
  display: grid;
  gap: 0.45rem;
}
.contact-form span {
  font-size: 0.95rem;
  font-weight: 600;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
}
.contact-form textarea {
  resize: vertical;
  min-height: 8rem;
}
.form-hint {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid rgba(0, 51, 102, 0.1);
  background: rgba(255, 255, 255, 0.55);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 0;
}
.footer-name {
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-weight: 800;
}
.footer-role,
.footer-copy {
  margin: 0;
  color: var(--muted-foreground);
}

.reveal {
  opacity: 1;
  transform: none;
}
body.js-enabled .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-delay { transition-delay: 120ms; }
body.js-enabled .reveal.is-visible,
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero-inner,
  .profile-grid,
  .contact-grid,
  .project-card,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .project-content {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
  }

  .projects-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .projects-header p { text-align: left; }

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

@media (max-width: 760px) {
  :root { --header-height: 68px; }
  .brand-text { display: none; }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1rem 1rem;
    background: rgba(247, 249, 252, 0.98);
    border-bottom: 1px solid rgba(0, 51, 102, 0.12);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    width: 100%;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(0, 51, 102, 0.08);
  }

  .section {
    padding: 4.5rem 0;
  }

  .hero-inner { gap: 2rem; }
  .hero-actions,
  .form-row,
  .footer-inner {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
  .button,
  .hero-actions a {
    width: 100%;
  }

  .portrait-frame {
    width: min(22rem, 100%);
  }
}

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