/*
  Nativity Website Styles
  - See docs/style.md for principles
  - See docs/technical-roadmap.md for implementation details
*/

:root {
  /* Light (default) theme */
  --color-green: #2B425B;
  /* Replaced green with blue */
  --color-red: #8B1E2D;
  --color-gold: #9A7B3F;
  --color-ink: #111827;
  --color-body: #374151;
  --color-muted: #4B5563;
  /* Darkened from #6B7280 for better readability */
  --color-line: #E5E7EB;
  --color-page: #F9FAFB;
  --color-white: #FFFFFF;
  --color-hero-bg: #2B425B;

  /* Spacing scale (px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Typography scale - mobile first */
  --font-size-xs: 0.875rem;
  /* Increased from 0.8125rem */
  --font-size-sm: 1rem;
  /* Increased from 0.875rem */
  --font-size-base: 1.125rem;
  /* Increased from 1rem */
  --font-size-lg: 1.25rem;
  /* Increased from 1.125rem */
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 3rem;
  --font-size-4xl: 4rem;
  /* New larger size for Hero title */

  /* Max widths */
  --max-width-container: 1200px;
  --max-width-content: 800px;

  /* Font families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  color: var(--color-body);
  background: var(--color-page);
  line-height: 1.65;
  margin: 0;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  color: var(--color-ink);
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-weight: 600;
}

h1 {
  font-size: var(--font-size-2xl);
  line-height: 1.2;
  margin-bottom: var(--space-5);
}

h2 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-7);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--font-size-lg);
  line-height: 1.3;
  margin-top: var(--space-6);
}

p {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.text-muted {
  color: var(--color-muted);
}

.text-small {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* Large text utility */
.text-lg {
  font-size: var(--font-size-lg);
  line-height: 1.6;
}

.tagline {
  font-size: var(--font-size-xl);
  color: var(--color-muted);
  margin-bottom: var(--space-5);
}

/* Links */
a {
  color: var(--color-green);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-red);
}

a:focus {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -120%);
  /* Start fully off-screen */
  background: var(--color-gold);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  text-decoration: none;
  border-radius: 0 0 6px 6px;
  /* Rounded bottom corners */
  font-weight: 500;
  transition: transform 0.2s ease-in-out;
}

.skip-link:focus {
  transform: translate(-50%, 0);
  /* Slide into view */
}

.skip-link:hover {
  color: var(--color-white);
}

.skip-link:active {
  color: var(--color-white);
}

/* Layout utilities */
.container {
  width: 100%;
  max-width: var(--max-width-container);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

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

.section {
  padding: var(--space-7) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-8) 0;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: var(--space-9) 0;
  }
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  padding: var(--space-3) var(--space-5);
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.5;
  white-space: nowrap;
}

.btn:focus {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
}

/* Primary button */
.btn-primary {
  background-color: var(--color-green);
  color: var(--color-white);
  border-color: var(--color-green);
  border-width: 2px;
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 0;
}

.btn-primary:hover {
  background-color: #1F3042;
  border-color: #1F3042;
  color: var(--color-white);
  outline-color: rgba(255, 255, 255, 0.5);
}

/* Secondary button */
.btn-secondary {
  background-color: var(--color-white);
  color: var(--color-green);
  border-color: var(--color-green);
}

.btn-secondary:hover {
  background-color: #F0F4F8;
  color: #1F3042;
  border-color: #1F3042;
}

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-5);
  justify-content: center;
  /* Center buttons */
}

/* Cards */
.card {
  background: var(--color-white);
  border-radius: 8px;
  padding: var(--space-5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-line);
}

@media (min-width: 768px) {
  .card {
    padding: var(--space-6);
    border-radius: 12px;
  }
}

.card h2,
.card h3 {
  margin-top: 0;
}

/* Hero section */
.hero {
  background: var(--color-hero-bg);
  color: var(--color-white);
  padding: var(--space-6) 0;
  text-align: center;
}

