/*
 * The bar, the footer, the search box and the Reyuko promo — every page on the
 * site uses this one file, so the chrome cannot drift between the landing page
 * and the generated book pages. Colours come from whatever palette the page
 * itself defines (--bg, --fg, --muted, --card, --line, --green).
 *
 * It also sets the two things every page must agree on: one column width and
 * one typeface. The chapters therefore read in the site's sans, not the serif
 * their print edition used — deliberately, so no page looks like a different
 * website.
 */
:root {
  --page: 880px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { font-family: var(--font); }

/* ---------------------------------------------------------------- nav */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--page); margin: 0 auto; padding: 11px 22px;
  display: flex; align-items: center; gap: 16px;
}
.site-nav .brand {
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  font-weight: 700; text-decoration: none; color: inherit;
  font-size: 17px; letter-spacing: -.01em;
}
.site-nav .brand img { width: 28px; height: 28px; border-radius: 7px; margin: 0; display: block; }

.nav-menu { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-menu > a {
  text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.nav-menu > a:hover { color: var(--fg); background: var(--card); }
.nav-menu > a.cta {
  background: var(--green); color: #fff; font-weight: 600; padding: 9px 18px; margin-left: 4px;
}
.nav-menu > a.cta:hover { background: color-mix(in srgb, var(--green) 82%, #000); color: #fff; }

/* the three stacked lines; only ever visible on a narrow screen */
.nav-toggle {
  display: none; margin-left: auto; width: 42px; height: 38px;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; padding: 0;
}
.nav-toggle span {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--fg);
  transition: transform .2s, opacity .15s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px; margin: 0;
    padding: 10px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .1);
  }
  .site-nav.is-open .nav-menu { display: flex; }
  .nav-menu > a { padding: 12px 10px; font-size: 16px; border-radius: 10px; }
  .nav-menu > a.cta { margin: 6px 0 0; text-align: center; padding: 13px 18px; }
}

/* ---------------------------------------------------------------- search */
.search { position: relative; display: flex; align-items: center; }
.search input {
  width: 168px; font: inherit; font-size: 14px; padding: 8px 13px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: inherit; transition: width .18s, border-color .18s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { width: 220px; outline: none; border-color: var(--green); }
@media (max-width: 820px) {
  .search { order: -1; margin-bottom: 6px; }
  .search input, .search input:focus { width: 100%; }
}

.search-results {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  width: min(360px, calc(100vw - 40px));
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .13);
  overflow: hidden; display: none; text-align: left;
}
.search.is-open .search-results { display: block; }
@media (max-width: 820px) { .search-results { left: 0; width: auto; } }
.search-results a {
  display: block; padding: 11px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line); margin: 0;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--card); }
.search-results b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.search-results span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.search-empty { margin: 0; padding: 14px 16px; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- promo */
.promo {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px;
  background: var(--card); margin: 56px auto 0;
  max-width: var(--page); font-family: var(--font);
}
.promo-mark { width: 54px; height: 54px; flex: none; border-radius: 14px; display: block; margin: 0; }
.promo-body { flex: 1; min-width: 220px; }
.promo-label {
  display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.promo-body b { display: block; font-size: 17px; font-weight: 650; line-height: 1.3; }
.promo-body p { margin: 5px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.promo-cta {
  flex: none; text-decoration: none; font-size: 15px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; background: #2a6fdb; color: #fff; white-space: nowrap;
}
.promo-cta:hover { background: #1b4ea0; color: #fff; }
@media (max-width: 560px) {
  .promo { padding: 20px; }
  .promo-cta { width: 100%; text-align: center; }
}

/* ---------------------------------------------------------------- footer */
.site-foot {
  margin-top: 70px; padding: 48px 0 60px; font-size: 14.5px;
  background: linear-gradient(135deg, #0e7a5f 0%, #0a4d3b 100%);
  color: rgba(255, 255, 255, .74);
}
.site-foot .foot-inner { max-width: var(--page); margin: 0 auto; padding: 0 22px; }
.site-foot .foot-cols {
  display: grid; gap: 28px; grid-template-columns: 1.4fr 1fr 1fr 1fr;
}
@media (max-width: 760px) {
  .site-foot .foot-cols { grid-template-columns: 1fr 1fr; }
  .site-foot .foot-about { grid-column: 1 / -1; }
}
.site-foot .foot-cols b {
  display: block; margin-bottom: 10px; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase; color: #ffd972;
  font-family: inherit; font-weight: 600;
}
.site-foot .foot-cols a { display: block; margin-bottom: 6px; text-decoration: none; color: #fff; }
.site-foot .foot-cols a:hover { text-decoration: underline; }
.site-foot .foot-about p { margin: 0; max-width: 26em; }
.site-foot .foot-about .brand { margin-bottom: 10px; }
.site-foot .brand { color: #fff; }
.site-foot .foot-fine {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .18);
  font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap;
  color: rgba(255, 255, 255, .6);
}
