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

:root {
  --bg: #11171d;
  --surface: #151d24;
  --surface-hover: #19232b;
  --line: #2c3942;
  --line-strong: #43525d;
  --text: #edf0f2;
  --text-secondary: #aeb7bd;
  --text-muted: #7f8b93;
  --accent: #9fb574;
  --accent-hover: #b0c485;
  --page-width: 1080px;
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

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

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

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

.site-header,
main,
.site-footer {
  width: min(calc(100% - 48px), var(--page-width));
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
}

.identity {
  justify-self: start;
  font-size: 0.95rem;
  font-weight: 650;
}

.site-nav {
  display: flex;
  gap: 30px;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.site-nav a,
.header-contact,
.contact-links a,
.secondary-links a {
  transition: color 140ms ease;
}

.site-nav a:hover,
.header-contact:hover,
.contact-links a:hover,
.secondary-links a:hover {
  color: var(--accent);
}

.header-contact {
  justify-self: end;
  color: var(--accent);
  font-size: 0.84rem;
}

.hero {
  padding: 54px 0 68px;
  border-bottom: 1px solid var(--line);
}

.hero-panel {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #101820;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.2);
  isolation: isolate;
}

.hero-panel::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 11, 15, 0.97) 0%, rgba(7, 11, 15, 0.9) 38%, rgba(7, 11, 15, 0.5) 66%, rgba(7, 11, 15, 0.16) 100%),
    linear-gradient(0deg, rgba(7, 11, 15, 0.42) 0%, transparent 44%);
  box-shadow: inset 0 0 0 1px rgba(237, 240, 242, 0.04);
  content: "";
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  max-width: 720px;
  padding: 48px;
}

.hero-content .eyebrow {
  color: #b6c0c6;
}

.eyebrow,
.project-type {
  margin-bottom: 17px;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  max-width: 720px;
  margin-bottom: 22px;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 580;
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: #cbd1d5;
  font-size: 1.08rem;
}

.hero-copy strong {
  color: var(--text);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 0;
}

.hero-banner {
  position: absolute;
  inset: 0;
  margin: 0;
}

.hero-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
}

.hero-panel + .skills {
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.button:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #11170f;
}

.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #11170f;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.71rem;
  list-style: none;
}

.skills li {
  display: flex;
  align-items: center;
}

.skills li:not(:last-child)::after {
  width: 3px;
  height: 3px;
  margin: 0 14px;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.site-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 54px;
  padding: 88px 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  align-self: start;
}

.section-heading .eyebrow {
  margin-bottom: 10px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.65rem;
  font-weight: 590;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

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

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 270px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  isolation: isolate;
}

.project::before,
.project::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.project::before {
  z-index: 0;
  background-image: var(--project-image);
  background-position: var(--project-position, center);
  background-size: cover;
  filter: saturate(0.82) contrast(1.04);
  opacity: 0.34;
}

.project::after {
  z-index: 0;
  background: rgba(15, 21, 27, 0.68);
}

.project > * {
  position: relative;
  z-index: 1;
}

.project-kingmakers {
  --project-image: url("/assets/kingmakers.jpg");
  --project-position: center 48%;
}

.project-navmesh {
  --project-image: url("/assets/navmesh.jpg");
}

.project-custom-engine {
  --project-image: url("/assets/custom-engine-frame-2.jpg");
}

.project-featured {
  grid-column: 1 / -1;
  min-height: 220px;
}

.project-type {
  margin-bottom: 13px;
  color: var(--accent);
  font-size: 0.64rem;
}

.project h3 {
  margin-bottom: 8px;
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.project p:not(.project-type) {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: auto 0 22px;
  padding-top: 30px;
}

.project-meta span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.63rem;
}

