:root {
  /* Change the theme from this single palette. */
  --bg: #f4effb;
  --bg-accent: #e8dff7;
  --surface: #fffdfd;
  --surface-strong: #f3ebfb;
  /* Dark enough for white button text while retaining the lavender theme. */
  --primary: #7d5da5;
  --secondary: #6f5a98;
  --secondary-soft: #efe5fb;
  --ink: #3f2e4d;
  /* Maintains readable contrast for body copy on the light surfaces. */
  --muted: #6f5d7e;
  --line: rgba(79, 53, 107, 0.12);
  --shadow: 0 18px 40px rgba(124, 106, 141, 0.14);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --container: 1160px;
}

* {
  /* Make width and height calculations predictable for every component. */
  box-sizing: border-box;
}

html {
  /* Anchor links scroll smoothly to the section IDs in index.html. */
  scroll-behavior: smooth;
}

/* Prevent sticky-header overlap when links jump to a section. */
section[id] {
  scroll-margin-top: 5.5rem;
}

body {
  /* Global typography, colors, and the page background. */
  margin: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #f7f1fb 100%);
  color: var(--ink);
  line-height: 1.7;
}

img {
  /* Prevent images from overflowing their cards on smaller screens. */
  max-width: 100%;
  display: block;
}

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

button {
  font: inherit;
}

.container {
  /* Shared maximum width used by the header and every page section. */
  width: min(var(--container), calc(100% - 2rem));
  margin: 0 auto;
}

.page-shell {
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--ink);
  color: #fff;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  /* Sticky header keeps the main navigation available while scrolling. */
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 240, 248, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-wrapper {
  /* Header layout: logo left, navigation and actions distributed across the row. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 80px;
}

.brand {
  /* The display font intentionally differs from the navigation font. */
  display: inline-flex;
  align-items: center;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 2vw + 1rem, 2.6rem);
  letter-spacing: 0.02em;
  font-weight: 700;
  line-height: 1;
}

.site-nav {
  /* Desktop navigation wrapper; mobile positioning is defined below. */
  display: flex;
  align-items: center;
}

.nav-list {
  /* Generated navigation items from content.js. */
  display: flex;
  list-style: none;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.2;
  transition: color 0.2s ease;
}

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

.nav-link:focus-visible,
.footer-links a:focus-visible,
.quick-link:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.2em;
}

.language-switcher {
  /* The custom listbox matches the mobile navigation panel instead of native select styling. */
  display: inline-flex;
  align-items: center;
  position: relative;
  z-index: 60;
}

.language-trigger {
  position: relative;
  min-width: 106px;
  min-height: 42px;
  padding: 0.42rem 2.2rem 0.42rem 0.85rem;
  border: 1px solid rgba(107, 77, 127, 0.18);
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--secondary);
  box-shadow: 0 4px 12px rgba(107, 77, 127, 0.08);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.language-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.85rem;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}

.language-switcher.open .language-trigger::after {
  transform: translateY(-25%) rotate(225deg);
}

.language-trigger:hover,
.language-switcher.open .language-trigger {
  border-color: rgba(107, 77, 127, 0.35);
  background: var(--surface);
}

.language-trigger:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.language-options {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(253, 251, 255, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.35rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.language-switcher.open .language-options {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.language-options button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.language-options button:hover,
.language-options button:focus-visible,
.language-options button[aria-selected="true"] {
  background: var(--secondary-soft);
  color: var(--ink);
}

.language-options button:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.button {
  /* Shared pill button shape used by hero, contact, and header actions. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.9rem 1.6rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}

.button-primary {
  /* Main action treatment. */
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 18px rgba(155, 107, 168, 0.25);
}

.button-secondary,
.button-ghost {
  /* Secondary and header action treatment. */
  background: rgba(107, 77, 127, 0.08);
  color: var(--ink);
  border: 1px solid rgba(107, 77, 127, 0.15);
}

.nav-cta {
  /* Match the CTA height to the language selector in the header. */
  min-height: 42px;
  padding: 0 1rem;
  line-height: 1.2;
}

@media (min-width: 901px) {
  /* Optical baseline correction for the different logo and menu fonts. */
  .site-nav,
  .language-switcher,
  .nav-cta {
    transform: translateY(3px);
  }
}

.hero {
  /* First viewport introduction. */
  padding: 5rem 0 4rem;
}

.hero-grid {
  /* Two-column desktop hero that collapses in the responsive breakpoint. */
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
}

.eyebrow,
.section-label {
  margin: 0 0 1rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
}

.hero h1,
.story h2,
.section-heading h2,
.contact h2 {
  /* Display headings use the same serif face throughout the site. */
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(3rem, 3vw + 1rem, 5rem);
  line-height: 0.97;
  letter-spacing: -0.04em;
}

.hero-roles {
  margin: 0.5rem 0 1.4rem 0;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hero-text {
  max-width: 620px;
  margin: 1.4rem 0 0;
  font-size: 1.07rem;
  color: var(--muted);
}

.hero-actions {
  /* Keep calls to action side by side when there is enough room. */
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hero-stats {
  /* Flexible statistics row below the hero actions. */
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2.25rem;
}

.stat-item {
  display: grid;
  gap: 0.25rem;
  min-width: 110px;
}

.stat-item strong {
  font-size: clamp(1.6rem, 1vw + 1rem, 2.1rem);
  font-weight: 800;
  color: var(--ink);
}

.stat-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  align-items: center;
}

.portrait-frame {
  /* Fixed aspect ratio keeps the portrait stable while the image loads. */
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--bg-accent), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-xl);
}

.quote-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  max-width: 430px;
  color: var(--muted);
  font-size: 1rem;
}

.quote-card blockquote {
  margin: 0;
}

.quick-info {
  /* Four short orientation cards between the hero and the story section. */
  background: rgba(155, 107, 168, 0.03);
  padding: 3rem 0;
}

.quick-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.quick-info-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: 0 4px 12px rgba(107, 77, 127, 0.06);
}

