:root {
  --background-primary: #ffffff;
  --background-muted: #f8fafc;
  --color-primary: #030615;
  --color-link: #2563eb;
  --color-link-transparent: rgba(37, 99, 235, 0.1);
  --color-highlight: #fef9c3;
  --border-primary: #f1f5f9;
  --border-secondary: #bed1e7;
  --border-radius-small: 0.5rem;
  --border-radius-large: 0.75rem;
  --gradient-start: #351008;
  --gradient-end: #3b250b;
}

[data-theme="dark"] {
  --background-primary: #05070f;
  --background-muted: #1a1e32;
  --color-primary: #ffffff;
  --color-link: #60a5fa;
  --color-link-transparent: rgba(96, 165, 250, 0.15);
  --color-highlight: #4649af;
  --border-primary: #29325b;
  --border-secondary: #323c71;
  --gradient-start: #ff9a76;
  --gradient-end: #ffd39a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--background-primary);
  color: var(--color-primary);
  font-size: 0.875rem;
  line-height: 1.6rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6,
button {
  font-family: 'Inter', sans-serif;
  width: fit-content;
}

h1 {
  background-image: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 2.4rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -1px;
  font-family: system-ui, -apple-system, sans-serif;
  margin-bottom: 0.15rem;
  transition: background-image 0.3s ease;
}

h2 {
  font-size: 1.5rem;
  line-height: 2rem;
}

h4 {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

h5 {
  font-size: 1rem;
  line-height: 1.5rem;
}

header,
main,
footer {
  width: 100%;
  max-width: 1150px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

nav i {
  font-size: 1.3rem;
}

main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
}

section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: stretch;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.intro-description {
  max-width: 600px;
  font-size: 1.05rem;
  line-height: 1.6;
  font-weight: 400;
}

.subtitle {
  background-image: linear-gradient(270deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-family: system-ui, -apple-system, sans-serif;
  padding-top: 0.1rem;
  transition: background-image 0.3s ease;
}

.links-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0;
}

.square-game {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;

  background-color: var(--background-muted);
  border: 1px dashed var(--border-secondary);
  border-radius: var(--border-radius-large);

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  padding: 1rem;
}

.square-game p {
  margin-bottom: 0.75rem;
}

#play-game,
#color-div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  width: 100%;
}

#play-game > *,
#color-div > * {
  margin-left: auto;
  margin-right: auto;
}

#play-game p,
#color-div h4,
#color-div p {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

button {
  color: var(--color-primary);
  background-color: var(--background-primary);
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border-secondary);
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  border-color: var(--color-link);
}

#theme-toggle {
  padding: 0.4rem 0.6rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-button-secondary {
  color: var(--color-link);
  background: var(--color-link-transparent);
  border: none;
  padding: 0.15rem 0.55rem;
  border-radius: var(--border-radius-small);
}

table {
  width: 100%;
  max-width: none;
  border-collapse: collapse;
  border: 1px solid var(--border-primary);
  background: var(--background-muted);
  border-radius: var(--border-radius-small);
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-primary);
}

th {
  background-color: var(--border-primary);
  font-weight: 600;
  font-size: 1rem;
}

.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 1.25rem;

  background-color: var(--background-muted);
  padding: 1rem 1.25rem;

  border-radius: var(--border-radius-large);
  border: 1px solid var(--border-primary);
}

.project-card > div:first-child {
  min-width: 0;
}

.project-card h4 {
  margin-bottom: 0.2rem;
}

.project-card > div:first-child > p:last-of-type {
  line-height: 1.45;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.6rem;
}

.tech-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
}

.tech-list p {
  font-size: 0.75rem;
  font-weight: bold;
}

.img-div {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.img-div img {
  display: block;
  width: 100%;
  height: 135px;
  object-fit: cover;

  border-radius: var(--border-radius-small);
  border: 1px solid var(--border-primary);
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

footer {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.hidden {
  display: none !important;
}

@media (min-width: 650px) {
  body {
    font-size: 1rem;
    line-height: 1.5rem;
  }

  h1 {
    font-size: 2.4rem;
    line-height: 2.5rem;
  }

  h2 {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }

  .intro-description {
    max-width: 720px;
  }
}

@media (min-width: 1000px) {
  main {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    column-gap: 2.5rem;
    row-gap: 1.5rem;

    align-items: start;
  }

  .hero-section {
    grid-column: 1;
    grid-row: 1;
  }

  main > section:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  main > section:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .project-card {
    grid-template-columns: minmax(0, 1fr) 210px;
  }

  .intro-description {
    max-width: 100%;
  }
}

@media (max-width: 649px) {
  header,
  main,
  footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  main {
    gap: 1.5rem;
  }

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

  .img-div img {
    height: auto;
    max-height: 220px;
  }
}

.img-div img[data-video] {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.img-div img[data-video]:hover {
  opacity: 0.85;
  transform: scale(1.01);
}

.img-div img[data-video]:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.video-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
}

.video-modal {
  position: relative;
  width: 100%;
  max-width: 1100px;
}

.video-frame-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--border-radius-large);
  overflow: hidden;
}

.video-frame-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-close-btn {
  position: absolute;
  top: -3rem;
  right: 0;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.75rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.video-close-btn:hover {
  color: var(--gradient-end);
}

@media (max-width: 649px) {
  .video-overlay {
    padding: 1rem;
  }

  .video-close-btn {
    top: -2.5rem;
    font-size: 1.4rem;
  }
}
