/* ============================================================
   Homepage
   Satu momen visual utama: jalur rute (peta transit) di hero dan tiket pencarian.
   Bagian lain sengaja tenang.
   ============================================================ */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 6vw, 4.5rem));
  padding-bottom: clamp(4rem, 8vw, 6rem);
  min-height: clamp(26rem, 58vh, 36rem);
  display: flex;
  align-items: center;
  /* Foto bus + overlay gelap agar teks tetap terbaca di atas gambar apa pun.
     Untuk foto asli: simpan sebagai assets/img/hero-bus.jpg (1600px, < 200 KB) lalu ganti hero-bus.svg di url() di bawah. */
  background-color: var(--midnight);
  background-image: linear-gradient(180deg, rgba(8, 18, 41, 0.72) 0%, rgba(8, 18, 41, 0.58) 45%, rgba(8, 18, 41, 0.9) 100%),
    linear-gradient(90deg, rgba(8, 18, 41, 0.75) 0%, rgba(8, 18, 41, 0) 70%), var(--hero-photo, url('../../assets/img/hero-bus.svg'));
  background-size: cover;
  background-position: center;
  color: var(--white);
}

.hero > .container {
  position: relative;
}

.hero__title {
  max-width: 17ch;
  font-size: var(--fs-hero);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero__lead {
  max-width: 48ch;
  margin-top: 1.25rem;
  color: #dbe4f8;
  font-size: var(--fs-lg);
}

/* ---------- Tiket pencarian ---------- */
.search {
  position: relative;
  z-index: 2;
  margin-top: -5.5rem;
}

.ticket-wrap {
  filter: drop-shadow(0 18px 28px rgba(8, 18, 41, 0.28));
}

.ticket {
  --perf: 220px; /* lebar bagian tombol di sisi kanan tiket */
  position: relative;
  display: grid;
  color: var(--ink);
}

/* Latar putih tiket digambar terpisah agar lubang sobekan (mask) tidak
   ikut memotong daftar saran kota yang keluar dari batas tiket. */
.ticket::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  background: var(--white);
}

.ticket__fields,
.ticket__cta {
  position: relative;
}

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

.ticket__cta {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  border-top: 2px dashed var(--line);
}

/* Kolom isian */
.field {
  position: relative;
  min-width: 0;
  padding: 0.875rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s var(--ease);
}

.field:focus-within {
  background: #f3f6ff;
}

.field__label {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.field__control {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.125rem;
}

.field__control .icon {
  color: var(--electric);
}

.field__input {
  width: 100%;
  min-width: 0;
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 700;
  outline: none;
  text-overflow: ellipsis;
}

.field__input::placeholder {
  color: #8d99b5;
  font-weight: 500;
}

/* Fokus dibuat terlihat pada kolom pembungkusnya */
.field:focus-within {
  box-shadow: inset 0 0 0 2px var(--electric);
}

.field__error {
  min-height: 0;
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.field__error:not(:empty) {
  margin-top: 0.25rem;
}

.field.has-error {
  background: var(--danger-tint);
}

/* Daftar saran kota */
.combobox__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0.5rem;
  right: 0.5rem;
  z-index: var(--z-list);
  max-height: 280px;
  overflow-y: auto;
  padding: 0.375rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: var(--shadow-lift);
}

.combobox__list[hidden] {
  display: none;
}

.combobox__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 700;
}

.combobox__option small {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.combobox__option[aria-selected='true'],
.combobox__option:hover {
  background: var(--electric-tint);
}

.combobox__empty {
  padding: 0.75rem;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Tombol tukar asal-tujuan */
.swap {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--electric);
  transition: transform 0.25s var(--ease), border-color 0.15s var(--ease);
}

.swap:hover {
  border-color: var(--electric);
}

.swap.is-flipped .icon {
  transform: rotate(180deg);
}

.swap .icon {
  transition: transform 0.25s var(--ease);
}

/* Penghitung penumpang */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.125rem;
}

.stepper__btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--electric);
}

.stepper__btn:hover:not([disabled]) {
  border-color: var(--electric);
}

