/* =====================================================================
   UPDATE v68
   - Pencarian header: ikon dulu, bar muncul saat diklik
   - Menu "Lainnya" -> Game
   - Sambutan Kepala Sekolah (beranda)
   - Halaman Kompetensi & kartu Ekstrakurikuler memakai kartu "program"
   - Lokasi digabung ke footer
   Dimuat paling akhir; semua warna memakai variabel tema (terang/gelap).
   ===================================================================== */

/* ---------- 1. PENCARIAN HEADER ---------- */
.main-nav .nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--surface-alt);
  overflow: hidden;
  flex-shrink: 0;
  transition: width .45s var(--ease), border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.main-nav .nav-search:hover { border-color: var(--gold); }
.main-nav .nav-search.is-open {
  width: min(300px, 42vw);
  background: var(--surface);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .14);
}
.main-nav .nav-search input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0 4px 0 16px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.main-nav .nav-search input:focus { border: 0; box-shadow: none; }
.main-nav .nav-search input::placeholder { color: var(--text-muted); }
.main-nav .nav-search.is-open input { opacity: 1; pointer-events: auto; transition-delay: .15s; }
.main-nav .nav-search .nav-search-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  transition: color .25s ease, transform .25s ease;
}
.main-nav .nav-search .nav-search-btn:hover { background: transparent; color: var(--orange, #ff6b00); }
.main-nav .nav-search.is-open .nav-search-btn { color: var(--orange, #ff6b00); }
.main-nav .nav-search .nav-search-btn:focus-visible { outline: 2px solid var(--orange, #ff6b00); outline-offset: -3px; }

/* HP & tablet kecil: ikon tetap tampil, bar melebar menutupi header saat dibuka */
@media (max-width: 768px) {
  .main-nav .nav-search { display: flex; margin-left: auto; }
  .main-nav .container.flex { position: relative; }
  .main-nav .nav-search.is-open {
    position: absolute;
    left: 14px; right: 14px; top: 50%;
    width: auto;
    transform: translateY(-50%);
    z-index: 8;
    animation: navSearchOpen .38s var(--ease);
  }
}
@keyframes navSearchOpen {
  from { clip-path: inset(0 0 0 calc(100% - 42px) round 999px); }
  to   { clip-path: inset(0 0 0 0 round 999px); }
}
@media (prefers-reduced-motion: reduce) {
  .main-nav .nav-search, .main-nav .nav-search input { transition: none; }
  .main-nav .nav-search.is-open { animation: none; }
}

/* ---------- 2. MENU: opsi Game ---------- */
.nav-game-link i { margin-right: 8px; color: var(--orange, #ff6b00); width: 1.1em; text-align: center; }

/* ---------- 3. SAMBUTAN KEPALA SEKOLAH ---------- */
.sambutan-section { position: relative; padding: clamp(44px, 7vw, 80px) 0; }
.sambutan-wrap {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 60px);
  align-items: center;
}
.sambutan-figure { margin: 0; text-align: center; }
.sambutan-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, var(--navy-steel-fixed) 0%, var(--navy) 100%);
  box-shadow: var(--shadow-lg);
}
.sambutan-photo::after {
  content: "";
  position: absolute; inset: 0; z-index: 2;
  border-radius: inherit;
  border: 2px solid rgba(255, 209, 102, .55);
  pointer-events: none;
}
.sambutan-photo img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.sambutan-photo-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: clamp(4rem, 12vw, 6.5rem);
  color: rgba(255, 255, 255, .85);
}
.sambutan-figure figcaption { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.sambutan-figure figcaption strong {
  font-family: var(--font-display);
  font-size: 1.05rem; line-height: 1.35;
  color: var(--navy);
}
.sambutan-figure figcaption span { font-size: .9rem; color: var(--text-muted); }
.sambutan-body .tag { display: inline-block; color: var(--orange, #ff6b00); }
.sambutan-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.25;
  color: var(--navy);
  margin: 8px 0 18px;
}
.sambutan-text p { margin: 0 0 14px; color: var(--ink); line-height: 1.8; max-width: 70ch; }
.sambutan-sign {
  margin: 20px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--orange, #ff6b00);
  font-style: italic;
  color: var(--text-muted);
}
:root[data-theme="dark"] .sambutan-figure figcaption strong,
:root[data-theme="dark"] .sambutan-body h2 { color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sambutan-figure figcaption strong,
  :root:not([data-theme="light"]) .sambutan-body h2 { color: var(--ink); }
}
@media (max-width: 820px) {
  .sambutan-wrap { grid-template-columns: 1fr; }
  .sambutan-figure { max-width: 240px; margin: 0 auto; }
}

/* ---------- 4. HALAMAN KOMPETENSI ---------- */
.page-body.program-section { padding-top: clamp(36px, 6vw, 64px); padding-bottom: clamp(44px, 7vw, 80px); }
main section.page[data-page="kompetensi"] .prog-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
@media (max-width: 1100px) { main section.page[data-page="kompetensi"] .prog-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (max-width: 820px)  { main section.page[data-page="kompetensi"] .prog-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (max-width: 520px)  { main section.page[data-page="kompetensi"] .prog-grid { grid-template-columns: 1fr; } }
.prog-grid > .loading-msg { grid-column: 1 / -1; }

/* ---------- 5. EKSTRAKURIKULER (tampilan = kartu program) ---------- */
.ekskul-prog-grid { margin-top: 24px; }
.prog-card--ekskul { --prog-img: none; min-height: 280px; cursor: pointer; padding: 26px 18px 22px; }
.prog-card--ekskul h3 { font-size: 1.15rem; }
.prog-card--ekskul .badge-baru { font-size: 9px; margin-left: 4px; }
.prog-card .prog-pembina { margin: -2px 0 2px; font-size: .9rem; line-height: 1.4; color: rgba(255, 255, 255, .85); text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.prog-card--ekskul:focus-visible { outline: 3px solid var(--orange, #ff6b00); outline-offset: 3px; }
@media (max-width: 820px) { .prog-card--ekskul { min-height: 240px; padding: 20px 12px; } }
@media (max-width: 520px) { .prog-card--ekskul { min-height: 220px; } }

/* ---------- 6. FOOTER + LOKASI ---------- */
footer .location-section.footer-location {
  padding: 0 0 44px;
  margin-bottom: 44px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
footer .footer-location .section-heading { margin-bottom: 26px; }
footer .footer-location .map-embed.home-map iframe { display: block; min-height: 320px; width: 100%; }
footer .footer-location .loc-item a { color: inherit; text-decoration: none; }
footer .footer-location .loc-item a:hover { color: var(--orange, #ff6b00); }
footer .footer-location .location-info { gap: 12px; }
footer .footer-location .loc-item h4::after { display: none; }
footer .footer-location .loc-item h4 { margin-bottom: 4px; }
footer .footer-location .loc-item { padding: 16px 18px; }
.footer-loc-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.footer-loc-actions .footer-loc-btn { flex: 1 1 180px; padding: 12px 16px; font-size: .95rem; text-align: center; }
footer .prog-btn-ghost {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .22);
}
footer .prog-btn-ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* kolom Kontak sudah menyatu di blok lokasi -> grid footer jadi 3 kolom */
footer .grid { grid-template-columns: 1.6fr 1fr 1.5fr; }
@media (max-width: 900px) {
  footer .grid { grid-template-columns: repeat(2, 1fr); }
  footer .grid > .about { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  footer .grid { grid-template-columns: 1fr; }
  footer .footer-location .map-embed.home-map iframe { min-height: 260px; }
  footer .location-section.footer-location { padding-bottom: 32px; margin-bottom: 32px; }
}

/* ---------- 7. Pengaman responsif umum ---------- */
html, body { max-width: 100%; overflow-x: clip; }
img, video, iframe { max-width: 100%; }

/* ---------- 8. Header di HP kecil: muat ikon cari + tema + menu ---------- */
@media (max-width: 480px) {
  .main-nav .container.flex { gap: 6px; }
  .main-nav .nav-search { width: 38px; height: 38px; }
  .main-nav .nav-search .nav-search-btn { flex-basis: 36px; width: 36px; height: 36px; font-size: 15px; }
  .main-nav .theme-toggle, .main-nav .menu-toggle { width: 38px; height: 38px; margin-left: 0; }
  .main-nav .logo-wrap { min-width: 0; flex: 1 1 auto; }
  .main-nav .logo-text { min-width: 0; }
  .logo-text .school-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo-text small { font-size: 10px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
}
@media (max-width: 360px) {
  .logo-text .school-name { font-size: 12.5px; }
  .logo-wrap .logo-media { width: 36px; height: 36px; }
}
