/* ==========================================
   NEXT LEVEL RENOVATIONS & SERVICES
   PUBLIC PROJECTS PAGE
========================================== */


/* ==========================================
   GENERAL
========================================== */

.projects-public-page {
  overflow-x: clip;
}

.projects-public-page [hidden] {
  display: none !important;
}

.portfolio-hero *,
.portfolio-intro *,
.portfolio-section *,
.portfolio-cta *,
.portfolio-dialog * {
  box-sizing: border-box;
}

.portfolio-section {
  scroll-margin-top: 90px;
}


/* ==========================================
   HERO
========================================== */

.portfolio-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 115px 0 105px;
  background: #071c2d;
  color: #ffffff;
}

.portfolio-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 280px;
}

.portfolio-hero-copy {
  position: relative;
  z-index: 2;
  max-width: 730px;
}

.portfolio-hero-copy .eyebrow {
  margin: 0 0 22px;
  color: #b6c8d8;
}

.portfolio-hero-copy h1 {
  margin: 0 0 24px;
  color: #ffffff;
  font-family: "Manrope", sans-serif;
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.portfolio-hero-copy h1 span {
  color: #6d91b0;
}

.portfolio-hero-copy > p:not(.eyebrow) {
  max-width: 580px;
  margin: 0;
  color: #d2dce5;
  font-size: 15px;
  line-height: 1.9;
}

.portfolio-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin-top: 32px;
}

.portfolio-hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.portfolio-hero-mark {
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: min(43vw, 500px);
  max-width: 500px;
  opacity: 0.09;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.portfolio-hero-mark img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}


/* ==========================================
   INTRO
========================================== */

.portfolio-intro {
  padding: 90px 0;
  background: #ffffff;
}

.portfolio-intro-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 75px;
}

.portfolio-intro h2 {
  margin: 15px 0 0;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: clamp(34px, 3.5vw, 52px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.045em;
}

.portfolio-intro h2 span {
  display: block;
  color: #547a9b;
}

.portfolio-intro-copy p {
  margin: 0;
  max-width: 570px;
  color: #596979;
  font-size: 15px;
  line-height: 1.95;
}


/* ==========================================
   PORTFOLIO SECTION
========================================== */

.portfolio-section {
  min-height: 420px;
  padding: 95px 0 115px;
  background: #f5f7f9;
}

.portfolio-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.portfolio-section-header h2 {
  margin: 12px 0 0;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: clamp(30px, 3.3vw, 46px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.portfolio-result-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: #627282; /* was #728395: 3.62:1 → 4.60:1 (WCAG AA) */
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}


/* ==========================================
   FILTER BAR
========================================== */

.portfolio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 35px;
  padding-bottom: 22px;
  border-bottom: 1px solid #dce4eb;
}

.portfolio-filter-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.portfolio-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 10px 16px;
  border: 1px solid #dce4eb;
  border-radius: 3px;
  background: #ffffff;
  color: #526477;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.portfolio-filter:hover {
  border-color: #547a9b;
  color: #071c2d;
}

.portfolio-filter.active {
  background: #071c2d;
  border-color: #071c2d;
  color: #ffffff;
}

.portfolio-search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 235px;
  min-width: 0;
  height: 41px;
  padding: 0 12px;
  border: 1px solid #dce4eb;
  border-radius: 3px;
  background: #ffffff;
  color: #7a8997;
}

.portfolio-search svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.portfolio-search input {
  display: block;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #071c2d;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
}

.portfolio-search input::placeholder {
  color: #8b98a5;
}


/* ==========================================
   PROJECT GRID
========================================== */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 25px;
  align-items: stretch;
}

.portfolio-card {
  min-width: 0;
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(7, 28, 45, 0.045);
}

.portfolio-card-button {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.portfolio-card-button:focus-visible {
  outline: 3px solid #547a9b;
  outline-offset: 4px;
}

.portfolio-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1.35 / 1;
  overflow: hidden;
  background: #dfe7ed;
}

.portfolio-card-media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.portfolio-card:hover .portfolio-card-media > img {
  transform: scale(1.04);
}

.portfolio-card-no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 25px;
  background: #dfe7ed;
  color: #71889d;
  text-align: center;
}

.portfolio-card-no-photo svg {
  width: 46px;
  height: 46px;
  stroke-width: 1.3;
}

.portfolio-card-no-photo span {
  font-size: 12px;
  font-weight: 700;
}

.portfolio-card-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 7px 11px;
  border-radius: 2px;
  background: #071c2d;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.portfolio-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 25px 25px 23px;
}

.portfolio-card-category {
  display: block;
  margin-bottom: 12px;
  color: #547a9b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portfolio-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.portfolio-card-heading h3 {
  margin: 0;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.portfolio-card-heading > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 3px;
  color: #547a9b;
}

