/* Litenlite Lending Library */

:root {
  --bg:           #fff;
  --border:       #e0e0e0;
  --border-strong:#000;
  --text:         #000;
  --muted:        #666;
  --blue:         #2563eb;
  --red:          #dc2626;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border-strong);
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.logo-img {
  height: 32px;
  width: 32px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
}

.logo-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
}

header nav { display: flex; gap: 4px; }

header nav a {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid transparent;
  text-decoration: none;
}

header nav a:hover { color: var(--text); border-color: var(--border); }
header nav a.active { color: var(--text); border-color: var(--border-strong); }

/* ── Main / Footer ── */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

footer {
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ── Utilities ── */
.muted  { color: var(--muted); }
.small  { font-size: 12px; }
.error  { color: var(--red); font-size: 13px; margin-bottom: 10px; }
.empty  { color: var(--muted); font-style: italic; padding: 24px 0; text-align: center; }

.section { margin-top: 32px; }
.section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.85; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 3px 9px; font-size: 11px; }

/* ── Forms ── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid var(--text);
  outline-offset: -1px;
}

.form-field textarea { resize: vertical; min-height: 60px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 24px;
}

.tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { border-color: var(--border-strong); background: var(--bg); color: var(--text); }

/* ── Home ── */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.home-photo img { width: 100%; max-width: 480px; border-radius: 4px; }

.home-copy h1 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.home-copy h2 { font-size: 18px; font-weight: 700; margin: 24px 0 12px; }
.home-copy p  { margin-bottom: 14px; color: #333; }
.home-copy ol { padding-left: 20px; color: #333; }
.home-copy ol li { margin-bottom: 6px; }

/* ── Book grid (browse) ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.book-card {
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-card:hover .book-title { color: var(--blue); }

.book-cover {
  position: relative;
  aspect-ratio: 3/4;
  background: #f0f0f0;
  overflow: hidden;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ccc;
  background: #f5f5f5;
}

.cover-fallback.large { font-size: 64px; }

.book-info { padding: 0 2px; }
.book-title { font-size: 12px; font-weight: 600; line-height: 1.3; }
.book-author { font-size: 11px; color: var(--muted); margin-top: 2px; }
.book-subtitle { font-size: 12px; color: var(--muted); }

/* ── Search ── */
.search-bar { margin-bottom: 24px; }
.search-bar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-bar input[type=text] {
  border: 1px solid var(--border-strong);
  padding: 7px 12px;
  font-size: 14px;
  font-family: var(--font);
  width: 320px;
  max-width: 100%;
}
.search-bar input:focus { outline: 2px solid var(--text); outline-offset: -1px; }

.search-results { display: flex; flex-direction: column; gap: 1px; }

.result-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color .1s;
}

.result-row:hover { border-color: var(--border-strong); text-decoration: none; }
.result-row img { width: 48px; height: 64px; object-fit: cover; flex-shrink: 0; }

/* ── Book detail ── */
.detail-back { margin-bottom: 20px; font-size: 13px; }
.detail-back a { color: var(--muted); }
.detail-back a:hover { color: var(--text); }

.detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: start;
}

.detail-cover { position: relative; }
.detail-cover img { width: 100%; border-radius: 2px; display: block; }

.detail-body h1 { font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 6px; }
.detail-body .subtitle { font-size: 17px; color: var(--muted); font-weight: 400; margin-bottom: 10px; }
.detail-body .author { font-size: 15px; margin-bottom: 6px; }
.description { margin-top: 16px; color: #333; line-height: 1.7; }

/* ── YouTube links ── */
.yt-list { display: flex; flex-direction: column; gap: 12px; }

.yt-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
}

.yt-thumb { width: 128px; height: 72px; object-fit: cover; flex-shrink: 0; border-radius: 2px; }
.yt-meta { flex: 1; }
.yt-title { font-weight: 600; font-size: 14px; color: var(--blue); }
.yt-title:hover { text-decoration: underline; }

.category-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 4px;
}

/* ── In Memoriam ── */
.memoriam { text-align: center; }
.memoriam img { max-width: 480px; width: 100%; border-radius: 4px; margin-bottom: 24px; }
.memoriam h1 { font-size: 20px; font-weight: 700; }

/* ── Admin ── */
.auth-box { max-width: 360px; margin: 0 auto; }
.auth-box h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.book-list { display: flex; flex-direction: column; gap: 1px; margin-top: 24px; }

.admin-book-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.admin-book-row img { width: 36px; height: 52px; object-fit: cover; flex-shrink: 0; }
.admin-book-info { flex: 1; }

.add-link-form { max-width: 560px; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .home-layout { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-cover { max-width: 200px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  header nav { display: none; }
}
