/* ─── Custom properties ─────────────────────────────────────────────────────── */
:root {
  --color-primary:        #000000;
  --color-secondary:      #0071c2;
  --color-accent:         #febb02;
  --color-bg:             #FFFFFF;
  --color-text-primary:   #000000;
  --color-text-secondary: #3E2C23;

  --font-heading: 'DM Serif Text', Georgia, serif;
  --font-body:    'Newsreader', Georgia, serif;

  --max-width: 600px;
  --padding-inline: 24px;

  /* slide-header: padding-top + line-height*font-size + padding-bottom */
  --slide-header-height: calc(0.99rem + 3px + (1.44rem * 1.2) + 0.9rem);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Loading / error states ────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.state-loading,
.state-error {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-secondary);
  padding: var(--padding-inline);
  text-align: center;
}

/* ─── Swiper container ──────────────────────────────────────────────────────── */
#app {
  height: 100vh;
  width: 100%;
}

.story-swiper {
  width: 100%;
  height: 100vh;
  position: relative;
}

/* ─── Slides ────────────────────────────────────────────────────────────────── */
/* Tasks 2.4: position:relative + overflow:hidden for absolute image/panel layers */
.swiper-slide {
  position: relative;
  overflow: hidden;
  height: 100vh;
}


/* ─── Slide inner (used by text panel content + CTA slide) ─────────────────── */
.slide-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem var(--padding-inline) 5rem;
}

/* ─── Slide title ───────────────────────────────────────────────────────────── */
.slide-title {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text-primary);
  font-size: 1.6rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 600px) {
  .slide-title {
    font-size: 2rem;
  }
}

.slide-title.h3 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

@media (min-width: 600px) {
  .slide-title.h3 {
    font-size: 1.5rem;
  }
}

/* ─── Persistent slide header ───────────────────────────────────────────────── */
.slide-header {
  position: relative;
  z-index: 1;
  align-self: stretch;
  background: #ffffff;
  text-align: left;
  padding: calc(0.99rem + 3px) var(--padding-inline) 0.9rem var(--padding-inline);
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.44rem;
  font-weight: 600;
  line-height: 1.2;
}

/* ─── Image layer (mobile: full-bleed; desktop: constrained block) ──────────── */
/* Tasks 2.2 + 2.3: mobile fullscreen image */
.slide-image-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #f0ede8;
}

.slide-image-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Task 2.5: desktop — image reverts to constrained block flow */
@media (min-width: 600px) {
  .slide-header {
    align-self: center;
    width: 100%;
    max-width: var(--max-width);
    padding-left: 0;
  }

  .slide-image-layer {
    position: static;
    inset: auto;
    width: 100%;
    max-width: var(--max-width);
    height: auto;
    flex-shrink: 0;
    overflow: hidden;
    margin-bottom: 1.75rem;
  }

  .slide-image-layer img {
    width: 100%;
    height: auto;
    object-fit: unset;
  }
}

/* ─── Text panel (mobile: animated overlay; desktop: normal block) ──────────── */
/* Tasks 3.1 + 3.2 */
.slide-text-panel {
  position: absolute;
  top: calc(var(--slide-header-height) - 1px);
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.swiper-slide.panel-open .slide-text-panel {
  transform: translateY(0);
}

/* Task 3.4: desktop — slide becomes a scrollable centered column */
@media (min-width: 600px) {
  /* Slide scrolls vertically; content stacks in a centered column */
  .swiper-slide:not(.cta-slide):not(.final-slide) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--padding-inline) 5rem;
  }

  /* Text panel becomes a block in document flow; position:relative makes it the containing block for Rough Notation SVGs */
  .slide-text-panel {
    position: relative;
    transform: none;
    overflow: visible;
    background: transparent;
    transition: none;
    height: auto;
    width: 100%;
    max-width: var(--max-width);
  }

  .swiper-slide.panel-open .slide-text-panel {
    transform: none;
  }

  /* Remove inner padding since desktop slide already has it */
  .swiper-slide:not(.cta-slide):not(.final-slide) .slide-inner {
    padding: 0;
    max-width: 100%;
  }
}

/* ─── Slide body text ───────────────────────────────────────────────────────── */
.slide-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-text-primary);
}

@media (min-width: 600px) {
  .slide-body {
    font-size: 1.125rem;
  }
}

.slide-body p + p {
  margin-top: 1.25em;
}

/* ─── Inline links ──────────────────────────────────────────────────────────── */
a {
  color: var(--color-text-secondary);
  font-weight: 700;
  text-decoration: underline;
}

a:visited {
  color: var(--color-text-secondary);
}

a:active {
  color: var(--color-text-secondary);
}

/* ─── Final slide ───────────────────────────────────────────────────────────── */
.final-slide {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final-slide__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--max-width);
  padding: 0 var(--padding-inline) 5rem;
}

