/* =========================================================
   Perpustakaan SMK Negeri 8 Surabaya — gaya halaman publik
   Warna diambil dari logo SMKN 8 Surabaya: biru bola dunia & oranye cincin.
   ========================================================= */
:root {
  --primary: #1c4482;
  --primary-600: #25599d;
  --primary-50: #eaf1fa;
  --accent: #f26837;
  --accent-ink: #241005;
  --ink: #14213d;
  --muted: #5b6475;
  --line: #e3e7ef;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --ok: #157a3c;
  --ok-bg: #e5f5ea;
  --warn: #9a5b00;
  --warn-bg: #fff4dc;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(28, 68, 130, .10);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: var(--primary-600); }
a:hover { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- Header ---------- */
.site-header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 0 var(--accent); }
.site-header .bar { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; flex: none; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: .75rem; opacity: .8; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a { color: rgba(255, 255, 255, .88); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .08); box-shadow: inset 0 -3px 0 var(--accent); }
.nav .nav-cta { border: 1.5px solid rgba(255, 255, 255, .35); }
.nav-toggle { display: none; margin-left: auto; background: transparent; border: 1.5px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--primary); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; box-shadow: 0 2px 0 var(--accent); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .brand-text span { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; color: #fff; background: var(--primary) url('/assets/img/gedung-smkn8.jpg') center 45% / cover no-repeat; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(28, 68, 130, .62) 0%, rgba(28, 68, 130, .25) 45%, rgba(28, 68, 130, .78) 100%); }
.hero .container { position: relative; padding-top: 72px; padding-bottom: 96px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; max-width: 720px; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.hero p { font-size: 1.05rem; max-width: 620px; margin: 0 0 24px; opacity: .95; text-shadow: 0 1px 8px rgba(0, 0, 0, .3); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.hero .eyebrow { color: #ffb48f; }

/* ---------- Kotak pencarian ---------- */
.search-box { display: flex; gap: 8px; background: #fff; border-radius: var(--radius); padding: 8px; box-shadow: 0 16px 40px rgba(28, 68, 130, .25); max-width: 720px; }
.search-box input { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 1.05rem; padding: 10px 12px; color: var(--ink); background: transparent; }
.search-box input:focus { outline: none; }
.search-box:focus-within { box-shadow: 0 16px 40px rgba(28, 68, 130, .25), 0 0 0 3px var(--accent); }

/* ---------- Tombol ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.05); color: var(--accent-ink); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary-600); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Bagian ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.5rem; font-weight: 800; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }

/* Statistik di bawah hero */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: -48px; position: relative; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Kartu jurusan */
.jurusan-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.jurusan-card { display: flex; flex-direction: column; gap: 4px; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.jurusan-card:hover { transform: translateY(-3px); border-color: var(--primary-600); box-shadow: var(--shadow); color: var(--ink); }
.jurusan-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.jurusan-icon svg { width: 22px; height: 22px; }
.jurusan-name { font-weight: 700; }
.jurusan-desc { color: var(--muted); font-size: .82rem; line-height: 1.35; }
@media (max-width: 980px) { .jurusan-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .jurusan-grid { grid-template-columns: repeat(2, 1fr); } .jurusan-desc { display: none; } }

/* Kartu buku */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.book-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.book-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.book-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.book-card .title { font-weight: 700; font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .author { color: var(--muted); font-size: .82rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .badge { margin-top: auto; align-self: flex-start; }
@media (max-width: 560px) { .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* Sampul */
.cover { aspect-ratio: 2 / 3; width: 100%; background: var(--primary-50); position: relative; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-ph { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; color: #fff; }
.cover-ph .ph-title { font-weight: 800; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cover-ph .ph-foot { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.cover-ph::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: rgba(0, 0, 0, .15); }

/* Lencana status */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: #eef0f4; color: var(--muted); }

/* ---------- Halaman cari ---------- */
.page-head { background: var(--primary); color: #fff; padding: 28px 0 56px; }
.page-head h1 { font-size: 1.6rem; font-weight: 800; }
.page-head .search-box { margin-top: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: -28px 0 20px; position: relative; }
.filters select, .field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.filters select { box-shadow: var(--shadow); border-color: transparent; }
.result-meta { color: var(--muted); margin: 0 0 12px; }
.result-list { display: flex; flex-direction: column; gap: 12px; }
.result { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--ink); }
.result:hover { box-shadow: var(--shadow); color: var(--ink); }
.result .cover { border-radius: 8px; }
.result .cover-ph { padding: 8px; }
.result .cover-ph .ph-title { font-size: .62rem; -webkit-line-clamp: 4; }
.result .cover-ph .ph-foot { display: none; }
.result h3 { font-size: 1.02rem; margin: 0 0 2px; }
.result .meta { color: var(--muted); font-size: .88rem; }
.result .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: .75rem; background: var(--primary-50); color: var(--primary-600); border-radius: 6px; padding: 2px 8px; font-weight: 600; }
@media (max-width: 640px) {
  .result { grid-template-columns: 64px 1fr; }
  .result .avail { grid-column: 2; }
}
.pager { display: flex; gap: 6px; justify-content: center; margin: 24px 0 0; flex-wrap: wrap; }
.pager button { min-width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.pager button[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }

/* ---------- Detail buku ---------- */
.detail { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.detail .cover { border-radius: var(--radius); box-shadow: var(--shadow); }
.detail h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; }
.meta-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.meta-table th, .meta-table td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.meta-table th { width: 170px; color: var(--muted); font-weight: 500; }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; } .detail .cover { max-width: 200px; } .meta-table th { width: 120px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #f8f9fc; }

/* ---------- Formulir ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(37, 89, 157, .15); }
.alert { border-radius: 10px; padding: 12px 14px; font-weight: 500; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Info & peta ---------- */
.info-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: stretch; }
.info-grid iframe { width: 100%; height: 100%; min-height: 300px; border: 0; border-radius: var(--radius); }
.info-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; }
.info-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.info-list svg { width: 20px; height: 20px; color: var(--primary-600); margin-top: 2px; }
.social { display: flex; gap: 8px; flex-wrap: wrap; }
.social a { border: 1.5px solid var(--primary); color: var(--primary); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-weight: 600; font-size: .9rem; }
.social a:hover { background: var(--primary); color: #fff; }
@media (max-width: 820px) { .info-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary); color: rgba(255, 255, 255, .85); border-top: 4px solid var(--accent); padding: 36px 0 24px; margin-top: 48px; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
.site-footer h3 { color: #fff; font-size: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer .copy { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 24px; padding-top: 16px; font-size: .85rem; }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* Kerangka pemuatan */
.skeleton { background: linear-gradient(90deg, #e9edf4 25%, #f3f5f9 50%, #e9edf4 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
