/* Course Page Specific Styles */

/* Disable scroll snap for course page */
html,
body {
  scroll-snap-type: none;
  /* Smooth scrolling for all devices */
  scroll-behavior: smooth;
}

html {
  /* Prevent horizontal scroll */
  overflow-x: hidden;
  width: 100%;
}

body {
  /* Prevent pull-to-refresh on mobile, but allow normal scrolling */
  overscroll-behavior-y: auto;
  /* Better text rendering on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Ensure body can scroll */
  overflow-y: auto;
  overflow-x: hidden;
}

/* iOS Safari viewport height fix */
:root {
  --vh: 1vh;
}

/* Fix for iOS Safari address bar */
@supports (-webkit-touch-callout: none) {
  .fullscreen {
    min-height: -webkit-fill-available;
  }
}

/* Hero Section with Background Image */
.course-hero {
  background-image: url('../assets/Background4.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  opacity: 1;
  transform: none;
  animation: none;
  /* iOS Safari fixes */
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
}

.course-hero.fullscreen {
  box-sizing: border-box;
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.course-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.3);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  max-width: var(--content-width);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.5rem);
}

.course-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--text);
}

.hero-subtitle {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  line-height: 1.6;
  color: var(--text);
  font-weight: 400;
  font-family: var(--font-body);
}

.hero-emoji {
  margin: 0;
  font-size: clamp(2.6rem, 5.2vw, 3.9rem);
  line-height: 1;
  font-family: var(--font-body);
  display: inline-block;
  position: relative;
  width: 1.2em;
  height: 1.2em;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  transition: transform 0.2s ease;
  /* Ensure touch target is large enough (44x44px minimum for iOS) */
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hero-emoji:hover {
  transform: scale(1.1);
}

/* Active state for touch devices */
.hero-emoji:active {
  transform: scale(1.05);
}

.hero-emoji span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease-in-out;
  line-height: 1;
}

.hero-emoji .emoji-current {
  opacity: 1;
}

.hero-emoji .emoji-next {
  opacity: 0;
}

.hero-emoji.fading .emoji-current {
  opacity: 0;
}

.hero-emoji.fading .emoji-next {
  opacity: 1;
}

.hero-tagline {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-body);
}

/* Section spacing - reduced gaps for continuous flow */
.content-flow .essence {
  padding: clamp(1.5rem, 3vw, 2rem) 1.5rem;
}

.content-flow .essence:first-of-type {
  padding-top: clamp(2.5rem, 5vw, 3rem);
}

/* Section headers: asymmetric rhythm (more space above than below) */
body.base .content-flow .essence .content {
  gap: 0;
}

.content-flow .essence .content > h2 {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 0;
}

.content-flow .essence:first-of-type .content > h2 {
  margin-top: 0;
}

.content-flow .essence .content > h2 + * {
  margin-top: 1.125rem;
}

/* Reduce gap between consecutive sections */
.content-flow .essence + .essence {
  padding-top: clamp(1rem, 2vw, 1.5rem);
}

/* Reduce paragraph gaps to normal spacing */
.content-flow .essence .content p + p {
  margin-top: 0.75rem;
}

/* What to expect — card grid */
.expect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  margin-top: 2rem;
}

.expect-card {
  display: flex;
  flex-direction: column;
  gap: var(--base-space-4);
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 4px solid rgba(150, 115, 70, 0.55);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.expect-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.12);
}

.expect-card-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--text);
}

.expect-card-body {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
}

/* Is this for you — three-column cards */
.for-you-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
  width: 100%;
  margin-top: 2rem;
}

.for-you-card {
  display: flex;
  flex-direction: column;
  gap: var(--base-space-4);
  height: 100%;
  padding: 1.5rem 1.65rem 1.65rem;
  background: linear-gradient(165deg, #ffffff 0%, rgba(150, 115, 70, 0.04) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 4px solid rgba(196, 85, 77, 0.55);
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.for-you-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
  border-color: rgba(0, 0, 0, 0.11);
}

.for-you-card-title {
  margin: 0;
  padding-bottom: var(--base-space-4);
  font-size: clamp(1.08rem, 2.3vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--text);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.content-flow .essence .content p.for-you-card-body {
  margin: 0;
  flex: 1;
  font-size: clamp(0.8rem, 1.65vw, 0.875rem);
  line-height: 1.6;
  color: rgba(17, 17, 17, 0.78);
}

.content-flow .essence .content .for-you-grid + p {
  margin-top: clamp(3rem, 6vw, 3.5rem);
}

/* How we practice together */
.practice-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.practice-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 1.75rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.practice-item:first-child {
  padding-top: 0;
}

.practice-numeral {
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
  color: rgba(150, 115, 70, 0.8);
}

.practice-item-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--text);
}

