/* =====================================================
   LEMONS: IN AN ORCHARD — book site styles
   ghostofamericabook.com/lemons/
   Dark-only, single stylesheet
   ===================================================== */

/* --- Variables ---------------------------------------- */
:root {
  --color-bg:        #0e0d09;
  --color-bg-mid:    #1a1810;
  --color-bg-card:   #16140d;
  --color-text:      #f5f2e4;
  --color-cream:     #fbfaed;
  --color-accent:    #c0be54;
  --color-accent-dim:#8a8a3a;
  --color-brown:     #403816;
  --color-muted:     #7a7860;
  --color-border:    #2e2c1a;

  --font-body:       "sitka-text", "Sitka Text", Georgia, serif;
  --font-head:       "korolev", "Korolev", "Impact", sans-serif;
  --font-typewriter: "american-typewriter", "Courier New", monospace;

  --max-prose:       68ch;
  --max-wide:        900px;
  --page-pad:        clamp(20px, 5vw, 60px);
}

/* --- Reset -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* --- Skip link ---------------------------------------- */
.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  background: var(--color-accent);
  color: var(--color-bg);
  padding: 0.5rem 1rem;
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  z-index: 999;
}
.skip-link:focus { top: 1rem; }

/* --- Header ------------------------------------------- */
.lemons-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-pad);
  height: 64px;
  background: rgba(14, 13, 9, 0.92);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lemons-header-home {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.lemons-header-logo {
  height: 36px;
  width: auto;
}

.lemons-header-title {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  text-transform: uppercase;
  line-height: 1.2;
  max-width: 160px;
}

/* Nav trigger — card 15 */
.lemons-nav-trigger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.lemons-nav-trigger img {
  height: 44px;
  width: auto;
  display: block;
  transition: opacity 0.2s;
}

.lemons-nav-trigger:hover img,
.lemons-nav-trigger:focus-visible img {
  opacity: 0.75;
}

.lemons-nav-trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Side nav panel ----------------------------------- */
.lemons-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(340px, 90vw);
  height: 100vh;
  background: var(--color-bg-card);
  border-left: 1px solid var(--color-border);
  z-index: 200;
  overflow-y: auto;
  padding: 72px 24px 48px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.lemons-nav-panel.open {
  transform: translateX(0);
}

.lemons-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
}

.lemons-nav-overlay.open { display: block; }

.lemons-nav-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.lemons-nav-close:hover,
.lemons-nav-close:focus-visible {
  color: var(--color-accent);
}

.lemons-nav-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.lemons-nav-panel h2 {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 20px;
}

.lemons-nav-list {
  list-style: none;
}

.lemons-nav-list li {
  border-top: 1px solid var(--color-border);
}

.lemons-nav-list li:last-child {
  border-bottom: 1px solid var(--color-border);
}

.lemons-nav-list a {
  display: block;
  padding: 12px 0;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.lemons-nav-list a:hover,
.lemons-nav-list a:focus-visible,
.lemons-nav-list a[aria-current="page"] {
  color: var(--color-accent);
}

.lemons-nav-list a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Main content area -------------------------------- */
main {
  padding-top: 64px; /* header height */
}

/* --- Landing page ------------------------------------- */
.lemons-cover-hero {
  position: relative;
  height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  background: #000;
}

.lemons-cover-painting {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 50%;
  opacity: 0.7;
}

.lemons-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.1) 0%,
    rgba(0,0,0,0.2) 40%,
    rgba(14,13,9,0.85) 75%,
    var(--color-bg) 100%
  );
}

.lemons-cover-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px var(--page-pad) 60px;
  max-width: 700px;
}

.lemons-cover-title {
  font-family: var(--font-head);
  font-size: clamp(2.4rem, 7vw, 5rem);
  letter-spacing: 0.04em;
  color: var(--color-accent);
  line-height: 1.05;
  margin-bottom: 0.2em;
}

.lemons-cover-subtitle {
  font-family: var(--font-head);
  font-size: clamp(1rem, 3vw, 1.6rem);
  letter-spacing: 0.08em;
  color: var(--color-cream);
  margin-bottom: 0.5em;
  text-transform: uppercase;
}

.lemons-cover-author {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--color-cream);
  letter-spacing: 0.04em;
  margin-bottom: 2em;
}

.lemons-cover-blurb {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  font-style: italic;
  line-height: 1.6;
  max-width: 50ch;
  margin: 0 auto 2.5em;
}

.lemons-cover-cta {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-bg);
  background: var(--color-accent);
  padding: 12px 32px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.lemons-cover-cta:hover,
