:root {
  --clr-bg: #fafafa;
  --clr-text: #111;
  --clr-accent: #ffd400;
  --clr-bg-dark: #0f0f0f;
  --clr-text-dark: #e2e2e2;
  --radius: 0.75rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  font-family: "Inter", system-ui, Arial, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
}

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

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

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  max-width: 65ch;
}

ul {
  list-style: none;
  padding-left: 0;
}

.container {
  width: min(90rem, 90%);
  margin-inline: auto;
  padding-block: 4rem;
}

.accent {
  color: var(--clr-accent);
}

.grid {
  display: grid;
  gap: 2rem;
}

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

.wrap {
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--clr-accent);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.btn:hover,
.btn:focus {
  background: var(--clr-accent);
  color: #000;
}

/* Dark mode */
body.dark {
  background: var(--clr-bg-dark);
  color: var(--clr-text-dark);
}

body.dark a:not(.btn) {
  color: var(--clr-accent);
}

body.dark .btn:hover {
  color: #000;
}

body.dark img[src*="GH.png"],
body.dark img[src*="sun.svg"] {
  filter: invert(1) brightness(1.2);
}

/* Header/Nav */
header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 0.4rem 0;
  overflow: hidden;
}

body.dark header {
  background: rgba(15, 15, 15, 0.85);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  max-width: 90rem;
  margin-inline: auto;
}

.brand {
  font-size: 1.25rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.icon {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  vertical-align: middle;
}

.burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
}

.burger span {
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: 0.3s;
}

@media (max-width: 42rem) {
  .nav-links {
    position: fixed;
    inset: 0 0 auto auto;
    background: var(--clr-bg);
    flex-direction: column;
    padding: 5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    z-index: 10000;
  }

  body.dark .nav-links {
    background: var(--clr-bg-dark);
  }

  .nav-links.open {
    transform: none;
  }

  .burger {
    display: flex;
  }
}

/* About section */
.about {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  align-items: center;
}

.about img {
  border-radius: 50%;
  width: 200px;
  height: 200px;
  object-fit: cover;
  border: 4px solid var(--clr-accent);
}

/* Card layout */
.card {
  padding: 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  transition: 0.25s;
  position: relative;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.dark .card {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Space between stacked cards */
.card + .card {
  margin-top: 2rem;
}

/* Certifications */
.certs {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.cert-item {
  display: block;
  padding: 1rem;
  border-radius: var(--radius);
  transition: 0.25s;
}

.cert-item:hover {
  transform: translateY(-4px);
}

.thumb {
  aspect-ratio: 16/9;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: var(--radius);
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Competitions */
.comp-grid {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 2rem;
}

.comp-item {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  padding: 1rem;
  transition: 0.25s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.comp-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.comp-thumb {
  aspect-ratio: 4/3;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.comp-item ul {
  margin-top: 0.5rem;
  padding-left: 1.2rem;
  list-style: disc;
}

/* Footer */
footer {
  padding: 2rem 1rem;
  background: #f0f0f0;
  text-align: center;
}

body.dark footer {
  background: #171717;
}

/* Theme toggle hover */
#themeToggle {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#themeToggle:hover img {
  opacity: 0.75;
}

/* Prevent margin collapse with header */
main > section:first-child {
  margin-top: 0;
  padding-top: 2rem;
}

/* Improve hover visibility in dark mode */
body.dark .card:hover,
body.dark .cert-item:hover,
body.dark .comp-item:hover {
  filter: brightness(1.2) invert(0.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}
