:root{
  --ink:#26221c;
  --paper:#f6efe2;
  /*--accent:#d4af37;*/
  --accent:#dBAE36;
  --accent-dk:#b68d1d;
  /* --nav:#2f2b24; */
--nav: #07131d;
  --card:#ffffff;
  --muted:#6d5f4f;
  --rail: 1400px; /* match .container max-width */
  --cover-blue-dark: #0a3557;
  --cover-blue-mid:  #0f4c75;
  --cover-blue-lite: #1b6fa3;

  /* Tweak these if you ever want slightly different proportions */
  --header-vh: 20vh;   /* ~20% of viewport for the title band */
  --hero-vh:   32vh;   /* ~32% of viewport for the hero band  */
  --header-cap: 260px; /* header max height */
  --header-min: 120px; /* header min height */
  --hero-cap:   650px; /* hero max height */
}
html{
  scroll-behavior:smooth;
  font-size: 16px;
}
body{
  margin:0; color:var(--ink); background:var(--paper);
  font-family:'Merriweather', serif; line-height:1.6;
  font-size: clamp(16px, 1.05vw + 10px, 20px); /* grows on big screens */
  line-height: 1.6;
}

/*************************************************** HEADER ***************************************************/
header {
  /* background: linear-gradient(180deg, #000 20%, #554322 63%, #000 100%); */

background-image:
  linear-gradient(
    180deg,
    rgba(5, 18, 32, 0.96) 0%,
    rgba(10, 30, 49, 0.86) 26%,

    /* cover-matched deep royal blue glow */
    rgba(24, 76, 130, 0.72) 53%,
    rgba(70, 150, 220, 0.48) 63%,
    rgba(24, 76, 130, 0.72) 73%,

    /* fade later */
    rgba(10, 30, 49, 0.86) 92%,
    rgba(5, 18, 32, 0.96) 100%
  ),
  url("/images/stone_texture.jpg");

background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-blend-mode: multiply;
filter: contrast(1.04) saturate(0.92);

  text-align: center;
  padding: 12px 12px 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);

  height: clamp(var(--header-min), var(--header-vh), var(--header-cap));
  padding: clamp(8px, 1.5vh, 16px) clamp(12px, 1.2vw, 24px);
  display: flex; 
  align-items: center; 
  justify-content: center;
}
header a {
  text-decoration: none;
  color: inherit;
  display:flex; align-items:center; justify-content:center;
}
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* 1) Size the WRAPPER, not the img */
.logo-wrap {
  position: relative;
  margin: 0 auto 8px;
  overflow: hidden;
  isolation: isolate;
  /* optional: move the shadow here so it doesn’t affect visual alignment */
  /* filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); */
  filter: drop-shadow(0 0 4px rgba(0,0,0,.65));

  /* responsive width with sane floor/ceiling */
  width: clamp(280px, 72vw, 800px);

  height: 20vh;           /* <-- this ties it to viewport height */
  width: auto;             /* scales naturally with height */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2) Image just fills the wrapper */
.title-image {
  display: block;
  /* shadow moved to wrapper; keep img “pure” for mask alignment */
  filter: none;
  position: relative;
  z-index: 0;
  height: 100%;            /* fills the wrapper vertically */
  width: auto;             /* scales proportionally */
}

/* 3) Shimmer masked to EXACT wrapper size */
.logo-wrap::after{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;

  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,.18) 44%,
    rgba(255,255,255,.9) 50%,
    rgba(255,255,255,.18) 56%,
    transparent 100%
  );
  background-size: 200% 200%;
  background-position: 150% 0;   /* match the 0% keyframe exactly */
  background-repeat: no-repeat;   /* (optional) avoid any tile edge artifacts */
  animation-name: logo-shine;
  animation-duration: 8s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-direction: normal;          /* <-- key */
  will-change: background-position;

  opacity: .95;

  /* Use the EXACT SAME URL (with cache-bust) as the <img src> */
  -webkit-mask-image: url("/images/title.png?v=7");
  mask-image: url("/images/title.png?v=7");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;

  -webkit-mask-size: contain;  /* was: 100% 100% */
          mask-size: contain;
  -webkit-mask-position: center; /* was: 0 0 */
          mask-position: center;
}

@keyframes logo-shine{
  0%   { background-position: 150% 0; }   /* start off the right */
  100% { background-position: -200% 0; }  /* end off the left */
}
/* Optional: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .logo-wrap::after { animation: none; }
}


/*************************************************** NAV ***************************************************/
nav,
nav.sticky,
nav.scrolled,
header.scrolled nav,
header.sticky nav {
  background-color: #2b2b2b !important;
  backdrop-filter: none !important;
}

