:root {
  --bg: #ffffff;
  --bg-alt: #f4f4f1;
  --surface: #ffffff;
  --text: #333333;
  --text-muted: #767676;
  --accent: #6cb83a;
  --accent-strong: #547f30;
  --border: #e6e5df;
  --chip-bg: #eef4e5;
  --chip-text: #4c7a2c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
  --font-display: "Oswald", "Arial Black", sans-serif;
  --font-body: "Droid Sans", Verdana, sans-serif;
  --font-serif: "Droid Serif", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.site-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  gap: 22px;
}

.main-nav a {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 500;
}

.main-nav a:hover { color: var(--accent); }

/* On Hebrew (RTL) pages the page content mirrors, but the top bar should keep
   the same layout as every other language: LIVE RECIPE pinned left, language
   picker pinned right. Forcing the header row to LTR does exactly that while
   the Hebrew nav-link glyphs still shape correctly within each link. */
[dir="rtl"] .header-inner {
  direction: ltr;
}

.hero-search {
  padding: 40px 0 16px;
  text-align: center;
}

.hero-search h1 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#search-input {
  width: 100%;
  max-width: 520px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  box-shadow: var(--shadow);
}

#search-input:focus {
  border-color: var(--accent);
}

.search-count {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.filter-chip {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  height: 24px;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}

.card {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-image {
  aspect-ratio: 4 / 3;
  background: var(--chip-bg);
  overflow: hidden;
}

.card-image img, .no-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 14px 16px 18px;
}

.card-body h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.3;
  font-weight: 600;
}

.meta {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.no-results {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

/* Recipe detail page */
.recipe-page { padding-top: 20px; }

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.back-link:hover { color: var(--accent); }

.recipe-header h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.recipe-header {
  margin-bottom: 2px;
}

/* Float the hero photo beside the text at its natural size, like the
   original blog layout, instead of stretching it into a wide banner. */
.hero-image {
  display: block;
  float: left;
  width: auto;
  max-width: 300px;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  padding: 2px;
  background: var(--surface);
  margin: 2px 20px 12px 0;
}

/* Hebrew reads right-to-left, so the photo should sit on the right with text
   starting from it, mirroring the LTR layout rather than keeping a
   physically-left float. */
[dir="rtl"] .hero-image {
  float: right;
  margin: 2px 0 12px 20px;
}

@media (max-width: 640px) {
  .hero-image {
    float: none;
    max-width: 100%;
    margin: 12px 0;
  }
}

.recipe-text {
  font-size: 0.95rem;
  line-height: 1.42;
}

.recipe-text u strong,
.recipe-text strong u {
  display: block;
  margin: 1.1em 0 0.35em;
  font-size: 1.05em;
  color: #000000;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  font-weight: 600;
}

/* Small inline thumbnail row, matching the original's compact photo strip,
   instead of a large stretched grid. */
.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  clear: both;
  margin-top: 28px;
}

.gallery-grid img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
}

.static-page h1 {
  margin-top: 32px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.static-content { max-width: 760px; }
.static-content img { max-width: 100%; border-radius: 10px; }
.static-content h2 {
  margin-top: 2em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.static-content table { width: 100%; border-collapse: collapse; }
.static-content td { vertical-align: top; padding: 8px 16px 8px 0; }
.static-content a { color: var(--accent); text-decoration: underline; }

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 30px 0 50px;
}

/* Image lightbox — hero and gallery photos open here instead of a new tab. */
.hero-image { cursor: zoom-in; }
.gallery-grid a { cursor: zoom-in; }

.img-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
}

.img-modal[hidden] { display: none; }

/* The frame sizes to the photo, so the close button can pin to the image's
   own corner rather than floating off in the viewport corner. */
.img-modal-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.img-modal-img {
  width: 600px;
  height: 600px;
  object-fit: contain;
  border-radius: 6px;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55);
}

.img-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.img-modal-close:hover { background: rgba(0, 0, 0, 0.8); }

body.img-modal-open { overflow: hidden; }

/* Modal wrapper with flexbox for image + carousel */
.img-modal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Image carousel in modal */
.img-modal-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.img-modal-thumbs-scroll {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 600px;
  scroll-behavior: smooth;
}

.img-modal-thumbs {
  display: flex;
  gap: 8px;
  padding: 4px;
}

.img-modal-thumb {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.img-modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-modal-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.img-modal-thumb.active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.img-modal-nav-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.img-modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.img-modal-nav-btn:active {
  background: rgba(255, 255, 255, 0.4);
}

/* --- Top-bar tools: recipe prev/next, search, language picker --- */
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Prev/next recipe controls, now compact and inline in the header. */
.recipe-nav-group { display: flex; gap: 4px; }

.recipe-nav {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: none;
}

a.recipe-nav:hover { color: var(--accent); border-color: var(--accent); }
.recipe-nav.disabled { opacity: 0.35; }

/* Header search box + results dropdown. */
.header-search { position: relative; }

.header-search-input {
  width: 190px;
  max-width: 40vw;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.header-search-input:focus { border-color: var(--accent); }

.header-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-width: 80vw;
  max-height: 62vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 60;
  padding: 6px;
}

.hs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text);
}

.hs-item:hover { background: var(--bg-alt); }

.hs-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
}

.hs-item span { font-size: 0.9rem; line-height: 1.3; }

@media (max-width: 720px) {
  .header-search-input { width: 120px; }
  .header-tools { gap: 8px; }
}

/* Recipe title with side navigation buttons at page edges */
.recipe-title-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 30px;
  width: 100%;
}

.recipe-nav-side {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: none;
  flex-shrink: 0;
}

a.recipe-nav-side:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.recipe-nav-side.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

a.recipe-nav-side {
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.recipe-title-nav .recipe-header {
  text-align: center;
  flex: 1;
}

.recipe-title-nav h1 {
  margin: 0;
  text-align: center;
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* Date and categories on same line */
.meta-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1;
}

.meta-inline time {
  white-space: nowrap;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  height: 100%;
}

.meta-inline .chips {
  display: flex;
  align-items: center;
  margin: 0;
}

/* Remove conflicting recipe-header styles for new layout */
.recipe-title-nav h1 {
  margin: 0;
  text-align: center;
}

/* Ensure meta is centered below title */
.recipe-page .meta-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0 30px;
  line-height: 1;
}

.recipe-page .meta-inline time {
  white-space: nowrap;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  height: 100%;
}

.recipe-page .meta-inline .chips {
  display: flex;
  align-items: center;
  margin: 0;
}
