/*
  style.css
  Modern dark portfolio styling for Brian Mukudu.
  Uses CSS variables, flexbox, grid, glassmorphism, and responsive layout.
*/

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-soft: rgba(30, 41, 59, 0.72);
  --surface-strong: rgba(15, 23, 42, 0.88);
  --text: #e2e8f0;
  --subtext: #cbd5e1;
  --border: rgba(148, 163, 184, 0.18);
  --green: #16a34a;
  --green-soft: #22c55e;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top, rgba(34, 197, 94, 0.12), transparent 28%),
              linear-gradient(180deg, #0b1221 0%, #0f172a 100%);
  color: var(--text);
}

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

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

button,
input,
textarea {
  font: inherit;
}

.container {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(15, 23, 42, 0.82);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

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

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-links a {
  color: var(--subtext);
  font-size: 0.95rem;
  transition: color 0.25s ease, transform 0.25s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--green);
  transform: translateY(-1px);
}

.hero {
  min-height: calc(100vh - 96px);
  display: grid;
  place-items: center;
  padding: 4rem 0 2rem;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.hero__content h1,
.hero__content h2 {
  margin: 0;
}

.hero__content h1 {
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  line-height: 0.95;
}

.hero__content h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--green);
  margin: 1rem 0 1.25rem;
}

.hero__text {
  max-width: 640px;
  color: var(--subtext);
  line-height: 1.85;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.btn,
.btn--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.95rem 1.8rem;
  border: 1px solid transparent;
  transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.btn {
  background: linear-gradient(135deg, var(--green), var(--green-soft));
  color: var(--white);
  box-shadow: 0 20px 40px rgba(22, 163, 74, 0.25);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 54px rgba(34, 197, 94, 0.28);
}

.btn--ghost {
  color: var(--white);
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.04);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.hero__profile {
  position: relative;
  max-width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at top, rgba(34, 197, 94, 0.35), transparent 45%),
              linear-gradient(180deg, #111827 20%, #1f2937 100%);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12),
              0 24px 80px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero__profile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.7), rgba(34, 197, 94, 0.2));
  mask: radial-gradient(circle at center, transparent 58%, black 60%);
}

.hero__avatar {
  position: relative;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  display: grid;
  place-items: center;
  color: rgba(226, 232, 240, 0.88);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  z-index: 1;
}

/* profile image link and image */
.hero__profile-link {
  display: block;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  overflow: hidden;
  z-index: 2;
}

.hero__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  border-radius: 50%;
}

/* accessibility helper */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.section-heading__line {
  display: none;
}

.section-heading h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--subtext);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 2.6vw, 2.8rem);
}

.about,
.skills,
.services,
.portfolio,
.certifications,
.contact {
  padding: 5rem 0;
}

.about__grid,
.stats-grid,
.skill-grid,
.service-grid,
.project-grid,
.certificate-grid,
.contact-grid {
  display: grid;
  gap: 1.5rem;
}

.about__grid {
  grid-template-columns: 1.3fr 0.95fr;
  align-items: center;
}

.about__text {
  color: var(--subtext);
  line-height: 1.85;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(30, 41, 59, 0.96);
}

.card__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
}

.card__icon {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(22, 163, 74, 0.18);
  color: var(--green);
}

.card__value {
  margin: 0;
  font-size: 1.65rem;
}

.card__text {
  margin: 0;
  color: var(--subtext);
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-card {
  padding: 1.6rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.stats-card__name {
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.stats-card__detail {
  margin: 0;
  color: var(--subtext);
  line-height: 1.75;
}

.skill-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.skill-card {
  padding: 1.4rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
  transition: transform 0.25s ease, background 0.25s ease;
}

.skill-card:hover {
  transform: translateY(-5px);
  background: rgba(22, 163, 74, 0.08);
}

.skill-card__icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.06);
}

.skill-card__title {
  margin: 0;
  font-weight: 700;
}

.skill-card__subtitle {
  margin: 0.5rem 0 0;
  color: var(--subtext);
  font-size: 0.95rem;
}

.service-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.service-card {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius);
  padding: 1.8rem;
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.service-card:hover {
  transform: translateY(-5px);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(30, 41, 59, 0.92);
}

.service-card__icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(22, 163, 74, 0.18);
  color: var(--green);
  margin-bottom: 1.2rem;
}

