:root {
  --paper: #f2f1ed;
  --panel: #fbfaf6;
  --ink: #151514;
  --muted: #66645e;
  --line: rgba(21, 21, 20, 0.16);
  --accent: #892f22;
  --max: 72rem;
  --header-background-color: #f2f1ed;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.header-color-band {
  --header-band-color: var(--paper);
  --header-size: 70px;
  position: relative;
  z-index: 0;
  width: 100%;
  height: var(--header-size);
  margin-bottom: calc(-1 * var(--header-size));
  background: var(--header-band-color);
  pointer-events: none;
}

.site-header {
  --header-size: 70px;
  --header-logo-size: 35px;
  --header-org-size: 18px;
  --header-route-size: 15px;
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-size);
  padding: 0 clamp(1rem, 4vw, 3rem);
  background: var(--header-background-color);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

@supports (background: color-mix(in srgb, white 88%, transparent)) {
  .site-header {
    background: color-mix(in srgb, var(--header-background-color) 88%, transparent);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: "EB Garamond", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  text-decoration: none;
  font-size: var(--header-org-size);
}

.brand img {
  width: var(--header-logo-size);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  color: var(--muted);
  font-size: var(--header-route-size);
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover,
.text-link:hover {
  color: var(--accent);
}

.page-heading h1,
.page-content h1 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1;
}

.gesar-hero {
  --frame-width: 32px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  background: #0057b8;
}

.hero-tv-static {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.home-content-anchor {
  scroll-margin-top: 0;
}

.hero-scroll-link {
  position: absolute;
  z-index: 1;
  bottom: clamp(1rem, 4vh, 2.5rem);
  left: 50%;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  transform: translateX(-50%);
  text-decoration: none;
}

.hero-scroll-link span {
  width: 1rem;
  height: 1rem;
  border-right: 2px solid rgba(255, 255, 255, 0.78);
  border-bottom: 2px solid rgba(255, 255, 255, 0.78);
  transform: translateY(-0.2rem) rotate(45deg);
}

.gesar-frame {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  line-height: 0;
  padding: var(--frame-width);
}

.gesar-frame-green {
  background: #15844c;
}

.gesar-frame-red {
  background: #d9231f;
}

.gesar-frame-white {
  background: #f8f5e9;
}

.gesar-frame-yellow {
  background: #f4cf29;
}

.gesar-frame picture,
.gesar-frame img {
  display: block;
}

.gesar-frame img {
  width: auto;
  height: auto;
  max-width: min(690px, 58vw);
  max-height: min(800px, 70svh);
}

.gesar-hero[data-text-theme="red_black"] ~ .book-feature,
.gesar-hero[data-text-theme="red_black"] ~ .events-preview {
  --ink: #ff3026;
  --muted: #cc211a;
  --line: rgba(255, 48, 38, 0.28);
  --accent: #ff5a50;
  background: #050505;
  color: #ff3026;
}

.gesar-hero[data-text-theme="red_black"] ~ .book-feature .panel,
.gesar-hero[data-text-theme="red_black"] ~ .events-preview {
  background: #050505;
}

.gesar-hero[data-text-theme="red_black"] ~ .book-feature .button,
.gesar-hero[data-text-theme="red_black"] ~ .events-preview .button {
  border-color: #ff3026;
  background: #ff3026;
  color: #050505;
}

.gesar-hero[data-text-theme="red_black"] ~ .book-feature .button-secondary,
.gesar-hero[data-text-theme="red_black"] ~ .events-preview .button-secondary {
  background: transparent;
  color: #ff3026;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.section-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.78rem 1.05rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

.button-secondary {
  background: transparent;
  color: var(--ink);
}

.donate-action {
  margin-top: 2rem;
}

.donate-button {
  border-color: #dd0000;
  background: #dd0000;
  color: #fff;
}

.tuning-panel {
  position: fixed;
  z-index: 30;
  bottom: 1rem;
  left: 1rem;
  color: var(--ink);
}

.tuning-toggle,
.tuning-save {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.52rem 0.85rem;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.tuning-body {
  position: absolute;
  bottom: calc(100% + 0.6rem);
  left: 0;
  width: 17rem;
  max-height: calc(100vh - 5.5rem);
  overflow: auto;
  padding: 1rem;
  background: rgba(242, 241, 237, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

.tuning-body h2 {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
  font-weight: 400;
}

.tuning-body label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  color: #333;
  font-size: 0.88rem;
}

.tuning-body input[type="range"],
.tuning-body input[type="color"] {
  width: 100%;
}

.tuning-body .tuning-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tuning-checkbox input {
  margin: 0;
}

.tuning-status {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.section-grid,
.book-feature,
.events-preview,
.newsletter-signup,
.page-shell {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
}

.section-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  padding: 0 0 clamp(3rem, 8vw, 7rem);
}

.book-feature {
  padding: clamp(3rem, 8vw, 7rem) 0;
}

.panel,
.events-preview,
.newsletter-signup,
.page-shell {
  border-top: 1px solid var(--line);
}

.panel {
  padding: clamp(1.5rem, 4vw, 3rem);
  background: rgba(251, 250, 246, 0.42);
}

.panel h2,
.events-preview h2,
.book-card h2,
.event-list-panel h2,
.calendar-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 400;
  line-height: 1;
}

.panel p,
.events-preview p,
.page-content p,
.book-card p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.62;
}

.text-link {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.book-callout {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(18rem, 34rem);
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  background: transparent;
}

.book-callout img,
.book-card img {
  border: 1px solid var(--line);
  box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 0.08);
}

.events-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.newsletter-signup {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(18rem, 30rem);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.newsletter-signup p,
.newsletter-form label {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.62;
}

.newsletter-form {
  display: grid;
  gap: 0.85rem;
}

.newsletter-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.newsletter-form label {
  display: grid;
  gap: 0.35rem;
}

.newsletter-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.8rem 0.9rem;
  background: rgba(255, 255, 255, 0.36);
  color: var(--ink);
  font: inherit;
}

.newsletter-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.newsletter-status {
  margin: 0.25rem 0 0;
  color: var(--ink);
}

.newsletter-status-error {
  color: var(--accent);
}

.empty-state {
  max-width: 34rem;
}

.site-footer {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 3rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.35rem 0;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.footer-contact a {
  text-underline-offset: 0.2em;
}

.page-shell {
  min-height: calc(100svh - 10rem);
  padding: clamp(3rem, 8vw, 7rem) 0;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(16rem, 0.72fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.page-layout-about,
.page-layout-gterma {
  grid-template-columns: minmax(0, 0.62fr) minmax(22rem, 1.1fr);
}

.page-layout-text-only {
  display: block;
}

.page-content {
  max-width: 48rem;
}

.page-media {
  margin: 0;
}

.page-media img {
  width: 100%;
  border: 1px solid var(--line);
  box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 0.08);
}

.page-content h2,
.page-content h3 {
  margin-top: 2rem;
  font-weight: 400;
}

.page-content li {
  margin: 0.45rem 0;
  color: var(--muted);
}

.book-grid {
  margin-top: 3rem;
}

.book-card {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.book-subtitle {
  font-style: italic;
}

.events-shell {
  width: min(100% - 2rem, 80rem);
}

.page-heading {
  max-width: 48rem;
  margin-bottom: clamp(2rem, 6vw, 4rem);
}

.page-heading p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.events-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.45fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}

.calendar-panel,
.event-list-panel {
  border: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.5);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.calendar-header a {
  color: var(--muted);
  font-size: 0.9rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.weekday,
.calendar-day {
  min-height: 5.8rem;
  padding: 0.65rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday {
  min-height: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.calendar-day {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.calendar-day.is-muted {
  color: rgba(21, 21, 20, 0.28);
}

.calendar-day strong {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  text-align: center;
}

.event-list-panel {
  padding: 1.2rem;
}

.event-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.event-list li {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.event-list time {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 820px) {
  .site-header,
  .section-grid,
  .events-preview,
  .newsletter-signup,
  .book-card,
  .events-layout,
  .page-layout {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 0.9rem;
    padding-bottom: 0.75rem;
  }

  .gesar-hero {
    min-height: 100svh;
    padding: 1rem;
  }

  .gesar-frame img {
    width: auto;
    max-width: min(690px, 64vw);
    max-height: 62svh;
  }

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

  .book-callout img,
  .book-card img {
    width: min(14rem, 70vw);
  }

  .events-preview {
    align-items: start;
  }

  .newsletter-fields {
    grid-template-columns: 1fr;
  }

  .page-media {
    position: static;
  }

  .calendar-grid {
    font-size: 0.84rem;
  }

  .weekday,
  .calendar-day {
    min-height: 3.6rem;
    padding: 0.45rem;
  }
}
