/* Reset and Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Color Palette - Modern, Warm, Accessible */
  --color-primary: #333333;
  --color-secondary: #555555;
  --color-tertiary: #767676;
  --color-accent: #0056b3;
  --color-accent-hover: #004494;
  --color-accent-light: #3395ff;
  --color-background: #f8f9fa;
  --color-surface: #ffffff;
  --color-border: #e9ecef;
  --color-text-light: #6c757d;

  --color-link: #0056b3;
  --color-link-hover: #004494;
  --color-link-visited: #5c4d7d;

  /* Typography Variables by Language */
  --font-en-serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --font-en-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-he-serif: 'Frank Ruhl Libre', serif;
  --font-he-sans: 'Assistant', sans-serif;

  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;

  /* Layout */
  --container-max: 72rem;
  --content-max: 65ch;
  --header-height: auto;
}

/* Base Typography */
html {
  font-size: 16px;
  line-height: 1.6;
}

/* Global Link Styles */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

a:visited {
  color: var(--color-link-visited);
}

/* Component Overrides for Links */
.nav-link,
.site-title a,
.lang-switch-btn,
.button {
  text-decoration: none;
  /* Colors managed by their own classes */
}

/* Prevent visited color bleed for nav/buttons */
.nav-link:visited {
  /* Keep visited nav links consistent with their state (hover/active override this mostly, but good for base) */
  color: var(--color-secondary);
}

.site-title a:visited {
  color: var(--color-primary);
}

.button:visited {
  color: #ffffff !important;
}

body {
  font-family: var(--font-en-serif);
  font-size: 1.125rem;
  color: var(--color-primary);
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hebrew Overrides */
[lang="he"] body {
  font-family: var(--font-he-serif);
}

/* Layout Structure */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
  width: 100%;
}

/* Header Styles */
.site-header {
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-md) 0;
}

/* Header Layout */
.header-top-bar {
  display: flex;
  justify-content: flex-end;
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-surface);
}

