:root {
  --ink: #0c1327;
  --muted: #526078;
  --line: #e2e6ec;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --surface-subtle: #f3f5f8;
  --blue: #1769ff;
  --blue-hover: #2563eb;
  --navy: #0f172a;
  --navy-elevated: #17223b;
  --content-width: 1090px;
}

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

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

b,
strong {
  font-weight: 700;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 6px;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid #6da0ff;
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner,
.page-shell,
.footer-inner {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
}

.header-inner {
  min-height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  font-size: 15px;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.main-nav {
  display: flex;
  gap: 32px;
  color: #40506b;
  font-size: 14px;
  font-weight: 500;
}

.main-nav a {
  transition: color 160ms ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--blue);
}

.language-switcher {
  justify-self: end;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.language-button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4c5870;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.language-button:hover,
.language-button:focus-visible {
  background: var(--surface-subtle);
  color: var(--ink);
}

.language-button.active {
  background: var(--ink);
  color: white;
}

/* Hero — clean figure/ground without decorative grid or internal dividers */
.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--paper);
}

.hero .page-shell {
  padding: 96px 0 104px;
}

.hero-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.eyebrow,
.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #3b4963;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.eyebrow-dot,
.location-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
}

.eyebrow-dot {
  background: var(--ink);
}

.location-dot {
  background: #16a34a;
}

h1 {
  margin: 20px 0 48px;
  font-size: clamp(44px, 5.8vw, 66px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.04;
  text-align: left;
}

/* 12-column symmetric grid */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 48px;
  align-items: start;
}

.hero-copy {
  grid-column: span 7;
}

.hero-aside {
  grid-column: span 5;
}

.intro {
  margin: 0 0 32px;
  color: #172138;
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
}

.intro strong {
  font-weight: 700;
}

.body-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.7;
  text-align: left;
}

.body-copy:last-child {
  margin-bottom: 0;
}

.body-copy strong {
  color: #26334d;
  font-weight: 600;
}

.skills-card,
.contact-card {
  border-radius: 16px;
}

/* Proximity 1:2: intra-group 8px, between groups 24px, between cards 48px; padding 32px >= 24px */
.skills-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(12, 19, 39, 0.04);
}

.skill-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag-list,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag,
.project-tag {
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.tag {
  background: var(--surface-subtle);
  color: #2c3a52;
}

.contact-card {
  margin-top: 48px;
  padding: 32px;
  color: white;
  background: var(--navy);
  box-shadow: 0 4px 14px rgba(12, 19, 39, 0.08);
}

.contact-card [data-i18n="cta"] {
  margin: 0 0 24px;
  font-size: 17px;
  line-height: 1.5;
  text-align: left;
}

.social-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.social-link:hover,
.social-link:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.36);
}

.social-link-primary {
  border-color: var(--blue);
  background: var(--blue);
}