.final-slide__image {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin-bottom: 1.75rem;
  background: #f0ede8;
}

@media (min-width: 600px) {
  .final-slide__image {
    max-width: 100%;
  }
}

.final-slide__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.final-slide__text {
  width: 100%;
}

.final-slide__text .slide-title {
  margin-top: 0;
}

.final-slide__cta {
  margin-top: 2rem;
  margin-bottom: 4rem;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.5rem;
  background: var(--color-primary);
  color: var(--color-bg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.2s, color 0.2s;
}

.cta-button:visited,
.cta-button:active {
  color: var(--color-bg);
  text-decoration: none;
}

.cta-button:hover,
.cta-button:focus-visible {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-bg);
  text-decoration: none;
  outline: none;
}

.cta-button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ─── Progress bar ──────────────────────────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
  z-index: 100;
}

.progress-fill {
  height: 100%;
  background: var(--color-secondary);
  transition: width 0.3s ease;
  width: 0%;
}


/* ─── Desktop navigation chevrons ──────────────────────────────────────────── */
.swiper-button-prev,
.swiper-button-next {
  display: none;
}

@media (min-width: 600px) {
  .swiper-button-prev,
  .swiper-button-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    opacity: 0.35;
    transition: opacity 0.2s;
    padding: 0;
  }

  .swiper-button-prev:hover,
  .swiper-button-next:hover {
    opacity: 1;
  }

  .swiper-button-prev {
    left: 8px;
  }

  .swiper-button-next {
    right: 8px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 1.25rem;
    color: var(--color-primary);
  }

  .swiper-button-prev.swiper-button-disabled,
  .swiper-button-next.swiper-button-disabled {
    opacity: 0.1;
    cursor: default;
  }
}

/* ─── List styles (why page) ────────────────────────────────────────────────── */
.slide-body ul {
  padding-left: 1.25rem;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.slide-body li {
  padding-top: 0;
}

.slide-body li + li {
  margin-top: 0.75rem;
}

/* ─── Why page ──────────────────────────────────────────────────────────────── */
.why-header .slide-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

@media (min-width: 600px) {
  .why-header {
    padding-inline: var(--padding-inline);
  }
  .why-header .slide-header {
    margin: 0 auto;
  }
}

.why-main {
  padding: 2rem var(--padding-inline) 5rem;
}

.why-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ─── Navigation drawer ─────────────────────────────────────────────────────── */
.nav-toggle {
  position: fixed;
  top: calc((var(--slide-header-height) - 44px) / 2);
  right: 0.5rem;
  z-index: 300;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-text-primary);
}

.nav-toggle-icon {
  width: 15px;
  height: 15px;
}

.nav-toggle-label {
  display: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

@media (min-width: 768px) {
  .nav-toggle-icon { display: none; }
  .nav-toggle-label { display: inline; }
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 240;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 75vw;
  background: var(--color-bg);
  z-index: 250;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 4.5rem var(--padding-inline) var(--padding-inline);
}

@media (min-width: 768px) {
  .nav-drawer {
    width: 20vw;
  }
}

.nav-drawer.is-open {
  transform: translateX(0);
}

.nav-list {
  list-style: none;
}

.nav-list li a {
  display: block;
  padding: 1rem 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-list li a:hover,
.nav-list li a:focus-visible {
  color: var(--color-secondary);
  outline: none;
}

/* ─── Page Load Overlay ─────────────────────────────────────────────────────── */
#page-load-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 1000ms ease;
}

#page-load-overlay.reveal-white .page-load-spinner {
  opacity: 0;
}

#page-load-overlay.reveal-transparent {
  opacity: 0;
  pointer-events: none;
}

.page-load-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(127, 183, 126, 0.25);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: page-load-spin 0.8s linear infinite;
  transition: opacity 400ms ease;
}

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

.page-load-label {
  position: absolute;
  top: calc(50% + 36px);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-primary);
  transition: opacity 400ms ease;
}

#page-load-overlay.reveal-white .page-load-label {
  opacity: 0;
}

/* ─── Swipe Hint Overlay ────────────────────────────────────────────────────── */
.swipe-hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  background: rgba(0, 0, 0, 0.52);
  opacity: 1;
  pointer-events: none;
  transition: opacity 700ms ease;
}

.swipe-hint-overlay.fade-out {
  opacity: 0;
}

.swipe-hint-directions {
  display: flex;
  gap: 3rem;
  align-items: flex-end;
}

.swipe-hint-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.swipe-hint-item svg {
  width: 2.5rem;
  height: 2.5rem;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swipe-hint-item span {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.swipe-hint-tagline {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-sans, sans-serif);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Transitions ───────────────────────────────────────────────────────────── */
/* Task 3.3: disable panel animation for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  .slide-text-panel,
  .progress-fill,
  .nav-drawer,
  .nav-overlay,
  .swipe-hint-overlay {
    transition: none !important;
  }
}
