:root {
  --lego-red: #D01012;
  --lego-blue: #0057A8;
  --lego-yellow: #FFD500;
  --lego-green: #00852B;
  --lego-orange: #F57D20;
  --lego-white: #FFFFFF;
  --lego-light: #F5F0E1;
  --lego-gray: #A0A0A0;
  --lego-dark: #1B1B1B;
  --lego-baseplate-green: #6DB644;

  --text-dark: #222;
  --text-mid: #444;
  --text-light: #666;

  --radius-brick: 8px;
  --stud-size: 28px;
  --stud-dot: 10px;

  --shadow-brick: 0 6px 0 rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.10);
  --shadow-brick-hover: 0 8px 0 rgba(0,0,0,0.22), 0 12px 32px rgba(0,0,0,0.14);

  --transition: 200ms ease;
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-dark);
  background: var(--lego-light);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

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

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

h1, h2, h3, h4 {
  font-family: 'Fredoka', 'Inter', system-ui, sans-serif;
  line-height: 1.2;
}

.container {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

/* ---- STUD PATTERN MIXIN (via background) ---- */
.studs-bg {
  background-image:
    radial-gradient(circle, rgba(0,0,0,0.06) 28%, transparent 29%);
  background-size: var(--stud-size) var(--stud-size);
  background-position: calc(var(--stud-size) / 2) calc(var(--stud-size) / 2);
}

/* ---- LEGO BRICK CARD ---- */
.lego-card {
  position: relative;
  border-radius: var(--radius-brick);
  background: var(--lego-white);
  box-shadow: var(--shadow-brick);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.lego-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--lego-red);
  border-radius: var(--radius-brick) var(--radius-brick) 0 0;
}

.lego-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-brick-hover);
}

.lego-card--blue::before { background: var(--lego-blue); }
.lego-card--green::before { background: var(--lego-green); }
.lego-card--yellow::before { background: var(--lego-yellow); }
.lego-card--orange::before { background: var(--lego-orange); }

/* ---- NAVBAR ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--lego-red);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 6px 20px rgba(0,0,0,0.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
}

.nav__logo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--lego-yellow);
  letter-spacing: 0.05em;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.nav__links {
  display: flex;
  list-style: none;
  gap: 1.2rem;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav__links a {
  color: rgba(255,255,255,0.9);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.nav__links a:hover {
  background: rgba(255,255,255,0.2);
  color: var(--lego-yellow);
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--lego-white);
  transition: transform var(--transition), opacity var(--transition);
}

.nav__toggle span + span {
  margin-top: 5px;
}

/* ---- HERO ---- */
.hero {
  position: relative;
  padding: 4rem 0 3.5rem;
  background: var(--lego-yellow);
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(to right,
    var(--lego-red) 25%,
    var(--lego-blue) 25% 50%,
    var(--lego-green) 50% 75%,
    var(--lego-orange) 75%);
}

.hero .studs-bg {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
}

.hero__content {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: center;
}

.profile-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 8px solid var(--lego-red);
  box-shadow:
    0 0 0 4px var(--lego-white),
    0 0 0 8px var(--lego-blue),
    0 8px 24px rgba(0,0,0,0.15);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--lego-red);
  font-family: 'Fredoka', sans-serif;
}

.hero__title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3rem);
  color: var(--lego-dark);
}

.hero__subtitle {
  margin: 0.4rem 0 0.8rem;
  font-size: 1rem;
  color: var(--text-mid);
  min-height: 1.5em;
}

.hero__typing {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  color: var(--lego-blue);
  border-right: 3px solid var(--lego-red);
  padding-right: 3px;
}

.hero__description {
  margin: 0 0 1.2rem;
  color: var(--text-mid);
  font-size: 0.95rem;
  max-width: 32rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius-brick);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Fredoka', sans-serif;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(0,0,0,0.2);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

.btn--primary {
  background: var(--lego-red);
  color: var(--lego-white);
}

