@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

:root {
  --red: #A31E22;
  --red-dark: #7E1518;
  --gold: #C9A24B;
  --gold-light: #E5CD8C;
  --cream: #FAF6EC;
  --ink: #2B1B12;
}

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

/* Direction comes from the dir attribute on <html>, which follows the interface language
   (middleware/locale.js). Everything below uses logical properties so the layout mirrors itself. */
body {
  font-family: 'Cairo', sans-serif;
  background: var(--cream);
  color: var(--ink);
  /* Keeps the footer at the bottom of the viewport when a page has little content. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body { flex: 1 0 auto; }

a { color: inherit; text-decoration: none; }

.topbar {
  background: var(--red);
  border-bottom: 4px solid var(--gold);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* The logo JPG has a white background, so it sits on a white tile rather than straight on the red bar. */
.brand-mark {
  width: 52px;
  height: 52px;
  padding: 4px;
  object-fit: contain;
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 6px;
}

.brand h1 {
  color: var(--gold-light);
  font-size: 22px;
  font-weight: 900;
}

.brand span {
  color: var(--cream);
  font-size: 13px;
  display: block;
  opacity: .85;
}

.search-box {
  display: flex;
  gap: 0;
}

.search-box input {
  border: 2px solid var(--gold);
  padding: 9px 14px;
  font-family: inherit;
  min-width: 220px;
  background: var(--cream);
}

.search-box button {
  background: var(--gold);
  border: 2px solid var(--gold);
  color: var(--red-dark);
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
}

/* Round only the two outer corners and drop the seam between the pair — works whichever
   element comes first in the markup, and mirrors with the reading direction. */
.search-box > :first-child,
.newsletter-form > :first-child {
  border-start-start-radius: 6px;
  border-end-start-radius: 6px;
}

.search-box > :last-child,
.newsletter-form > :last-child {
  border-start-end-radius: 6px;
  border-end-end-radius: 6px;
  border-inline-start: none;
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-greeting {
  color: var(--gold-light);
  font-size: 14px;
  font-weight: 600;
}

.btn-account {
  display: inline-block;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold-light);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-account:hover {
  background: var(--gold);
  color: var(--red-dark);
}

.lang-btn { min-width: 78px; }

.btn-account.gold {
  background: var(--gold);
  color: var(--red-dark);
}

.btn-account.gold:hover {
  background: var(--gold-light);
}

.form-alt {
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
  color: #7a6a55;
}

.form-alt a {
  color: var(--red);
  font-weight: 700;
}

.arch-divider {
  height: 14px;
  background:
    linear-gradient(135deg, var(--gold) 25%, transparent 25%) -7px 0,
    linear-gradient(225deg, var(--gold) 25%, transparent 25%) -7px 0;
  background-size: 14px 14px;
  background-color: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  max-width: 1180px;
  margin: 32px auto;
  padding: 0 24px;
  align-items: start;
}

.categories-panel {
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 10px;
  overflow: hidden;
}

.categories-panel h2 {
  background: var(--red);
  color: var(--gold-light);
  padding: 12px 16px;
  font-size: 15px;
}

.categories-panel ul { list-style: none; }

.categories-panel li a {
  display: block;
  padding: 11px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.categories-panel li a:hover,
.categories-panel li.active a {
  background: var(--gold-light);
  color: var(--red-dark);
  font-weight: 700;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 22px;
}

.book-card {
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 10px 10px 50% 50% / 10px 10px 22px 22px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(163, 30, 34, .18);
}

.book-cover {
  height: 230px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.book-cover .placeholder {
  color: var(--gold-light);
  font-size: 13px;
  padding: 10px;
  text-align: center;
}

.book-info { padding: 14px 16px; }

.book-info h3 { font-size: 16px; margin-bottom: 4px; }

.book-info .author { font-size: 13px; color: #7a6a55; margin-bottom: 8px; }

/* Prices are hidden for now; kept for when they come back. */
.book-info .price {
  display: inline-block;
  background: var(--gold);
  color: var(--red-dark);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 20px;
}

.book-info .category-tag {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: #9b8a70;
}

.book-detail {
  width: min(820px, 100% - 48px);
  margin: 32px auto;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  padding: 30px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}

.book-detail .cover {
  border-radius: 6px;
  overflow: hidden;
  border: 3px solid var(--gold);
}

.book-detail .cover img { width: 100%; display: block; }

.book-detail h1 { font-size: 26px; margin-bottom: 6px; }

.book-detail .meta { color: #7a6a55; margin-bottom: 16px; }

.book-detail .summary { line-height: 1.9; margin-bottom: 20px; }

.back-link {
  display: inline-block;
  margin: 20px 24px;
  color: var(--red);
  font-weight: 700;
}

footer {
  text-align: center;
  padding: 22px;
  color: #9b8a70;
  font-size: 13px;
  border-top: 3px solid var(--gold-light);
  margin-top: 40px;
}

.admin-page { max-width: 960px; margin: 30px auto; padding: 0 20px; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.btn {
  display: inline-block;
  background: var(--red);
  color: var(--cream);
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  font-family: inherit;
  /* <button>s default to a smaller size than the <a> buttons beside them. */
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn.gold { background: var(--gold); color: var(--red-dark); }
.btn.danger { background: #7a2020; }

table { width: 100%; border-collapse: collapse; background: #fff; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 560px; }
th, td { padding: 10px 14px; border-bottom: 1px solid #eee; text-align: start; font-size: 14px; }
th { background: var(--red); color: var(--gold-light); }

form.stacked label { display: block; margin: 14px 0 6px; font-weight: 700; font-size: 14px; }

form.stacked input, form.stacked textarea, form.stacked select {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--gold-light);
  border-radius: 6px;
  font-family: inherit;
}

form.stacked textarea { min-height: 120px; }

.login-box {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  padding: 30px;
}

.error-msg { color: #a31e22; margin-top: 10px; font-size: 14px; }
.notice-msg { color: #2f6b3a; margin-top: 10px; font-size: 14px; }

/* --- one-time code pages (sign-in verification, password reset / change) --- */

.otp-hint {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.8;
  color: #7a6a55;
}

/* The code is digits only, so it reads left-to-right even on these RTL pages. */
.otp-input {
  direction: ltr;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 8px;
}

/* "Resend the code" — a form button that has to look like the links beside it. */
.link-btn {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  text-decoration: underline;
  cursor: pointer;
}

.form-aside {
  margin-top: 8px;
  font-size: 13px;
  text-align: end;
}

.form-aside a { color: var(--red); font-weight: 700; }

/* --- main nav (header) --- */

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  color: var(--cream);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  border-bottom: 3px solid transparent;
}

.main-nav a:hover { color: var(--gold-light); }

.main-nav a.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

/* --- house tagline (home page banner) --- */

.tagline-hero {
  /* Same width as the content column below (1180px minus its 24px padding), with a gutter on narrower screens. */
  width: min(1132px, 100% - 48px);
  margin: 28px auto 0;
  padding: 30px 28px;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  text-align: center;
}

.tagline-main {
  font-size: 26px;
  font-weight: 900;
  color: var(--red);
  line-height: 1.7;
}

/* Small gold rule between the two lines. */
.tagline-main::after {
  content: '';
  display: block;
  width: 90px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 14px auto;
}

.tagline-sub {
  font-size: 16px;
  color: #5c4a3a;
  line-height: 1.9;
  max-width: 620px;
  margin: 0 auto;
}

/* --- featured slideshow (home page) --- */

.featured {
  max-width: 1180px;
  margin: 26px auto 0;
  padding: 0 24px;
}

.featured-title {
  font-size: 20px;
  color: var(--red);
  margin-bottom: 14px;
  padding-inline-start: 14px;
  border-inline-start: 5px solid var(--gold);
}

.slider {
  position: relative;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  overflow: hidden;
}

.slides {
  display: grid;
  /* Every slide sits in the same cell, so the box keeps the height of the tallest one
     and nothing jumps when the slide changes. */
  align-items: stretch;
}

.slide {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  /* The side padding is the arrows' lane, so they never cover the book or the text. */
  padding: 24px 64px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease;
}

.slide.active {
  opacity: 1;
  visibility: visible;
}

.slide-cover {
  height: 240px;
  border: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slide-cover img { width: 100%; height: 100%; object-fit: cover; }

.slide-cover .placeholder {
  color: var(--gold-light);
  font-size: 14px;
  padding: 12px;
  text-align: center;
}

.slide-body { align-self: center; }

.slide-rank {
  display: inline-block;
  background: var(--red);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.slide-body h3 { font-size: 24px; margin-bottom: 6px; }

.slide-author { font-size: 14px; color: #7a6a55; margin-bottom: 12px; }

.slide-summary {
  line-height: 1.9;
  color: #5c4a3a;
  margin-bottom: 14px;
  /* Long summaries are cut to four lines so every slide stays about the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Unused while prices are hidden — see .book-info .price above. */
.slide .price {
  display: inline-block;
  background: var(--gold);
  color: var(--red-dark);
  font-weight: 700;
  font-size: 14px;
  padding: 5px 14px;
  border-radius: 20px;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  background: rgba(163, 30, 34, .85);
  border: 2px solid var(--gold);
  color: var(--gold-light);
  font-size: 22px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s;
}

.slider-arrow:hover { background: var(--red); }

.slider-arrow.prev { inset-inline-start: 12px; }
.slider-arrow.next { inset-inline-end: 12px; }

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 0 14px;
}

.slider-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.slider-dots button.active { background: var(--gold); }

.admin-hint {
  color: #7a6a55;
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 18px;
}

/* --- content pages (about, contact) --- */

.page {
  max-width: 900px;
  margin: 32px auto 48px;
  padding: 0 24px;
}

.page-hero {
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  padding: 34px 30px;
  text-align: center;
}

.page-kicker {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
}

.page-hero h1 {
  font-size: 30px;
  color: var(--red);
  margin-bottom: 14px;
}

.page-hero h1::after {
  content: '';
  display: block;
  width: 70px;
  height: 3px;
  background: var(--gold);
  margin: 12px auto 0;
  border-radius: 2px;
}

.lead {
  line-height: 2;
  font-size: 16px;
  color: #5c4a3a;
  max-width: 680px;
  margin: 0 auto;
}

.page-section { margin-top: 36px; }

.page-section h2 {
  font-size: 22px;
  color: var(--red);
  margin-bottom: 18px;
  padding-inline-start: 14px;
  border-inline-start: 5px solid var(--gold);
}

.stockists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.stockist-card {
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 10px;
  overflow: hidden;
}

.stockist-card h3 {
  background: var(--red);
  color: var(--gold-light);
  font-size: 15px;
  padding: 10px 16px;
}

.stockist-card ul { list-style: none; padding: 8px 0; }

.stockist-card li {
  font-size: 14px;
  padding: 7px 16px;
  color: #5c4a3a;
}

.stockist-card li + li { border-top: 1px solid #f1ece0; }

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.contact-card {
  display: block;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 10px;
  padding: 20px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.contact-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 8px 18px rgba(163, 30, 34, .14);
}

.contact-label {
  display: block;
  font-size: 13px;
  color: #9b8a70;
  margin-bottom: 6px;
}

.contact-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--red);
  word-break: break-word;
}

.page-cta {
  margin-top: 36px;
  background: var(--red);
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 34px 30px;
  text-align: center;
  color: var(--cream);
}

.page-cta h2 {
  color: var(--gold-light);
  font-size: 22px;
  margin-bottom: 12px;
}

.page-cta p {
  line-height: 1.9;
  max-width: 620px;
  margin: 0 auto 22px;
  opacity: .92;
}

/* --- site footer --- */

.site-footer {
  background: var(--red);
  border-top: 4px solid var(--gold);
  color: var(--cream);
  margin-top: 48px;
  /* overrides the plain `footer` rule above, which the admin pages still use */
  padding: 0;
  font-size: 15px;
  text-align: start;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 26px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 30px;
}

.footer-col h3 {
  color: var(--gold-light);
  font-size: 16px;
  margin-bottom: 10px;
}

.footer-col p {
  font-size: 14px;
  opacity: .85;
  margin-bottom: 14px;
}

.newsletter-form { display: flex; }

.newsletter-form input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--gold);
  padding: 9px 14px;
  font-family: inherit;
  background: var(--cream);
  color: var(--ink);
}

.newsletter-form button {
  background: var(--gold);
  border: 2px solid var(--gold);
  color: var(--red-dark);
  font-family: inherit;
  font-weight: 700;
  padding: 9px 18px;
  cursor: pointer;
}

.newsletter-form button:hover { background: var(--gold-light); }

.newsletter-msg { font-size: 13px; margin-top: 10px; margin-bottom: 0; opacity: 1; }
.newsletter-msg.ok { color: var(--gold-light); font-weight: 600; }
.newsletter-msg.error { color: #F6C1C1; font-weight: 600; }

.footer-links { list-style: none; }

.footer-links li { margin-bottom: 8px; }

.footer-links a { font-size: 14px; opacity: .9; }
.footer-links a:hover { color: var(--gold-light); opacity: 1; }

.social-link {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  margin-bottom: 10px;
  opacity: .9;
  word-break: break-word;
}

.social-link:hover { color: var(--gold-light); opacity: 1; }

.social-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: var(--gold);
}

.footer-bottom {
  border-top: 1px solid rgba(229, 205, 140, .3);
  padding: 16px 24px;
  text-align: center;
  font-size: 13px;
  opacity: .8;
}

/* Tablets and small laptops: the header does not fit on one row, so it gets two planned ones —
   logo and account buttons, then search and page links — instead of wrapping wherever it runs out. */
@media (min-width: 721px) and (max-width: 1100px) {
  .topbar { row-gap: 0; }
  .topbar::after { content: ""; order: 2; flex-basis: 100%; height: 12px; }
  .account-nav { order: 1; }
  .search-box { order: 3; }
  .main-nav { order: 4; }
}

@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  /* Header: kept compact so the page content starts within the first screen. */
  .topbar { justify-content: center; padding: 12px 16px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-mark { width: 42px; height: 42px; }
  .brand h1 { font-size: 19px; }
  .brand span { font-size: 12px; }
  /* Logo and search share the first row; the search box takes whatever width the logo leaves. */
  .search-box { flex: 1; min-width: 0; }
  .search-box input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; }
  .search-box button { padding: 8px 12px; }
  .main-nav { order: 2; width: 100%; flex-wrap: wrap; justify-content: center; }
  .main-nav a { padding: 6px 10px; }
  .account-nav { order: 3; width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px; }
  /* The sign-out button already shows the visitor is signed in; the greeting would push the buttons onto two rows. */
  .account-greeting { display: none; }
  .btn-account { white-space: nowrap; font-size: 13px; padding: 6px 12px; }
  .lang-btn { min-width: 0; }

  /* minmax(0, 1fr): the scrolling category row must not widen the column past the screen. */
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 20px auto; padding: 0 16px; }

  /* Categories become one row of chips that scrolls sideways, instead of a tall list above the books. */
  .categories-panel { background: none; border: 0; border-radius: 0; overflow: visible; }
  .categories-panel h2 {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .categories-panel ul { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .categories-panel ul::-webkit-scrollbar { display: none; }
  .categories-panel li a {
    white-space: nowrap;
    background: #fff;
    border: 2px solid var(--gold-light);
    border-radius: 20px;
    padding: 6px 14px;
  }

  /* Two books per row, with covers in book proportions. */
  .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .book-cover { height: auto; aspect-ratio: 2 / 3; }
  .book-info { padding: 10px 12px; }
  .book-info h3 { font-size: 14px; }
  .book-info .author { font-size: 12px; margin-bottom: 4px; }

  .back-link { margin: 16px; }
  .book-detail { grid-template-columns: 1fr; width: auto; margin: 0 16px 24px; padding: 18px; gap: 18px; }
  .book-detail .cover { justify-self: center; width: min(220px, 100%); }
  .book-detail h1 { font-size: 22px; }

  .login-box { margin: 32px 16px; padding: 22px; }
  .admin-page { padding: 0 16px; }
  .admin-header { flex-wrap: wrap; gap: 12px; }
  /* Footer: one centred column — newsletter panel, a row of links, a row of round icons. */
  .site-footer { text-align: center; margin-top: 32px; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; padding: 26px 16px 20px; }
  .footer-newsletter {
    background: rgba(0, 0, 0, .12);
    border: 1px solid rgba(229, 205, 140, .35);
    border-radius: 12px;
    padding: 18px 16px;
  }
  .footer-newsletter p { margin-bottom: 12px; }
  /* The same links are in the header nav, a scroll away. */
  .footer-nav { display: none; }
  /* "تابعنا" sits on the same row as the icons, before them in reading order. */
  .footer-social { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; }
  .footer-social h3 { margin: 0; margin-inline-end: 4px; }
  .social-link {
    width: 46px;
    height: 46px;
    margin: 0;
    justify-content: center;
    border: 2px solid var(--gold);
    border-radius: 50%;
    opacity: 1;
  }
  .social-link:hover { background: var(--gold); }
  .social-link:hover svg { fill: var(--red-dark); }
  .social-link svg { width: 22px; height: 22px; }
  /* Icon-only on phones; the handle, number and address stay readable to screen readers and on the contact page. */
  .social-link span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .footer-bottom { padding: 14px 16px; font-size: 12px; }
  .page-hero h1 { font-size: 24px; }
  .tagline-hero { width: auto; margin: 20px 16px 0; padding: 24px 18px; }
  .tagline-main { font-size: 20px; }
  .tagline-sub { font-size: 15px; }
  .featured { padding: 0 16px; }
  .slide { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  /* A book-shaped cover in the middle, with the arrows level with it on either side, clear of the text. */
  .slide-cover { justify-self: center; width: 160px; }
  .slide-body { padding-inline-end: 0; }
  .slide-body h3 { font-size: 20px; }
  .slider-arrow { top: 138px; }
  .slider-arrow.prev { inset-inline-start: 6px; }
  .slider-arrow.next { inset-inline-end: 6px; }
}

/* --- admin: site preview dialog --- */

.site-preview {
  width: min(1280px, 96vw);
  height: 92vh;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 3px solid var(--gold);
  border-radius: 10px;
  background: var(--cream);
  overflow: hidden;
}
.site-preview[open] { display: flex; flex-direction: column; }
.site-preview::backdrop { background: rgba(43, 27, 18, 0.6); }

.site-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--red);
  color: var(--cream);
}
.site-preview-sizes, .site-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.site-preview-sizes .btn[aria-pressed="false"] { background: transparent; color: var(--gold-light); box-shadow: inset 0 0 0 2px var(--gold); }

.site-preview-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  background: #e9e1cf;
  overflow: auto;
}
.site-preview-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.site-preview[data-size="mobile"] .site-preview-stage { padding: 16px 0; }
.site-preview[data-size="mobile"] .site-preview-stage iframe {
  width: 390px;
  max-width: 100%;
  border: 2px solid var(--ink);
  border-radius: 16px;
}

/* The narrowest phones (320–360px): tighter header so the account buttons stay on one row. */
@media (max-width: 360px) {
  .topbar { padding: 10px 12px; }
  .btn-account { padding: 5px 9px; font-size: 12px; }
  .main-nav a { padding: 6px 8px; font-size: 14px; }
}

/* --- admin: newsletter dialog (subscribers page) --- */

.admin-notice {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border-inline-start: 4px solid;
}
.admin-notice.ok { background: #EAF3EC; color: #2f6b3a; border-color: #2f6b3a; }
.admin-notice.error { background: #FBECEC; color: var(--red-dark); border-color: var(--red); }

.newsletter-dialog {
  width: min(760px, 96vw);
  max-width: none;
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 3px solid var(--gold);
  border-radius: 10px;
  background: var(--cream);
  overflow: hidden;
}
.newsletter-dialog[open] { display: flex; }
.newsletter-dialog::backdrop { background: rgba(43, 27, 18, 0.6); }

/* The form is the dialog's only child: it carries the column layout so the list scrolls
   between a fixed bar and a fixed footer. */
.newsletter-dialog form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 92vh;
}

.newsletter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--red);
  color: var(--cream);
}
.newsletter-bar span { font-size: 13px; color: var(--gold-light); }

.newsletter-body { padding: 16px; overflow: auto; }

.newsletter-field { display: block; margin-bottom: 14px; }
.newsletter-field span { display: block; margin-bottom: 6px; font-size: 13px; color: #7a6a55; }
.newsletter-field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 8px;
  resize: vertical;
}
.newsletter-field textarea:focus { outline: none; border-color: var(--gold); }

.newsletter-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.newsletter-tools input {
  flex: 1 1 220px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 8px;
}
.newsletter-tools input:focus { outline: none; border-color: var(--gold); }

.newsletter-list {
  display: grid;
  gap: 10px;
  max-height: 42vh;
  overflow: auto;
  padding: 4px;
}

.newsletter-book {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border: 2px solid var(--gold-light);
  border-radius: 8px;
  cursor: pointer;
}
.newsletter-book:hover { border-color: var(--gold); }
/* :has() lets the whole row show the ticked state, with no script involved. */
.newsletter-book:has(input:checked) { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.newsletter-book input { width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.newsletter-book img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gold-light);
  flex: none;
}
.newsletter-book-nocover {
  width: 44px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 10px;
  color: #7a6a55;
  background: var(--cream);
  border: 1px dashed var(--gold-light);
  border-radius: 4px;
  flex: none;
}
.newsletter-book-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.newsletter-book-text strong { font-size: 15px; }
.newsletter-book-text span { font-size: 13px; color: #55463a; }
.newsletter-book-meta { font-size: 12px !important; color: #7a6a55 !important; }

.newsletter-empty { padding: 20px; text-align: center; font-size: 14px; color: #7a6a55; }

.newsletter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  border-top: 2px solid var(--gold-light);
}
.newsletter-footer span { font-size: 14px; font-weight: 600; }
.newsletter-footer .btn[disabled] { opacity: .5; cursor: not-allowed; }

@media (max-width: 520px) {
  .newsletter-list { max-height: 38vh; }
  .newsletter-footer { justify-content: center; }
}