[dir="rtl"] .header-top-bar {
  justify-content: flex-end;
  /* In RTL, 'flex-end' is logically Left, which is correct for "end of line" */
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Site Title */
.site-title h1 {
  font-family: var(--font-en-serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

[lang="he"] .site-title h1 {
  font-family: var(--font-he-serif);
}

.site-title a {
  text-decoration: none;
  color: inherit;
}



.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.nav-link {
  font-family: var(--font-en-sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--color-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  background-color: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 2.5rem;
  /* Ensure uniform height target */
}

[lang="he"] .nav-link {
  font-family: var(--font-he-sans);
  font-weight: 500;
}

/* Hover/Active State - Animated Underline */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--color-accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

[dir="ltr"] .nav-link::after {
  transform-origin: right;
}

[dir="ltr"] .nav-link:hover::after,
[dir="ltr"] .nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

[dir="rtl"] .nav-link::after {
  transform-origin: left;
}

[dir="rtl"] .nav-link:hover::after,
[dir="rtl"] .nav-link.active::after {
  transform: scaleX(1);
  transform-origin: right;
}

.nav-link:hover,
.nav-link:focus {
  background-color: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.nav-link.active {
  background-color: var(--color-surface);
  color: var(--color-accent);
  font-weight: 600;
}

.nav-link:focus {
  outline: none;
}

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

/* Migrated Hugo Columns */
.columns-container {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: start;
}

.columns-container>* {
  flex: 1;
  min-width: 250px;
}

/* Call to Action Button in Nav */
/* Call to Action Split Button */
.nav-cta-group {
  display: flex;
  align-items: stretch;
  background-color: var(--color-accent);
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 86, 179, 0.4);
  transition: all 0.2s ease;
  position: relative;
  color: #ffffff;
  min-height: 2.5rem;
  /* Match nav-link */
}

.nav-cta-group:hover {
  background-color: var(--color-accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(0, 86, 179, 0.5);
}

.nav-cta-main {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-en-sans);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

[lang="he"] .nav-cta-main {
  font-family: var(--font-he-sans);
}

[dir="rtl"] .nav-cta-main {
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-cta-main:hover {
  color: #ffffff !important;
  /* Override global a:hover */
  text-decoration: none;
}

.nav-cta-main:visited {
  color: #ffffff !important;
  /* Override global a:visited */
  text-decoration: none;
}

.nav-cta-arrow {
  background: none;
  border: none;
  color: inherit;
  padding: 0 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

[dir="rtl"] .nav-cta-arrow {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.nav-cta-arrow:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Dropdown Menu */
.nav-cta-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 160px;
  display: none;
  z-index: 1000;
}

[dir="rtl"] .nav-cta-dropdown {
  right: auto;
  left: 0;
}

.nav-cta-dropdown.show {
  display: block;
}

.nav-cta-dropdown li {
  display: block;
}

.nav-cta-dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.15s;
  font-family: var(--font-en-sans);
}

.nav-cta-dropdown a:hover {
  background-color: var(--color-background);
  color: var(--color-accent);
}

/* Language Toggle */
.language-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.lang-separator {
  color: var(--color-border);
  user-select: none;
}

.lang-switch-btn {
  font-family: var(--font-en-sans);
  font-size: 0.85rem;
  color: var(--color-tertiary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
}

[lang="he"] .lang-switch-btn {
  font-family: var(--font-he-sans);
}

.lang-switch-btn:hover {
  color: var(--color-primary);
  background-color: var(--color-surface);
}

.lang-switch-btn.active {
  color: var(--color-primary);
  font-weight: 700;
  cursor: default;
}

/* 
   Layout Logic:
   .header-inner uses justify-content: space-between.
   
   LTR (English):
   Order: Title (Start/Left), Nav (End/Right)
   
   RTL (Hebrew):
   Order: Title (Start/Right), Nav (End/Left)
   
   This matches the requirements naturally.
*/


/* Main Content */
.main-content {
  flex: 1;
  padding: var(--space-xl) 0;
}

.content-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
}

.footer-content {
  text-align: center;
  font-family: var(--font-en-sans);
  font-size: 0.875rem;
  color: var(--color-tertiary);
}

[lang="he"] .footer-content {
  font-family: var(--font-he-sans);
}


/* Hero Image */
.hero-image-container {
  margin: var(--space-lg) 0;
  text-align: center;
}

.hero-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  /* Elevation */
  transition: transform 0.3s ease;
}

.hero-image:hover {
  transform: translateY(-2px);
}

/* Button Component */
.button {
  display: inline-block;
  background-color: var(--color-accent);
  color: #ffffff !important;
  /* Force white text */
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-family: var(--font-en-sans);
  /* Use sans serif for buttons */
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: none;
  cursor: pointer;
  line-height: 1.2;
}

[lang="he"] .button {
  font-family: var(--font-he-sans);
}

.button:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-1px);
  text-decoration: none;
}

.button:active {
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .main-nav {
    width: 100%;
    order: 3;
    border-top: 1px solid var(--color-surface);
    padding-top: var(--space-sm);
  }

  /* Hero Image */
  .hero-image-container {
    margin: var(--space-lg) 0;
    text-align: center;
  }

  .site-title {
    order: 1;
    margin-top: var(--space-lg);
    /* Space for language toggle */
  }

  .language-toggle {
    order: 2;
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    /* Fixed position on mobile for lang toggle often nicer? Or flow. Let's keep flow for now but maybe absolute is better to save space */
  }

  [dir="rtl"] .language-toggle {
    right: auto;
    left: var(--space-md);
  }

  .nav-list {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: center;
  }
}

@media print {

  .site-header,
  .site-footer,
  .language-toggle {
    display: none;
  }

  .page-wrapper {
    min-height: auto;
  }

  .main-content {
    padding: 0;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.4;
  }
}

/* Notice Box - Pop Style */
.notice-box {
  font-size: 120%;
  background-color: #fffaf0;
  /* Vibrant Orange */
  padding: 1rem 0.75rem;
  border-radius: 4px;
  margin: var(--space-md) 0;
  color: #2d3748;
  /* Dark grey for readability */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.notice-box-en {
  /* Warm cream/orange tint */
  border-left: 4px solid #dd6b20;
}

.notice-box-he {
  border-right: 4px solid #dd6b20;
}

.notice-box a {
  color: #c05621;
  /* Darker orange/brown for links */
  font-weight: 700;
  text-decoration: underline;
}

.notice-box a:hover {
  color: #9c4221;
}

.notice-box strong {
  color: #c05621;
  font-size: 130%;
  display: inline-block;
  margin: 0 0.5rem;
}

.buy-section-container {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin: var(--space-sm) 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.buy-section-item:not(:last-child) {
  margin-bottom: var(--space-xl);
}

/* Details and Summary Styling */
details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin: var(--space-sm) 0;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

details[open] {
  padding-bottom: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--color-accent-light);
}

summary {
  cursor: pointer;
  font-weight: 500;
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  list-style: none;
  /* Hide default triangle in some browsers */
  position: relative;
  color: var(--color-primary);
  /* font-family: var(--font-en-sans); Use existing font inheritance */
}

summary::-webkit-details-marker {
  display: none;
  /* Hide default triangle in WebKit */
}

summary::after {
  content: '+';
  position: absolute;
  right: 0;
  font-weight: 300;
  font-size: 1.5rem;
  color: var(--color-tertiary);
  transition: transform 0.2s ease;
}

[dir="rtl"] summary::after {
  right: auto;
  left: 0;
}

details[open] summary::after {
  content: '-';
  /* Or rotate existing plus */
  transform: rotate(180deg);
  /* Just for fun interaction if using icon */
  /* Since we swap content, rotation might look weird, let's keep it simple or just rotate */
}

/* Let's try rotation with SVG or pure CSS shape instead of changing content for smooth anim? 
   Actually, standard "+" to "-" content swap is robust. 
*/

summary:hover {
  color: var(--color-accent);
}

summary:hover::after {
  color: var(--color-accent);
}

/* Smooth reveal for content? 
   Pure CSS height transition for details is tricky. 
   For now, simple state change. 
*/

/* Crescas Library Section Styling */
.crescas-library-section {
  background-color: #f0f7ff;
  /* Very light blue tint */
  border-top: 4px solid var(--color-accent);
  padding: var(--space-xl) var(--space-lg);
  margin-top: var(--space-2xl);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.crescas-library-section h2 {
  font-family: var(--font-en-serif);
  color: var(--color-accent);
  font-size: 2.25rem;
  margin-bottom: var(--space-xs);
}

.crescas-library-section h3 {
  font-family: var(--font-en-sans);
  font-weight: 400;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-tertiary);
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

.crescas-library-section a {
  font-weight: 600;
  font-size: 1.25rem;
  text-decoration: none;
  border-bottom: 2px solid var(--color-accent-light);
  padding-bottom: 2px;
  transition: all 0.2s ease;
}

.crescas-library-section a:hover {
  background-color: rgba(0, 86, 179, 0.05);
  border-bottom-color: var(--color-accent);
  color: var(--color-accent-hover);
}

/* Marketplaces Styling */
.marketplaces {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.marketplaces li {
  display: inline-block;
  margin-right: 0.5rem;
}

.marketplaces li::before {
  content: "> ";
  color: var(--color-tertiary);
  margin-right: 0.2rem;
}

[dir="rtl"] .marketplaces li {
  margin-right: 0;
  margin-left: 0.5rem;
}

[dir="rtl"] .marketplaces li::before {
  margin-right: 0;
  margin-left: 0.2rem;
  content: "< ";
}