.btn--ghost {
  background: var(--lego-white);
  color: var(--lego-dark);
  border: 3px solid var(--lego-dark);
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

.hero__social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-mid);
}

.hero__social a {
  color: var(--lego-blue);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition);
}

.hero__social a:hover {
  border-color: var(--lego-blue);
}

/* ---- SECTIONS ---- */
.section {
  padding: 4rem 0;
  position: relative;
}

.section--baseplate {
  background: var(--lego-baseplate-green);
  color: var(--lego-white);
}

.section--baseplate .studs-bg {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.18) 28%, transparent 29%);
  background-size: var(--stud-size) var(--stud-size);
  background-position: calc(var(--stud-size) / 2) calc(var(--stud-size) / 2);
}

.section--baseplate .section__header h2 {
  color: var(--lego-yellow);
}

.section--baseplate .section__header p {
  color: rgba(255,255,255,0.85);
}

.section--gray {
  background: #E8E4D8;
}

.section__header {
  max-width: 640px;
  margin-bottom: 2rem;
}

.section__header h2 {
  font-size: 2rem;
  margin: 0 0 0.4rem;
  color: var(--lego-red);
}

.section__header p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ---- ABOUT / STATS ---- */
.about__grid {
  display: grid;
  grid-template-columns: 1.3fr 1.2fr;
  gap: 2rem;
  align-items: start;
}

.about__summary {
  margin: 0;
  color: var(--text-mid);
  font-size: 0.95rem;
  line-height: 1.7;
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.stat {
  text-align: center;
  padding: 1rem 0.6rem;
}

.stat::before {
  height: 8px;
}

.stat__value {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--lego-blue);
}

.stat__label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ---- EXPERIENCE TIMELINE ---- */
.timeline {
  position: relative;
  margin-top: 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 14px;
  width: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    to bottom,
    var(--lego-red) 0px,
    var(--lego-red) 12px,
    var(--lego-yellow) 12px,
    var(--lego-yellow) 24px
  );
}

.timeline__item {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2.5rem;
}

.timeline__marker {
  position: absolute;
  left: 4px;
  top: 0.5rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lego-yellow);
  border: 4px solid var(--lego-red);
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
  z-index: 1;
}

.timeline__content {
  border-radius: var(--radius-brick);
  background: var(--lego-white);
  box-shadow: var(--shadow-brick);
  overflow: hidden;
}

.timeline__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.timeline__body {
  padding: 1.2rem 1.3rem 1.1rem;
}

.timeline__meta h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--lego-dark);
}

.timeline__meta-sub {
  margin: 0.15rem 0 0.7rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.timeline__bullets {
  margin: 0 0 0.7rem;
  padding-left: 1.1rem;
  color: var(--text-mid);
  font-size: 0.88rem;
  line-height: 1.6;
}

.timeline__bullets li + li {
  margin-top: 0.2rem;
}

.timeline__bullets strong {
  color: var(--lego-blue);
}

.timeline__tags {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
}

/* ---- PROJECT CARDS ---- */
.projects {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-card {
  position: relative;
  border-radius: var(--radius-brick);
  background: var(--lego-white);
  box-shadow: var(--shadow-brick);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  z-index: 2;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-brick-hover);
}

.project-card--purple::before { background: #7B4BB3; }
.project-card--green::before { background: var(--lego-green); }

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

.project-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 240px;
}

.project-card__info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-card__info h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--lego-dark);
}

.project-card__tagline {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.88rem;
  color: var(--text-light);
  font-weight: 500;
}

.project-card__bullets {
  margin: 0 0 0.7rem;
  padding-left: 1rem;
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.project-card__bullets li + li {
  margin-top: 0.2rem;
}

.project-card__bullets strong {
  color: var(--lego-blue);
}

.project-card__tags {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
}

.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Fredoka', sans-serif;
  color: var(--lego-red);
  transition: color var(--transition);
}

.project-card__link:hover {
  color: var(--lego-blue);
}

/* ---- OTHER PROJECTS GRID ---- */
.projects--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card--compact {
  display: flex;
  flex-direction: column;
}

