/* ==========================================================================
   TechAbbot – featured projects and case studies
   Markup: partials/projects.html (generated by tools/build-projects.js)
   No script.

   White section. Each card leads with a dark illustrated panel, so the row
   of visuals gives the section its contrast.

     below 640px    1 column
     640px and up   2 columns
     1024px and up  3 columns in one row
   ========================================================================== */

.projects {
  padding-block: clamp(48px, 6vw, 88px);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
}

/* Heading block ----------------------------------------------------------- */

.projects__head {
  max-width: 820px;
  margin-inline: auto;
  text-align: center;
}

.projects__title {
  margin: 14px 0 0;
  font-size: clamp(1.625rem, 1.2rem + 1.9vw, 2.5rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.projects__intro {
  max-width: 44em;
  margin: 16px auto 0;
  color: var(--c-text-muted);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
}

/* Cards --------------------------------------------------------------------- */

.projects__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 2.2vw, 28px);
  margin: clamp(32px, 4vw, 52px) 0 0;
  padding: 0;
  list-style: none;
}

.projects__cell { display: flex; }

.project-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--c-border);
  border-radius: 18px;
  background: var(--c-bg);
  box-shadow: 0 16px 34px -26px rgba(37, 55, 70, 0.5);
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: rgba(11, 109, 145, 0.3);
  box-shadow: 0 28px 44px -26px rgba(11, 109, 145, 0.55);
  transform: translateY(-6px);
}

/* Image: fixed 16:10 frame, so every card starts its text on the same line. */
.project-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--c-dark);
  overflow: hidden;
}

.project-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms ease;
}

.project-card:hover .project-card__media img { transform: scale(1.05); }

/* Brand line where the image meets the text. */
.project-card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--gradient-logo);
}

.project-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(20px, 2.2vw, 28px);
}

.project-card__category {
  margin: 0;
  color: var(--c-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.project-card__title {
  margin: 8px 0 0;
  font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* Challenge and solution */

.project-card__facts {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.project-card__fact {
  padding-left: 14px;
  border-left: 3px solid var(--c-blue);
}

.project-card__fact--solution,
.project-card__fact--result { border-left-color: var(--c-green); }

.project-card__fact dt {
  color: var(--c-text);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}

.project-card__fact dd {
  margin: 3px 0 0;
  color: var(--c-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.project-card__fact--result dd {
  color: var(--c-text);
  font-weight: 600;
}

/* Technology badges */

.project-card__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.project-card__tech li {
  padding: 4px 12px;
  border-radius: 999px;
  background: #E6F2F7;
  color: var(--c-blue);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* Case study link, pinned to the foot of the card */

.project-card__link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--c-blue);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
}

/* Keeps a gap above the link when the auto margin collapses. */
.project-card__tech { padding-bottom: 8px; }

.project-card__link::after {
  content: "\2192";
  margin-left: 8px;
  transition: transform var(--ease);
}

.project-card__link:hover { text-decoration: underline; text-underline-offset: 4px; }
.project-card__link:hover::after,
.project-card__link:focus-visible::after { transform: translateX(4px); }

/* Buttons ----------------------------------------------------------------- */

.projects__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: clamp(32px, 4vw, 48px);
}

/* Layout ------------------------------------------------------------------ */

@media (max-width: 519.98px) {
  .projects__cta .btn { flex: 1 1 100%; }
}

@media (min-width: 640px) {
  .projects__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .projects__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card__media img,
  .project-card__link::after { transition: none; }

  .project-card:hover,
  .project-card:focus-within,
  .project-card:hover .project-card__media img { transform: none; }
}
