html { scroll-behavior: smooth; }
/* CSS custom properties */
:root {
  --brand: #028081;
  --brand-dark: #015c5c;
  --text: #333333;
  --bg: #ffffff;
}
/* Base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  /* reduce header padding to limit vertical height */
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo container: we no longer rely on font size since an image is used */
.logo {
  display: flex;
  align-items: center;
  font-weight: normal;
  font-size: 1rem;
}

/* Ensure logo image fits within the navbar */
.logo img {
  height: 60px;
  width: auto;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--brand);
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #f5f7fa, #e2e6ec);
  padding: 120px 20px 80px;
  text-align: center;
  margin-top: 60px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.3s ease;
}

.btn:hover {
  background: var(--brand-dark);
}

/* Sections */
.section {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 20px;
}

.section.alt {
  background: #f9f9f9;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
}

/* Lists and results */
.results-list {
  list-style: disc;
  padding-left: 1.25rem;
}

.results-list li {
  margin-bottom: 0.75rem;
}

/* Service cards */
.service {
  margin-bottom: 2rem;
}

.service h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Books */
.book {
  margin-bottom: 1.5rem;
}

/* Process */
.process-steps {
  list-style: decimal;
  padding-left: 1.25rem;
}

.process-steps li {
  margin-bottom: 0.75rem;
}

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

.note {
  font-size: 0.9rem;
  font-style: italic;
  color: #666;
  text-align: center;
}

/* Footer */
.footer {
  background: #333;
  color: #fff;
  text-align: center;
  padding: 40px 20px;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }
  .hero p {
    font-size: 1.5rem;
  }
}

/* Social links styling */
.social-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.linkedin-icon {
  width: 28px;
  height: 28px;
  /* use white icon for better contrast in dark footer */
  fill: #ffffff;
  transition: fill 0.3s ease;
}

/* Change icon color on hover to LinkedIn brand blue */
.linkedin-link:hover .linkedin-icon {
  fill: #0077b5;
}

/* Responsive navigation for smaller screens */
@media (max-width: 768px) {
  .logo img {
    height: 40px;
  }
}

/* -------- Modern Upgrades (sweep) -------- */

/* Transparent nav over hero; solid after scroll (glassmorphism) */
header {
  background: transparent;
  box-shadow: none;
  transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
  backdrop-filter: none;
}
header.scrolled {
  background: rgba(255,255,255,0.72);
  box-shadow: 0 10px 30px rgba(2,8,20,0.08);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(2,8,20,0.06);
}

/* Nav links underline on hover/active */
.nav-links a {
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 2px;
  background: var(--brand);
  transition: width 0.25s ease;
}
.nav-links a:hover::after, .nav-links a.active::after {
  width: 100%;
}

/* Mobile hamburger */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: 60px;
    right: 16px;
    background: rgba(255,255,255,0.98);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    display: none;
    flex-direction: column;
    gap: 0.75rem;
  }
  .nav-links.open { display: flex; }
}

/* Hero: full viewport with brand-driven animated gradient */
.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin-top: 0;
  padding: 0 20px;
  background: radial-gradient(1200px 800px at 20% 20%,
    color-mix(in oklab, var(--brand) 10%, white) 0%,
    color-mix(in oklab, var(--brand) 22%, white) 28%,
    color-mix(in oklab, var(--brand) 40%, white) 56%,
    color-mix(in oklab, var(--brand) 60%, white) 76%,
    color-mix(in oklab, var(--brand) 75%, white) 100%);
  background-size: 200% 200%;
  animation: gradientShift 16s ease-in-out infinite alternate;
}
@keyframes gradientShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}
.hero .btn { transform: translateY(0); transition: transform 0.2s ease; }
.hero .btn:hover { transform: translateY(-2px); }

/* Buttons & accents */
.btn {
  background: var(--brand);
}
.btn:hover {
  background: var(--brand-dark);
}

/* Sections spacing tweak */
.section { padding: 80px 20px; }