.quick-info-card h3 {
  margin: 0 0 0.8rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.quick-info-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.quick-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--primary);
  transition: opacity 0.2s ease;
}

.quick-link:hover {
  opacity: 0.7;
}

.events {
  /* Light band visually separates event content from adjacent sections. */
  background: rgba(155, 107, 168, 0.03);
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.event-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(107, 77, 127, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(107, 77, 127, 0.12);
}

.event-icon {
  font-size: 2.8rem;
  margin: 0 0 1rem;
  display: block;
}

.event-card h3 {
  margin: 0 0 0.8rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.event-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.section {
  /* Default vertical rhythm for all major page sections. */
  padding: 4.5rem 0;
  /* Defer layout and paint work for sections below the first viewport. */
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

.story-grid {
  /* Two-column personal introduction on desktop. */
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 2.5rem;
  align-items: start;
}

.story-content {
  display: grid;
  gap: 1rem;
  color: var(--muted);
}

.story-content p {
  margin: 0;
  font-size: 1.02rem;
}

.section-heading {
  /* Shared label, heading, and spacing pattern for content sections. */
  display: grid;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.section-heading h2 {
  font-size: clamp(2.2rem, 1.2vw + 1.5rem, 4rem);
  line-height: 1.02;
}

.section-intro {
  max-width: 800px;
  margin: 0 0 2.5rem 0;
  font-size: 1.02rem;
  color: var(--muted);
  line-height: 1.7;
}

.books-note {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.45;
}

.principles .section-intro {
  text-align: center;
  margin-bottom: 2.5rem;
}

.card-grid,
.principles-grid,
.book-grid {
  /* Reusable card grid; each section overrides columns where needed. */
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.book-grid {
  grid-template-columns: 1fr;
}

.info-card,
.principle-card,
.book-card {
  /* Shared card surface and border treatment. */
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: 0 10px 24px rgba(27, 23, 21, 0.04);
}

.book-card {
  max-width: 700px;
  padding: 2.2rem;
}

.card-badge,
.book-type {
  display: inline-flex;
  align-items: center;
  background: var(--secondary-soft);
  color: var(--secondary);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.info-card h3,
.principle-card h3,
.book-card h3 {
  margin: 1rem 0 0.7rem;
  font-size: 1.4rem;
}

.book-cover {
  /* Covers stay centered and never exceed their intended display width. */
  width: 100%;
  height: auto;
  max-width: 240px;
  margin: 0 auto 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(107, 77, 127, 0.15);
  display: block;
}

.book-type {
  text-transform: none;
  letter-spacing: 0.01em;
}

.info-card p,
.principle-card p,
.book-card p,
.contact-card p {
  margin: 0;
  color: var(--muted);
}

.principles {
  /* Upcoming dates receive a subtly darker section background. */
  background: rgba(107, 77, 127, 0.04);
}

.principle-card {
  text-align: center;
}

.principle-card h3 {
  font-size: 1.3rem !important;
}

.principles-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.principle-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(155, 107, 168, 0.1);
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.contact-card {
  /* Contact block balances copy on the left with actions on the right. */
  background: linear-gradient(135deg, #f3f0f8, #e8dff5);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: clamp(1.6rem, 3vw, 3rem);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer {
  /* Footer closes the page with secondary social navigation. */
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2.5rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
}

.menu-toggle {
  /* Hidden on desktop; becomes the mobile navigation trigger below 900px. */
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 10px;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}

/* Respect users who request less animation or movement from the operating system. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Keep borders, text, and controls distinguishable when the user enables forced colors. */
@media (forced-colors: active) {
  .button,
  .language-switcher,
  .menu-toggle,
  .quick-info-card,
  .event-card,
  .info-card,
  .principle-card,
  .book-card,
  .contact-card {
    border: 1px solid ButtonText;
  }

  .button,
  .language-switcher,
  .menu-toggle {
    background: ButtonFace;
    color: ButtonText;
  }

  .button-primary {
    background: Highlight;
    color: HighlightText;
  }
}

@media (max-width: 900px) {
  /* Collapse navigation into the menu button on smaller screens. */
  .hero-grid,
  .story-grid,
  .contact-card,
  .card-grid,
  .principles-grid,
  .book-grid,
  .quick-info-grid,
  .events-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    display: grid;
  }

  .site-nav {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + 0.5rem);
    background: rgba(253, 251, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    box-shadow: var(--shadow);
    display: none;
  }

  .site-nav.open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .nav-cta {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  /* Extra-small screens use full-width actions and tighter section spacing. */
  .hero {
    padding-top: 3rem;
  }

  .section {
    padding: 3.4rem 0;
  }

  .button {
    width: 100%;
  }

  .hero-actions,
  .contact-actions {
    display: grid;
  }
}
