/* =========================================================
   israelgalmor.com — site styles
   Hebrew RTL literary site. Color tokens matched to the
   original Wix design (forest green + bright yellow + cream).
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---------- Design tokens (matched to Wix palette) ---------- */
:root {
  --bg:           #ffffff;
  --bg-soft:      #fbf9f4;
  --ink:          #1a1a1a;
  --ink-soft:     #3d3d3d;
  --ink-mute:     #6b6b6b;

  /* Brand colors lifted from the Wix site via DOM inspection */
  --green:        #3F7652;     /* primary forest green */
  --green-light:  #68B04D;
  --yellow:       #FED301;     /* bright newsletter yellow */
  --gold:         #c4a047;     /* subtle line accent */
  --rule:         #e2dccc;

  --gradient-divider: linear-gradient(50deg, #7A798A 17%, #C2D4F6 48%, #FED301 81%);

  --max-width: 78rem;
  --content-width: 44rem;

  --font-serif:  "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --font-sans:   "Heebo", "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body:   "Heebo", Arial, Helvetica, sans-serif;
}

html { font-size: 17px; }
@media (min-width: 800px) { html { font-size: 18px; } }

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  margin: 0;
}

/* ---------- Site header ---------- */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
  padding: 0.6rem 1.5rem;
}
.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}
.site-header a.brand { grid-column: 1; }
.site-header nav     { grid-column: 2; justify-self: center; }
.site-header a.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--ink);
}
.site-header nav { display: flex; gap: 1.3rem; flex-wrap: wrap; }
.site-header nav a {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.15s;
}
.site-header nav a:hover { color: var(--green); }

main { display: block; }

/* ---------- Hero (fixed behind content; content slides up over it) ---------- */
/* On the home page the hero is position:fixed so it stays pinned in the
   viewport, and the post-hero content has margin-top:100vh + a higher
   z-index so it visually slides up over the photo as the user scrolls. */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  width: 100%;
  overflow: hidden;
  background: #1a1410;
}
body.home .hero {
  position: fixed;
  inset: 0 0 auto 0;
  height: 100vh;
  z-index: 0;
}
body.home .page-scroll-content {
  position: relative;
  z-index: 1;
  margin-top: 100vh;
  background: var(--bg);
}
body.home .site-footer {
  position: relative;
  z-index: 1;
}
/* The header stays above everything */
body.home .site-header { z-index: 60; }
.hero-image {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 35%;
}
.hero-image::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.35) 100%);
}
.hero-inner {
  position: absolute;
  top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  text-align: center;
  padding: 0 1.5rem;
  color: #fff;
  z-index: 2;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(3rem, 6vw, 5rem);
  color: #FED301;          /* bright gold, matches the Wix hero */
  letter-spacing: 0.02em;
  margin: 0 0 0.4em;
  text-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.hero-tagline {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.18em;
  margin: 0;
  color: #fff;
  opacity: 0.95;
}

/* ---------- About CTA pill (immediately under hero) ---------- */
.about-cta-wrap {
  display: flex; justify-content: center;
  padding: 2.5rem 1.5rem 2rem;
  background: var(--bg);
}
.about-cta {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.95rem 2.4rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(63,118,82,0.25);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.about-cta:hover {
  background: #2f5e40;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(63,118,82,0.35);
}

/* ---------- Sections (green-framed boxes) ---------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section-box {
  border: 1px solid var(--green);
  border-radius: 2px;
  padding: 3rem 2rem 4rem;
  background: var(--bg);
}
.section-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.8rem;
  text-align: center;
  color: var(--ink-soft);
  letter-spacing: 0.3em;
  margin: 0 0 1.2rem;
}
.section-rule {
  height: 1px;
  background: var(--gold);
  max-width: 38rem;
  margin: 0 auto 3rem;
  opacity: 0.6;
}

/* ---------- Book grid ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4rem 2.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
@media (max-width: 760px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 3rem 1.5rem; }
}
@media (max-width: 480px) {
  .book-grid { grid-template-columns: 1fr; }
}
.book-card {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none;
  color: inherit;
}
.book-card .cover {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 220 / 335;
  background: #f3eee2;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(20, 10, 0, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.book-card .cover img {
  width: 100%; height: 100%; object-fit: cover;
}
.book-card:hover .cover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(20, 10, 0, 0.26);
}
.book-card .label {
  margin-top: 1.2rem;
  display: inline-block;
  border: 1px solid var(--green);
  color: var(--green);
  background: transparent;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 1.3rem;
  border-radius: 2px;
  text-align: center;
  transition: background 0.18s, color 0.18s;
}
.book-card:hover .label {
  background: var(--green);
  color: #fff;
}
.book-card .label-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-mute);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ---------- Gradient divider band between sections ---------- */
.gradient-divider {
  height: 50px;
  width: 100%;
  background: var(--gradient-divider);
  margin: 3rem 0;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  background-color: #1a1410;
  background-size: cover;
  background-position: center;
  padding: 6rem 1.5rem 2rem;
  color: #fff;
  margin-top: 0;
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,15,15,0.45), rgba(15,15,15,0.75));
}
.footer-portrait {
  position: relative;
  width: 220px; height: 220px;
  margin: 0 auto -110px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  z-index: 2;
}
.footer-portrait img { width: 100%; height: 100%; object-fit: cover; }

