:root {
  color-scheme: light;
  --color-background: #fafafa;
  --color-surface: #ffffff;
  --color-foreground: #09090b;
  --color-muted: #5f6670;
  --color-border: #e4e4e7;
  --color-soft: #f0f2f4;
  --color-primary: #18181b;
  --color-on-primary: #ffffff;
  --color-accent: #2563eb;
  --color-signal: #0f766e;
  --shadow-soft: 0 24px 80px rgb(24 24 27 / 8%);
  --radius: 8px;
  --space-page: clamp(20px, 5vw, 72px);
  --font-display: "Space Grotesk", "Archivo", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgb(9 9 11 / 3.8%) 1px, transparent 1px),
    linear-gradient(180deg, rgb(9 9 11 / 3.8%) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, var(--color-background) 34%, #f6f7f8 100%);
  background-size: 48px 48px, 48px 48px, auto;
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
}

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

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

.site-header,
.site-footer,
.section {
  width: min(1120px, calc(100% - var(--space-page) * 2));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  gap: 24px;
}

.brand,
.nav-links,
.hero-actions,
.contact-links,
.language-toggle {
  display: flex;
  align-items: center;
}

.brand {
  min-height: 44px;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-display);
  font-size: 15px;
}

.nav-links {
  gap: 4px;
}

.nav-links a,
.site-footer a {
  min-height: 44px;
  border-radius: var(--radius);
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.nav-links a:hover,
.site-footer a:hover,
.language-toggle:hover {
  background: var(--color-soft);
  color: var(--color-foreground);
}

.language-toggle {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-foreground);
  cursor: pointer;
  justify-content: center;
  padding: 0 12px;
  font: 700 0.82rem/1 var(--font-body);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.language-toggle [data-lang-label] {
  display: inline-block;
  transition: transform 180ms ease, opacity 180ms ease;
}

.language-toggle:active [data-lang-label] {
  transform: scale(0.9);
  opacity: 0.6;
}

.section {
  padding-block: clamp(56px, 9vw, 112px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  min-height: calc(100dvh - 88px);
  align-items: center;
  gap: clamp(36px, 8vw, 96px);
  padding-top: 28px;
}

.eyebrow,
.project-meta,
.facts dt {
  margin: 0 0 14px;
  color: var(--color-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.04;
}

h1 {
  max-width: 780px;
  margin-bottom: 24px;
  font-size: clamp(2.8rem, 7vw, 6rem);
  text-wrap: balance;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.5rem);
}

h3 {
  margin-bottom: 16px;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.intro {
  max-width: 620px;
  margin-bottom: 32px;
  color: var(--color-muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

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

.button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 700;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

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

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

.button-secondary {
  border-color: var(--color-border);
  background: var(--color-surface);
}

.profile-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 78%);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.portrait {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgb(24 24 27 / 7%) 1px, transparent 1px),
    linear-gradient(180deg, rgb(24 24 27 / 7%) 1px, transparent 1px),
    radial-gradient(circle at 26% 24%, rgb(15 118 110 / 18%), transparent 32%),
    radial-gradient(circle at 76% 72%, rgb(37 99 235 / 14%), transparent 34%),
    linear-gradient(135deg, #f8fafc 0%, #dfe5ec 100%);
  background-size: 32px 32px, 32px 32px, auto, auto, auto;
  overflow: hidden;
}

.portrait::before,
.portrait::after {
  position: absolute;
  content: "";
  border: 1px solid rgb(24 24 27 / 18%);
  border-radius: 999px;
}

.portrait::before {
  width: 46%;
  height: 46%;
}

.portrait::after {
  width: 72%;
  height: 1px;
  background: rgb(24 24 27 / 18%);
}

.portrait span {
  position: relative;
  z-index: 1;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: clamp(6rem, 16vw, 10rem);
  font-weight: 700;
}

.facts {
  display: grid;
  gap: 1px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.facts div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  background: var(--color-surface);
  padding: 14px;
}

.facts dd {
  margin: 0;
  font-weight: 700;
}

.section-heading {
  display: grid;
  max-width: 720px;
  margin-bottom: 32px;
}

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

.project-card {
  min-height: 280px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: clamp(20px, 3vw, 28px);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgb(15 118 110 / 46%);
  box-shadow: var(--shadow-soft);
}

.project-card p:last-child,
.about-content p {
  color: var(--color-muted);
}

.about {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(32px, 8vw, 96px);
}

.about-content {
  max-width: 720px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.skill-list li {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  border-top: 1px solid var(--color-border);
}

.contact h2 {
  max-width: 820px;
}

.contact-links {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
  min-width: min(100%, 260px);
}

.contact-links a {
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 700;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.contact-links a:hover {
  border-color: rgb(15 118 110 / 46%);
  background: #f3fbf9;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  gap: 20px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
}

.site-footer p {
  margin: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-background: #09090b;
    --color-surface: #18181b;
    --color-foreground: #fafafa;
    --color-muted: #a1a1aa;
    --color-border: #27272a;
    --color-soft: #27272a;
    --color-primary: #fafafa;
    --color-on-primary: #18181b;
    --shadow-soft: 0 24px 80px rgb(0 0 0 / 40%);
  }

  body {
    background:
      linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px),
      linear-gradient(180deg, rgb(255 255 255 / 4%) 1px, transparent 1px),
      linear-gradient(180deg, #18181b 0%, var(--color-background) 34%, #0f0f11 100%);
    background-size: 48px 48px, 48px 48px, auto;
  }

  .profile-panel {
    background: rgb(24 24 27 / 78%);
  }

  .portrait {
    background:
      linear-gradient(90deg, rgb(255 255 255 / 7%) 1px, transparent 1px),
      linear-gradient(180deg, rgb(255 255 255 / 7%) 1px, transparent 1px),
      radial-gradient(circle at 26% 24%, rgb(15 118 110 / 24%), transparent 32%),
      radial-gradient(circle at 76% 72%, rgb(37 99 235 / 18%), transparent 34%),
      linear-gradient(135deg, #1a1a1f 0%, #2a2a32 100%);
    background-size: 32px 32px, 32px 32px, auto, auto, auto;
  }

  .portrait::before,
  .portrait::after {
    border-color: rgb(255 255 255 / 20%);
  }

  .portrait::after {
    background: rgb(255 255 255 / 20%);
  }

  .button-secondary {
    border-color: var(--color-border);
  }

  .project-card:hover {
    border-color: rgb(15 118 110 / 56%);
  }

  .contact-links a:hover {
    background: #0f2925;
  }
}

@media (max-width: 900px) {
  .hero,
  .about,
  .contact {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .profile-panel {
    max-width: 520px;
  }

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

  .project-card {
    min-height: 220px;
  }
}

@media (max-width: 620px) {
  :root {
    --space-page: 18px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 18px;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links a {
    flex: 1;
    justify-content: center;
  }

  .language-toggle {
    position: absolute;
    right: var(--space-page);
    top: 18px;
  }

  h1 {
    font-size: clamp(2.35rem, 13vw, 3.8rem);
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 20px;
  }
}

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

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