/* Home page — mobile-first: base styles = small screens; min-width media queries enhance up. */
.home-page {
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 0 clamp(48px, 8vw, 72px);
  overflow-x: clip;
}

/* —— Hero (modern premium search + tabs) —— */
.home-hero.home-hero--cd {
  position: relative;
  overflow: hidden;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0;
  border: none;
  box-shadow: none;
  margin-bottom: clamp(24px, 4vw, 36px);
  min-height: min(480px, 85vh);
  display: flex;
  align-items: stretch;
}

@media (min-width: 720px) {
  .home-hero.home-hero--cd {
    min-height: min(520px, 88vh);
  }
}

.home-hero__cd-bg {
  position: absolute;
  inset: 0;
  background-color: #0f172a;
  background-image: url("../img/hero-home.png");
  background-size: cover;
  background-position: center top;
}

.home-hero__cd-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.5) 0%,
    rgba(15, 23, 42, 0.7) 42%,
    rgba(15, 23, 42, 0.88) 100%
  );
  pointer-events: none;
}

.home-hero__cd-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(36px, 8vw, 72px) clamp(16px, 3vw, 40px) clamp(32px, 6vw, 48px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-hero__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-hero__badge--cd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 0 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.38);
}

.home-hero__badge--cd i {
  color: #ff7000;
  font-size: 0.9em;
}

.home-hero__title--cd {
  margin: 0 0 16px;
  font-size: clamp(1.65rem, 5vw, 2.65rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.4);
  max-width: 18ch;
}

@media (min-width: 640px) {
  .home-hero__title--cd {
    max-width: none;
  }
}

.home-hero__sub--cd {
  margin: 0 0 clamp(22px, 4vw, 32px);
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(0.95rem, 2.2vw, 1.08rem);
  line-height: 1.55;
  max-width: 42ch;
}

.home-hero__search--cd {
  width: 100%;
  max-width: 100%;
  margin: 0 auto clamp(18px, 3vw, 24px);
  box-sizing: border-box;
}

.home-search-cd {
  --cd-blue: #1d4ed8;
  --cd-blue-dark: #1e40af;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  margin: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(219, 234, 254, 0.95);
  overflow: hidden;
}

.home-search-cd__segment {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  margin: 0;
  background: #fff;
  cursor: text;
  border-bottom: 1px solid #e2e8f0;
}

.home-search-cd__segment--q {
  flex: 1 1 auto;
}

.home-search-cd__segment--loc {
  flex: 1 1 auto;
  max-width: none;
}

.home-search-cd__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-search-cd__segment input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #0f172a;
  padding: 14px 0;
  box-shadow: none;
  border-radius: 0;
}

.home-search-cd__segment input::placeholder {
  color: #64748b;
}

.home-search-cd__segment:focus-within {
  background: #f8fbff;
}

.home-search-cd__segment:focus-within .home-search-cd__icon {
  color: #1e40af;
  background: #dbeafe;
}

.home-search-cd__vbar {
  display: none;
}

.home-search-cd__submit {
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  min-height: 48px;
  min-width: 0;
  padding: 0 20px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: linear-gradient(135deg, var(--cd-blue), var(--cd-blue-dark));
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.home-search-cd__submit:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.home-search-cd__submit:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

@media (min-width: 720px) {
  .home-hero__search--cd {
    max-width: min(760px, 100%);
  }

  .home-search-cd {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    border-radius: 18px;
  }

  .home-search-cd__segment {
    min-height: 58px;
    padding: 0 14px 0 16px;
    border-bottom: none;
  }

  .home-search-cd__segment--q {
    flex: 1.5 1 180px;
  }

  .home-search-cd__segment--loc {
    flex: 0.85 1 140px;
    max-width: 240px;
  }

  .home-search-cd__segment input {
    font-size: 1rem;
    padding: 16px 0;
  }

  .home-search-cd__vbar {
    display: block;
    width: 1px;
    flex-shrink: 0;
    align-self: stretch;
    margin: 10px 0;
    background: #e2e8f0;
  }

  .home-search-cd__submit {
    width: auto;
    min-width: 156px;
    min-height: 0;
    padding: 0 28px;
    font-size: 1.02rem;
  }
}

.home-hero__actions--cd {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: clamp(22px, 4vw, 28px);
}

.home-hero__cta--cd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

@media (min-width: 560px) {
  .home-hero__actions--cd {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    max-width: none;
    width: auto;
  }

  .home-hero__cta--cd {
    min-height: 44px;
    width: auto;
  }
}

.home-hero__cta--cd i {
  font-size: 0.92em;
  opacity: 0.95;
}

.home-hero__cta--cd-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: none;
}

.home-hero__cta--cd-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
}

.home-chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-chips__label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.home-chips__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-chips__row button {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.home-chips__row button:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

.home-chips__row button:focus-visible {
  outline: 2px solid var(--dc-brand, #0b5fff);
  outline-offset: 2px;
}

.home-chips--cd {
  width: 100%;
  max-width: min(960px, 100%);
  margin: 0 auto;
  align-items: flex-start;
  text-align: left;
}

.home-chips__label--cd {
  color: rgba(255, 255, 255, 0.78);
}

/* Popular cities: horizontal scroll on small screens; wrap on larger */
.home-chips__row--cd {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  gap: 10px;
  padding-bottom: 6px;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.home-chips__row--cd::-webkit-scrollbar {
  height: 4px;
}

.home-chips__row--cd::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

.home-chips__row--cd button {
  flex-shrink: 0;
  scroll-snap-align: start;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.48);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .home-chips__row--cd {
    flex-wrap: wrap;
    overflow-x: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
  }

  .home-chips__row--cd button {
    scroll-snap-align: unset;
  }
}

.home-chips__row--cd button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
  transform: none;
}

.home-chips__row--cd button:focus-visible {
  outline: 2px solid #ff7000;
  outline-offset: 2px;
}

.home-hero__cd-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
  margin-top: clamp(28px, 5vw, 40px);
  padding-top: clamp(20px, 4vw, 28px);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  width: 100%;
  max-width: min(960px, 100%);
}