.practice-item-body {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
}

.practice-rule {
  margin-top: clamp(2rem, 4vw, 2.5rem);
  padding: clamp(1.5rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2rem);
  text-align: center;
  background: rgba(150, 115, 70, 0.06);
  border-top: 1px solid rgba(150, 115, 70, 0.22);
  border-bottom: 1px solid rgba(150, 115, 70, 0.22);
}

.content-flow .essence .content .practice-rule p {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.65;
  color: var(--text);
}

.content-flow .essence .content .practice-rule p + p {
  margin-top: 0.5rem;
}

.content-flow .essence .content p.gift-outro {
  margin-bottom: clamp(3.5rem, 7vw, 4.5rem);
}

/* Journey timeline (live gatherings) */
.journey-lead {
  margin-top: 1rem;
}

.journey-timeline {
  --journey-moon-size: clamp(3.3rem, 7.5vw, 4.05rem);
  list-style: none;
  margin: clamp(2rem, 4vw, 2.75rem) 0 0;
  padding: 0;
  position: relative;
}

.journey-step {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0 1.25rem;
  align-items: start;
  margin: 0 0 clamp(2rem, 4vw, 2.75rem);
}

.journey-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--journey-moon-size) * 0.5);
  z-index: 0;
  width: 1px;
  height: calc(100% + clamp(2rem, 4vw, 2.75rem));
  transform: translateX(-50%);
  background: rgba(150, 115, 70, 0.22);
  pointer-events: none;
}

.journey-step:last-child {
  margin-bottom: 0;
}

.journey-marker {
  grid-row: 1;
  grid-column: 2;
  position: relative;
  z-index: 1;
}

.journey-moon {
  display: block;
  font-size: var(--journey-moon-size);
  line-height: 1;
}

.journey-step-body {
  min-width: 0;
}

.journey-step--left .journey-step-body {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

.journey-step--right .journey-step-body {
  grid-column: 3;
  grid-row: 1;
  text-align: left;
}

.journey-step-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--text);
}

.journey-step-date {
  margin: 0 0 0.5rem;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.journey-step-text {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
}

.content-flow .essence .content .journey-timeline + .journey-timezones {
  margin-top: clamp(3.5rem, 7vw, 4.5rem);
}

.content-flow .essence .content .journey-timezones .time-list {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* Course Sessions */
.course-sessions {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  margin-top: 2rem;
  margin-bottom: 0;
}

.timezone-note {
  margin-top: 4rem;
  padding-top: 2rem;
  font-size: clamp(0.9rem, 2vw, 0.95rem);
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
  display: block;
}

.session-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  align-items: start;
}

.session-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.12);
}

.session-emoji {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1;
  flex-shrink: 0;
}

.session-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.session-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--text);
}

.session-subtitle {
  font-weight: 400;
  font-size: 0.9em;
  color: var(--muted);
}

.session-date {
  margin: 0;
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--muted);
  line-height: 1.5;
  font-weight: 500;
}

.session-focus {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
}

/* Time Commitment Breakdown */
.time-breakdown {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
  width: 100%;
}

.time-item {
  text-align: left;
}