.project-card--compact::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: var(--lego-blue);
  z-index: 2;
}

.project-card--compact .project-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.project-card--compact .project-card__body {
  padding: 1rem 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card--compact h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  color: var(--lego-dark);
}

.project-card--compact p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
  flex: 1;
}

.project-card--compact .project-card__tags {
  margin-bottom: 0.4rem;
}

/* color variants for other project cards */
.project-card--compact.card-green::before { background: var(--lego-green); }
.project-card--compact.card-orange::before { background: var(--lego-orange); }
.project-card--compact.card-red::before { background: var(--lego-red); }

/* ---- SKILLS ---- */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
}

.skills__group {
  position: relative;
  border-radius: var(--radius-brick);
  padding: 1.2rem 1rem 1rem;
  background: var(--lego-white);
  box-shadow: var(--shadow-brick);
  overflow: hidden;
  transition: transform var(--transition);
}

.skills__group::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  border-radius: var(--radius-brick) var(--radius-brick) 0 0;
}

.skills__group:hover {
  transform: translateY(-3px);
}

.skills__group--red::before { background: var(--lego-red); }
.skills__group--blue::before { background: var(--lego-blue); }
.skills__group--green::before { background: var(--lego-green); }
.skills__group--yellow::before { background: var(--lego-yellow); }
.skills__group--orange::before { background: var(--lego-orange); }

.skills__group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--lego-dark);
}

.skills__group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-mid);
}

.skills__group li {
  padding: 0.15rem 0;
}

.skills__group li::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.skills__group--red li::before { background: var(--lego-red); }
.skills__group--blue li::before { background: var(--lego-blue); }
.skills__group--green li::before { background: var(--lego-green); }
.skills__group--yellow li::before { background: var(--lego-yellow); }
.skills__group--orange li::before { background: var(--lego-orange); }

/* ---- CONTACT ---- */
.contact__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
}

.contact__links {
  margin: 0;
  color: var(--text-mid);
  font-size: 0.88rem;
}

.contact__links a {
  color: var(--lego-yellow);
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition);
}

.contact__links a:hover {
  border-color: var(--lego-yellow);
}

/* ---- FOOTER ---- */
.site-footer {
  background: var(--lego-dark);
  padding: 1.2rem 0;
  color: rgba(255,255,255,0.5);
}

.site-footer::before {
  content: '';
  display: block;
  height: 8px;
  background: linear-gradient(to right,
    var(--lego-red) 25%,
    var(--lego-blue) 25% 50%,
    var(--lego-yellow) 50% 75%,
    var(--lego-green) 75%);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding-top: 0.8rem;
}

/* ---- SCROLL REVEAL ---- */
.timeline__item,
.project-card,
.project-card--compact,
.skills__group,
.stat {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.timeline__item.is-visible,
.project-card.is-visible,
.project-card--compact.is-visible,
.skills__group.is-visible,
.stat.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav__toggle {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
  }

  .nav__links {
    position: absolute;
    inset-inline: 0;
    top: 52px;
    background: var(--lego-red);
    padding: 0.6rem 1.2rem 0.8rem;
    flex-direction: column;
    gap: 0.4rem;
    border-bottom: 4px solid rgba(0,0,0,0.15);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
  }

  .nav--open .nav__links {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
  }

  .hero__content {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .profile-frame {
    width: 140px;
    height: 140px;
  }

  .hero__actions {
    justify-content: center;
  }

  .hero__social {
    justify-content: center;
  }

  .about__grid {
    grid-template-columns: 1fr;
  }

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

  .project-card__image {
    min-height: 200px;
  }

  .timeline__item {
    margin-bottom: 2rem;
  }
}

@media (max-width: 480px) {
  .container {
    width: min(100% - 1.2rem, 100%);
  }

  .section {
    padding: 3rem 0;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .about__stats {
    grid-template-columns: 1fr;
  }

  .projects--grid {
    grid-template-columns: 1fr;
  }
}
