/* booklinkbg.space: черно-бяла типографска визия. Само черно и бяло,
   без сиви тонове, без рамки, без икони. Мобилен изглед на първо място. */

:root {
  --black: #000;
  --white: #fff;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 4rem;
}
main { flex: 1 0 auto; }

::selection { background: var(--black); color: var(--white); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.wrap { width: 95%; max-width: 1300px; margin: 0 auto; }

h1, h2, h3 { line-height: 1.2; font-family: var(--serif); }
h1 { font-size: 1.7rem; margin: 0.5rem 0; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.08rem; margin: 0; }

a { color: var(--black); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

em { font-style: normal; font-weight: 700; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Полета и бутони: плътни черни блокове, без рамки. */
input[type="search"], input[type="text"], input[type="url"],
input[type="email"], input[type="password"], select, textarea {
  background: var(--white);
  color: var(--black);
  caret-color: var(--black);
  border: 1px solid var(--black);
  border-radius: 0;
  padding: 0.6rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}
::placeholder { color: var(--black); font-style: italic; opacity: 1; }

button, .button {
  display: inline-block;
  background: var(--black);
  color: var(--white);
  border: 0;
  border-radius: 0;
  padding: 0.6rem 1.2rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
button:hover, .button:hover { text-decoration: underline; }

/* Заглавна част: бяла лента, само с долна черна рамка. */
.site-header {
  background: var(--white);
  color: var(--black);
  border-bottom: 1px solid var(--black);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.header-inner {
  width: 95%;
  max-width: 95%;
  margin: 0 auto;
  padding: 0.9rem 0;
  font-family: var(--serif);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--black);
  text-decoration: none;
}
.logo:hover { text-decoration: underline; }

/* Хамбургер бутон (виден под 1200px). */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--black);
  padding: 0.2rem;
  cursor: pointer;
}
.nav-toggle:hover { text-decoration: none; }
.icon-menu { display: block; }

/* Под 1200px навигацията е падащо меню под лентата. */
.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  background: var(--white);
  border-bottom: 1px solid var(--black);
  font-family: var(--sans);
  font-size: 1.05rem;
}
.site-nav.is-open { display: flex; }
.site-nav a {
  color: var(--black);
  text-decoration: none;
  padding: 0.85rem 2.5%;
}
.site-nav a + a { border-top: 1px solid var(--black); }
.site-nav a:hover { text-decoration: underline; }
.nav-cta { font-weight: 700; }

/* Начална страница */
.hero { text-align: center; padding: 7.4rem 0 7rem; }
.hero h1 { font-size: 2rem; margin: 0 auto; }
.hero-sub { margin: 0.8rem auto 1.5rem; }

.search-form { display: flex; gap: 0.6rem; max-width: 42rem; margin: 0 auto; }
.search-form input[type="search"] { flex: 1; min-width: 0; }
.search-form input[type="search"], .search-form button {
  font-size: 1.1rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--black);
}
.search-form button { display: inline-flex; align-items: center; justify-content: center; }
.icon-search { display: block; }
.search-page { margin: 0 0 8vw; }

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6vw;
  margin: 2.5rem 0;
}
.tile {
  display: block;
  text-decoration: none;
  color: var(--black);
}
.tile:hover h2 { text-decoration-thickness: 2px; }
.tile h2 { margin: 0 0 0.3rem; font-size: 1.5rem; text-decoration: underline; text-underline-offset: 4px; }
.tile p { margin: 0 0 0.5rem; font-size: 1.2rem; }
.tile-count { font-family: var(--sans); font-size: 0.85rem; font-weight: 700; }

/* Категорийни страници */
.category-head { margin-top: 5rem; padding: 0 0 0.4rem; }
.category-head p { max-width: 40rem; margin: 0.3rem 0 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
  margin: 0 0 8vw;
  font-family: var(--sans);
}
.filters label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; }
.filters .filter-q { flex: 1 1 12rem; order: 1; }
.filters input[type="search"], .filters select { max-width: 100%; }
.filters input[type="search"], .filters select, .filters-submit, .filters-toggle { height: 2.75rem; }
.filters-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--black);
  padding: 0.6rem 1.2rem;
  order: 2;
}

