/* Homepage: "The Long Tail" panorama. One curve, amber day into warm night over a teal ground. */
@property --dusk {
  syntax: "<color>";
  inherits: true;
  initial-value: #14110e;
}

:root {
  --night: #14110e;
  --night-raised: #1e1a16;
  --night-high: #28231d;
  --espresso: #2b1700;
  --amber: #ffb14c;
  --amber-hover: #ffc16d;
  --amber-text-dark: #ffb14c;
  --teal: #0a708c;
  --teal-night: #06303a;
  --teal-deep: #082a32;
  --teal-text-dark: #75d6f5;
  --on-night: #f2eae0;
  --on-night-muted: #c9c0b4;
  --on-night-subtle: #a89f93;
  --on-amber: #1a1614;
  --on-amber-muted: #3d2a15;
  --rule-night: #3d3830;
  --rule-teal: #2c5560;
  --sky: linear-gradient(
    90deg,
    #ffc56a 0%,
    #fcb04f 16%,
    #f29a36 26%,
    #d9771a 32%,
    #a84c12 38%,
    #73300f 45%,
    #4a2414 53%,
    #2c1a12 64%,
    #1b1410 80%,
    #14110e 100%
  );
  --ground: linear-gradient(
    90deg,
    #6b3410 0%,
    #4c2512 22%,
    #2e1c14 40%,
    #182220 58%,
    #0b2b31 78%,
    #06303a 100%
  );
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: max(1.25rem, env(safe-area-inset-left));
  /* Shared shell tokens from content.css. */
  --color-deep: #14110e;
  --color-on-deep-muted: #c9c0b4;
  color-scheme: dark;
}

html {
  background: var(--night);
  scrollbar-color: var(--rule-night) var(--night);
}

.home {
  background: var(--dusk);
  color: var(--on-night);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.home ::selection { background: var(--amber); color: var(--on-amber); }

.home :focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
  border-radius: 4px;
}

.home a:not(.pill, .skip-link) { color: inherit; }
.home .skip-link { color: var(--on-amber); font-weight: 700; }

.wrap {
  width: min(100%, 76rem);
  margin-inline: auto;
  padding-left: var(--gutter);
  padding-right: max(1.25rem, env(safe-area-inset-right));
}

/* The page sinks from dusk into night as the visitor scrolls past the panorama. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .home {
      animation: nightfall linear both;
      animation-timeline: scroll(root);
      animation-range: 0 120vh;
    }
  }
}

@keyframes nightfall {
  from { --dusk: #3a2013; }
  to { --dusk: #14110e; }
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 3;
  padding-top: env(safe-area-inset-top);
  background: var(--night);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  min-height: 4.5rem;
  padding-block: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  color: var(--on-night);
  font-weight: 700;
  text-decoration: none;
}

.brand img { border-radius: 0.5rem; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
}

.site-nav a:not(.pill) {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--on-night-muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s var(--ease-out-expo);
}

.site-nav a:not(.pill):hover { color: var(--on-night); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  background: var(--amber);
  color: var(--on-amber);
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color 0.2s var(--ease-out-expo), transform 0.2s var(--ease-out-expo);
}

.pill:hover { background: var(--amber-hover); }

@media (max-width: 40rem) {
  .site-nav { gap: 0.25rem 1rem; }
  .site-nav a:not(.pill) { display: none; }
  .pill { padding: 0 1rem; font-size: 0.875rem; }
}
.pill:active { transform: translateY(1px); }

/* ---------- Hero panorama ---------- */

