/* ── RESET & BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0800;
  --surface: #180f00;
  --surface-2: #221500;
  --border: #331e00;
  --accent: #f97316;
  --accent-2: #fb923c;
  --accent-dim: rgba(249, 115, 22, 0.1);
  --accent-glow: rgba(249, 115, 22, 0.18);
  --text: #fdecd8;
  --muted: #9a6840;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 80px;
}

/* ── PAGE WRAPPER ── */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── HEADER ── */
.page-header {
  padding: 48px 0 36px;
  text-align: center;
  position: relative;
}

.back-link {
  position: absolute;
  top: 52px;
  left: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-2);
}

.header-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: var(--accent-dim);
  border: 1px solid rgba(249, 115, 22, 0.28);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.page-header h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.2;
}

.header-sub {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── SEARCH BAR ── */
.search-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

#query {
  padding: 12px 18px;
  width: min(320px, 100%);
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#query::placeholder {
  color: #5a3820;
}

#query:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

#searchbtn {
  padding: 12px 24px;
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--accent);
  color: #0d0800;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition:
    opacity 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.28);
  white-space: nowrap;
}

#searchbtn:hover {
  opacity: 0.88;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.38);
}

/* ── BOOK GRID ── */
#container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
}

/* ── BOOK CARD ── */
.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.book-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.book-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

/* ── BOOK INFO ── */
.book-info {
  padding: 16px;
}

.book-info h3 {
  font-family: "Syne", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-2);
  margin-bottom: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-info p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.5;
}

.book-info p strong {
  color: #c07848;
  font-weight: 600;
}

/* ── STATES ── */
.message {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1rem;
  color: #6a4020;
  padding: 60px 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .back-link {
    position: static;
    display: block;
    margin-bottom: 20px;
    text-align: left;
  }
  .page-header {
    padding-top: 28px;
  }
  #container {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (max-width: 380px) {
  #container {
    grid-template-columns: 1fr;
  }
}
