:root {
  color-scheme: light;

  --color-bg: #ffffff;
  --color-text: #050505;
  --color-muted: #5f5f5f;
  --color-soft: #f5f5f5;
  --color-border: #d9d9d9;
  --color-border-strong: #111111;
  --color-focus: #111111;
  --color-header: rgba(255, 255, 255, 0.86);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  --container: 1120px;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.08);
}

/*
  Dark palette. The two blocks below are intentionally identical and must be
  kept in sync: the first serves the manual toggle, the second serves visitors
  whose OS is set to dark and who have not chosen a theme on this site.
  Cards sit lighter than the muted band here, inverting the light-mode
  relationship so raised surfaces still read as raised.
*/
:root[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #101010;
  --color-text: #f2f2f2;
  --color-muted: #a1a1a1;
  --color-soft: #080808;
  --color-border: #2a2a2a;
  --color-border-strong: #6f6f6f;
  --color-focus: #f2f2f2;
  --color-header: rgba(16, 16, 16, 0.86);
  --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --color-bg: #101010;
    --color-text: #f2f2f2;
    --color-muted: #a1a1a1;
    --color-soft: #080808;
    --color-border: #2a2a2a;
    --color-border-strong: #6f6f6f;
    --color-focus: #f2f2f2;
    --color-header: rgba(16, 16, 16, 0.86);
    --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body.menu-open {
  overflow: hidden;
}

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

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.24em;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.container {
  width: min(calc(100% - 32px), var(--container));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--color-text);
  color: var(--color-bg);
  transform: translateY(-140%);
  transition: transform 160ms ease;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-header);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-text);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.logo:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}

.nav-menu a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-muted);
}

.nav-menu a:hover {
  color: var(--color-text);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.theme-toggle:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the theme you would switch *to*. */
.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  place-items: center;
  gap: 4px;
}

.nav-toggle span:not(.sr-only) {
  width: 18px;
  height: 2px;
  background: var(--color-text);
  display: block;
  transition: transform 160ms ease;
}

.nav-toggle[aria-expanded="true"] span:nth-of-type(2) {
  transform: translateY(3px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-of-type(3) {
  transform: translateY(-3px) rotate(-45deg);
}

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

.section {
  padding: 104px 0;
}

.section-muted {
  background: var(--color-soft);
  border-block: 1px solid var(--color-border);
}

.hero {
  min-height: calc(100vh - 76px);
  min-height: calc(100dvh - 76px);
  display: flex;
  align-items: center;
  padding: 80px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 64px;
  align-items: center;
}

.section-kicker {
  margin: 0 0 16px;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 24px;
  max-width: 850px;
  font-size: clamp(3.3rem, 9vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: -0.085em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.07em;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.hero-text {
  max-width: 680px;
  color: var(--color-muted);
  font-size: clamp(1.06rem, 1.5vw, 1.25rem);
}

.hero-actions,
.contact-actions,
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

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

.button-primary {
  background: var(--color-text);
  color: var(--color-bg);
  border: 1px solid var(--color-text);
}

.button-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 72px;
  align-items: start;
}

.section-content {
  color: var(--color-muted);
  font-size: 1.08rem;
}

.section-content p:last-child {
  margin-bottom: 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 44px;
}

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

.skill-card,
.project-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 26px;
  background: var(--color-bg);
}

.skill-card p,
.project-card p,
.contact-card p {
  color: var(--color-muted);
}

.skill-card p,
.project-card p {
  margin-bottom: 0;
}

.project-heading {
  max-width: none;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.text-link {
  font-weight: 800;
  white-space: nowrap;
}

.project-list {
  display: grid;
  gap: 18px;
}

.project-card {
  padding: 30px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.project-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card h3 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

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

.project-tags li {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.project-links {
  margin-top: 26px;
}

.project-links a {
  font-weight: 800;
}

.contact-section {
  padding-bottom: 80px;
}

.contact-card {
  padding: clamp(32px, 7vw, 72px);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.contact-card h2 {
  max-width: 760px;
  margin-inline: auto;
}

.contact-card p {
  max-width: 640px;
  margin: 24px auto 0;
  font-size: 1.08rem;
}

.contact-actions {
  justify-content: center;
}

.social-links {
  justify-content: center;
  margin-top: 30px;
}

.social-links a {
  color: var(--color-muted);
  font-weight: 800;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  font-weight: 800;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: grid;
  }

  .nav-actions {
    margin-left: auto;
  }

  .nav-menu {
    margin: 0;
    position: fixed;
    inset: 76px 16px auto 16px;
    display: grid;
    gap: 0;
    padding: 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 22px;
    background: var(--color-bg);
    box-shadow: var(--shadow-soft);
    transform: translateY(-16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  }

  .nav-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-menu a {
    display: block;
    padding: 14px 12px;
    color: var(--color-text);
  }

  .hero-grid,
  .two-column {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .hero {
    min-height: auto;
    padding-top: 72px;
  }

  .section {
    padding: 76px 0;
  }

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

@media (max-width: 620px) {
  .container {
    width: min(calc(100% - 24px), var(--container));
  }

  h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

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

  .project-heading {
    align-items: start;
    flex-direction: column;
  }

  .project-meta,
  .footer-inner {
    flex-direction: column;
  }

  .contact-actions,
  .hero-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

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


/* Minimal hero variant: used when the profile card is removed. */
.hero-grid-minimal {
  grid-template-columns: 1fr;
}

.hero-grid-minimal .hero-copy {
  max-width: 980px;
}

.hero-grid-minimal h1 {
  max-width: 980px;
}

.hero-grid-minimal .hero-text {
  max-width: 760px;
}

.project-results {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.project-results p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.project-results strong {
  color: var(--color-text);
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.project-results span {
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