.hero {
  --cup-x: 19.4%;
  --bed-x: 94.4%;
  --bed-y: 82%;
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.hero-sky {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: linear-gradient(180deg, var(--night) 0%, #1c1410 45%, #3a2013 80%, #5a2b11 100%);
}

.hero-copy {
  padding: 0.75rem var(--gutter) 1.5rem;
  max-width: 40rem;
}

@media (max-width: 59.99rem) {
  .hero-sub { display: none; }
  .hero-lede { font-size: 1rem; }
  .store-row { margin-top: 1.25rem; }
  .scrub-hint { display: none; }
  .hero-note { display: none; }
  .hero-chart { height: clamp(8.5rem, 38vw, 17rem); }
  .hero-controls { gap: 0.75rem; }
  .hero-ground { padding-bottom: 2rem; }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 1.6rem + 3.4vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
  color: var(--on-night);
}

.hero-title span { display: block; color: var(--amber); }

.hero-sub {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--on-night);
  text-wrap: balance;
}

.hero-lede {
  margin-top: 0.75rem;
  max-width: 34rem;
  color: var(--on-night-muted);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.store-row a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  border-radius: 0.5rem;
  transition: transform 0.25s var(--ease-out-expo);
}

.store-row a:hover { transform: translateY(-2px); }
.store-row a:active { transform: translateY(0); }
.store-row img { height: 2.5rem; width: auto; }

.hero-note {
  margin-top: 1rem;
  max-width: 32rem;
  color: var(--on-night-subtle);
  font-size: 0.875rem;
  line-height: 1.5;
}

.hero-chart {
  position: relative;
  height: clamp(10rem, 44vw, 17rem);
  background: var(--sky);
}

.hero-chart svg.curve {
  position: absolute;
  inset: 12% 0 0;
  width: 100%;
  height: 88%;
  overflow: visible;
}

.curve path {
  fill: none;
  stroke: url(#tail-ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.curve .tail {
  stroke-width: 3.5;
  stroke-linecap: butt;
  stroke-dasharray: 9 7;
  filter: drop-shadow(0 0 5px rgb(255 177 76 / 0.45));
}

.horizon {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, var(--espresso) 0 40%, #3a4a4c 70%, var(--rule-teal));
}

/* Markers share the SVG's box: 12% top inset, 88% height. */
.marker {
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  margin: -0.375rem 0 0 -0.375rem;
  border-radius: 50%;
}

.marker.cup {
  left: var(--cup-x);
  top: 100%;
  background: var(--espresso);
  box-shadow: 0 0 0 3px #fcb04f;
}

.marker.bed {
  left: var(--bed-x);
  top: calc(12% + var(--bed-y) * 0.88);
  background: var(--amber);
  box-shadow: 0 0 0 4px rgb(255 177 76 / 0.22), 0 0 18px 2px rgb(255 177 76 / 0.45);
}

.moon {
  position: absolute;
  left: var(--bed-x);
  top: calc(12% + var(--bed-y) * 0.88 - 3.75rem);
  width: 1.75rem;
  height: 1.75rem;
  margin-left: -0.875rem;
  color: var(--on-night);
}

.hero-ground {
  background: var(--ground);
  padding-bottom: 2.5rem;
}

.axis {
  position: relative;
  height: clamp(2.5rem, 2rem + 1.5vw, 3.5rem);
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.75rem + 1vw, 1.625rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.axis span {
  position: absolute;
  top: 0.375rem;
}

.axis .axis-cup {
  left: var(--cup-x);
  color: #ffd9a6;
  transform: translateX(-0.375rem);
}

.hero[data-cup-side="left"] .axis .axis-cup { transform: translateX(calc(-100% + 0.375rem)); }

.axis .axis-bed {
  left: var(--bed-x);
  color: var(--on-night);
  transform: translateX(calc(-100% + 0.375rem));
}

.hero-controls {
  display: grid;
  gap: 1.25rem;
  padding-top: 0.5rem;
}

.scrub label {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
  color: var(--on-night);
  font-weight: 600;
}

.scrub output {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffd9a6;
}

.scrub input {
  --fill: 23%;
  display: block;
  width: 100%;
  max-width: 26rem;
  height: 2.75rem;
  margin-top: 0.25rem;
  background: transparent;
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
}

.scrub input:active { cursor: grabbing; }
.scrub input:disabled { cursor: default; opacity: 0.5; }

.scrub input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgb(242 234 224 / 0.28);
}

.scrub input::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgb(242 234 224 / 0.28);
}

.scrub input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: calc(2px - 0.875rem);
  border: 3px solid var(--espresso);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
  transition: transform 0.2s var(--ease-out-expo);
}

.scrub input::-moz-range-thumb {
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid var(--espresso);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}

.scrub input:enabled:hover::-webkit-slider-thumb { transform: scale(1.1); }
.scrub input:focus-visible { outline-offset: 2px; }

.scrub-hint {
  margin-top: 0.25rem;
  color: var(--on-night-subtle);
  font-size: 0.875rem;
}

.readout p:first-child {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--on-night);
  text-wrap: balance;
}