.footer-content {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8rem 2rem 3rem;
  text-align: center;
}
.footer-content h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.footer-content .rule {
  width: 36rem; max-width: 80%;
  height: 1px;
  background: var(--gold);
  margin: 0 auto 2rem;
  opacity: 0.5;
}
.footer-content p { margin: 0.6em 0; color: var(--ink-soft); }
.footer-content a { color: var(--green); text-decoration: none; }
.footer-content a:hover { text-decoration: underline; }

.newsletter {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin: 2rem 0 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter input[type="email"] {
  border: 1px solid var(--rule);
  background: var(--bg);
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  border-radius: 2px;
  min-width: 250px;
  text-align: right;
  direction: rtl;
}
.newsletter button {
  background: var(--yellow);
  color: var(--ink);
  border: none;
  padding: 0.75rem 1.8rem;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 2px;
  transition: background 0.2s, transform 0.2s;
}
.newsletter button:hover { background: #ffd900; transform: translateY(-1px); }
.newsletter-label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-family: var(--font-sans);
}

.social {
  margin: 2rem 0;
  display: flex; justify-content: center; gap: 0.8rem; align-items: center;
}
.social .label {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-mute);
  margin-left: 0.6rem;
}
.social a {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}
.social a:hover { background: var(--ink); color: #fff; }
.social svg { width: 18px; height: 18px; }

.copyright {
  background: var(--bg-soft);
  border-top: 1px solid var(--rule);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.78rem;
  line-height: 1.7;
  position: relative;
}

/* ---------- Content pages (book / essay / about) — kept intact ---------- */
.page-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
article.content {
  max-width: var(--content-width);
  margin: 0 auto;
}
article.content .page-title {
  text-align: center;
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin: 0.4em 0 0.2em;
  color: var(--ink);
}
article.content .page-rule {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem;
  color: var(--gold);
  margin-bottom: 2.5rem;
}
article.content .page-rule::before,
article.content .page-rule::after {
  content: "";
  display: block; width: 60px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
article.content .page-rule .diamond {
  width: 7px; height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
}
article.content p { font-size: 1.08rem; margin: 0.3em 0; line-height: 1.75; }
article.content p:empty { display: none; }
article.content img,
article.content p > img:only-child {
  display: block;
  margin: 2.5rem auto 1.5rem;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(20, 10, 0, 0.14);
  max-width: 100%;
}
.poem-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--green);
  text-align: center;
  margin: 3rem 0 0.2em;
}
.poem-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  text-align: center;
  margin: 0 0 1.6em !important;
}
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink-soft);
}
.back-link:hover { color: var(--green); }
.back-link::before { content: "← "; }

/* When a poem/chapter is jumped to, leave room for the sticky header so the
   title isn't hidden behind it. */
.poem-title, .chapter-title { scroll-margin-top: 84px; }
html { scroll-behavior: smooth; }

/* Prose chapter headings */
.chapter-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--green);
  text-align: center;
  margin: 3.5rem 0 1rem;
}

/* ---------- TOC: top-left toggle button + slide-in drawer ---------- */
.toc-toggle {
  position: fixed;
  top: 78px;
  right: 1.5rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.55rem 1rem 0.55rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.toc-toggle:hover {
  background: #2f5e40;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.toc-toggle svg { width: 18px; height: 18px; display: block; }
.toc-toggle-label { line-height: 1; }

@media (max-width: 600px) {
  .toc-toggle { padding: 0.55rem; }
  .toc-toggle-label { display: none; }
}

.toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 5, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}
.toc-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.toc-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 88vw;
  background: var(--bg);
  border-left: 1px solid var(--rule);
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  direction: rtl;
  text-align: right;
}
.toc-drawer.open { transform: translateX(0); }

.toc-drawer__header {
  flex-shrink: 0;
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.toc-drawer__header h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.toc-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.toc-close:hover { background: var(--bg-soft); color: var(--green); }

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  overflow-y: auto;
  flex: 1;
  counter-reset: poem;
}
.toc-list li {
  counter-increment: poem;
}
.toc-list a {
  display: block;
  padding: 0.7rem 1.5rem 0.7rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid #f1ebd9;
  transition: background 0.15s, color 0.15s, padding 0.15s;
  position: relative;
}
.toc-list a::before {
  content: counter(poem) ".";
  display: inline-block;
  width: 1.8em;
  color: var(--ink-mute);
  font-family: var(--font-sans);
  font-size: 0.85em;
}
.toc-list a:hover {
  background: var(--bg-soft);
  color: var(--green);
  padding-right: 1.8rem;
}
.toc-list a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}