.portfolio-card-description {
  display: -webkit-box;
  margin: 13px 0 0;
  overflow: hidden;
  color: #667686;
  font-size: 13px;
  line-height: 1.8;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.portfolio-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: auto;
  padding-top: 24px;
}

.portfolio-card-location {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #687687; /* was #748394: 3.88:1 → 4.64:1 (WCAG AA) */
  font-size: 11px;
}

.portfolio-card-location svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.portfolio-card-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #345b7a;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.portfolio-card-link svg {
  width: 14px;
  height: 14px;
}


/* ==========================================
   LOADING / EMPTY / ERROR STATES
========================================== */

.portfolio-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 55px 20px;
  border: 1px solid #e3e9ef;
  background: #ffffff;
  text-align: center;
}

.portfolio-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 65px;
  height: 65px;
  margin-bottom: 22px;
  border-radius: 50%;
  background: #edf2f6;
  color: #547a9b;
}

.portfolio-state-icon svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.6;
}

.portfolio-state h3 {
  margin: 0 0 12px;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: 22px;
  font-weight: 800;
}

.portfolio-state p {
  max-width: 420px;
  margin: 0;
  color: #687889;
  font-size: 13px;
  line-height: 1.8;
}

.portfolio-state .btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 25px;
}


/* ==========================================
   CONTACT CTA
========================================== */

.portfolio-cta {
  padding: 85px 0;
  background: #071c2d;
  color: #ffffff;
}

.portfolio-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.portfolio-cta-inner > div:first-child {
  max-width: 680px;
}

.portfolio-cta h2 {
  margin: 14px 0 18px;
  color: #ffffff;
  font-family: "Manrope", sans-serif;
  font-size: clamp(30px, 3.2vw, 45px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.portfolio-cta p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: #c7d4df;
  font-size: 14px;
  line-height: 1.9;
}

.portfolio-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  flex-shrink: 0;
}

.portfolio-cta-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}


/* ==========================================
   PROJECT MODAL
========================================== */

.portfolio-dialog {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 24px;
  isolation: isolate;
}

.portfolio-dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(4, 14, 25, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.portfolio-dialog-panel {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1.25fr)
    minmax(0, 0.75fr);
  width: min(1150px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}

.portfolio-dialog-close {
  position: absolute;
  top: 17px;
  right: 17px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #e2e8ee;
  border-radius: 50%;
  background: #ffffff;
  color: #071c2d;
  cursor: pointer;
}

.portfolio-dialog-close:hover {
  background: #f2f5f7;
}

.portfolio-dialog-close svg {
  width: 18px;
  height: 18px;
}


/* ==========================================
   MODAL IMAGE VIEWER
========================================== */

.portfolio-viewer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #101e2b;
  color: #ffffff;
}

.portfolio-viewer-main {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  max-height: 620px;
  overflow: hidden;
  background: #101e2b;
}

.portfolio-viewer-main > img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 620px;
  object-fit: contain;
}

.portfolio-viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 100%;
  min-height: 320px;
  padding: 35px;
  color: #8093a5;
  text-align: center;
}

.portfolio-viewer-placeholder svg {
  width: 55px;
  height: 55px;
  stroke-width: 1.2;
}

.portfolio-viewer-placeholder span {
  font-size: 12px;
  font-weight: 600;
}

.portfolio-viewer-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(7, 28, 45, 0.7);
  color: #ffffff;
  cursor: pointer;
}

.portfolio-viewer-arrow.previous {
  left: 16px;
}

.portfolio-viewer-arrow.next {
  right: 16px;
}

.portfolio-viewer-arrow:hover {
  background: rgba(7, 28, 45, 0.95);
}

.portfolio-viewer-arrow:disabled {
  display: none;
}

.portfolio-viewer-arrow svg {
  width: 21px;
  height: 21px;
}

.portfolio-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 20px;
  background: #101e2b;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.portfolio-photo-counter {
  color: #ffffff;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.portfolio-photo-caption {
  color: #92a4b4;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}


/* ==========================================
   THUMBNAILS
========================================== */

.portfolio-thumbnails {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 0;
  padding: 0 20px 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: #101e2b;
  scrollbar-width: thin;
}

.portfolio-thumbnail {
  display: block;
  flex: 0 0 69px;
  width: 69px;
  height: 55px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 2px;
  overflow: hidden;
  background: #273b4c;
  opacity: 0.58;
  cursor: pointer;
}

.portfolio-thumbnail:hover {
  opacity: 0.85;
}

.portfolio-thumbnail.active {
  border-color: #ffffff;
  opacity: 1;
}

.portfolio-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ==========================================
   MODAL DETAILS
