/* ==========================================================================
   CrowdRead — site styles
   --------------------------------------------------------------------------
   Sections in order:
     1. Tokens
     2. Fonts (self-hosted Lora + Roboto)
     3. Base / resets
     4. Buttons + icons
     5. Site header (nav)
     6. Landing hero (split layout + vertical carousel)
     7. Warm strip (philosophy + how-it-works)
     8. Dark CTA panel
     9. Site footer
    10. Privacy page (hero, summary card, policy body, dark CTA)
    11. Back-to-top
    12. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Surfaces */
  --page-bg: #FAF8F5;
  --page-bg-strip: #F5EFE5;
  --page-bg-dark: #1A1815;

  /* Text */
  --text-primary: #000000;
  --text-muted: #6B7280;
  --text-eyebrow: #A89B85;
  --text-on-dark: #F0EDE7;
  --text-on-dark-muted: #B8B0A4;

  /* Borders */
  --border-warm: #E8DED2;
  --border-warm-soft: #EEE4D8;

  /* Shadows */
  --shadow-warm: 0px 12px 32px 0px rgba(80, 54, 24, 0.18);
  --shadow-dark-cta: 0px 12px 32px 0px rgba(0, 0, 0, 0.38);

  /* Buttons */
  --button-dark-bg: #1A1A1A;
  --button-dark-bg-hover: #000000;
  --button-light-bg: #FFFFFF;
  --button-light-bg-hover: #F5EFE5;

  /* Layout */
  --page-max: 1280px;
  --page-gutter: 32px;
}

/* 2. Fonts ----------------------------------------------------------------- */
@font-face {
  font-family: "Lora";
  src: url("assets/fonts/lora-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("assets/fonts/lora-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* 3. Base / resets --------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: "Roboto", Arial, sans-serif;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page-bg);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
}

a:focus-visible,
button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(24, 147, 56, 0.22);
}

/* 4. Buttons + icons ------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  font-family: "Roboto", Arial, sans-serif;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

/* Dark button on light surface */
.button-dark {
  background: var(--button-dark-bg);
  color: #FFFFFF;
  padding: 14px 24px;
  font-size: 16px;
}
.button-dark:hover,
.button-dark:focus-visible {
  background: var(--button-dark-bg-hover);
}

/* Nav button (smaller dark) */
.button-nav {
  background: var(--button-dark-bg);
  color: #FFFFFF;
  padding: 12px 20px;
  font-size: 14px;
}
.button-nav:hover,
.button-nav:focus-visible {
  background: var(--button-dark-bg-hover);
}

/* Light button on dark CTA */
.button-light {
  background: var(--button-light-bg);
  color: #1A1A1A;
  padding: 14px 24px;
  font-size: 16px;
}
.button-light:hover,
.button-light:focus-visible {
  background: var(--button-light-bg-hover);
}

.icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-arrow {
  transition: transform 140ms ease;
}

.button:hover .icon-arrow,
.button:focus-visible .icon-arrow {
  transform: translateX(3px);
}

.chrome-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  transform-origin: center;
  transition: transform 140ms ease;
}

.button:hover .chrome-icon,
.button:focus-visible .chrome-icon {
  transform: scale(1.1);
}

.icon-email {
  transform-origin: center;
  transition: transform 140ms ease;
}

.button:hover .icon-email,
.button:focus-visible .icon-email {
  transform: scale(1.1);
}

/* 5. Site header ----------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--page-gutter);
  background: var(--page-bg);
  border-bottom: 1px solid var(--border-warm);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand img {
  width: 180px;
  height: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a:not(.button) {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 140ms ease;
}
.site-nav a:not(.button):hover,
.site-nav a:not(.button):focus-visible {
  color: var(--text-primary);
}

/* 6. Landing hero ---------------------------------------------------------- */
.landing-hero {
  background: var(--page-bg);
  /* Vertical padding kept minimal so the carousel's top edge sits right
     under the header and its bottom edge meets the warm strip — the mask
     fade then makes the cropped neighbour images blend into the adjacent
     surfaces (header above, warm strip below). The text column stays
     comfortably positioned via `align-items: center` on the grid. */
  padding: 0 var(--page-gutter);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
}

.hero-text {
  max-width: 640px;
}