/* Cardify lists */
.results-list {
  list-style: none;
  padding-left: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
  gap: 16px;
}
.results-list li {
  margin: 0; padding: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.section.alt .results-list li { background: #ffffff; }
.results-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

/* Books grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
  gap: 20px;
  align-items: start;
}
.book-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(0,0,0,0.06);
}
.book-card img { width: 100%; height: auto; display: block; }
.book-card .book-body { padding: 14px 16px 18px; }
.book-card h3 { margin: 0 0 6px; }
.book-card p { margin: 0; }

/* Footer gradient */
.footer {
  background: linear-gradient(180deg, #0f172a, #0b1222);
  color: #e8eefc;
}
.footer p { color: #c9d3f0; }

/* Reduce logo size slightly for overlay */
.logo img { height: 56px; }

/* Floating mobile CTA */
.floating-cta{
  position: fixed; right: 16px; bottom: 16px; z-index: 1100;
  background: var(--brand); color: #fff;
  padding: 12px 16px; border-radius: 999px; text-decoration: none; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18); display: none;
}
@media (max-width: 900px){ .floating-cta{ display: inline-block; } }

/* Scroll reveal */
.reveal{ opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible{ opacity: 1; transform: translateY(0); }


/* Hero typography tuning for punch */
.hero h1{
  font-size: clamp(2.5rem, 5vw + 1rem, 4.25rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.hero p{
  font-size: clamp(1.125rem, 1.25vw + 1rem, 1.5rem);
  line-height: 1.55;
  letter-spacing: 0.005em;
  margin-bottom: 1.75rem;
}


/* Keep logo visible over animated hero */
/* Slight edge lift for teal-on-teal situations */
.logo img { height: 56px; }


/* Lighten top 15% under navbar to keep logo readable */
.hero{
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 15%),
    radial-gradient(1200px 800px at 20% 20%,
      color-mix(in oklab, var(--brand) 10%, white) 0%,
      color-mix(in oklab, var(--brand) 22%, white) 28%,
      color-mix(in oklab, var(--brand) 40%, white) 56%,
      color-mix(in oklab, var(--brand) 60%, white) 76%,
      color-mix(in oklab, var(--brand) 75%, white) 100%);
  background-size: auto, 200% 200%;
}


/* Hero typography tuning for punch */
.hero h1{
  font-size: clamp(2.7rem, 5.2vw + 1rem, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.hero p{
  font-size: clamp(1.125rem, 1.25vw + 1rem, 1.55rem);
  line-height: 1.55;
  letter-spacing: 0.005em;
  margin-bottom: 1.75rem;
}


.book-card .book-body h3 a{
  text-decoration: none;
  color: inherit;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 2px;
}
.book-card .book-body h3 a:hover{
  color: var(--brand);
}
.book-card .book-link{ display:block; }


/* --- Mobile pill nav + hamburger removal + CTA behavior --- */

/* Floating CTA now controlled by JS; hidden by default, appears with .show */
.floating-cta{
  position: fixed; right: 16px; bottom: 16px; z-index: 1100;
  background: var(--brand); color: #fff;
  padding: 12px 16px; border-radius: 999px; text-decoration: none; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.floating-cta.show{ opacity: 1; transform: translateY(0); pointer-events: auto; }

/* (removed old conflicting mobile pills block) */

/* Smaller, denser book cards on small screens */
@media (max-width: 640px){
  .books-grid{ gap: 12px; }
  .book-card{
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    border-radius: 12px;
  }
  .book-card img{
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
  }
  .book-card .book-body{ padding: 8px 8px 10px; }
  .book-card h3{ font-size: 1rem; margin-bottom: 4px; }
  .book-card p{ font-size: .95rem; }
}


/* --- Floating CTA cross-device override --- */
.floating-cta{
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  position: fixed; right: 20px; bottom: 20px; z-index: 1100;
  background: var(--brand); color: #fff;
  padding: 12px 16px; border-radius: 999px; text-decoration: none; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.floating-cta.show{ opacity: 1; transform: translateY(0); pointer-events: auto; }
@media (min-width: 901px){
  .floating-cta{ right: 24px; bottom: 24px; }
}


@media (max-width: 900px){
  header .nav{ display:grid; grid-template-columns:auto 1fr auto; align-items:center; column-gap:8px; row-gap:4px; padding:8px 10px; }
  .logo img{ height:44px; }
  .nav-links{ grid-column:2/3; }
  .menu-toggle{ grid-column:3/4; justify-self:end; display:inline-flex; background:transparent; border:0; font-size:1.75rem; line-height:1; color:var(--brand-dark); }
  header.scrolled .menu-toggle{ color:var(--text); }
}


#drawer{ position:fixed; inset:0 0 0 auto; width:76%; max-width:360px; height:100%; background:#fff; box-shadow:-20px 0 40px rgba(0,0,0,0.18); transform:translateX(100%); transition:transform .25s ease; z-index:1200; padding:14px 16px; }
#drawer[aria-hidden="false"]{ transform:translateX(0%); }
#drawer nav ul{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
#drawer nav a{ padding:10px 12px; border-radius:10px; text-decoration:none; color:#0b1222; background:rgba(0,0,0,0.04); }
#drawer nav a:hover{ background:rgba(0,0,0,0.08); }


@media (max-width: 640px){
  .book-card{ grid-template-columns:110px 1fr; }
  .book-card picture{ display:flex; align-items:center; justify-content:center; height:100%; }
  .book-card img{ width:100%; height:150px; object-fit:cover; object-position:center; }
}


/* === FINAL OVERRIDES (win over earlier rules) === */

/* Keep header always visible and stable */
header{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1200;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}
/* Ensure content isn't hidden under header */
body{ padding-top: var(--header-h, 72px); }

/* Mobile header row: Logo | Pills | Hamburger */
@media (max-width: 900px){
  header .nav{
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    padding: 8px 10px;
  }
  .logo img{ height: 44px; }
  header.compact .logo img{ height: 28px !important; }

  /* Force hamburger visible even if earlier rules hid it */
  .menu-toggle{
    display: inline-flex !important;
    background: transparent; border: 0;
    font-size: 1.75rem; line-height: 1;
    color: var(--brand-dark);
    justify-self: end;
  }

  /* Horizontal pill bar beside logo */
  .nav-links{
    grid-column: 2 / 3;
    position: static !important;
    display: flex !important;
    flex-direction: row;
    gap: .5rem;
    overflow-x: auto; overflow-y: hidden;
    white-space: nowrap;
    padding: .25rem 0 .5rem;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    -ms-overflow-style: none; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
            mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  }
  .nav-links::-webkit-scrollbar{ display: none; }
  .nav-links a{
    padding: .35rem .6rem;
    border-radius: 999px;
    font-weight: 600;
    background: color-mix(in oklab, var(--brand) 14%, white);
    color: #0b1222;
  }
  .nav-links a.active{ background: var(--brand); color: #fff; }
  .nav-links a::after{ display: none; }
}

/* Sticky floating CTA reveal behavior */
.floating-cta{
  position: fixed; right: 20px; bottom: 20px; z-index: 1100;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff;
  padding: 12px 16px; border-radius: 999px; text-decoration: none; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.floating-cta.show{ opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Book thumbnails — clean, centered, consistent on mobile */
@media (max-width: 640px){
  .books-grid{ gap: 12px; }
  .book-card{ display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 12px; border-radius: 12px; }
  .book-card picture{ width: 112px; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; display: block; }
  .book-card picture img{ width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
  .book-card .book-body{ padding: 8px 8px 10px; }
  .book-card h3{ font-size: 1rem; margin-bottom: 4px; }
  .book-card p{ font-size: .95rem; line-height: 1.45; }
}


/* === MOBILE UX FINAL — consolidated single-row header === */
@media (max-width: 900px){
  header .nav{ display:grid !important; grid-template-columns:auto 1fr auto !important; align-items:center !important; column-gap:8px !important; row-gap:0 !important; padding:8px 10px !important; }
  .logo img{ height:44px !important; }
  header.compact .logo img{ height:28px !important; }
  .nav-links{ grid-column:2/3 !important; position:relative !important; display:flex !important; flex-direction:row !important; flex-wrap:nowrap !important; gap:.55rem !important; overflow-x:auto !important; overflow-y:hidden !important; white-space:nowrap !important; -ms-overflow-style:none; scrollbar-width:none; padding:.2rem 0 .3rem !important; margin:0 !important; background:transparent !important; box-shadow:none !important; border-radius:0 !important; }
  .nav-links::-webkit-scrollbar{ display:none !important; }
  .nav-links li{ display:inline-block !important; flex:0 0 auto !important; }
  .nav-links a{ padding:.35rem 0 !important; border:none !important; background:transparent !important; border-radius:0 !important; }
  .menu-toggle{ grid-column:3/4 !important; justify-self:end !important; display:inline-flex !important; background:transparent !important; border:0 !important; font-size:1.75rem !important; line-height:1 !important; color:var(--brand-dark) !important; }
}
/* Drawer panel */
#drawer{ position:fixed; top:var(--header-h,72px); right:0; bottom:0; width:min(84vw,360px); background:#fff; box-shadow:-22px 0 40px rgba(0,0,0,.18); transform:translateX(100%); transition:transform .25s ease; z-index:1200; }
#drawer[aria-hidden="false"]{ transform:translateX(0); }
#drawer nav ul{ list-style:none; margin:0; padding:16px; display:flex; flex-direction:column; gap:10px; }
#drawer nav a{ text-decoration:none; color:#0b1222; background:#f3f7f7; padding:10px 12px; border-radius:10px; font-weight:600; }
#drawer nav a:hover{ background:#e6efef; }
/* Floating CTA visibility via .show only */
.floating-cta{ opacity:0; transform:translateY(8px); pointer-events:none; }
.floating-cta.show{ opacity:1; transform:translateY(0); pointer-events:auto; }
/* Book cards: equal-height left column */
@media (max-width: 640px){
  .books-grid{ gap:12px; }
  .book-card{ display:grid; grid-template-columns:min(38vw,140px) 1fr; align-items:stretch; gap:12px; border-radius:12px; }
  .book-card picture{ height:100%; border-radius:10px; overflow:hidden; display:block; }
  .book-card picture img{ width:100%; height:100%; object-fit:cover; object-position:center; display:block; }
  .book-card .book-body{ padding:8px 8px 10px; }
  .book-card h3{ font-size:1rem; margin-bottom:4px; }
  .book-card p{ font-size:.95rem; line-height:1.45; }
}


/* === RAMIT MOBILE POLISH: FINAL OVERRIDES (2025-10-03) — cleaned === */

/* Backdrop for drawer */
#backdrop{ position:fixed; inset:0; background:rgba(2,8,20,.44); opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:1195;}
#backdrop.show{ opacity:1; pointer-events:auto; }

/* Prevent body scroll when drawer open */
body.noscroll{ overflow:hidden; touch-action:none; overscroll-behavior:none; }

/* (removed: rule that hid .nav-links on mobile) */

/* Modern, minimal header look */
header{ background:rgba(255,255,255,.82); backdrop-filter:saturate(140%) blur(10px); border-bottom:1px solid rgba(2,8,20,.06); }
header.scrolled{ background:rgba(255,255,255,.9); box-shadow:0 12px 30px rgba(2,8,20,.06); }

/* Drawer: denser spacing and full-height list; no big blank zones */
#drawer{ top:0; height:100%; padding-top: calc(var(--header-h,72px) + 8px); }
#drawer nav ul{ gap:6px; }
#drawer nav a{ background:#f2f5f5; font-weight:600; }
#drawer nav a:active{ transform:translateY(1px); }

/* Book covers: preserve aspect ratio (never squish) */
@media (max-width: 640px){
  .book-card{ grid-template-columns:min(36vw,136px) 1fr !important; }
  .book-card picture{ width:100%; height:auto !important; aspect-ratio:auto !important; display:block; }
  .book-card picture img{ width:100% !important; height:auto !important; object-fit:contain !important; }
}

/* Improve tap targets in nav chips (desktop) */
.nav-links a{ padding:.45rem .7rem; border-radius:999px; background:transparent; border:1px solid rgba(2,8,20,.08); }
.nav-links a.active{ background:var(--brand); color:#fff; border-color:var(--brand); }

/* Smooth anchor offset behavior uses --header-h; ensure a sane default */
:root{ --header-h: 72px; }
html{ scroll-behavior: smooth; } /* kept for non-JS fallback */

/* Floating CTA visibility handled in JS; ensure no flash at page top */
.floating-cta{ opacity:0; transform:translateY(8px); pointer-events:none; }


/* === NAV: Underline / Sliding Indicator (Desktop + Mobile) === */
.nav-links{
  display:flex; align-items:center; gap:1rem;
  position:relative;
  overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none;
  white-space:nowrap; padding:.35rem .5rem .5rem;
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.nav-links::-webkit-scrollbar{ display:none; }
.nav-links a{
  background:none!important; border:none!important;
  border-radius:0;
  padding:.4rem 0;
  font-weight:600; line-height:1.1;
  color:rgba(10,24,39,.85);
}
.nav-links a:hover{ color:rgba(10,24,39,1); }
.nav-links a.active{ color:var(--brand); }

/* Sliding underline bar */
.nav-links .nav-slider{
  position:absolute; left:0; bottom:0;
  height:2px; width:0;
  background:var(--brand);
  border-radius:2px;
  opacity:.95;
  transform:translateX(0);
  transition:transform .25s ease, width .25s ease, opacity .25s ease;
}

/* Header layout stays: logo | links | hamburger */
header .nav{ display:grid; grid-template-columns:auto 1fr auto; align-items:center; column-gap:.5rem; }
@media (max-width: 900px){
  .menu-toggle{ display:inline-flex !important; }
  .nav-links{ display:flex !important; } /* keep pills (now text links) visible in header */
}

/* Optional subtle bottom border to separate content */
@media (max-width: 900px){
  header{ border-bottom:1px solid rgba(2,8,20,.06); }
}


/* === Desktop nav alignment (v4) === */
@media (min-width: 901px){
  header .nav{ grid-template-columns:auto 1fr auto; column-gap:2rem; }
  .nav-links{ justify-content:flex-end; gap:1.1rem; padding-left:clamp(16px, 3vw, 40px); }
}


/* === V4.2 FINAL OVERRIDES (2025-10-03) === */
/* Mobile header: single row (Logo | Links | Hamburger), no wrapping */
@media (max-width: 900px){
  header .nav{ display:grid !important; grid-template-columns:auto 1fr auto !important; align-items:center !important; column-gap:8px !important; row-gap:0 !important; padding:8px 10px !important; }
  .logo img{ height:44px !important; }
  .menu-toggle{ grid-column:3/4 !important; justify-self:end !important; display:inline-flex !important; background:transparent !important; border:0 !important; font-size:1.75rem !important; line-height:1 !important; }

  /* Inline nav row: do not wrap; horizontal scroll if overflow */
  .nav-links{ 
    grid-column:2/3 !important;
    display:flex !important; flex-direction:row !important; 
    flex-wrap:nowrap !important; gap:.55rem !important; 
    overflow-x:auto !important; overflow-y:hidden !important; 
    white-space:nowrap !important; padding:.25rem 0 .35rem !important; 
    margin:0 !important; position:static !important; background:transparent !important; box-shadow:none !important; border-radius:0 !important;
    -ms-overflow-style:none; scrollbar-width:none;
  }
  .nav-links::-webkit-scrollbar{ display:none; }
  .nav-links li{ display:inline-block !important; flex:0 0 auto !important; }
  .nav-links a{ padding:.35rem 0 !important; border:none !important; background:transparent !important; border-radius:0 !important; }
  .nav-links a::after{ display:block !important; content:''; height:2px; width:0; background:var(--brand); transition:width .2s ease; margin-top:4px; }
  .nav-links a.active::after, .nav-links a:hover::after{ width:100%; }
}

/* Desktop: keep right-aligned links with breathing room */
@media (min-width: 901px){
  .nav-links{ justify-content:flex-end !important; gap:1.1rem !important; padding-left:clamp(16px, 3vw, 40px) !important; }
}

/* Drawer: sit directly under header; compact padding; no giant top gap */
:root{ --header-h: 72px; }
#drawer{ 
  top: var(--header-h, 72px) !important; 
  height: calc(100% - var(--header-h, 72px)) !important; 
  padding: 12px 14px !important; 
}
#drawer nav ul{ gap:10px !important; }
#drawer nav a{ background:#f4f6f6 !important; }
#backdrop{ position:fixed !important; inset:0 !important; background:rgba(2,8,20,.44) !important; opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:1195; }
#backdrop.show{ opacity:1; pointer-events:auto; }

/* Prevent body scroll beneath open drawer */
body.noscroll{ overflow:hidden !important; touch-action:none !important; overscroll-behavior:none !important; }

/* === Custom fixes (2025-10-03) === */
/*
 * The following rules correct three UX issues reported on mobile devices:
 *
 * 1. On narrow screens the navigation links were wrapping onto a second
 *    line beneath the logo and hamburger. To keep everything on a single
 *    row we convert the header layout to a flex container, give the
 *    navigation bar flex‑grow so it can shrink and scroll horizontally, and
 *    prevent items from wrapping. We also hide the sliding indicator bar
 *    on mobile because it contributes extra height that forces a wrap.
 *
 * 2. The slide‑out drawer left a large area of unused white space to the
 *    right. We constrain its width using a clamp so that it only takes as
 *    much room as needed for the menu items (with sensible minimum and
 *    maximum values) and adjust padding for a denser layout.
 *
 * 3. Book covers were not matching the height of their cards on small
 *    screens, leaving awkward gaps. We switch to a vertical card layout
 *    for screens under 640px so the image sits above the text and can use
 *    its natural aspect ratio without being cropped. This ensures both
 *    book covers display consistently.
 */

@media (max-width: 900px) {
  /* Keep header content on a single line */
  header .nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    row-gap: 0 !important;
    column-gap: 0 !important;
  }
  header .logo {
    flex: 0 0 auto !important;
  }
  .menu-toggle {
    flex: 0 0 auto !important;
  }
  .nav-links {
    flex: 1 1 auto !important;
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    margin: 0 8px !important;
    padding: 0 !important;
    gap: 0.75rem !important;
    /* remove background and border so pills don't add extra height */
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .nav-links::-webkit-scrollbar {
    display: none;
  }
  .nav-links li {
    flex: 0 0 auto !important;
    display: inline-block !important;
    list-style: none !important;
  }
  .nav-links a {
    display: inline-block !important;
    padding: 0.4rem 0 !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    text-decoration: none !important;
    border-bottom: 2px solid transparent !important;
  }
  .nav-links a.active,
  .nav-links a:hover {
    border-color: var(--brand) !important;
    color: var(--brand) !important;
  }
  /* Show the sliding underline bar on mobile for active indication */
  .nav-links{ position: relative !important; }
  .nav-links .nav-slider {
    display: block !important;
  }
}

/* Drawer tweaks: reduce unused white space */
#drawer {
  width: clamp(220px, 60vw, 320px) !important;
  max-width: 320px !important;
  padding: 20px 16px !important;
}
#drawer nav ul {
  gap: 8px !important;
}
#drawer nav a {
  display: block !important;
  padding: 10px 12px !important;
}

/* Books: vertical layout on extra small screens */
@media (max-width: 640px) {
  .books-grid {
    gap: 16px !important;
  }
  .book-card {
    display: flex !important;
    flex-direction: column !important;
  }
  .book-card picture {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
  }
  .book-card picture img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .book-card .book-body {
    padding: 12px !important;
  }
}

/* === ABSOLUTE FINAL MOBILE ENFORCEMENT (keeps header as one row) === */
@media (max-width: 900px){
  header .nav{
    display: grid !important;
    grid-template-columns: auto minmax(0,1fr) auto !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 0 !important;
    padding: 8px 10px !important;
  }
  .logo{ grid-column: 1 / 2 !important; }
  .menu-toggle{ grid-column: 3 / 4 !important; justify-self: end !important; display: inline-flex !important; }
  .nav-links{
    grid-column: 2 / 3 !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    gap: .5rem !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar{ display: none !important; }
  .nav-links li{ list-style: none !important; display: inline-block !important; flex: 0 0 auto !important; }
  .nav-links a{ padding: .35rem 0 !important; border: 0 !important; background: transparent !important; border-radius: 0 !important; }
  .nav-links .nav-slider{ position: absolute !important; left: 0; bottom: 0; height: 2px; width: 0; pointer-events: none; display: block !important; list-style: none !important; }
}

/* === FINAL FINAL: enforce single-row mobile header (wins everything) === */
@media (max-width: 900px){
  header .nav{
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 0 !important;
    padding: 8px 10px !important;
  }
  .logo{ grid-column: 1 / 2 !important; }
  .nav-links{
    grid-column: 2 / 3 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !IMPORTANT;
    gap: .55rem !important;
    margin: 0 !important;
    padding: .2rem 0 .3rem !important;
    position: static !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar{ display: none !important; }
  .nav-links li{ display: inline-block !important; flex: 0 0 auto !important; }
  .nav-links a{ padding: .35rem 0 !important; border: 0 !important; background: transparent !important; border-radius: 0 !important; }
  .menu-toggle{ grid-column: 3 / 4 !important; justify-self: end !important; display: inline-flex !important; }
}