.readout strong {
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.readout-note {
  margin-top: 0.5rem;
  max-width: 30rem;
  color: var(--on-night-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.readout-note a {
  color: var(--teal-text-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  white-space: nowrap;
}

/* The curve draws itself once, left to right, as the day passes. */
@media (prefers-reduced-motion: no-preference) {
  .hero-chart .curve,
  .hero-chart .marker,
  .hero-chart .moon {
    animation: daybreak 1.8s var(--ease-out-expo) 0.15s both;
  }

  .hero-chart .marker.bed,
  .hero-chart .moon {
    animation-name: moonrise;
    animation-duration: 0.9s;
    animation-delay: 1.2s;
  }
}

@keyframes daybreak {
  from { clip-path: inset(-20% 100% -20% 0); }
  to { clip-path: inset(-20% 0 -20% 0); }
}

@keyframes moonrise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 60rem) {
  .site-header {
    position: absolute;
    inset: 0 0 auto;
    background: none;
  }

  .home .site-header .brand { color: var(--on-amber); }

  .hero-sky {
    grid-template-rows: auto minmax(13rem, 1fr);
    min-height: clamp(36rem, calc(100svh - 11.5rem), 50rem);
    background: var(--sky);
  }

  .hero-copy {
    justify-self: end;
    width: min(52%, 44rem);
    max-width: none;
    padding: calc(6rem + env(safe-area-inset-top)) max(2rem, env(safe-area-inset-right)) 1.5rem 0;
    margin-right: max(0px, (100vw - 76rem) / 2);
  }

  .hero-note { max-width: none; }

  .hero-chart {
    height: auto;
    background: none;
  }

  .hero-chart svg.curve { inset: 0; height: 100%; }
  .hero-title { font-size: clamp(3rem, 1rem + 3vw, 3.75rem); }
  .hero-ground { padding-bottom: 2rem; }
  .marker.bed { top: var(--bed-y); }
  .moon { top: calc(var(--bed-y) - 3.75rem); }

  .hero-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem 4rem;
    align-items: start;
  }

  .readout { justify-self: end; max-width: 32rem; text-align: right; }
  .readout-note { margin-left: auto; }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(4rem, 8vw, 7rem); }

.section-head {
  display: grid;
  gap: 1.25rem;
  align-items: end;
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 36rem;
  color: var(--on-night-muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.6;
  text-wrap: pretty;
}

@media (min-width: 48rem) {
  .section-head { grid-template-columns: 1fr 1fr; gap: 4rem; }
}

/* Native captures, cropped to their content and scaled, never redrawn. */
.shot {
  width: 100%;
  max-width: 21rem;
  margin: 0;
  overflow: hidden;
  border-radius: 1.5rem;
  background: #000;
  box-shadow:
    0 0 0 1px #4a4239,
    0 2rem 3.5rem -1.5rem rgb(0 0 0 / 0.8),
    0 0.75rem 1.5rem -0.75rem rgb(0 0 0 / 0.5);
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* Today and Insights are cropped to the app's own card, so the card is the outer shape. */
.shot-today,
.shot-insights {
  border-radius: 1.125rem;
  background: none;
}

/* Routine: three moments of one day, stepping down like the tail. */
.steps {
  display: grid;
  gap: 4rem;
  margin: clamp(3.5rem, 7vw, 6rem) 0 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  gap: 1.75rem;
  justify-items: center;
}

.step { align-content: start; }

.step-text { max-width: 22rem; text-align: center; }

.step h3 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.step p {
  margin-top: 0.625rem;
  color: var(--on-night-muted);
  line-height: 1.55;
  text-wrap: pretty;
}

@media (min-width: 56rem) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3rem; }
  .step:nth-child(2) { margin-top: 4rem; }
  .step:nth-child(3) { margin-top: 8rem; }
}

/* Fix: free capture and recovery. */
.fix {
  display: grid;
  gap: 3.5rem;
  align-items: center;
}

.fix .shot { justify-self: center; }

.fix-lede { margin-top: 1.25rem; }

.fix-list {
  margin-top: 2.5rem;
  border-top: 1px solid var(--rule-night);
}

.fix-list div {
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule-night);
}

.fix-list dt {
  color: var(--teal-text-dark);
  font-weight: 700;
}

.fix-list dd {
  margin: 0.5rem 0 0;
  max-width: 36rem;
  color: var(--on-night-muted);
  line-height: 1.6;
}

@media (min-width: 56rem) {
  .fix { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 6rem; }
}

/* Privacy: below the horizon. */
.privacy {
  background: linear-gradient(180deg, transparent 0, #0c2328 30%, var(--teal-night) 60%, var(--teal-deep) 100%);
  color: var(--on-night);
}

.ground {
  --rule-night: var(--rule-teal);
  background: var(--teal-deep);
}

.ground .lede,
.ground p { color: #cfe3e6; }

.close.ground { background: linear-gradient(180deg, var(--teal-deep), #061f25); }

.privacy .lede { color: #cfe3e6; }

.boundary {
  display: grid;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--rule-teal);
}

.boundary section { padding-block: 2rem; border-bottom: 1px solid var(--rule-teal); }

.boundary h3 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.boundary ul { margin-top: 1rem; padding: 0; list-style: none; }

.boundary li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.5rem;
  color: #e3eff1;
  line-height: 1.5;
}

.boundary li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05rem;
  width: 0.625rem;
  height: 2px;
  background: var(--teal-text-dark);
}

.boundary .stays li::before { background: var(--amber); }

@media (min-width: 48rem) {
  .boundary { grid-template-columns: 1fr 1fr; }
  .boundary section + section { padding-left: 3rem; border-left: 1px solid var(--rule-teal); }
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  margin-top: 1.75rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.text-link svg { transition: transform 0.25s var(--ease-out-expo); }
.text-link:hover svg { transform: translateX(4px); }

/* Resources: three reading routes as rows, not cards. */
.routes {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule-night);
}

.routes li { border-bottom: 1px solid var(--rule-night); }

.routes a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 2rem;
  align-items: center;
  padding-block: 1.75rem;
  text-decoration: none;
}

.routes h3 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.1rem + 1vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  transition: color 0.2s var(--ease-out-expo);
}

.routes p {
  grid-column: 1;
  max-width: 40rem;
  color: var(--on-night-muted);
  line-height: 1.55;
}

.routes svg {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--amber);
  transition: transform 0.3s var(--ease-out-expo);
}

