/* =========================================================
   Rabin Rai - electrician portfolio
   Layout: CSS grid everywhere. Design width = 1440px (laptop)
   and 390px (phone). One shared --w keeps side padding equal
   in every section (hero, services, works, experience, footer).
   ========================================================= */

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

:root {
  /* colours (taken from the design) */
  --yellow: #f8d431;
  --bg: #f7f7f7;
  --dark: #272a31;
  --text: #1c1c1c;

  /* 1 "unit" = 1% of the 1440px design, stops growing after 1440px */
  --vw: min(1vw, 14.4px);

  /* content width: same left/right padding for EVERY section */
  --w: min(74.17vw, 1072px);

  /* type scale (laptop) */
  --fs: clamp(14px, 1.389vw, 20px);          /* body 20px  */
  --fs-h: clamp(30px, 3.333vw, 48px);        /* titles 48px */
  --fs-card: clamp(16px, 1.528vw, 22px);     /* card titles 22px */

  /* vertical rhythm (laptop) */
  --sec: calc(var(--vw) * 9.1);              /* space between sections */
}

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

body {
  font-family: "Poppins", sans-serif;
  font-size: var(--fs);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.container { width: var(--w); margin-inline: auto; }

.section-title {
  font-size: var(--fs-h);
  font-weight: 900;
  line-height: 1.25;
  color: #000;
  text-align: center;
}

.section-sub {
  max-width: 32em;                 /* keeps the same line breaks as the design */
  margin: 10px auto 0;
  text-align: center;
}

a:focus-visible, button:focus-visible { outline: 3px solid #000; outline-offset: 3px; }

/* ================= HERO ================= */
.hero {
  position: relative;
  height: calc(var(--vw) * 61.67);   /* 888px at 1440 */
  background:
    url("../images/hero.jpg") center top / min(100%, 1440px) auto no-repeat,
    linear-gradient(#ffe902 0%, #ffe103 9%, #ffdb03 18.5%, #fecd04 37%, #ffc003 55.5%, #feb103 74%, #ffa302 92.5%, #ff9e02 100%);
}

/* curved white edge at the bottom of the hero
   FIX: uses uncapped 1vw (not the frozen var(--vw)) so the curve keeps
   scaling proportionally on any laptop screen width, not just up to 1440px */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: calc(1vw * 10.55);
  background: radial-gradient(circle calc(1vw * 123.7) at 50% calc(1vw * 123.7),
              var(--bg) calc(100% - 1.5px), transparent 100%);
  pointer-events: none;
}

.header { padding-top: calc(var(--vw) * 3.05); }

.header__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.logo img { height: calc(var(--vw) * 2.15); width: auto; }

.nav {
  display: grid;
  grid-auto-flow: column;
  gap: calc(var(--vw) * 8.47);
  justify-self: end;
  font-weight: 500;
}
.nav a { text-decoration: none; color: #1a1a1a; }
.nav a:hover { text-decoration: underline; text-underline-offset: 6px; }

.hero__content {
  display: grid;
  justify-items: start;
  margin-top: calc(var(--vw) * 13.125);
}

.hero__title {
  font-size: var(--fs-h);
  font-weight: 900;
  line-height: 1.25;
  color: #000;
}

.hero__text { margin-top: 24px; color: #1a1a1a; }

.hero__actions {
  display: grid;
  grid-auto-flow: column;
  gap: 21px;
  margin-top: 38px;
}

.btn {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: calc(var(--vw) * 11.94);
  height: clamp(38px, 3.333vw, 48px);
  padding: 0 22px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: var(--fs);
  text-decoration: none;
  transition: transform .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn img { width: 1.1em; height: 1.1em; }

/* ================= SERVICES ================= */
.services {
  position: relative;
  margin-top: calc(var(--vw) * -2.5);   /* title sits inside the curve */
  padding-bottom: var(--sec);
}

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px 34px;
  margin-top: 56px;
  align-items: stretch;             /* keeps every card in a row the same height */
}

.card {
  display: grid;
  align-content: start;
  justify-items: center;
  text-align: center;
  padding: 44px clamp(16px, 2.43vw, 35px) 36px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 7px 6px rgba(0, 0, 0, .28);
  height: 100%;                     /* card fills that equal row height */
}

.card__icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--yellow);
}
.card__icon img { width: 56%; height: 56%; object-fit: contain; }

.card__title {
  margin-top: 19px;
  font-size: var(--fs-card);
  font-weight: 800;
  line-height: 1.25;
  color: #000;
  white-space: nowrap;             /* keeps "Electrical Maintenance" on one line */
}
.card__text { margin-top: 14px; }

/* ================= WORKS ================= */
.slider {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 50px;
  column-gap: 39px;
  align-items: center;
  max-width: 900px;
  margin: 66px auto 0;
}

.slider__btn {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  cursor: pointer;
  transition: transform .15s ease;
}
.slider__btn:hover { transform: scale(1.08); }
.slider__btn svg {
  width: 46%; height: 46%;
  fill: none; stroke: #000; stroke-width: 3.2;
  stroke-linecap: round; stroke-linejoin: round;
}

.slider__viewport {
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 6px 6px rgba(0, 0, 0, .3);
}

.slider__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  transition: transform .5s ease;
}

.slide {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #ddd;
}
.slide img { width: 100%; height: 100%; object-fit: cover; }

.slide figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  min-height: 30%;
  padding: 40px 49px 20px;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
}