nav {
  position: sticky;
  top: 0;
  z-index: 20;

  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;           /* prevent wrapping */
  overflow-x: auto;            /* allow gentle horizontal scroll if needed */
  white-space: nowrap;         /* keep links on one line */
  scrollbar-width: none;       /* Firefox */
  border-top: 1px solid #5c4b2a;
  border-bottom: 1px solid #5c4b2a;

  transform: translate3d(0,0,0);      /* stronger layer promotion */
  will-change: transform;              /* hint Safari’s compositor */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: paint;                      /* isolate repaints to the nav */
}
nav::-webkit-scrollbar { display: none; } /* Safari/iOS */

nav a {
  font-family: 'Montserrat', sans-serif;
  text-decoration: none;
  color: #f6e7b2;
  padding: 12px 14px;          /* slightly narrower padding for mobile */
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: .02em;
  font-size: clamp(14px, 2.8vw, 17px); /* auto-scale on small screens */
}
nav a:hover, nav a:focus { background: #4a4136; color: #fff; }

/*************************************************** HERO ***************************************************/

.hero {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(50% 40% at 50% 50%,
    rgba(0,0,0,0) 45%,
    rgba(0,0,0,.55) 100%
  ), #0a141d; /* blue-black base */

  color: #eee;
  overflow: hidden;
  border-bottom: 4px solid var(--accent-dk); /* gold border */
  box-shadow: 0 4px 6px rgba(0,0,0,.25);

  /* neutralize previous min-height so this takes effect */
  min-height: 0;
  height: min(var(--hero-vh), var(--hero-cap));
  padding: clamp(24px, 4vh, 56px) clamp(20px, 5vw, 56px);
  display: grid; place-items: center;
}
.hero::before,
.hero::after {
  content: "";
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 0;               /* ensure it sits above background but below text */
}

/* LEFT image */
.hero::before {
  opacity: 0.12;
  position: absolute;
  top: 60px;
  left: max(-40px, calc((100vw - var(--rail)) / 2 - 40px));
  width: min(28%, 360px);
  aspect-ratio: 1 / 1;
  background-image: url("/images/hero-left.png");
  background-position: top left;
  background-repeat: no-repeat;
  background-size: contain;
}	
/* RIGHT image */
.hero::after {
  opacity: 0.15;
  position: absolute;
  bottom: 20px;
  right: max(20px, calc((100vw - var(--rail)) / 2 + 20px));
  width: min(30%, 400px);
  aspect-ratio: 1 / 1;      /* keeps it square automatically */
  background-image: url("/images/hero-right.png");
  background-position: bottom right;
}

.hero .content { position: relative; z-index: 2; text-align: center; }

.hero h1 {
  font-family: 'Merriweather', serif;
  font-weight: 900;
  color: var(--accent);
  text-shadow: none !important;
  filter:
    drop-shadow(0 2px 2px rgba(10,20,29,1))
    drop-shadow(0 4px 8px rgba(10,20,29,.95))
    drop-shadow(0 6px 12px rgba(10,20,29,.9))
    drop-shadow(0 8px 16px rgba(10,20,29,.85)) !important;
  font-size: clamp(32px, 2.5vw + 16px, 64px);
  line-height: 1.15;
}
.hero p{
  max-width:900px; margin:0 auto;
  font-size:clamp(17px,2.8vw,22px);
  z-index: 2;
  text-shadow:1px 1px 6px rgba(0,0,0,.65)
}

/*************************************************** BOOK ***************************************************/
.buy-wrap {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.book {
  justify-self: center;            /* center in grid column */
  width: 100%;
  max-width: 350px;
  border: 4px solid var(--accent-dk); /* gold border */
  background-color: var(--paper);     /* ensures visible edge contrast */
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  border-radius: 6px;
}
.cta {
  display:inline-block; background:var(--accent-dk); color:#111; text-decoration:none;
  font-family:'Montserrat',sans-serif; font-weight:700; padding:14px 22px; border-radius:10px;
  box-shadow:0 6px 12px rgba(0,0,0,.18);
}
.cta:hover {
  margin-top: 4px;
  background:var(--accent);
}

.availability {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 15px;
  color: rgba(0,0,0,0.65);
  font-family: "Montserrat", sans-serif;
}


/*************************************************** BOOK ENDORSEMENTS ***************************************************/

.buy-wrap .buy-copy {
  max-width: 520px;
}

.endorsements {
  margin: 18px 0 18px;
  display: grid;
  gap: 12px;
}

.endorsement {
  margin: 0;
  padding: 14px 16px;
  background: rgba(255,255,255,0.55);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.endorsement p {
  margin: 0 0 10px;
  font-family: "Merriweather", serif;
  font-size: 1.02rem;
  line-height: 1.45;
  color: #2a2a2a;
}

.endorsement cite {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: rgba(0,0,0,0.72);
}

/* Optional: slightly tighter on small screens */
@media (max-width: 700px) {
  .endorsement {
    padding: 12px 14px;
  }
  .endorsement p {
    font-size: 0.98rem;
  }
}

/*************************************************** COMMON ***************************************************/

.section{
  padding: 64px clamp(20px, 5vw, 56px);
}
.section--compact {
  padding: 32px clamp(20px, 4vw, 40px);
}
.section.divider{
  position: relative;
  box-sizing: border-box;
  box-shadow: 0 -1px 0 rgba(0,0,0,.06) inset,
              0 1px 0 rgba(0,0,0,.06) inset;
  overflow: hidden;       /* keeps any blur or shadow inside */
}
.container{
  max-width: 1200px;           /* a tad wider, still centered */
  margin-inline: auto;         /* shorthand for left/right auto */
}
h2{
  font-family:'Montserrat',sans-serif; font-weight:800;
  font-size:clamp(26px,3.2vw,40px); 
  color:#3a3026; 
  margin:0 0 12px
  font-weight: 900;
}
.lede{
  font-weight: 500;        /* or 600 if your font supports it well */
  color: #3f352c;          /* darker parchment brown */
  margin:0 0 22px
}

/* Make sure all images behave */
img{ display:block; max-width:100%; height:auto; }

/* PLACEHOLDERS */
.placeholder{ background:var(--card); border:1px solid #e6dcc8; border-radius:10px; padding:18px 20px; }
.placeholder ul{ margin:0; }
.placeholder li{ margin:8px 0; }

.forum-logo { 
  display: block;
  margin: 1.5rem auto; /* centers horizontally */
  max-width:320px;
  margin-top:15px;
  border-radius:6px;
  box-shadow:0 2px 6px rgba(0,0,0,.2);
}

footer{ background:#241f19; color:#e9dcc2; text-align:center; padding:30px 12px; }

/*************************************************** X-Trail ***************************************************/
.trail-shine{
  position: absolute;
  right: max(20px, calc((100vw - var(--rail)) / 2 + 20px));
  bottom: 20px;
  width: min(30%, 400px);
  aspect-ratio: 1 / 1;
  z-index: 1;
  pointer-events: none;

  /* animated sweep */
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(182,141,29,0.1) 42%,   /* dark gold edges */
    rgba(212,175,55,0.8) 50%,   /* bright golden center */
    rgba(182,141,29,0.1) 58%,   /* fade back out */
    transparent 100%
  );
  background-size: 300% 100%;
  background-repeat: no-repeat; /* stop tiling (prevents the second flash) */
  animation: trail-sweep 8s linear infinite;
  animation-delay: 2.5s;
  will-change: background-position;
  opacity: .75;

  /* IMPORTANT: match the ::after image geometry */
  -webkit-mask-image: url("/images/hero-right.png?v=1");
          mask-image: url("/images/hero-right.png?v=1");
  -webkit-mask-size: contain;          /* was 100% 100% -> causes offset */
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: bottom right; /* was center -> causes vertical shift */
          mask-position: bottom right;

  mix-blend-mode: screen; /* optional */
}
@keyframes trail-sweep{
  0%   { background-position: 100% 0; opacity: 0.75; }
  45%  { background-position: 30% 0; opacity: 1; }   /* hits the X */
  65%  { background-position: 20% 0; opacity: 1; }
  100% { background-position: -100% 0; opacity: 0.75; } /* fade away */
}

/* Optional tiny nudge controls if you still need to align by a few px */
.trail-shine{
  transform: translate(var(--trail-x, 0px), var(--trail-y, 0px));
}

/*************************************************** MOBILE ***************************************************/
@media (max-width: 720px) {
  header {
    height: auto;                 /* let content define the height */
    padding: 24px 12px 20px;        /* less bottom padding */
    align-items: flex-end;        /* push logo down toward the nav */
    background-size: 100% 140%;
  }
  .logo-wrap{
    height: 15vh;   /* ~15% of viewport for the title image itself */
    width: auto;    /* width follows height to preserve aspect */
  }
  .title-image{
    height: 100%;   /* fill the 15vh box */
    width: auto;    /* keep aspect ratio */
  }
  .logo-wrap::after{
    /* keep 1:1 fill so shimmer tracks perfectly on mobile too */
    -webkit-mask-size: 100% 100%;
            mask-size: 100% 100%;
    -webkit-mask-position: 0 0;
            mask-position: 0 0;
  }
  .hero::before, .hero::after{
    width: 40vw;
  }
  /* keep shimmer aligned with the right image on mobile */
  .trail-shine{
    width: 40vw;
    right: 20px;        /* same effective position as calc(...) on small screens */
    bottom: 20px;       /* match the image */
    /* optional tiny nudge if needed */
    transform: translate(var(--trail-x, 0px), var(--trail-y, 0px));
  }
  .buy-wrap {
    grid-template-columns: 1fr;
  }
  .book {
    order: 1;                 /* make sure book comes first */
    justify-self: center;     /* center the cover */
    margin-bottom: 24px;      /* add spacing before the text */
  }
  .buy-wrap > div {
    order: 2;                 /* text follows the book */
    text-align: center;       /* optional for mobile alignment */
  }
}