.project > a {
  align-self: flex-start;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

.project > a:hover {
  color: var(--accent);
}

.secondary-links {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 26px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.secondary-links > span {
  color: var(--text-muted);
}

.repo-list {
  border-top: 1px solid var(--line);
}

.repo {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 120px 16px;
  gap: 20px;
  align-items: center;
  min-height: 78px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  transition: background 140ms ease;
}

.repo:hover {
  background: var(--surface-hover);
}

.repo-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.repo-description {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.repo-language {
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.66rem;
  text-align: right;
}

.repo > span:last-child {
  color: var(--text-muted);
}

.site-section.about {
  display: block;
}

.about .section-heading {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 54px;
  align-items: end;
  margin-bottom: 38px;
}

.about .section-heading .eyebrow {
  margin-bottom: 5px;
}

.about .section-heading h2 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 580;
  letter-spacing: -0.045em;
}

.about-copy {
  max-width: none;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.45fr);
  gap: 46px;
  align-items: start;
}

.about-portrait {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.about-story > p {
  margin-bottom: 22px;
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.about-story > p:first-child {
  color: var(--text);
}

.about-story .about-list-label {
  margin: 30px 0 12px;
  color: var(--text);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.about-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 34px;
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.about-list li::marker {
  color: var(--accent);
}

.about-list a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.about-list a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.about-gallery {
  margin-top: 58px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.gallery-heading {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.gallery-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.gallery-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
}

.gallery-counter {
  min-width: 62px;
  margin-right: 4px;
  color: var(--text-muted);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.66rem;
}

.gallery-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.gallery-controls button:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  color: var(--accent);
}

.gallery-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gallery-viewport {
  position: relative;
  display: grid;
  grid-auto-columns: minmax(240px, 32%);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 4px;
  scroll-behavior: smooth;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
}

.gallery-viewport::-webkit-scrollbar {
  display: none;
}

.gallery-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.gallery-slide {
  position: relative;
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  scroll-snap-align: start;
}

.gallery-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 280ms ease;
}

.gallery-slide:hover img {
  transform: scale(1.015);
}

.gallery-slide figcaption {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 2px 6px;
  border: 1px solid rgba(237, 240, 242, 0.16);
  border-radius: 999px;
  background: rgba(7, 11, 15, 0.72);
  color: rgba(237, 240, 242, 0.78);
  font-family: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  font-size: 0.57rem;
  letter-spacing: 0.06em;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  font-size: 0.84rem;
}

.about .contact-links {
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 46px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    display: none;
  }

  .hero {
    padding-top: 78px;
  }

  .site-section {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about .section-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .about-intro {
    grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
    gap: 32px;
  }

  .about-list {
    grid-template-columns: 1fr;
  }

  .secondary-links {
    grid-column: 1;
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  .site-footer {
    width: min(calc(100% - 32px), var(--page-width));
  }

  .site-header {
    min-height: 66px;
  }

  .hero {
    padding: 32px 0 56px;
  }

  .hero-panel,
  .hero-content {
    min-height: 500px;
  }

  .hero-content {
    justify-content: flex-start;
    padding: 34px 24px;
  }

  .hero-panel::after {
    background:
      linear-gradient(180deg, rgba(7, 11, 15, 0.94) 0%, rgba(7, 11, 15, 0.82) 62%, rgba(7, 11, 15, 0.45) 100%),
      linear-gradient(90deg, rgba(7, 11, 15, 0.74) 0%, rgba(7, 11, 15, 0.28) 100%);
  }

  h1 {
    font-size: clamp(2.4rem, 13vw, 3.2rem);
  }

  .hero-copy {
    font-size: 1rem;
  }

  .hero-actions {
    margin-top: 26px;
  }

  .hero-banner img {
    object-position: 56% 50%;
  }

  .skills {
    line-height: 2;
  }

  .skills li:not(:last-child)::after {
    margin: 0 10px;
  }

  .site-section {
    padding: 64px 0;
  }

  .about-intro {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .about-portrait {
    max-width: 420px;
  }

  .about-gallery {
    margin-top: 46px;
  }

  .gallery-heading {
    align-items: flex-end;
  }

  .gallery-viewport {
    grid-auto-columns: 82%;
  }

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

  .project-featured {
    grid-column: auto;
  }

  .repo {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding-block: 17px;
  }

  .repo-description {
    grid-column: 1;
  }

  .repo-language {
    grid-column: 1;
    text-align: left;
  }

  .repo > span:last-child {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