@media (min-width: 768px) {
  .hero {
    padding: var(--space-8) 0;
  }
}

.hero h1 {
  font-size: var(--font-size-4xl);
  line-height: 1.1;
  margin-bottom: var(--space-5);
  color: var(--color-white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero .subtitle {
  font-size: var(--font-size-xl);
  font-style: italic;
  margin-top: var(--space-2);
  opacity: 0.95;
  color: rgba(255, 255, 255, 0.95);
}

.hero .tagline {
  font-size: clamp(1.35rem, 5vw, var(--font-size-2xl));
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
  max-width: min(32ch, 100%);
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
  overflow-wrap: normal;
  word-break: normal;
  margin-bottom: var(--space-5);
}

.hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-lg);
}

.hero-image {
  margin: var(--space-6) 0;
  border-radius: 8px;
  overflow: hidden;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Gallery grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  /* Use flexbox for alignment */
  flex-direction: column;
  justify-content: space-between;
}

.gallery-item picture {
  display: block;
  height: 350px;
  /* Give the picture element a fixed height */
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  /* Make image fill the fixed-height container */
  object-fit: cover;
  /* Cover the area, cropping gently if needed */
  display: block;
  transition: transform var(--transition-base);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-caption {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  color: var(--color-muted);
}

/* Event details */
.event-details {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-6);
}

@media (min-width: 768px) {
  .event-details {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

.event-detail-item {
  text-align: center;
}

.event-detail-item h3 {
  margin-bottom: var(--space-2);
  color: var(--color-green);
}

/* Footer */
footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-line);
  padding: var(--space-6) 0;
  margin-top: var(--space-9);
  text-align: center;
}

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

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-5 {
  margin-top: var(--space-5);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mb-0 {
  margin-bottom: 0;
}

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

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

/* Image focus utilities */
.object-position-top {
  object-position: center top;
  /* Keeps the top of the image in frame */
}

/* Focus visible for better accessibility */
:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Image with caption */
.figure {
  margin: var(--space-6) 0;
}

.figure img {
  border-radius: 8px;
  width: 100%;
  height: auto;
}

.figure figcaption {
  margin-top: var(--space-2);
  font-size: var(--font-size-base);
  color: var(--color-muted);
  text-align: center;
}

/* Icon buttons for sharing */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 6px;
  background: var(--color-white);
  border: 1px solid var(--color-line);
  color: var(--color-green);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--color-green);
  border-color: var(--color-green);
  color: var(--color-white);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Share Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(17, 24, 39, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

@media (prefers-color-scheme: dark) {
  .modal-overlay {
    background-color: rgba(0, 0, 0, 0.7);
  }
}

.modal-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  max-width: 400px;
  width: calc(100% - var(--space-6));
  padding: var(--space-7);
  text-align: center;
}

.modal-close-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  line-height: 1;
  color: var(--color-muted);
}

.modal-close-btn:hover {
  color: var(--color-ink);
}

.modal-close-btn svg {
  width: 24px;
  height: 24px;
}

.share-options {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.copy-feedback {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-ink);
  color: var(--color-page);
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

/* Calendar Modal specific styles */
.event-slots {
  list-style: none;
  padding: 0;
  margin: var(--space-5) 0 0;
  text-align: left;
}

.event-slots li {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.event-slots li:last-child {
  border-bottom: none;
}

.event-slots .slot-info {
  font-weight: 500;
}

.event-slots .slot-actions {
  display: flex;
  gap: var(--space-3);
}

.event-slots .slot-actions .btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

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

/* Print styles */
@media print {

  .btn,
  .btn-group,
  .skip-link {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-green: #1F3042;
    --color-red: #A01A2C;
    --color-gold: #8A6B2F;
  }

  .btn-primary {
    border-width: 2px;
  }

  .card {
    border-width: 2px;
  }
}