:root {
  --main-red: #be3144;
  --main-gray: #303841;
  --main-blue: #45567d;

  /* type scale */
  --step--1: clamp(0.9rem, 0.86rem + 0.2vw, 1.1rem);
  --step-0: clamp(1rem, 0.95rem + 0.5vw, 1.25rem);
  --step-1: clamp(1.5rem, 1.3rem + 1.2vw, 2rem);
  --step-2: clamp(2rem, 1.6rem + 2.2vw, 3rem);
  --step-3: clamp(2.5rem, 2rem + 3vw, 4rem);
  --step-4: clamp(3rem, 2.4rem + 4vw, 6rem);

  --nav-offset: 5rem;
}

/* RESET / BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* 62.5% => 1rem ≈ 10px, easier mental math */
  font-size: 62.5%;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji", sans-serif;
  scroll-behavior: smooth;
}

body {
  background: #0d1117;
  color: #fff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.skip-link:focus {
  left: 0;
  top: 0;
  background: #000;
  color: #fff;
  padding: 0.8rem 1.2rem;
  z-index: 10000;
}

/* NAVBAR */
#navbar {
  position: sticky;
  width: 100%;
  height: 25%;
  z-index: 1000;
  top: 0;
  background-color: var(--main-red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  gap: 2rem;
}

#navbar h3 {
  font-size: var(--step-1);
  white-space: nowrap;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-link {
  font-size: var(--step--1);
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

section {
  padding: clamp(3rem, 4vw, 6rem) 1.6rem;
  width: 100%;
  text-align: center;
  scroll-margin-top: var(--nav-offset);
}

/* Visually hidden utility for a11y captions */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

section#welcome-section {
  height: 100vh;
  background-color: var(--main-gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding-inline: 2rem;
  text-align: center;
}

/* Layout: stack on mobile, side-by-side on ≥768px */
@media (min-width: 768px) {
  section#welcome-section h1,
  section#welcome-section p {
    margin-inline: 0;
  }

  section#welcome-section .hero-text {
    display: grid;
    place-items: center;
    gap: 1rem;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

h1 {
  color: white;
  font-size: var(--step-4);
  font-weight: 700;
}

section#welcome-section span#name {
  color: var(--main-red);
}

p {
  color: white;
  font-size: var(--step-2);
}

section#welcome-section span#skill-details {
  color: var(--main-red);
}

/* Photo styling */
.hero-media {
  margin: 0;
  display: block;
}

.hero-photo {
  width: clamp(180px, 35vw, 360px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  outline: 3px solid rgba(255, 255, 255, 0.08);
}

.hero-photo::selection {
  background: transparent;
}

/* Optional subtle brand ring */
.hero-photo {
  border: 4px solid color-mix(in oklab, var(--main-red) 40%, white);
}

section#projects {
  background-color: var(--main-blue);
}

h2.section-header {
  font-size: var(--step-2);
  color: white;
  text-decoration: underline;
}

.projects-container {
  --tile-min: 260px;
  max-width: 1200px;
  width: min(92%, 1200px);
  margin: 3rem auto clamp(3rem, 5vw, 6rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr));
  gap: clamp(1.6rem, 2.5vw, 2.4rem);
}

.project-tile {
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
  background: #1f2937;
  outline: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 200ms ease, box-shadow 200ms ease,
    outline-color 200ms ease;
  position: relative;
  min-height: 30rem;
}

/* Hover effects only when a hover device exists */
@media (hover: hover) and (pointer: fine) {
  .project-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    outline-color: rgba(255, 255, 255, 0.18);
  }
}

a.project-link {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
}

.project-preview-image {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.project-title {
  background-color: var(--main-gray);
  color: white;
  width: 100%;
  min-height: 5.2rem;
  padding: 1.2rem;
  font-size: var(--step-0);
  display: grid;
  place-items: center;
  position: absolute;
  bottom: 0;
}

section#contact {
  background-color: var(--main-gray);
}

div.social-icons {
  max-width: 1000px;
  width: min(92%, 1000px);
  margin: 3rem auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.2rem;
  font-size: var(--step-1);
}

div.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  outline: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 180ms ease, outline-color 180ms ease,
    transform 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
  div.social-icons a:hover {
    background: rgba(255, 255, 255, 0.12);
    outline-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
  }
}

div.social-icons a i {
  display: block;
  font-size: 0.9em;
}

/* TYPOGRAPHY TWEAKS FOR SMALL SCREENS */
@media (max-width: 768px) {
  :root {
    --nav-offset: 7rem;
  }

  #navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav-list {
    gap: 1rem;
  }

  h1 {
    text-align: center;
  }
}

/* EXTRA SMALL */
@media (max-width: 420px) {
  .nav-list {
    width: 100%;
    justify-content: space-between;
  }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