.hero-text h1 {
  margin: 0 0 16px;
  font-size: clamp(40px, 4.4vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hero-subhead {
  margin: 0 0 24px;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Carousel ---------------------------------------------------------------- */
.carousel {
  position: relative;
  width: 100%;
  /* Tall enough to show one focal slide (scale 1.0) plus ~30% peeks of the
     neighbour above and below (each at scale 0.85). */
  aspect-ratio: 1659 / 1700;
  overflow: hidden;
  /* Soft edge fade so the cropped neighbours recede gently. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 8%,
    #000 92%,
    transparent 100%
  );
          mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 8%,
    #000 92%,
    transparent 100%
  );
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.carousel.is-dragging {
  cursor: grabbing;
}

.carousel.is-preparing .carousel-track {
  opacity: 0;
}

.carousel.is-ready .carousel-track {
  opacity: 1;
}

.carousel-track {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* Four cells: 3 unique slides + a 4th duplicate of slide 1 so we can
     snap the track invisibly from clone-1 back to real slide-1. The
     transform is driven by inline JS in index.html. */
  will-change: transform;
  transform: translateY(0);
  opacity: 1;
}

.carousel-slide {
  flex: 0 0 auto;
  /* Cells are slightly narrower than the container so the focal slide,
     when scaled to 1.05, lands exactly inside the container bounds and
     never clips against the column edges. */
  width: 95%;
  aspect-ratio: 1659 / 1005;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Default = receded; .is-focal scales up to 1.0 in lockstep with the
     track's translateY transition (driven by JS in index.html). */
  transform: scale(0.85);
  transform-origin: center;
  transition: transform 800ms ease;
  will-change: transform;
}

.carousel-slide.is-focal {
  transform: scale(1.05);
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-slide {
    transition: none;
  }
}

/* 7. Warm strip (philosophy + how-it-works) -------------------------------- */
.warm-strip {
  background: var(--page-bg-strip);
  padding: 72px var(--page-gutter);
}

.warm-strip-inner {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
}

/* Philosophy */
.philosophy {
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}

.philosophy h2 {
  margin: 0 0 20px;
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.philosophy p {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
}

.philosophy strong {
  font-weight: 700;
}

/* Quiet divider between philosophy and how-it-works */
.strip-divider {
  width: 100%;
  height: 1px;
  margin: 56px 0;
  background: var(--border-warm);
  border: 0;
}

/* How it works */
.how-it-works {
  text-align: center;
}

.eyebrow {
  margin: 0 0 36px;
  color: var(--text-eyebrow);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  text-align: left;
}

.step {
  padding: 0 40px;
  border-left: 1px solid var(--border-warm);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  align-items: start;
}

.step:first-child {
  border-left: 0;
  padding-left: 0;
}

.step:last-child {
  padding-right: 0;
}

.step-num {
  font-family: "Lora", Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  color: var(--text-eyebrow);
}

.step-body h3 {
  margin: 0 0 14px;
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
}

.step-body p {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
}

/* 8. Dark CTA panel -------------------------------------------------------- */
.cta-dark {
  background: var(--page-bg-dark);
  color: var(--text-on-dark);
  padding: 72px var(--page-gutter);
  text-align: center;
}

.cta-dark h2 {
  margin: 0 0 12px;
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-on-dark);
}

.cta-dark .cta-support {
  margin: 0 0 28px;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-on-dark-muted);
}

/* 9. Site footer ----------------------------------------------------------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--page-gutter);
  background: var(--page-bg);
  border-top: 1px solid var(--border-warm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.footer-dot {
  color: var(--border-warm);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.footer-nav a {
  color: var(--text-muted);
  transition: color 140ms ease;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--text-primary);
}

.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-cta .icon-arrow {
  transition: transform 140ms ease;
}

.footer-cta:hover .icon-arrow,
.footer-cta:focus-visible .icon-arrow {
  transform: translateX(3px);
}

/* 10. Privacy page --------------------------------------------------------- */
.privacy-hero {
  text-align: center;
  padding: 64px var(--page-gutter) 48px;
  background: var(--page-bg);
}

.privacy-hero .eyebrow {
  margin-bottom: 16px;
}

.privacy-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.privacy-hero-sub {
  max-width: 640px;
  margin: 0 auto;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
}

/* Summary card — 4 columns */
.privacy-summary {
  --summary-divider: #E2D5C5;
  background: var(--page-bg-strip);
  padding: 36px var(--page-gutter);
}

.privacy-summary-inner {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.summary-cell {
  padding: 8px 32px;
  border-left: 1px solid var(--summary-divider);
}

.summary-cell:first-child {
  border-left: 0;
  padding-left: 0;
}

.summary-cell:last-child {
  padding-right: 0;
}

.summary-cell h3 {
  margin: 0 0 10px;
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
}

.summary-cell p {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Policy body */
.policy-content {
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.policy-content .last-updated {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 14px;
  color: var(--text-muted);
}

.policy-section {
  margin-top: 36px;
  padding-top: 36px;
  border-top: 1px solid var(--border-warm);
}

.policy-content .last-updated + .policy-section {
  margin-top: 18px;
}

.policy-section h2 {
  margin: 0 0 24px;
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
}

.policy-section h2 .policy-num {
  font-weight: 400;
  color: var(--text-eyebrow);
  margin-right: 8px;
}

.policy-section p,
.policy-section li {
  font-family: "Roboto", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
}

.policy-section p {
  margin: 0 0 20px;
}

.policy-section p:last-child {
  margin-bottom: 0;
}

.policy-section ul {
  display: grid;
  gap: 8px;
  margin: 0 0 24px;
  padding-left: 24px;
}

.policy-section code {
  font-family: "Roboto", Arial, sans-serif;
  font-style: italic;
}

.policy-section a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-eyebrow);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms ease;
}

.policy-section a:hover,
.policy-section a:focus-visible {
  text-decoration-color: var(--text-primary);
}

/* 11. Back-to-top --------------------------------------------------------- */
.back-to-top {
  --back-to-top-gap: 28px;
  --footer-offset: 0px;
  position: fixed;
  right: 28px;
  bottom: calc(var(--back-to-top-gap) + var(--footer-offset));
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--button-dark-bg);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(26, 24, 21, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--button-dark-bg-hover);
}

.back-to-top.is-inverted {
  background: var(--page-bg);
  color: var(--button-dark-bg);
  box-shadow: 0 12px 28px rgba(26, 24, 21, 0.28);
}

.back-to-top.is-inverted:hover,
.back-to-top.is-inverted:focus-visible {
  background: #FFFFFF;
}

.back-to-top .icon {
  width: 14px;
  height: 14px;
}

.back-to-top .icon-top-arrow {
  transition: transform 140ms ease;
}

.back-to-top:hover .icon-top-arrow,
.back-to-top:focus-visible .icon-top-arrow {
  transform: translateY(-2px);
}

/* 12. Responsive ---------------------------------------------------------- */
@media (max-width: 960px) {
  :root {
    --page-gutter: 24px;
  }

  .brand img {
    width: 160px;
  }

  /* Hero: stack text above the horizontal carousel */
  .landing-hero {
    padding: 24px var(--page-gutter) 32px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    justify-items: center;
  }

  .hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: none;
    text-align: center;
  }

  .hero-subhead {
    max-width: 720px;
  }

  /* Carousel: switch to horizontal cycling. The JS picks the axis from
     a matching matchMedia query and uses translateX + offsetLeft. */
  .carousel {
    aspect-ratio: 2400 / 1005;
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      #000 8%,
      #000 92%,
      transparent 100%
    );
            mask-image: linear-gradient(
      to right,
      transparent 0%,
      #000 8%,
      #000 92%,
      transparent 100%
    );
    touch-action: pan-y;
  }

  .carousel-track {
    flex-direction: row;
    align-items: center;
  }

  .carousel-slide {
    /* In horizontal mode, height is the constrained dimension; aspect-ratio
       gives us the width. 95% leaves room for the focal scale of 1.05. */
    width: auto;
    height: 95%;
  }

  /* Warm strip */
  .warm-strip {
    padding: 56px var(--page-gutter);
  }

  .strip-divider {
    margin: 40px 0;
  }

  /* Steps stack vertically */
  .steps {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .step {
    padding: 32px 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-warm);
  }

  .step:first-child {
    border-top: 0;
    padding-top: 0;
  }

  /* CTA */
  .cta-dark {
    padding: 56px var(--page-gutter);
  }

  /* Privacy summary collapses to 2x2 */
  .privacy-summary-inner {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .summary-cell {
    padding: 8px 24px 28px;
  }

  .summary-cell:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .summary-cell:nth-child(even) {
    padding-right: 0;
  }

  .summary-cell:nth-child(n + 3) {
    padding-top: 28px;
    padding-bottom: 8px;
    border-top: 1px solid var(--summary-divider);
  }

  /* Footer stacks */
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .footer-nav {
    flex-wrap: wrap;
    gap: 20px;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 14px 18px;
  }

  .brand img {
    width: 132px;
  }

  .site-nav {
    gap: 14px;
  }

  .site-nav a:not(.button) {
    display: none;
  }

  .button-nav {
    padding: 10px 14px;
    font-size: 13px;
  }

  .hero-text h1 {
    font-size: 40px;
    white-space: normal;
  }

  .hero-subhead br {
    display: none;
  }

  .philosophy h2,
  .cta-dark h2 {
    font-size: 32px;
  }

  /* Privacy summary stacks 1-col */
  .privacy-summary-inner {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .summary-cell,
  .summary-cell:nth-child(odd),
  .summary-cell:nth-child(even) {
    padding: 24px 0;
    border-left: 0;
    text-align: center;
  }

  .summary-cell:first-child {
    padding-top: 0;
  }

  .summary-cell:last-child {
    padding-bottom: 0;
  }

  .summary-cell + .summary-cell,
  .summary-cell:nth-child(n + 3) {
    border-top: 1px solid var(--summary-divider);
  }

  .policy-section h2 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .back-to-top {
    transition: none;
  }
}

/* 13. Scroll reveal -------------------------------------------------------
   Subtle fade-up triggered by IntersectionObserver in index.html. Uses a
   CSS animation (not a transition) so it doesn't conflict with the per-
   element transition rules (button hover states, etc.). */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  will-change: opacity, transform;
}

.reveal.is-in-view {
  animation: revealFadeUp 700ms cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

/* Stagger for grouped reveals so sibling elements arrive in sequence. */
.philosophy p.is-in-view              { animation-delay: 100ms; }
.steps .step:nth-child(2).is-in-view  { animation-delay: 100ms; }
.steps .step:nth-child(3).is-in-view  { animation-delay: 200ms; }
.cta-dark .cta-support.is-in-view     { animation-delay: 120ms; }
.cta-dark .button.is-in-view          { animation-delay: 240ms; }

@keyframes revealFadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
  .reveal.is-in-view {
    animation: none;
  }
}