.routes a:hover h3 { color: var(--amber); }
.routes a:hover svg { transform: translateX(6px); }

@media (min-width: 56rem) {
  .routes a { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) auto; }
  .routes p { grid-column: 2; grid-row: 1; }
  .routes svg { grid-column: 3; grid-row: 1; }
}

/* Close: the tail reaches bedtime. */
.close {
  position: relative;
  overflow: clip;
  padding-block: clamp(5rem, 10vw, 8rem) clamp(4rem, 8vw, 6rem);
}

.close-tail {
  display: block;
  width: 100%;
  height: clamp(5rem, 12vw, 9rem);
  overflow: visible;
}

.close-tail path {
  fill: none;
  stroke: var(--amber);
  stroke-width: 3.5;
  stroke-dasharray: 9 7;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgb(255 177 76 / 0.45));
}

.close-art { position: relative; }

.close-dot {
  position: absolute;
  left: 96%;
  top: 88.6%;
  width: 0.75rem;
  height: 0.75rem;
  margin: -0.375rem 0 0 -0.375rem;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgb(255 177 76 / 0.22), 0 0 18px 2px rgb(255 177 76 / 0.45);
}

.close-moon {
  position: absolute;
  left: 96%;
  top: calc(88.6% - 3.5rem);
  width: 1.5rem;
  height: 1.5rem;
  margin-left: -0.75rem;
  color: var(--on-night);
}

.close-inner {
  display: grid;
  gap: 2rem;
  align-items: end;
  margin-top: 1rem;
}

.close .display span { color: var(--amber); }

.close p { margin-top: 1rem; color: var(--on-night-muted); font-size: 1.125rem; }

.close .store-row { margin-top: 0; }

.close-meta {
  margin-top: 0.75rem;
  color: var(--on-night-subtle);
  font-size: 0.875rem;
}

@media (min-width: 48rem) {
  .close-inner { grid-template-columns: 1fr auto; gap: 4rem; }
  .close-cta { display: grid; justify-items: end; text-align: right; }
}

.home .content-footer {
  border-top: 1px solid var(--rule-night);
  background: var(--night);
}