.slide__title { display: block; }

.slide__desc {
  margin-top: 6px;
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

/* ================= EXPERIENCE ================= */
.experience { padding-top: calc(var(--vw) * 9.5); }

.experience__inner {
  display: grid;
  grid-template-columns: .72fr 1fr;
  align-items: center;
}

.experience .section-title { text-align: left; }

.experience__text p {
  max-width: 19.75em;
  margin-top: 25px;
}

.checks {
  list-style: none;
  display: grid;
  gap: 16px;
  margin-top: 30px;
}
.checks li {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 17px;
  align-items: center;
}
.checks span {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--yellow);
  font-size: 17px;
  font-weight: 800;
  color: #000;
}

.experience__img {
  width: 100%;
  aspect-ratio: 1.16;
  object-fit: cover;
  object-position: top;
}

/* ================= FOOTER ================= */
.footer { padding: 58px 0; background: var(--dark); color: #fff; }

.footer__list {
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  column-gap: 96px;
}

.footer__item {
  display: grid;
  grid-template-columns: 24px auto;
  column-gap: 14px;
  align-items: center;
  color: #fff;
  text-decoration: none;
}
.footer__item img { width: 24px; height: 24px; object-fit: contain; }
a.footer__item:hover { text-decoration: underline; text-underline-offset: 5px; }

/* small helper: only show on laptop */
.d-only { display: initial; }

/* =========================================================
   PHONE  (design width 390px)
   ========================================================= */
@media (max-width: 899px) {
  :root {
    --w: calc(100% - 48px);        /* 24px padding left and right, every section */
    --fs: 15px;
    --fs-h: 20px;
    --fs-card: 16px;
    --sec: 70px;
  }

  .d-only { display: none; }
  .section-title, .hero__title { line-height: 1.3; }
  .section-sub { max-width: 18.8em; margin-top: 10px; }

  /* hero: straight bottom, no nav, stacked buttons */
  .hero {
    height: auto;
    padding-bottom: 33px;
    background:
      url("../images/hero.jpg") 63% 100% / cover no-repeat,
      linear-gradient(#ffe902, #ff9e02);
  }
  .hero::after, .nav { display: none; }

  .header { padding-top: 12px; }
  .logo img { height: 15px; }

  .hero__content { margin-top: 33px; }
  .hero__text { max-width: 172px; margin-top: 11px; line-height: 1.55; }
  .hero__actions { grid-auto-flow: row; gap: 12px; margin-top: 14px; }
  .btn { height: 30px; min-width: 139px; padding: 0 18px; }

  /* services: icon on the left, text on the right */
  .services { margin-top: 0; padding-top: 55px; }
  .cards { grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 16px; margin-top: 24px; }
  .card {
    grid-template-columns: 40px 1fr;
    column-gap: 14px;
    justify-items: start;
    text-align: left;
    padding: 26px 30px 21px 21px;
    border-radius: 24px;
  }
  .card__icon { grid-row: 1 / span 2; width: 40px; height: 40px; margin-top: 1px; }
  .card__title { margin-top: 0; line-height: 1.3; }
  .card__text { margin-top: 8px; line-height: 1.55; }

  /* works */
  .slider {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
    column-gap: 11px;
    max-width: 316px;
    margin-top: 25px;
  }
  .slider__btn { width: 26px; height: 26px; }
  .slider__viewport { border-radius: 16px; }
  .slide figcaption {
    display: grid;
    place-items: center;
    height: 22%;
    min-height: 0;
    padding: 0;
    text-align: center;
  }
  .slide__desc { display: none; }  /* phone shows title only */

  /* experience: heading, picture, list (paragraph hidden on phone) */
  .experience { padding-top: 69px; }
  .experience__inner { grid-template-columns: 1fr; justify-items: center; }
  .experience__text { display: contents; }
  .experience .section-title { order: 1; text-align: center; }
  .experience__text p { display: none; }
  .experience__img { order: 2; width: 197px; aspect-ratio: auto; margin-top: 19px; }
  .checks { order: 3; gap: 5px; margin-top: 8px; padding-bottom: 18px; }  /* FIX: small gap so "Reliable Work" doesn't touch the footer */
  .checks li { grid-template-columns: 25px 1fr; column-gap: 10px; }
  .checks span { width: 25px; height: 25px; font-size: 13px; }

  /* footer: stacked */
  .footer { padding: 38px 0 46px; }
  .footer__list {
    grid-auto-flow: row;
    justify-content: start;
    row-gap: 16px;
    padding-left: 13px;
  }
  .footer__item { grid-template-columns: 20px auto; column-gap: 24px; }
  .footer__item img { width: 20px; height: 20px; }
}