/* ============================================================
   Matika — Reusable components: page hero, service card,
   carousel, search overlay
   ============================================================ */

/* ---------------- Page hero ---------------- */
.page-hero {
  position: relative;
  color: #fff;
  padding-top: var(--header-h);
  display: flex;
  align-items: flex-end;
  min-height: 38vh;
}
.ph-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.ph-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ph-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(11, 22, 32, 0.9), rgba(13, 38, 58, 0.72) 55%, rgba(0, 107, 169, 0.32));
}
.ph-grid {
  position: relative;
  z-index: 1;
  width: 100%;
}
.ph-inner {
  padding-block: clamp(30px, 4vw, 54px);
  max-width: 820px;
  text-align: left;
}
.page-hero.is-split {
  background: linear-gradient(115deg, var(--blue-800), var(--blue));
  align-items: center;
  min-height: auto;
}
.is-split .ph-overlay {
  display: none;
}
.is-split .ph-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.is-split .ph-inner {
  max-width: none;
}
.ph-side img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.6);
}
.crumbs a {
  transition: color var(--t) var(--ease);
}
.crumbs a:hover {
  color: var(--yellow);
}
.crumbs .sep {
  opacity: 0.45;
}
.page-hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.page-hero h1 strong {
  font-weight: 700;
}
.page-hero h1 .h1-rest {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}
.ph-text {
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  color: rgba(255, 255, 255, 0.86);
  max-width: 58ch;
  margin: 0;
}
.ph-cta {
  margin-top: 26px;
}
@media (max-width: 820px) {
  .is-split .ph-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .is-split .ph-side {
    order: -1;
  }
}

/* ---------------- Service card ---------------- */
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid var(--bg-line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.card:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.card .media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
}
.card .media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(32, 36, 40, 0.32));
}
.card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .media img {
  transform: scale(1.06);
}
.card .body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card .body h3 {
  font-size: 1.18rem;
  margin-bottom: 8px;
  transition: color var(--t) var(--ease);
}
.card:hover .body h3 {
  color: var(--blue);
}
.card .body p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.55em);
}
.card .more {
  font-size: 0.9rem;
}
.card:hover .more {
  color: var(--blue);
}
.card:hover .more svg {
  transform: translate(2px, -2px);
}

/* ---------------- Carousel ---------------- */
.carousel {
  position: relative;
}
.carousel .track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel .track::-webkit-scrollbar {
  display: none;
}
.carousel .slide {
  flex: 0 0 calc((100% - 48px) / 3);
  scroll-snap-align: start;
  display: flex;
}
.carousel-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}
.cbtn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bg-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease),
    border-color var(--t) var(--ease), opacity var(--t) var(--ease);
}
.cbtn:hover:not(:disabled) {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.cbtn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
@media (max-width: 1100px) {
  .carousel .slide {
    flex: 0 0 calc((100% - 24px) / 2);
  }
}
@media (max-width: 640px) {
  .carousel .slide {
    flex: 0 0 86%;
  }
}

/* ---------------- Search overlay ---------------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 22, 28, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(60px, 12vh, 140px) 20px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}
.search-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.search-panel {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform 0.22s var(--ease);
}
.search-overlay.is-open .search-panel {
  transform: translateY(0);
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--bg-line);
  color: var(--ink-mute);
}
.search-bar input {
  flex: 1;
  border: 0;
  outline: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--ink);
  background: transparent;
}
.search-close {
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.search-close:hover {
  color: var(--ink);
  background: var(--bg-soft);
}
.search-body {
  max-height: min(56vh, 460px);
  overflow-y: auto;
}
.results {
  list-style: none;
  margin: 0;
  padding: 8px;
}
.result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.result.active {
  background: var(--bg-soft);
}
.result-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.result-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.result.active .result-title {
  color: var(--blue);
}
.result-text {
  font-size: 0.85rem;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-type {
  flex-shrink: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  background: rgba(0, 107, 169, 0.1);
  padding: 4px 9px;
  border-radius: 3px;
}
.search-empty,
.search-hint {
  margin: 0;
  padding: 26px 22px;
  color: var(--ink-mute);
  font-size: 0.95rem;
}