.service-card__title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.service-card__text {
  margin: 0;
  color: var(--subtext);
  line-height: 1.8;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.project-card {
  overflow: hidden;
  border-radius: 32px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: var(--shadow);
  transition: transform 0.35s ease;
}

.project-card:hover {
  transform: translateY(-6px);
}

.project-card__image {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.3), rgba(15, 23, 42, 0.78));
  display: grid;
  place-items: center;
  color: rgba(226, 232, 240, 0.55);
  font-weight: 700;
  text-align: center;
  padding: 1rem;
  overflow: hidden;
}

.project-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__body {
  padding: 1.5rem;
}

.project-card__title {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.project-card__text {
  margin: 0 0 1rem;
  color: var(--subtext);
  line-height: 1.75;
}

.project-card__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--subtext);
  font-size: 0.85rem;
}

.project-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--green), var(--green-soft));
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.project-card__cta:hover,
.project-card__cta:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(22, 163, 74, 0.16);
  opacity: 0.98;
}

.certificate-grid,
.documents-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.certificate-card,
.documents-card {
  display: grid;
  gap: 1rem;
  padding: 1.6rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.certificate-card__label,
.documents-card__label {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: rgba(22, 163, 74, 0.16);
  color: var(--green);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.certificate-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(22, 163, 74, 0.16);
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.certificate-card__cta:hover,
.certificate-card__cta:focus-visible {
  background: rgba(22, 163, 74, 0.28);
  transform: translateY(-2px);
}

.certificate-card__title {
  margin: 0;
  font-size: 1.05rem;
}

.certificate-card__text {
  margin: 0;
  color: var(--subtext);
}

.certificate-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.certificate-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.certificate-list img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.04);
}

/* icon sizing for cards */
.card__icon svg,
.contact-card__label svg,
.certificate-card__label svg {
  width: 2.2rem;
  height: 2.2rem;
  display: block;
  color: var(--green);
}

.contact-card__label {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.02);
  color: var(--subtext);
}

/* Section separators and card accents for a professional look */
section + section {
  border-top: 1px solid rgba(255,255,255,0.03);
  margin-top: 2.4rem;
  padding-top: 2.4rem;
}

.certificate-card,
.card,
.documents-card,
.contact-card__item {
  border-left: 4px solid transparent;
  transition: box-shadow 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.certificate-card:hover,
.card:hover,
.documents-card:hover,
.contact-card__item:hover {
  border-left-color: rgba(34,197,94,0.18);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  transform: translateY(-6px);
}

/* Make section headings stand out slightly */
.section-heading > div h2 {
  letter-spacing: 0.01em;
  font-weight: 700;
}

@media (max-width: 900px) {
  section + section {
    margin-top: 1.6rem;
    padding-top: 1.6rem;
    border-top-width: 1px;
  }
  .certificate-card,
  .card,
  .documents-card,
  .contact-card__item:hover {
    transform: none;
    box-shadow: none;
  }
}

/* collapsed certificate grid: hide cards after the first three */
.certificate-grid.collapsed > .certificate-card:nth-child(n+4) {
  display: none;
}

.cert-controls {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

#cert-toggle {
  padding: 0.7rem 1rem;
}

/* inner collapsing for grouped certificate lists */
.certificate-list.collapsed > li:nth-child(n+2) {
  display: none;
}

.cert-inner-controls {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-start;
}

.cert-inner-toggle {
  padding: 0.5rem 0.8rem;
  font-size: 0.95rem;
}

.contact-grid {
  grid-template-columns: 1.2fr 0.9fr;
  gap: 2rem;
}

.contact-card,
.contact-form {
  padding: 2rem;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: var(--shadow);
}

.contact-card__item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.4rem;
}

.contact-card__label {
  min-width: 3rem;
  color: var(--green);
}

.contact-card__text {
  margin: 0;
  color: var(--subtext);
  line-height: 1.8;
}

.form-group {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.95rem;
  color: var(--subtext);
}

.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(255, 255, 255, 0.07);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

.footer {
  padding: 3rem 0 1.4rem;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

.footer__brand {
  display: grid;
  gap: 0.85rem;
}

.footer__brand h3 {
  margin: 0;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.8rem;
}

.footer__link {
  color: var(--subtext);
}

.footer__social {
  display: flex;
  gap: 0.85rem;
}

.footer__social span {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--subtext);
}

.footer__note {
  margin-top: 1.8rem;
  color: rgba(203, 213, 225, 0.75);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .hero__inner,
  .about__grid,
  .contact-grid,
  .footer__inner {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 3rem;
  }
}

@media (max-width: 720px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    gap: 0.8rem;
  }

  .cards-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .hero__content h1 {
    font-size: 2.7rem;
  }

  .hero__profile {
    max-width: 280px;
  }

  .btn,
  .btn--ghost {
    width: 100%;
  }

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