.lemons-cover-cta:focus-visible {
  background: var(--color-cream);
}

.lemons-cover-cta:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* --- Card 16 front matter divider --------------------- */
.lemons-front-matter {
  display: flex;
  justify-content: center;
  padding: 60px var(--page-pad) 0;
}

.lemons-card16 {
  width: min(220px, 50vw);
  height: auto;
  opacity: 0.85;
}

/* --- TOC section -------------------------------------- */
.lemons-toc {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 80px var(--page-pad);
}

.lemons-toc-heading {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 40px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.lemons-toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.lemons-toc-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.2s;
}

.lemons-toc-item:hover,
.lemons-toc-item:focus-visible {
  color: var(--color-accent);
}

.lemons-toc-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.lemons-toc-card {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  margin-bottom: 10px;
  transition: opacity 0.2s;
}

.lemons-toc-item:hover .lemons-toc-card {
  opacity: 0.8;
}

.lemons-toc-label {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* --- Credits strip ------------------------------------ */
.lemons-credits {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 40px var(--page-pad) 80px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
}

.lemons-credits p {
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
}

.lemons-credits a {
  color: var(--color-accent-dim);
  text-decoration: none;
}
.lemons-credits a:hover { text-decoration: underline; }

/* --- Chapter pages ------------------------------------ */
.chapter-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px var(--page-pad) 40px;
  background: var(--color-bg-mid);
  border-bottom: 1px solid var(--color-border);
}

.chapter-card-img {
  width: min(180px, 40vw);
  height: auto;
  margin-bottom: 28px;
}

.chapter-number-label {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.chapter-title {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 5vw, 2.8rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-accent);
  text-align: center;
  line-height: 1.1;
}

/* Report chapter uses typewriter font for title */
.chapter-report .chapter-title {
  font-family: var(--font-typewriter);
  font-size: clamp(1.2rem, 4vw, 2.2rem);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--color-cream);
}

/* --- Prose area --------------------------------------- */
.chapter-prose {
  max-width: var(--max-prose);
  margin: 0 auto;
  padding: 60px var(--page-pad) 80px;
}

/* Report prologue uses typewriter styling */
.chapter-report .chapter-prose {
  font-family: var(--font-typewriter);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--color-cream);
}

.chapter-prose p {
  margin-bottom: 1.4em;
  font-size: 1.05rem;
}

.chapter-prose p:last-child {
  margin-bottom: 0;
}

/* --- Chapter navigation ------------------------------- */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 32px var(--page-pad) 64px;
  border-top: 1px solid var(--color-border);
  gap: 16px;
}

.chapter-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  transition: color 0.15s;
}

.chapter-nav-link:hover,
.chapter-nav-link:focus-visible {
  color: var(--color-accent);
}

.chapter-nav-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.chapter-nav-link .nav-card {
  width: 32px;
  height: auto;
  opacity: 0.7;
}

.chapter-nav-link:hover .nav-card { opacity: 1; }

.chapter-nav-link.next { flex-direction: row-reverse; }

.chapter-nav-center {
  font-family: var(--font-head);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-border);
  text-align: center;
}

/* --- Footer ------------------------------------------- */
.lemons-footer {
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  padding: 32px var(--page-pad);
  text-align: center;
}

.lemons-footer p {
  font-size: 0.7rem;
  color: var(--color-muted);
  letter-spacing: 0.05em;
}

.lemons-footer a {
  color: var(--color-accent-dim);
  text-decoration: none;
}
.lemons-footer a:hover { text-decoration: underline; color: var(--color-accent); }

/* --- Focus visible global ----------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Scrollbar (webkit) ------------------------------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-muted); }

/* --- Responsive --------------------------------------- */
@media (max-width: 600px) {
  .lemons-header-title { display: none; }
  .lemons-toc-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
  .chapter-nav-link span:not(.nav-card) { display: none; }
}

/* --- Scene breaks ------------------------------------ */
.scene-break {
  display: flex;
  justify-content: center;
  margin: 2.5em auto;
  max-width: 80px;
}

.scene-break img {
  width: 100%;
  height: auto;
  opacity: 0.6;
}

/* --- Opening paragraph in display font (mirrors print) --- */
.chapter-prose p:first-child {
  font-family: var(--font-head);
  font-size: 1.05rem;
  line-height: 1.65;
  letter-spacing: 0.02em;
  font-weight: 700;
}

/* Report/prologue stays in typewriter throughout */
.chapter-report .chapter-prose p:first-child {
  font-family: var(--font-typewriter);
  font-size: inherit;
  letter-spacing: inherit;
}