.social-link-primary:hover,
.social-link-primary:focus-visible {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

/* Projects section — stepped surface (#ffffff over --paper) */
.projects {
  padding: 96px 0 104px;
  background: var(--surface);
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 48px;
}

.section-heading h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.section-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Proximity 1:2: 64px between project cards >= 2x 32px internal column gap */
.project-list {
  display: grid;
  gap: 64px;
}

.project-showcase {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 32px;
  align-items: start;
  margin: 0;
  padding: 40px;
  border-radius: 20px;
  color: white;
  text-align: left;
  background: var(--navy);
  box-shadow: 0 6px 20px rgba(12, 19, 39, 0.08);
}

.project-showcase > :first-child {
  grid-column: span 5;
}

.project-copy {
  grid-column: span 7;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project-image {
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

/* Embedded terminal preview — flat stepped surface (no nested card shadow) */
.extension-visual {
  width: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  border-radius: 12px;
  background: var(--navy-elevated);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.extension-window-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.extension-window-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #52617d;
}

.extension-window-bar span:first-child {
  background: #ff6b6b;
}

.extension-window-bar span:nth-child(2) {
  background: #ffd166;
}

.extension-window-bar span:last-child {
  background: #53d98c;
}

.extension-command {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.extension-name {
  margin: 0 0 20px;
  color: white;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.extension-results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
  list-style: none;
}

.extension-results li::before {
  content: "✓";
  margin-right: 8px;
  color: #53d98c;
}

/* 3 clear typographic levels inside .project-copy:
   1. Title: h3 (26px, 750)
   2. Body: .project-description (16px, 400)
   3. Metadata: .project-label & .project-tag (12px, 600) */
.project-label {
  display: block;
  margin: 0 0 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-copy h3 {
  margin: 0 0 14px;
  font-size: 26px;
  font-weight: 750;
  line-height: 1.2;
}

.project-description {
  margin: 0 0 24px;
  color: #cbd5e1;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  text-align: left;
}

.project-tags {
  margin-bottom: 28px;
}

.project-tag {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 13px;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background-color 160ms ease;
}

.project-link:hover,
.project-link:focus-visible {
  transform: translateY(-1px);
  background: var(--blue-hover);
}

.project-link-secondary {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
}

.project-link-secondary:hover,
.project-link-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}

.site-footer {
  padding: 56px 0;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.footer-name {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.footer-links {
  grid-template-columns: repeat(3, 132px);
}

.footer-links .social-link {
  height: 44px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.footer-links .social-link:hover,
.footer-links .social-link:focus-visible {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
}

/* Secondary utility surface — does not compete with primary blue CTAs */
.back-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(12, 19, 39, 0.1);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 1000;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top-btn:hover,
.back-to-top-btn:focus-visible {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

#about,
#projects,
#connect {
  scroll-margin-top: 85px;
}

@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;
  }
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
    column-gap: 12px;
    padding: 8px 0;
  }

  .brand {
    min-width: 0;
    padding: 4px 0;
  }

  .main-nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    gap: 16px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface-subtle);
    font-size: 13px;
    font-weight: 600;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 4px;
  }

  #about,
  #projects,
  #connect {
    scroll-margin-top: 118px;
  }

  .hero .page-shell {
    padding: 72px 0 80px;
  }

  .hero-grid,
  .project-showcase {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-aside,
  .project-showcase > :first-child,
  .project-copy {
    grid-column: 1 / -1;
  }

  .hero-grid {
    gap: 48px;
  }

  .project-list {
    gap: 48px;
  }

  .project-showcase {
    padding: 32px;
    gap: 24px;
  }
}

@media (max-width: 600px) {
  .header-inner,
  .page-shell,
  .footer-inner {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .brand {
    gap: 9px;
    font-size: 13px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .language-button {
    min-width: 34px;
    min-height: 34px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .hero .page-shell {
    padding: 48px 0 64px;
  }

  .hero-meta-row {
    gap: 8px;
  }

  .eyebrow,
  .location-pill {
    padding: 7px 11px;
    border-radius: 10px;
    line-height: 1.35;
  }

  h1 {
    margin: 18px 0 32px;
    font-size: clamp(32px, 9.5vw, 43px);
    overflow-wrap: break-word;
  }

  .intro {
    margin-bottom: 24px;
    font-size: 19px;
    line-height: 1.5;
  }

  .body-copy {
    font-size: 16px;
    line-height: 1.65;
  }

  .skills-card,
  .contact-card {
    padding: 24px;
  }

  .skills-card {
    gap: 20px;
  }

  .contact-card {
    margin-top: 36px;
  }

  .projects {
    padding: 64px 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 32px;
  }

  .section-count {
    text-align: left;
  }

  .section-heading h2 {
    font-size: 28px;
  }

  /* Padding (24px) >= internal gap (20px); inter-card gap (40px) = 2x 20px */
  .project-list {
    gap: 40px;
  }

  .project-showcase {
    gap: 20px;
    padding: 24px;
    border-radius: 16px;
  }

  .extension-visual {
    min-height: auto;
    padding: 20px;
  }

  .extension-window-bar {
    margin-bottom: 18px;
  }

  .extension-command {
    margin-bottom: 8px;
    font-size: 11.5px;
  }

  .extension-name {
    margin-bottom: 14px;
    font-size: 18px;
  }

  .project-copy h3 {
    font-size: 22px;
  }

  .project-actions {
    width: 100%;
    flex-direction: column;
  }

  .project-link {
    width: 100%;
    justify-content: center;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
  }

  .footer-links {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .back-to-top-btn {
    bottom: max(18px, env(safe-area-inset-bottom));
    right: 18px;
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 480px) {
  .social-row,
  .footer-links {
    grid-template-columns: 1fr;
  }

  .social-link {
    height: 44px;
  }
}
