:root {
  /* light theme (default) */
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-hover: #f3f3f1;
  --border: #e6e6e3;
  --border-bright: #d3d3cf;
  --text: #16160f;
  --muted: #52524d;
  --faint: #6c6c66;
  --icon: #16160f;
  --header-bg: rgba(250, 250, 249, 0.72);
  --outline-fallback: #d3d3cf;
  color-scheme: light;

  --display: "Space Grotesk", sans-serif;
  --body: "Inter", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --maxw: 1080px;
  --padding-x: clamp(1rem, 0.359rem + 2.564vw, 2rem);
}
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1c1c1c;
  --border: #262626;
  --border-bright: #3a3a3a;
  --text: #fafafa;
  --muted: #9a9a9a;
  --faint: #7d7d7d;
  --icon: #fafafa;
  --header-bg: rgba(10, 10, 10, 0.72);
  --outline-fallback: #2a2a2a;
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}
a {
  color: inherit;
  text-decoration: none;
}
::selection {
  background: var(--text);
  color: var(--bg);
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--padding-x);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-family: var(--mono);
  font-size: 13px;
}
.skip:focus {
  left: 0;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.monogram {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -1px;
  transform: rotate(0deg);
  transition: transform 0.35s ease, background 0.25s ease, color 0.25s ease,
    border-color 0.3s ease;
}
.monogram:hover {
  transform: rotate(-8deg);
  background: var(--text);
  color: var(--bg);
}
.nav-links {
  display: flex;
  gap: 34px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.nav-links a {
  color: var(--muted);
  transition: color 0.2s ease;
  position: relative;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 1px;
  width: 0;
  background: var(--text);
  transition: width 0.25s ease;
}
.nav-links a:hover::after {
  width: 100%;
}
.nav-right {
  display: flex;
  gap: 16px;
  align-items: center;
}
.nav-right a {
  color: var(--muted);
  display: flex;
  transition: color 0.2s ease, transform 0.2s ease;
}
.nav-right a:hover,
.nav-right a:focus-visible {
  color: var(--text);
  transform: translateY(-2px);
}
.nav-right svg {
  width: 20px;
  height: 20px;
}
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
  transform: translateY(-2px);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
.icon-sun {
  display: none;
}
.icon-moon {
  display: block;
}
[data-theme="dark"] .icon-sun {
  display: block;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

.hero {
  padding-block-start: 120px;
  padding-block-end: 110px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.04em;
  margin-bottom: 26px;
}
.cursor {
  display: inline-block;
  width: 9px;
  height: 17px;
  background: var(--text);
  margin-left: 3px;
  transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 6.4rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
}
h1 .line {
  display: block;
}
.outline {
  color: var(--outline-fallback);
}
@supports ((-webkit-text-stroke: 1px white)) {
  .outline {
    -webkit-text-stroke: 1.5px var(--text);
    color: transparent;
  }
}
.hero-sub {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: var(--muted);
  margin-top: 34px;
  letter-spacing: 0.01em;
}
.hero-sub .slash {
  color: var(--faint);
  margin: 0 6px;
}

.section {
  padding-block: clamp(4rem, 2.718rem + 5.128vw, 6rem);
}
section[id] {
  scroll-margin-top: 90px;
}
.sec-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--border-bright);
}
h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin-bottom: 8px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 64px;
  align-items: start;
  margin-top: 40px;
}
.about-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0;
}
.about-tag {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.9;
}
.about-tag span {
  display: block;
}
.about-body p {
  color: var(--muted);
  margin-bottom: 20px;
  max-width: 54ch;
}
.about-body p:last-child {
  margin-bottom: 0;
}
.about-body strong {
  color: var(--text);
  font-weight: 500;
}

.skills-intro {
  color: var(--muted);
  max-width: 62ch;
  margin-top: 34px;
  font-size: 1.02rem;
}
.skills-intro strong {
  color: var(--text);
  font-weight: 500;
}
.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
  margin-top: 56px;
  list-style: none;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: background 0.22s ease, border-color 0.22s ease,
    transform 0.22s ease;
}
.tile:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  transform: translateY(-3px);
}
.tile img {
  width: 40px;
  height: 40px;
  display: block;
  opacity: 0.8;
  transition: opacity 0.22s ease, filter 0.22s ease;
}
.tile:hover img {
  opacity: 1;
}
/* icons load black (for light theme); invert to white in dark theme */
[data-theme="dark"] .tile img {
  filter: invert(1);
}
.tile span {
  font-family: var(--mono);
  font-size: clamp(0.813rem, 0.772rem + 0.16vw, 0.875rem);
  color: var(--faint);
  letter-spacing: 0.01em;
  text-align: center;
}
.tile:hover span {
  color: var(--muted);
}

.project {
  margin-top: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(1.5rem, 1.1rem + 1.8vw, 2.5rem);
  max-width: 660px;
  transition: border-color 0.22s ease, background 0.22s ease;
}
.project:hover {
  border-color: var(--border-bright);
  background: var(--surface-hover);
}
.project-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.project-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}
.project-desc {
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 22px;
}
.project-desc strong {
  color: var(--text);
  font-weight: 500;
}
.project-tags {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.01em;
}
.project-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.02em;
}
.project-foot svg {
  width: 15px;
  height: 15px;
  opacity: 0.55;
}

.contact-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: end;
  margin-top: 36px;
}
.contact-copy {
  color: var(--muted);
  max-width: 46ch;
  font-size: 1.05rem;
}
.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-style: normal;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  padding: 14px 22px;
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease,
    border-color 0.3s ease;
  white-space: nowrap;
}
.btn svg {
  width: 17px;
  height: 17px;
}
.btn:hover,
.btn:focus-visible {
  background: var(--text);
  color: var(--bg);
  transform: translateY(-2px);
}
.btn:hover svg path,
.btn:focus-visible svg path {
  fill: var(--bg);
}

footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
}
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .contact-inner {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
@media (max-width: 560px) {
  .wrap {
    padding: 0 22px;
  }
  .nav-links {
    display: none;
  }
  .hero {
    padding: 80px 0 70px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .foot {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