.home-hero__cd-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.home-hero__cd-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.home-hero__cd-stat--uni .home-hero__cd-stat-val {
  color: #93c5fd;
}
.home-hero__cd-stat--coach .home-hero__cd-stat-val {
  color: #fdba74;
}
.home-hero__cd-stat--school .home-hero__cd-stat-val {
  color: #5eead4;
}
.home-hero__cd-stat--tutor .home-hero__cd-stat-val {
  color: #c4b5fd;
}

.home-hero__cd-stat-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.66);
  margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .home-chips__row button:hover {
    transform: none;
  }
}

/* —— Browse section —— */
.home-browse {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8ff 100%);
  padding: 12px 0 clamp(24px, 5vw, 36px);
  box-sizing: border-box;
}

.home-tabs-wrap {
  max-width: min(1200px, calc(100% - clamp(16px, 4vw, 28px)));
  margin: -8px auto 20px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dbeafe;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.35) transparent;
}

.home-tabs-wrap::-webkit-scrollbar {
  height: 5px;
}

.home-tabs-wrap::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.35);
  border-radius: 6px;
}

.home-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .home-tabs-wrap {
    overflow-x: visible;
  }

  .home-tabs {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    min-width: 0;
  }
}

.home-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(0.78rem, 2vw, 0.9rem);
  font-family: inherit;
  color: #475569;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.home-tab .label-text {
  white-space: nowrap;
}

.home-tab i {
  font-size: 0.95em;
  opacity: 0.9;
}

.home-tab.is-active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.home-tab[data-tab="university"].is-active {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.home-tab[data-tab="coaching"].is-active {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.3);
}

.home-tab[data-tab="school"].is-active {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.28);
}

.home-tab[data-tab="tutor"].is-active {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.home-tab:not(.is-active):hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.home-tab:focus-visible {
  outline: 2px solid var(--dc-brand, #0b5fff);
  outline-offset: 2px;
}

.home-panels [id^="home-panel-"] {
  scroll-margin-top: min(100px, 20vh);
}

.home-panels {
  width: 100%;
  max-width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 clamp(12px, 2.2vw, 20px);
  box-sizing: border-box;
}

.home-panel {
  display: none;
}

.home-panel.is-active {
  display: block;
  animation: home-fade 0.25s ease-out;
}

@keyframes home-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-panel.is-active {
    animation: none;
  }
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 3vw, 20px);
}

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

@media (min-width: 900px) {
  .home-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  }
}

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  padding: 22px 20px 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s;
  overflow: hidden;
}

.home-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--dc-brand, #0b5fff), #38bdf8);
  opacity: 0;
  transition: opacity 0.2s;
}

.home-card:hover {
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
  transform: translateY(-3px);
  border-color: #cbd5e1;
}

.home-card:hover::before {
  opacity: 1;
}

.home-card.is-hidden {
  display: none;
}

.home-card__type {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dc-muted, #64748b);
  margin-bottom: 8px;
}

.home-card h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #0f172a;
}

.home-card__meta {
  margin: 0 0 16px;
  color: var(--dc-muted, #64748b);
  font-size: 0.88rem;
}

.home-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.home-card__apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 45%, #1e40af 100%);
  box-shadow:
    0 6px 18px rgba(37, 99, 235, 0.38),
    0 2px 6px rgba(30, 64, 175, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.22s cubic-bezier(0.34, 1.45, 0.64, 1), box-shadow 0.25s ease, filter 0.2s ease;
}

.home-card__apply i {
  font-size: 0.92em;
  opacity: 0.95;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.home-card__apply:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.06);
  box-shadow:
    0 10px 30px rgba(37, 99, 235, 0.45),
    0 4px 12px rgba(30, 64, 175, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.home-card__apply:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.98);
}

.home-card__apply:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
}

.home-card a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--dc-brand, #0b5fff) !important;
  text-decoration: none !important;
  touch-action: manipulation;
}

.home-card a:hover {
  gap: 12px;
}

.home-empty {
  padding: clamp(28px, 5vw, 40px) 24px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-radius: 18px;
  border: 2px dashed #cbd5e1;
  color: var(--dc-muted, #64748b);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.55;
}

.home-empty a {
  color: var(--dc-brand, #0b5fff);
  font-weight: 700;
}

/* Apply popup on home — blue accent; uses #applyModal from dc-apply-modal.css */
.home-page #applyModal {
  --dc-modal-accent: #2563eb;
  --dc-modal-accent-hover: #1d4ed8;
  --dc-modal-accent-soft: rgba(37, 99, 235, 0.14);
}

.home-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 150;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b5fff, #2563eb);
  color: #fff;
  font-weight: 800;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(11, 95, 255, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.home-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 44px rgba(11, 95, 255, 0.5);
}

.home-fab i {
  margin-right: 6px;
}

@media (max-width: 900px) {
  .home-fab {
    bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 52px);
  }
}

@media (max-width: 480px) {
  .home-fab {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 320px;
  }
  .home-fab:hover {
    transform: translateX(-50%) translateY(-2px) scale(1.02);
  }

  .home-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .home-card__apply,
  .home-card__actions a {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
}