========================================== */

.portfolio-dialog-details {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: #ffffff;
  overscroll-behavior: contain;
}

.portfolio-dialog-details-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 45px 35px 35px;
}

.portfolio-dialog-eyebrow {
  margin: 0 45px 30px 0;
  color: #6b8498;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.portfolio-detail-category {
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 8px 12px;
  background: #eaf0f4;
  color: #345b7a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portfolio-dialog-details h2 {
  margin: 0 0 25px;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: clamp(25px, 2.8vw, 35px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.portfolio-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.portfolio-detail-meta > div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #687889;
  font-size: 13px;
}

.portfolio-detail-meta svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: #547a9b;
}

.portfolio-detail-divider {
  height: 1px;
  margin: 28px 0;
  background: #e4eaf0;
}

.portfolio-dialog-details h3 {
  margin: 0 0 14px;
  color: #071c2d;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 800;
}

.portfolio-detail-description {
  margin: 0 0 35px;
  color: #5c6b7a;
  font-size: 13px;
  line-height: 1.95;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.portfolio-detail-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  margin-top: auto;
  padding-top: 20px;
}

.portfolio-detail-bottom .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  text-align: center;
}

.portfolio-detail-phone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #345b7a;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.portfolio-detail-phone svg {
  width: 15px;
  height: 15px;
}


/* ==========================================
   TABLET
========================================== */

@media (max-width: 1100px) {

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

  .portfolio-hero-mark {
    right: -35px;
    width: min(48vw, 420px);
  }

  .portfolio-dialog-panel {
    grid-template-columns:
      minmax(0, 1.1fr)
      minmax(0, 0.9fr);
  }

  .portfolio-dialog-details-inner {
    padding: 42px 25px 30px;
  }

  .portfolio-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .portfolio-search {
    flex: 0 0 auto;
    width: min(100%, 350px);
  }

}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 768px) {

  .portfolio-hero {
    padding: 80px 0 75px;
  }

  .portfolio-hero-inner {
    min-height: 0;
  }

  .portfolio-hero-copy h1 {
    font-size: clamp(43px, 11vw, 68px);
  }

  .portfolio-hero-copy > p:not(.eyebrow) {
    font-size: 14px;
    line-height: 1.85;
  }

  .portfolio-hero-actions {
    gap: 12px;
  }

  .portfolio-hero-mark {
    right: -45px;
    top: 54%;
    width: 78%;
    max-width: 340px;
    opacity: 0.065;
  }

  .portfolio-intro {
    padding: 65px 0;
  }

  .portfolio-intro-layout {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .portfolio-intro h2 {
    font-size: clamp(32px, 8vw, 43px);
  }

  .portfolio-intro-copy p {
    font-size: 14px;
  }

  .portfolio-section {
    padding: 70px 0 80px;
  }

  .portfolio-section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
  }

  .portfolio-section-header h2 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .portfolio-toolbar {
    gap: 16px;
    margin-bottom: 25px;
  }

  .portfolio-filter-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }

  .portfolio-filter {
    flex: 0 0 auto;
    min-height: 37px;
    padding: 10px 13px;
    font-size: 11px;
  }

  .portfolio-search {
    width: 100%;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 19px;
  }

  .portfolio-card-content {
    padding: 23px 21px;
  }

  .portfolio-card-heading h3 {
    font-size: 19px;
  }

  .portfolio-cta {
    padding: 70px 0;
  }

  .portfolio-cta-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 30px;
  }

  .portfolio-cta h2 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .portfolio-cta-actions {
    flex-direction: column;
    justify-content: stretch;
    width: 100%;
  }

  .portfolio-cta-actions .btn {
    width: 100%;
    min-height: 48px;
  }


  /* MOBILE PROJECT DIALOG */

  .portfolio-dialog {
    padding: 10px;
  }

  .portfolio-dialog-panel {
    display: block;
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .portfolio-viewer {
    width: 100%;
  }

  .portfolio-viewer-main {
    flex: none;
    min-height: 0;
    height: clamp(240px, 55vw, 390px);
  }

  .portfolio-viewer-main > img {
    max-height: 100%;
  }

  .portfolio-viewer-placeholder {
    min-height: 220px;
  }

  .portfolio-dialog-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .portfolio-viewer-arrow {
    width: 35px;
    height: 35px;
  }

  .portfolio-viewer-arrow.previous {
    left: 10px;
  }

  .portfolio-viewer-arrow.next {
    right: 10px;
  }

  .portfolio-viewer-footer {
    padding: 12px 16px;
  }

  .portfolio-thumbnails {
    padding: 0 16px 15px;
  }

  .portfolio-thumbnail {
    flex-basis: 59px;
    width: 59px;
    height: 49px;
  }

  .portfolio-dialog-details {
    overflow: visible;
  }

  .portfolio-dialog-details-inner {
    min-height: 0;
    padding: 30px 22px 35px;
  }

  .portfolio-dialog-eyebrow {
    margin-bottom: 25px;
  }

  .portfolio-dialog-details h2 {
    font-size: clamp(25px, 7vw, 34px);
  }

}


