/* Generated from theme.json at application startup */

:root {
  --background: #000000;
  --text: #ffffff;
  --accent: #4da6ff;
  --border: #444444;
  --font: system-ui, sans-serif;
  --background-image: url('/images/book-cover.webp');
  --background-image-opacity: 0.08;
  --content-max-width: 72rem;
  --radius: 12px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --message-success-bg: #1a3a1a;
  --message-success-border: #2d5f2d;
  --message-success-text: #90ee90;
  --message-error-bg: #3a1a1a;
  --message-error-border: #5f2d2d;
  --message-error-text: #ff8f8f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  background-color: var(--background);
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .loading-spinner::after {
    animation: none;
  }
}

body {
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  position: relative;
}

@supports not (overflow-x: clip) {
  body {
    overflow-x: hidden;
  }
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

img {
  max-width: 100%;
  height: auto;
}

video {
  max-width: 100%;
  width: 100%;
  height: auto;
}

iframe {
  max-width: 100%;
  width: 100%;
}

pre {
  max-width: 100%;
  overflow-x: auto;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: var(--background-image-opacity);
  z-index: -2;
  pointer-events: none;
  will-change: opacity;
}

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  opacity: 0.85;
}

a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 3px solid #4da6ff;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--background);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

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

.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.loading-spinner::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

nav {
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  padding: clamp(var(--space-2), 3vw, var(--space-4));
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-toggle {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}

.nav-toggle:hover, .nav-toggle:focus {
  color: var(--accent);
  border-color: var(--accent);
}

.nav-menu {
  display: none;
  width: 100%;
  margin-top: var(--space-2);
  flex: 1;
}

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

nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: flex-start;
}

nav a {
  color: var(--text);
  text-decoration: none;
  display: block;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color 0.3s ease;
}

nav a:hover, nav a:focus {
  color: var(--accent);
  border-color: var(--accent);
}

@media (min-width: 48rem) {
  .nav-bar {
    flex-wrap: nowrap;
  }
  .nav-menu {
    width: auto;
    margin-top: 0;
  }
  nav ul {
    flex-direction: row;
    gap: 2rem;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }
  nav a {
    border-color: transparent;
  }
}

.bookexcerpts-nav {
  border-bottom: 1px solid var(--border);
  padding: var(--space-1) var(--space-4);
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.bookexcerpts-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bookexcerpts-heading {
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0;
}

.bookexcerpts-toggle {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
}

.bookexcerpts-toggle:hover, .bookexcerpts-toggle:focus {
  color: var(--accent);
  border-color: var(--accent);
}

.bookexcerpts-panel {
  margin-top: 0.25rem;
}

.bookexcerpts-panel.collapsed {
  display: none;
}

.bookexcerpts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 0;
  margin: var(--space-2) 0;
}

.bookexcerpts-list li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookexcerpts-list a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.bookexcerpts-list a:hover, .bookexcerpts-list a:focus {
  color: var(--accent);
  border-color: var(--accent);
  background-color: rgba(77, 166, 255, 0.05);
  transform: translateX(4px);
}

.purchase-links {
  list-style: none;
  padding-left: 0;
  margin: var(--space-2) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.purchase-links a {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.purchase-links a:hover, .purchase-links a:focus {
  color: var(--accent);
  border-color: var(--accent);
}

main {
  flex: 1;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: clamp(var(--space-2), 3vw, var(--space-4));
  width: 100%;
}

section {
  margin-bottom: var(--space-4);
  padding: clamp(var(--space-2), 3vw, var(--space-4));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  word-break: break-word;
}

@supports (background: color-mix(in srgb, black 50%, white 50%)) {
  section {
    background: color-mix(in srgb, var(--background) 92%, var(--text) 8%);
  }
}

h1 {
  font-size: clamp(2.25rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
  color: var(--accent);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  margin: var(--space-3) 0 var(--space-2);
  color: var(--accent);
}

p {
  margin-bottom: var(--space-2);
}

ul {
  padding-left: 1.25rem;
  margin-bottom: var(--space-2);
}

li {
  margin-bottom: 0.5rem;
}

form {
  max-width: 600px;
  margin-top: var(--space-3);
}

label {
  display: block;
  margin-bottom: var(--space-3);
  font-weight: bold;
}

input, select, textarea {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background-color: var(--background);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.3s ease;
}

input:hover, select:hover, textarea:hover {
  border-color: var(--accent);
}

input.error, select.error, textarea.error {
  border-color: #ff4444;
}

.field-error {
  display: block;
  color: var(--message-error-text);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  font-weight: normal;
}

button {
  background-color: var(--accent);
  color: var(--background);
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.2s ease;
  min-height: 44px;
}

button:hover:not(:disabled) {
  opacity: 0.8;
  transform: translateY(-2px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#recaptcha-container {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.g-recaptcha {
  max-width: 100%;
}

.testimonials {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.testimonials-pager {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-2) 0;
}

.testimonials-pager-status {
  color: color-mix(in srgb, var(--text) 85%, var(--background) 15%);
}

.testimonial-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.testimonial-card--compact {
  padding: var(--space-2);
}

@supports (background: color-mix(in srgb, black 50%, white 50%)) {
  .testimonial-card {
    background: color-mix(in srgb, var(--background) 92%, var(--text) 8%);
  }
}

.testimonial-message {
  font-style: italic;
  margin-bottom: var(--space-2);
}

.testimonial-meta {
  color: var(--accent);
  font-weight: bold;
  margin: 0;
}

.visitor-count-block {
  margin: var(--space-2) 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.testimonial-widget {
  margin: var(--space-3) auto 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 900px;
}

@supports (background: color-mix(in srgb, black 50%, white 50%)) {
  .testimonial-widget {
    background: color-mix(in srgb, var(--background) 92%, var(--text) 8%);
  }
}

.testimonial-widget-title {
  margin: 0 0 var(--space-2) 0;
  font-size: 1.1rem;
}

.testimonial-widget-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.testimonial-widget-status {
  color: color-mix(in srgb, var(--text) 85%, var(--background) 15%);
}

.testimonial-widget-cta {
  margin-top: var(--space-2);
}

.button-link {
  display: inline-block;
  background-color: var(--accent);
  color: var(--background);
  padding: 0.75rem 2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: bold;
  min-height: 44px;
}

.button-link:hover, .button-link:focus {
  opacity: 0.85;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.02);
  border-color: var(--accent);
}

.image-frame {
  position: relative;
  width: 100%;
  height: clamp(200px, 30vh, 360px);
  background: color-mix(in srgb, var(--background) 85%, var(--text) 15%);
}

.image-frame-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

@media (max-width: 480px) {
  .image-frame {
    height: clamp(180px, 45vh, 360px);
  }
}

@media (max-height: 520px) {
  .image-frame {
    height: clamp(160px, 55vh, 320px);
  }
}

.image-frame.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 10%, transparent), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .image-frame.is-loading::after {
    animation: none;
  }
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 180ms ease-in-out;
}

.image-frame img.is-loaded {
  opacity: 1;
}

.image-frame.is-error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--text) 70%, var(--background) 30%);
  font-size: 0.95rem;
}