/* Под 1200px: филтрите (без търсенето) са в сгъваем панел „Филтри". */
.filters-toggle {
  order: 3;
  flex: 1 1 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.filters-toggle:hover { text-decoration: underline; }
.filters-fields {
  order: 4;
  flex: 1 1 100%;
  display: none;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}
.filters.is-open .filters-fields { display: grid; }
.filters-fields select { width: 100%; }

.result-count { font-family: var(--sans); font-size: 0.88rem; font-weight: 600; }

/* Карти: разделяне чрез типография и въздух, без рамки. */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(3rem, 6vw, 80px);
  margin: 1.2rem 0 2.5rem;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.card-head h3 { font-size: 1.5rem; }
.badge {
  font-family: var(--sans);
  font-size: 0.72rem;
  background: var(--black);
  color: var(--white);
  padding: 0.16rem 0.55rem;
  white-space: nowrap;
}
.card-desc { margin: 0.35rem 0; font-size: 1.2rem; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  margin-top: 0.35rem;
}
.meta-item.tag { font-style: italic; }
.cat-chip { font-weight: 700; }

/* Наскоро добавени */
.recent { margin-top: 7.4rem; }
.recent h2 {
  border-bottom: 1px solid var(--black);
  padding-bottom: 0.5rem;
  margin-bottom: 3rem;
}

.extra-links, .report-box { margin-top: 0.55rem; font-family: var(--sans); font-size: 0.85rem; }
.extra-links summary, .report-box summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.extra-links summary::-webkit-details-marker, .report-box summary::-webkit-details-marker { display: none; }
.extra-links ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.report-form { display: flex; gap: 0.5rem; margin-top: 0.55rem; flex-wrap: wrap; }
.report-form input[type="text"] { flex: 1; min-width: 12rem; font-size: 0.85rem; padding: 0.45rem 0.7rem; }
.report-form button { font-size: 0.85rem; padding: 0.45rem 0.9rem; }
.report-thanks { font-family: var(--sans); font-size: 0.85rem; font-weight: 700; margin: 0.5rem 0 0; }

/* Скрито поле срещу ботове */
.hp { position: absolute; left: -6000px; top: auto; width: 1px; height: 1px; opacity: 0; }

/* Търсене */
.search-group h2 { font-size: 1.25rem; margin-top: 2.2rem; }

/* Форми */
.submit-page { max-width: 38rem; margin: 0 auto; }
.submit-form {
  margin: 1.4rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-family: var(--sans);
}
.submit-form .button { font-size: 1.3rem; }
.submit-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 600; }
.submit-form input, .submit-form select, .submit-form textarea { font-weight: 400; font-size: 1rem; }
.submit-form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.form-row label { min-width: 0; }
.form-note { font-size: 0.82rem; font-style: italic; font-weight: 400; margin: 0; }

.flash {
  font-family: var(--sans);
  background: var(--black);
  color: var(--white);
  padding: 0.7rem 1rem;
  margin: 0.8rem 0 0;
  font-size: 0.92rem;
}

.empty-state { font-style: italic; }

/* Долна част: пълна ширина, само с горна черна рамка. */
.site-footer {
  background: var(--white);
  color: var(--black);
  border-top: 1px solid var(--black);
  margin-top: 7.4rem;
  padding: 1.6rem 0 2rem;
  font-family: var(--sans);
  font-size: 1rem;
}
.site-footer a, .footer-links a { color: var(--black); }
.site-footer .wrap {
  width: 95%;
  max-width: 95%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}
.site-footer p { margin: 0; }
.footer-credit p + p { margin-top: 0.15rem; }
.footer-tagline { font-size: 0.85rem; opacity: 0.6; }
.footer-links { margin-left: auto; }

/* Администрация */
.admin-nav {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 1.6rem 0 0;
}
.admin-nav a { text-decoration: none; }
.admin-nav a:hover { text-decoration: underline; }
.inline-form { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--black);
  font-family: var(--sans);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-button:hover { text-decoration-thickness: 2px; }
.link-danger { font-weight: 700; }
.muted { font-style: italic; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.4rem 0;
  font-family: var(--sans);
}
.stat { color: var(--black); text-decoration: none; }
.stat strong { display: block; font-size: 2rem; font-family: var(--serif); line-height: 1.1; }
.stat span { font-size: 0.82rem; }
a.stat:hover strong { text-decoration: underline; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.88rem;
}
.admin-table th {
  background: var(--black);
  color: var(--white);
  text-align: left;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
}
.admin-table td { padding: 0.65rem 0.8rem; vertical-align: top; }
.badge-warn { font-weight: 700; }
.row-actions { white-space: nowrap; }

.queue-list { display: flex; flex-direction: column; gap: 1.8rem; margin: 1.2rem 0 2.5rem; }
.queue-url { font-family: var(--sans); font-size: 0.82rem; word-break: break-all; margin: 0.2rem 0; }
.queue-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; font-family: var(--sans); font-size: 0.8rem; align-items: center; }
.queue-actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; flex-wrap: wrap; align-items: center; }
.button-quiet { background: var(--black); color: var(--white); }
.admin-login { max-width: 24rem; }

/* По-широки екрани */
@media (min-width: 640px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.6rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .filters .filter-q { flex: 2 1 14rem; }
}

@media (min-width: 960px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
}

/* От 1275px нагоре: навигацията е в лентата, без хамбургер. */
@media (min-width: 1275px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 1.9rem;
    background: none;
    border-bottom: 0;
    font-size: 1rem;
  }
  .site-nav a { padding: 0; white-space: nowrap; }
  .site-nav a + a { border-top: 0; }

  /* Филтрите се показват в един ред, без сгъване. */
  .filters-toggle { display: none; }
  .filters-fields { display: contents; }
  .filters-fields > label { order: 5; }
  .filters-submit { order: 10; }
}

/* По-тесни екрани: повече странично поле и по-компактен вертикален ритъм. */
@media (max-width: 639px) {
  .wrap, .header-inner, .site-footer .wrap { width: 90%; max-width: 90%; }
  .header-inner { padding: 0.75rem 0; }
  .site-nav a { padding-left: 5%; padding-right: 5%; }
  .hero { padding: 3.5rem 0 3rem; }
  .hero h1 { font-size: 1.8rem; }
  .recent { margin-top: 4rem; }
  .recent h2 { margin-bottom: 1.8rem; }
  .category-head { margin-top: 3rem; }
  .site-footer { margin-top: 4rem; }
}
