:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color-scheme: light dark;
  --color-bg: #f5f5fa;
  --color-surface: #ffffff;
  --color-primary: #1b2140;
  --color-accent: #6366f1;
  --color-accent-soft: #e0e7ff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --shadow-soft: 0 0.5em 1.5em rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #e5edff 0, var(--color-bg) 55%);
  color: var(--color-text);
}

.visually-hidden {
  position: absolute;
  width: 0.0625em;
  height: 0.0625em;
  padding: 0;
  margin: -0.0625em;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */

.site-header {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.header-inner {
  max-width: 70em;
  margin: 0 auto;
  padding: 1em 1.5em;
  display: flex;
  align-items: center;
  gap: 1.5em;
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.logo-main {
  font-size: 1.25em;
  font-weight: 700;
}

.logo-sub {
  font-size: 0.85em;
  opacity: 0.8;
}

.main-nav {
  margin-inline-start: auto;
}

.nav-list {
  display: flex;
  gap: 1.5em;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-list a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.95em;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: #ffffff;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 0.0625em solid #e5e7eb;
  border-radius: 999em;
  color: #fff;
  padding: 0.4em 0.8em;
  font-size: 1em;
}

.search-form {
  margin-inline-start: 1em;
}

.search-form input {
  border-radius: 999em;
  border: none;
  padding: 0.4em 0.9em;
  font-size: 0.9em;
  min-width: 10em;
}

/* Hero */

.hero {
  max-width: 70em;
  margin: 0 auto;
  padding: 2.5em 1.5em 1.5em;
}

.hero-content h1 {
  font-size: 1.8em;
  margin: 0 0 0.4em;
}

.hero-content p {
  margin: 0;
  font-size: 1em;
  color: var(--color-text-muted);
}

/* Categories */

.categories {
  max-width: 70em;
  margin: 0 auto;
  padding: 1.5em 1.5em 0.5em;
}

.categories h2 {
  font-size: 1.3em;
  margin: 0 0 0.8em;
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
}

.category-btn {
  border-radius: 999em;
  border: 0.0625em solid var(--color-border);
  background: #ffffff;
  padding: 0.4em 1.1em;
  font-size: 0.95em;
  cursor: pointer;
  color: var(--color-text);
}

.category-btn.active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Books */

.books-section {
  max-width: 70em;
  margin: 0 auto;
  padding: 1.5em 1.5em 2.5em;
}

.books-section h2 {
  font-size: 1.4em;
  margin: 0 0 1em;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5em;
}

.book-card {
  background: var(--color-surface);
  border-radius: 1.1em;
  padding: 1.2em 1.2em 1.1em;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}

.book-cover-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

.book-cover-img {
  width: 100%;
  border-radius: 0.9em;
  display: block;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 0.8em 1.8em rgba(15, 23, 42, 0.12);
}

.book-cover-btn:hover .book-cover-img,
.book-cover-btn:focus-visible .book-cover-img {
  transform: translateY(-0.2em);
  box-shadow: 0 1em 2.3em rgba(15, 23, 42, 0.16);
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.book-title {
  font-size: 1.05em;
  margin: 0;
}

.book-subtitle {
  margin: 0;
  font-size: 0.9em;
  color: var(--color-text-muted);
}

.read-btn {
  align-self: flex-start;
  margin-top: 0.4em;
  border-radius: 999em;
  border: none;
  padding: 0.45em 1.2em;
  font-size: 0.9em;
  background: var(--color-accent);
  color: #ffffff;
  cursor: pointer;
}

.read-btn:hover,
.read-btn:focus-visible {
  opacity: 0.92;
}

/* Sections */

.about-section,
.contact-section {
  max-width: 70em;
  margin: 0 auto;
  padding: 1.5em 1.5em;
  border-top: 0.0625em solid var(--color-border);
}

.about-section h2,
.contact-section h2 {
  margin-top: 0;
  font-size: 1.3em;
}

.contact-link {
  display: inline-block;
  margin-top: 0.6em;
  text-decoration: none;
  color: var(--color-accent);
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  max-width: 50em;
  width: 95%;
  max-height: 90vh;
  background: var(--color-surface);
  border-radius: 1.2em;
  box-shadow: var(--shadow-soft);
  padding: 1.2em 1.4em 1.2em;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2em;
}

.modal-close {
  border-radius: 999em;
  border: 0.0625em solid var(--color-border);
  background: #f9fafb;
  width: 2em;
  height: 2em;
  cursor: pointer;
}

.modal-body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.reading-toolbar {
  display: flex;
  gap: 0.6em;
  margin-bottom: 0.2em;
}

.font-btn,
.mode-btn {
  border-radius: 999em;
  border: 0.0625em solid var(--color-border);
  padding: 0.3em 0.9em;
  font-size: 0.85em;
  background: #f9fafb;
  cursor: pointer;
}

.book-content {
  overflow-y: auto;
  padding: 0.8em 0.4em 0.4em;
  font-size: 1em;
}

.book-content p {
  margin-top: 0;
  margin-bottom: 0.9em;
}

/* מצב לילה במודאל */

.modal.dark .modal-dialog {
  background: #0f172a;
  color: #e5e7eb;
}

.modal.dark .book-content {
  color: #e5e7eb;
}

.modal.dark .font-btn,
.modal.dark .mode-btn {
  background: #111827;
  color: #e5e7eb;
}

/* Footer */

.site-footer {
  border-top: 0.0625em solid var(--color-border);
  padding: 1em 1.5em;
  text-align: center;
  font-size: 0.85em;
  color: var(--color-text-muted);
}

/* פוקוס נגיש */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 0.15em solid var(--color-accent);
  outline-offset: 0.1em;
}

/* רספונסיבי */

@media (max-width: 64em) {
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 48em) {
  .header-inner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .main-nav {
    display: none;
    width: 100%;
  }

  .main-nav.open {
    display: block;
  }

  .nav-toggle {
    display: inline-block;
    margin-inline-start: auto;
  }

  .nav-list {
    margin-top: 0.8em;
    flex-direction: column;
    gap: 0.5em;
  }

  .search-form {
    width: 100%;
    margin-inline-start: 0;
    margin-top: 0.8em;
  }

  .search-form input {
    width: 100%;
  }

  .books-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}