.gallery-item-description {
  padding: 1rem;
}

.gallery-item-meta {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: rgba(0, 0, 0, 0.85);
}

.lightbox.is-open {
  display: flex;
}

.lightbox-dialog {
  width: min(96vw, 1100px);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.lightbox-close {
  align-self: flex-end;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.lightbox-close:hover, .lightbox-close:focus {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--background) 80%, var(--text) 20%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: var(--space-1);
}

.lightbox-media img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-caption {
  color: color-mix(in srgb, var(--text) 85%, var(--background) 15%);
  font-size: 0.95rem;
}

.slideshow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.slideshow-slide .gallery-item:hover {
  transform: none;
}

.slideshow-slide .image-frame {
  height: min(65vh, 520px);
}

@media (max-width: 480px) {
  .slideshow-slide .image-frame {
    height: min(55vh, 420px);
  }
}

@media (max-height: 520px) {
  .slideshow-slide .image-frame {
    height: min(50vh, 320px);
  }
}

.slideshow-slide .image-frame img {
  height: 100%;
}

.slideshow-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.slideshow-button {
  min-width: 140px;
}

.slideshow-status {
  color: var(--accent);
  font-weight: bold;
  text-align: center;
  flex: 1;
}

footer {
  background-color: var(--background);
  border-top: 1px solid var(--border);
  padding: var(--space-4);
  text-align: center;
}

footer a {
  color: var(--text);
  text-decoration: none;
  margin: 0 1rem;
  transition: color 0.3s ease;
}

footer a:hover, footer a:focus {
  color: var(--accent);
}

.visitor-count {
  margin-top: var(--space-1);
  color: color-mix(in srgb, var(--text) 85%, var(--background) 15%);
}

.message {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.success {
  background-color: var(--message-success-bg);
  border-color: var(--message-success-border);
  color: var(--message-success-text);
}

.message.error {
  background-color: var(--message-error-bg);
  border-color: var(--message-error-border);
  color: var(--message-error-text);
}

.message strong {
  display: block;
  margin-bottom: 0.5rem;
}

.error-message {
  color: var(--message-error-text);
  font-style: italic;
}

.retry-button {
  margin-top: 1rem;
}

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
}

.error-container {
  max-width: 800px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

@supports (background: color-mix(in srgb, black 50%, white 50%)) {
  .error-container {
    background: color-mix(in srgb, var(--background) 92%, var(--text) 8%);
  }
}

.error-code {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.error-message {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.error-description {
  max-width: 600px;
  margin: 0 auto var(--space-3);
}

.error-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.error-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--background);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.error-link:hover {
  opacity: 0.85;
}

.error-link.secondary {
  background: var(--background);
  color: var(--text);
}

.error-link.secondary:hover {
  border-color: var(--accent);
}

@media (max-width: 420px) {
  .testimonials-pager {
    flex-direction: column;
    align-items: stretch;
  }
  .testimonials-pager button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    gap: 1rem;
  }
  
  h1 {
    font-size: 2.25rem;
  }
  
  .gallery {
    grid-template-columns: 1fr;
  }
  .slideshow-controls {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  .slideshow-button {
    min-width: 0;
    width: 100%;
  }
  .slideshow-status {
    order: -1;
  }
}

@media (max-width: 360px) {
  nav {
    padding: var(--space-2);
  }
  main {
    padding: var(--space-2);
  }
  section {
    padding: var(--space-2);
  }
  button,
  .button-link {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
  }
}