.time-title {
  margin: 0 0 0.75rem 0;
  font-size: clamp(1.05rem, 2.2vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.time-list {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.time-list li {
  margin: 0.5rem 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
}

/* Closing Section Adjustments */
.closing {
  padding: clamp(4rem, 8vw, 6rem) clamp(1.5rem, 6vw, 3rem);
  padding-bottom: clamp(5rem, 10vw, 8rem);
  background-image: url('../assets/Background4.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  /* iOS Safari fixes */
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  /* Remove default section gap - override flex gap */
  gap: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.closing::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.3);
  z-index: 1;
}

.closing > * {
  position: relative;
  z-index: 2;
}

.closing p {
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  line-height: 1.6;
  letter-spacing: 0.01em;
  margin: 0;
  width: var(--content-width);
  max-width: 100%;
  color: var(--text);
}

.closing p:first-child {
  margin-bottom: 0;
  /* Style as heading to match other h2 headings */
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.closing p + p {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  margin-top: 0.75rem !important;
  color: var(--text);
}

.tally-button {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: calc(0.95rem * 1.3);
  letter-spacing: 0.04em;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.35s ease;
  margin-top: 1.5rem;
  font-weight: 500;
  /* iOS Safari fixes */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* Ensure minimum touch target size (44x44px) */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tally-button:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.tally-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

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

/* Mobile Responsive Styles */
@media (max-width: 720px) {
  /* iOS Safari viewport height fix */
  .course-hero {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
  }

  .course-hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }

  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.2rem);
  }

  .hero-emoji {
    font-size: clamp(2.6rem, 10.4vw, 3.9rem);
    /* Ensure touch target on mobile */
    min-width: 48px;
    min-height: 48px;
  }

  .session-card {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    /* Prevent text selection on tap */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  .session-emoji {
    font-size: 1.5rem;
  }

  .session-content {
    text-align: left;
  }

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

  .expect-card {
    padding: 1.25rem 1.35rem;
  }

  .for-you-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    margin-top: 1.5rem;
  }

  .for-you-card {
    padding: 1.35rem 1.4rem 1.45rem;
  }

  .practice-item {
    gap: 0.35rem 1.25rem;
    padding: 1.25rem 0;
  }

  .journey-step {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
  }

  .journey-step:not(:last-child)::after {
    left: calc(var(--journey-moon-size) * 0.5);
    transform: none;
  }

  .journey-step--left .journey-step-body,
  .journey-step--right .journey-step-body {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
  }

  .journey-step--left .journey-marker,
  .journey-step--right .journey-marker {
    grid-column: 1;
    grid-row: 1;
  }

  .time-breakdown {
    gap: 1.5rem;
  }

  .time-list {
    padding-left: 1.25rem;
  }

  .tally-button {
    width: 100%;
    text-align: center;
    font-size: 1rem; /* 16px minimum to prevent iOS zoom */
    padding: 0.875rem 1.75rem;
  }

  .hero-content {
    padding: 0 1rem;
  }

  .closing {
    /* Safe area insets for notched devices */
    padding-left: max(clamp(1.5rem, 6vw, 3rem), env(safe-area-inset-left));
    padding-right: max(clamp(1.5rem, 6vw, 3rem), env(safe-area-inset-right));
    padding-bottom: max(clamp(3rem, 6vw, 4rem), env(safe-area-inset-bottom));
  }

  /* Ensure all text is readable and prevents zoom on iOS */
  .essence .content p {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
  }

  /* Keep heading size for first paragraph in closing section */
  .closing p:first-child {
    font-size: clamp(1.6rem, 4vw, 2rem);
  }

  .closing p:not(:first-child) {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
  }

  /* Prevent iOS text size adjustment */
  html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* Footer */
footer {
  padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 6vw, 3rem);
  text-align: center;
  background: var(--bg);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.course-footer {
  background: var(--base-paper, var(--bg));
  border-top: 1px solid var(--base-hairline, rgba(0, 0, 0, 0.06));
  padding: clamp(2rem, 4vw, 3rem) var(--base-gutter, clamp(1.5rem, 6vw, 3rem));
}

.course-footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--base-space-4, 1rem);
  width: 100%;
  max-width: var(--base-measure, 40rem);
  margin: 0 auto;
}

.course-footer-item {
  margin: 0;
  font-family: var(--base-font-body, var(--font-body));
  font-size: clamp(0.875rem, 2vw, 1rem);
  line-height: 1.65;
  color: var(--base-ink-soft, var(--muted));
}

.course-footer .base-link {
  color: var(--base-ink, var(--text));
  text-decoration: underline;
  text-decoration-color: var(--base-rose, var(--accent));
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  border-bottom: none;
}

.course-footer .base-link:hover {
  color: var(--base-ink, var(--text));
  text-decoration-color: var(--base-ink, var(--accent));
}

.course-footer-logo {
  display: inline-block;
  margin-top: var(--base-space-2, 0.5rem);
  line-height: 0;
}

.course-footer-logo img {
  display: block;
  width: 2.75rem;
  height: auto;
}

.course-footer-logo:hover {
  border-bottom-color: transparent;
}

footer p {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1rem);
  line-height: 1.6;
  color: var(--muted);
  width: var(--content-width);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

footer a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
  border-bottom: 1px solid transparent;
}

footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Smooth scrolling for iOS */
  html {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix for iOS Safari address bar */
  .course-hero {
    min-height: -webkit-fill-available;
  }

  /* Prevent pull-to-refresh on iOS, but allow normal scrolling */
  body {
    overscroll-behavior-y: auto;
  }
}
