/* ==========================================================================
   NOMADIC AUTHORS USA — Responsive Layer
   Verified breakpoints: 320, 375, 430, 768, 1024, 1366, 1440, 1920
   Mobile is designed intentionally, not scaled down.
   ========================================================================== */

/* ---------- Large desktop: 1440px+ ---------- */
@media (min-width: 1600px) {
  :root { --shell: 1340px; }
  .hero__inner { padding-block: 7rem; }
}

/* ---------- Laptop: below 1366px ---------- */
@media (max-width: 1365px) {
  .nav__link { padding: 0.55rem 0.55rem; font-size: 0.845rem; }
  .logo__sub { letter-spacing: 0.24em; }
}

/* ---------- Small laptop / large tablet: below 1180px ---------- */
@media (max-width: 1180px) {
  :root { --header-h: 70px; }
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .header__actions .btn--desktop-only { display: none; }
  .footer__top { grid-template-columns: 1.4fr 1fr 1fr; row-gap: var(--sp-6); }
  .footer__brand { grid-column: 1 / -1; }
}

/* ---------- Tablet: below 1024px ---------- */
@media (max-width: 1023px) {
  .hero__inner { grid-template-columns: 1fr; padding-block: clamp(2.5rem, 6vw, 4rem); }
  .hero__art { max-width: 460px; margin-inline: auto; order: -1; }
  .hero__copy { max-width: none; }
  .split, .split--wide-left, .split--wide-right { grid-template-columns: 1fr; gap: var(--sp-6); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route--split { grid-template-columns: 1fr; }
  .route--split .route__line { display: block; }
  .route-h { grid-template-columns: repeat(2, 1fr); row-gap: var(--sp-6); }
  .route-h__step:nth-child(2)::before { right: 0; }
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .auth__aside { order: 2; }
  .fact-row { grid-template-columns: 1fr; gap: var(--sp-4); }
}

/* ---------- Small tablet / large phone: below 768px ---------- */
@media (max-width: 767px) {
  :root { --header-h: 64px; --section-y: 3rem; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .route-h { grid-template-columns: 1fr; }
  .route-h__step::before { display: none; }
  .route-h__step { padding-top: 0; padding-left: 46px; position: relative; }
  .route-h__node { top: 2px; }
  .footer__top { grid-template-columns: 1fr 1fr; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .cookie-bar { padding: var(--sp-4); }
  .cookie-bar .btn-row { width: 100%; }
  .cookie-bar .btn { flex: 1; }
  .section-head { margin-bottom: var(--sp-6); }
  .logo__mark { width: 34px; height: 34px; }
  .logo__name { font-size: 1.05rem; }
  .quote-block { font-size: 1.2rem; padding-left: var(--sp-4); }
  .testimonial { padding: var(--sp-5); }
  .accordion__btn { font-size: 1rem; }
}

/* ---------- Phone: below 480px ---------- */
@media (max-width: 479px) {
  :root { --sp-7: 2.25rem; --sp-8: 3rem; }
  .btn { width: 100%; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
  .header__actions .btn { width: auto; }
  .newsletter { flex-direction: column; }
  .newsletter .btn { width: 100%; }
  .filter-bar { gap: 0.4rem; }
  .filter-btn { font-size: 0.8rem; padding: 0.45rem 0.8rem; }
  .logo__sub { display: none; }
  .book-card__cover { padding: 1rem; }
  .book-card__cover-title { font-size: 1rem; }
  .dropzone { padding: var(--sp-6) var(--sp-4); }
  .article__meta { gap: var(--sp-3); }
  .pagination { flex-wrap: wrap; }
}

/* ---------- Very small phone: 320px ---------- */
@media (max-width: 359px) {
  :root { --fs-body: 0.95rem; }
  .shell { padding-inline: 1rem; }
  .logo__name { font-size: 0.98rem; }
  .header__actions .btn--sm { padding: 0.55rem 0.75rem; font-size: 0.8rem; }
  .route__stage { padding-left: 48px; }
  .route__node { width: 28px; height: 28px; font-size: 0.62rem; }
  .route__line { left: 13px; }
  .route__phase { padding-left: 48px; }
}

/* ---------- Landscape phone ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .mobile-nav { padding-block: var(--sp-4); }
  .auth { min-height: 0; }
}

/* ---------- Hover-capable devices only ---------- */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .book-card:hover .book-card__cover { transform: none; }
}


/* ==========================================================================
   HEADER FIT — corrections from the cross-breakpoint render sweep
   ========================================================================== */

/* Between 1024 and ~1500 the full nav, the login link and the long CTA label
   together exceed the 1240px shell. Tighten progressively rather than letting
   the row overflow. */
@media (min-width: 1024px) and (max-width: 1499px) {
  .nav__link { padding-inline: 0.55rem; font-size: 0.9rem; }
  .site-header__inner { gap: var(--sp-3); }
  .header__actions .btn--sm { padding-inline: 0.85rem; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .header__actions .btn--desktop-only { display: none; }
  .btn--cta-full { display: none; }
  .btn--cta-short { display: inline-flex; }
}

/* Small screens: the logo lockup plus a long CTA plus the toggle cannot fit.
   Drop to the short CTA, then to the toggle alone on the narrowest devices. */
@media (max-width: 560px) {
  .btn--cta-full { display: none; }
  .btn--cta-short { display: inline-flex; }
  .logo__mark { width: 32px; height: 32px; }
  .logo__name { font-size: 1.02rem; }
  .logo__sub { letter-spacing: 0.22em; font-size: 0.55rem; }
}
@media (max-width: 400px) {
  /* The CTA is the first item inside the mobile drawer, so hiding it here
     costs nothing and guarantees the header fits at 320px. */
  .header__actions .btn--cta-short { display: none; }
  .logo__sub { display: none; }
  .logo__name { font-size: 0.98rem; }
}

/* ==========================================================================
   FOOTER NEWSLETTER — input could not shrink below its default size
   ========================================================================== */
.newsletter { flex-wrap: wrap; }
.newsletter .input { flex: 1 1 12rem; min-width: 0; max-width: 100%; }
.newsletter .btn { flex: 0 0 auto; }

@media (max-width: 560px) {
  .newsletter .input,
  .newsletter .btn { flex: 1 1 100%; }
}

/* Long unbroken strings (emails, URLs) must never push a column open */
.footer__list a, .contact-list a, .article a { overflow-wrap: anywhere; }


/* Auth pages: the aside must drop below the form well before phone widths */
@media (max-width: 900px) {
  .auth__form-wrap { flex-direction: column; align-items: stretch; }
  .auth__form { max-width: 480px; margin-inline: auto; }
  .auth__aside { max-width: 480px; margin-inline: auto; margin-top: var(--sp-7); }
}

/* Landing pages have their own slim header with a long CTA and no toggle */
@media (max-width: 640px) {
  .lp-header__inner { gap: var(--sp-3); }
  .lp-header .btn--lp-full { display: none; }
  .lp-header .btn--lp-short { display: inline-flex; }
}
.lp-header .btn--lp-short { display: none; }

@media (max-width: 400px) {
  .lp-header .logo__sub { display: none; }
  .lp-header .logo__mark { width: 30px; height: 30px; }
}


/* ==========================================================================
   HEADER BREAKPOINTS — set from measured component widths, not guesswork.
   Logo 184px + nav 695-749px + actions. The shell caps at 1240px until
   1600px, so the "Author login" button (which pushes actions to 331px) is
   what breaks the row. It becomes a compact text link in the middle range
   and only returns as a button once there is genuinely space.
   ========================================================================== */
@media (max-width: 1279px) {
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .header__actions .btn--desktop-only { display: none; }
}

@media (min-width: 1280px) {
  .nav { display: flex; }
  .nav-toggle { display: none; }
  .btn--cta-full { display: inline; }
  .btn--cta-short { display: none; }
}

/* 1280-1599: login drops its button chrome to buy back ~55px.
   Measured: with the login button the header row needs 1296px, but the shell
   stays capped at 1240px until the viewport reaches 1600px. */
@media (min-width: 1280px) and (max-width: 1599px) {
  .header__actions .btn--desktop-only {
    display: inline-flex;
    background: transparent;
    border-color: transparent;
    padding-inline: 0.35rem;
    color: var(--color-primary);
  }
  .header__actions .btn--desktop-only:hover {
    background: transparent;
    color: var(--color-accent-ink);
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .nav__link { padding-inline: 0.5rem; font-size: 0.88rem; }
  .site-header__inner { gap: var(--sp-3); }
}

@media (min-width: 1600px) {
  .header__actions .btn--desktop-only { display: inline-flex; }
}

/* Nav items must never wrap onto a second line inside the header row */
.nav ul { flex-wrap: nowrap !important; }
.nav__link { white-space: nowrap; }

/* Page-hero headings: 4rem over four lines is too heavy for an interior page.
   The homepage .display stays large; interior h1s come down a step. */
.page-hero h1 { font-size: clamp(2.15rem, 1.4rem + 2.6vw, 3.15rem); max-width: 20ch; }
.page-hero .lead { max-width: 62ch; }

/* Split panels align to the top so a tall panel does not orphan the text */
.split, .split--wide-left, .split--wide-right { align-items: start; }