/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 420px) {

  .portfolio-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .portfolio-hero-actions .btn {
    width: 100%;
  }

  .portfolio-viewer-main {
    height: 245px;
  }

  .portfolio-dialog-details-inner {
    padding: 25px 18px 30px;
  }

}


/* ==========================================
   ACCESSIBILITY
========================================== */

@media (prefers-reduced-motion: reduce) {

  .portfolio-card-media > img {
    transition: none;
  }

}

/* ==========================================
   PROJECT CARDS — compact swipe carousel on
   phones and tablets (desktop keeps the grid)
========================================== */

@media (max-width: 900px) {

  .portfolio-grid {
    --cards-gutter: 24px;
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 40%;
    gap: 14px;
    margin-inline: calc(var(--cards-gutter) * -1);
    padding: 4px var(--cards-gutter) 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--cards-gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .portfolio-grid::-webkit-scrollbar {
    display: none;
  }

  .portfolio-card {
    scroll-snap-align: start;
    border: 1px solid #e3e9ee;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(7, 28, 45, 0.05);
  }

  .portfolio-card-media {
    aspect-ratio: 4 / 3;
  }

  .portfolio-card-badge {
    top: 10px;
    left: 10px;
    min-height: 24px;
    padding: 6px 9px;
  }

  .portfolio-card-no-photo svg {
    width: 34px;
    height: 34px;
  }

  .portfolio-card-content {
    padding: 13px 14px 15px;
  }

  .portfolio-card-category {
    margin-bottom: 7px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .portfolio-card-heading {
    gap: 10px;
  }

  .portfolio-card-heading h3 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .portfolio-card-heading > svg {
    width: 16px;
    height: 16px;
    margin-top: 2px;
  }

  /* The full description is shown when the project is opened. */
  .portfolio-card-description,
  .portfolio-card-location {
    display: none;
  }

  .portfolio-card-bottom {
    padding-top: 12px;
  }

  .portfolio-card-link {
    font-size: 12px;
  }

  /* Category filters scroll sideways instead of wrapping. */
  .portfolio-filter-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .portfolio-filter-list::-webkit-scrollbar {
    display: none;
  }

  .portfolio-filter {
    flex: 0 0 auto;
  }

}

@media (max-width: 600px) {

  .portfolio-grid {
    --cards-gutter: 16px;
    grid-auto-columns: 64%;
    gap: 12px;
  }

  .portfolio-section {
    padding: 56px 0 64px;
  }

}

@media (max-width: 360px) {

  .portfolio-grid {
    --cards-gutter: 12px;
    grid-auto-columns: 68%;
  }

}


/* ==========================================
   PHONE — vertical composition
   (portrait / 9:16 screens)
========================================== */

@media (max-width: 600px) {

  .portfolio-hero {
    padding: 52px 0 48px;
  }

  .portfolio-hero-copy h1 {
    font-size: clamp(40px, 11.5vw, 52px);
  }

  .portfolio-hero-copy > p:not(.eyebrow) {
    font-size: 14.5px;
    line-height: 1.6;
  }

  .portfolio-hero-actions {
    gap: 10px;
  }

  .portfolio-hero-actions .btn {
    min-height: 48px;
  }

  .portfolio-intro {
    padding: 38px 0;
  }

  .portfolio-intro-layout {
    gap: 14px;
  }

  .portfolio-intro h2 {
    font-size: clamp(26px, 7.4vw, 32px);
  }

  .portfolio-intro-copy p {
    font-size: 14.5px;
    line-height: 1.65;
  }

  .portfolio-section {
    padding: 38px 0 44px;
  }

  .portfolio-section-header {
    margin-bottom: 18px;
  }

  .portfolio-section-header h2 {
    font-size: clamp(25px, 7vw, 30px);
  }

  .portfolio-toolbar {
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  .portfolio-search {
    height: 42px;
  }

  .portfolio-filter {
    min-height: 36px;
    padding: 9px 14px;
    font-size: 12.5px;
  }

  /* 16px avoids the automatic zoom of iPhone when typing */
  .portfolio-search input {
    font-size: 16px;
  }

  .portfolio-cta {
    padding: 44px 0;
  }

  .portfolio-cta-inner {
    gap: 22px;
  }

  .portfolio-cta h2 {
    font-size: clamp(26px, 7.4vw, 32px);
  }

}