.stepper__btn[disabled] {
  color: #b3bcd1;
  cursor: not-allowed;
}

.stepper__btn .icon {
  width: 1rem;
  height: 1rem;
}

.stepper__value {
  min-width: 5.5rem;
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 700;
}

/* Susunan kolom per ukuran layar */
.ticket__fields > .field--from {
  grid-column: 1 / -1;
  grid-row: 1;
}

.ticket__fields > .field--to {
  grid-column: 1 / -1;
  grid-row: 2;
}

.ticket__fields > .swap {
  grid-column: 1 / -1;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  margin-right: 1rem;
}

.ticket__fields > .field--from,
.ticket__fields > .field--to {
  padding-right: 4rem;
}

/* Sudut atas ikut melengkung agar warna fokus/error tidak keluar dari tiket */
.ticket__fields > .field--from {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.ticket__fields > .field--date {
  grid-column: 1 / -1;
  grid-row: 3;
}

.ticket__fields > .field--pax {
  grid-column: 1 / -1;
  grid-row: 4;
}

@media (min-width: 640px) {
  .ticket__fields > .field--from {
    grid-column: 1;
    padding-right: 1.25rem;
    border-radius: var(--r-lg) 0 0 0;
  }

  .ticket__fields > .field--to {
    grid-column: 2;
    grid-row: 1;
    padding-left: 2.25rem;
    padding-right: 1.25rem;
    border-left: 1px solid var(--line);
    border-radius: 0 var(--r-lg) 0 0;
  }

  .ticket__fields > .swap {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    margin-right: 0;
  }

  .ticket__fields > .field--date {
    grid-column: 1;
    grid-row: 2;
    border-right: 1px solid var(--line);
  }

  .ticket__fields > .field--pax {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (min-width: 1040px) {
  .ticket {
    grid-template-columns: minmax(0, 1fr) var(--perf);
  }

  /* Lubang kecil di tepi atas dan bawah garis sobekan tiket */
  .ticket::before {
    -webkit-mask: radial-gradient(circle 12px at calc(100% - var(--perf)) 0, transparent 11.5px, #000 12px) top /
        100% 51% no-repeat,
      radial-gradient(circle 12px at calc(100% - var(--perf)) 100%, transparent 11.5px, #000 12px) bottom / 100% 51%
        no-repeat;
    mask: radial-gradient(circle 12px at calc(100% - var(--perf)) 0, transparent 11.5px, #000 12px) top / 100% 51%
        no-repeat,
      radial-gradient(circle 12px at calc(100% - var(--perf)) 100%, transparent 11.5px, #000 12px) bottom / 100% 51%
        no-repeat;
  }

  .ticket__fields {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.95fr);
  }

  .ticket__fields > .field {
    border-bottom: 0;
    padding-block: 1.25rem 1.125rem;
  }

  .ticket__fields > .field--from {
    grid-column: 1;
    grid-row: 1;
  }

  .ticket__fields > .field--to {
    grid-column: 2;
    grid-row: 1;
    padding-left: 2.5rem;
    border-radius: 0;
  }

  .ticket__fields > .swap {
    grid-column: 1 / span 2;
    grid-row: 1;
  }

  .ticket__fields > .field--date {
    grid-column: 3;
    grid-row: 1;
    border-left: 1px solid var(--line);
    border-right: 0;
  }

  .ticket__fields > .field--pax {
    grid-column: 4;
    grid-row: 1;
    border-left: 1px solid var(--line);
  }

  .ticket__cta {
    padding: 1.25rem 1.5rem;
    border-top: 0;
    border-left: 2px dashed var(--line);
  }

  /* Bagian kiri tiket: kedua sudut kiri melengkung mengikuti tiket */
  .ticket__fields > .field--from {
    border-radius: var(--r-lg) 0 0 var(--r-lg);
  }
}

/* ---------- Bagian umum ---------- */
.section {
  padding-block: clamp(4rem, 8vw, 6.5rem);
}

.section--white {
  background: var(--white);
}

.section--dark {
  background: var(--midnight);
  color: var(--white);
}

.section__title {
  max-width: 22ch;
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.section__lead {
  max-width: 56ch;
  margin-top: 0.875rem;
  color: var(--muted);
  font-size: var(--fs-lg);
}

.section--dark .section__lead {
  color: var(--muted-on-dark);
}

.mock-note {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  background: #fff6dd;
  color: #6b4e00;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.mock-note .icon {
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
}

.mock-note[hidden] {
  display: none;
}

/* ---------- Rute populer ---------- */
.routes {
  padding-top: clamp(3.5rem, 6vw, 5rem);
}

.route-list {
  display: grid;
  gap: 0.875rem;
  margin-top: 2rem;
  padding: 0;
  list-style: none;
}

.route {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background-color: #10254b;
  background-image: var(--route-photo, linear-gradient(135deg, #183a6b, #10254b));
  background-position: center;
  background-size: cover;
  color: #fff;
}

.route::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(100deg, rgba(8, 18, 41, 0.78), rgba(8, 18, 41, 0.54));
}

.route__path {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.route__track {
  position: relative;
  flex: 0 1 64px;
  height: 2px;
  min-width: 32px;
  background: repeating-linear-gradient(90deg, #fff 0 6px, transparent 6px 10px);
}

.route__track::before,
.route__track::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: transparent;
  transform: translateY(-50%);
}

.route__track::before {
  left: -4px;
}

.route__track::after {
  right: -4px;
}

.route__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--fs-sm);
}

.route__meta .icon {
  width: 1rem;
  height: 1rem;
}

.route__price {
  text-align: right;
  font-size: var(--fs-lg);
  font-weight: 800;
}

.route__price small {
  display: block;
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.route__action {
  grid-column: 1 / -1;
}

.route__action .btn {
  width: 100%;
  background: #fff;
  border-color: #fff;
  color: var(--ink);
}

.route__action .btn:hover {
  background: #f1f5ff;
  border-color: #f1f5ff;
  color: var(--ink);
}

@media (min-width: 800px) {
  .route {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.8fr) minmax(0, 0.9fr) auto;
    min-height: clamp(200px, 18vw, 250px);
    padding: 1.5rem 1.75rem;
    gap: 1rem 1.5rem;
  }

  .route__path {
    grid-column: auto;
  }

  .route__action {
    grid-column: auto;
  }

  .route__action .btn {
    width: auto;
  }
}

.route--skeleton .skeleton {
  height: 1.25rem;
}

.route--skeleton .skeleton:first-child {
  width: min(280px, 70%);
}

.route--skeleton {
  background: var(--white);
}

.route--skeleton::before {
  display: none;
}

/* ---------- Keunggulan ---------- */
.benefits {
  display: grid;
  gap: clamp(2rem, 6vw, 5rem);
}

.benefit-list {
  border-bottom: 1px solid var(--line);
}

.benefit {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1.25rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
}

.benefit__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--electric-tint);
  color: var(--electric);
}

.benefit h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.benefit p {
  max-width: 52ch;
  margin-top: 0.25rem;
  color: var(--muted);
}

@media (min-width: 960px) {
  .benefits {
    grid-template-columns: 5fr 7fr;
    align-items: start;
  }

  .benefits__intro {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
  }
}

/* ---------- Cara pemesanan ---------- */
.steps {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0 1.25rem;
  padding-bottom: 2rem;
}

.step:last-child {
  padding-bottom: 0;
}

/* Garis penghubung antar langkah (mode vertikal di layar kecil) */
.step:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 44px;
  bottom: 0;
  left: 20px;
  width: 4px;
  border-radius: 2px;
  background: var(--cyan);
}

.step__node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--cyan);
  border-radius: 50%;
  background: var(--midnight);
  font-weight: 800;
}

.step h3 {
  padding-top: 0.5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.step p {
  grid-column: 2;
  margin-top: 0.25rem;
  color: var(--muted-on-dark);
}

@media (min-width: 960px) {
  .steps {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* Garis mendatar dari langkah pertama sampai terakhir */
  .steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 22px;
    width: 80%;
    height: 4px;
    border-radius: 2px;
    background: var(--cyan);
  }

  .step {
    display: block;
    padding: 0 1.5rem 0 0;
  }

  .step:not(:last-child)::before {
    display: none;
  }

  .step h3 {
    margin-top: 1.25rem;
    padding-top: 0;
  }
}

/* ---------- Ulasan ---------- */
.quotes {
  display: grid;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.quote blockquote {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.quote--lead blockquote {
  font-size: clamp(1.375rem, 1rem + 1.6vw, 2rem);
  line-height: 1.35;
}

.quote figcaption {
  margin-top: 1rem;
  font-weight: 700;
}

.quote figcaption span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.quotes__side .quote + .quote {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.quotes__side blockquote {
  font-size: var(--fs-lg);
  line-height: 1.5;
}

@media (min-width: 960px) {
  .quotes {
    grid-template-columns: 1.35fr 1fr;
    gap: clamp(3rem, 6vw, 5rem);
    align-items: start;
  }
}

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  gap: 2.5rem;
}

.faq-list {
  border-bottom: 1px solid var(--line);
}

.faq-item {
  border-top: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary .icon {
  color: var(--electric);
  transition: transform 0.2s var(--ease);
}

.faq-item[open] summary .icon {
  transform: rotate(180deg);
}

.faq-item p {
  max-width: 60ch;
  padding-bottom: 1.25rem;
  color: var(--muted);
}

.faq__help {
  margin-top: 1.5rem;
  color: var(--muted);
}

.faq__help a {
  color: var(--electric);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 960px) {
  .faq {
    grid-template-columns: 5fr 7fr;
    gap: clamp(2rem, 6vw, 5rem);
    align-items: start;
  }
}

/* ---------- Jadwal keberangkatan ---------- */
.departures {
  padding-top: 0;
}

.departure-list {
  display: grid;
  gap: 0.875rem;
  margin-top: 2rem;
}

.departure {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--white);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.departure:hover {
  border-color: #b9c8ea;
  box-shadow: 0 10px 24px -14px rgba(8, 18, 41, 0.3);
}

.departure__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.departure__visual {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 220px;
  min-width: 0;
  padding: 1.25rem;
}

.departure__visual::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(90deg, rgba(8, 18, 41, 0.78), rgba(8, 18, 41, 0.58));
}

.departure__body {
  grid-column: 1;
  padding: 0.25rem 0;
  color: #fff;
  text-align: left;
}

.departure__route,
.departure__when,
.departure__seats {
  color: #fff;
}

.departure__when .icon {
  color: #c9dcff;
}

.departure__route {
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.25;
}

.departure__bus,
.departure__when,
.departure__seats {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.departure__bus strong {
  color: #fff;
}

.departure__when {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.departure__when span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.departure__when .icon {
  width: 1rem;
  height: 1rem;
  color: var(--electric);
}

.departure__seats {
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.departure__seats.is-low {
  color: var(--danger);
}

.departure__buy {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px dashed var(--line);
}

.departure__buy .price small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.departure__buy .price {
  font-size: var(--fs-xl);
  font-weight: 800;
}

.departure--skeleton {
  display: block;
}

.departure--skeleton .skeleton {
  height: 96px;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.tag--class {
  background: var(--electric-tint);
  color: var(--electric-dark);
}

@media (min-width: 760px) {
  .departure {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .departure__visual {
    min-height: 320px;
    padding: 1.5rem;
  }

  .departure__buy {
    grid-column: 2;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 1.25rem;
    border-top: 0;
    border-left: 1px dashed var(--line);
    min-width: 160px;
  }
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* Form pencarian di halaman Cari Bus (tidak menimpa hero) */
.search--page {
  margin-top: 1.75rem;
}

.search--page .ticket-wrap {
  filter: drop-shadow(0 10px 22px rgba(8, 18, 41, 0.14));
}

/* Ruang desktop tambahan agar foto hero dan foto bus pada kartu lebih utuh terlihat. */
@media (min-width: 960px) {
  .hero {
    min-height: clamp(42rem, 76vh, 54rem);
  }

  .inner--departures > .container {
    width: min(100% - 2 * var(--gutter), 1800px);
  }
}
