/*
  Jabal's website. The colours, type and shapes are the app's own:
  Hira's palette from MountainPalette.swift, cream as the one accent, the
  system serif for headlines, tracked capitals for small labels, and controls
  in a translucent plum panel with 28-point corners.
*/

:root {
  --cream: #fcedd9;
  --cream-soft: rgba(252, 237, 217, 0.80);
  --cream-quiet: rgba(252, 237, 217, 0.58);
  --cream-line: rgba(252, 237, 217, 0.14);
  --deep: #3b1f3d;
  --deep-quiet: rgba(59, 31, 61, 0.66);
  --ground: #4d2b4a;
  --panel: rgba(68, 38, 68, 0.80);
  --sky-top: #c76985;
  --sky-mid: #ed827d;
  --sky-horizon: #fcbd7a;
  --fog: 255, 214, 204;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;

  --gutter: 24px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--deep);
  color: var(--cream);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

/* Small, widely spaced capitals: the app's CapsLabel. */
.caps {
  font: 600 13px/1.3 var(--sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* The one filled, cream button on a screen. */
.button {
  display: block;
  padding: 15px 24px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--deep);
  font: 500 19px/1.3 var(--sans);
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}

.button:hover {
  opacity: 0.88;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--cream-line);
  border-radius: 28px;
  padding: 20px;
}

/* The opening screen: a headline over the sky, the mountain in the middle,
   a plum panel at the foot. */

.hero {
  --hero-h: clamp(620px, 100vh, 1000px);
  /* One mountain unit. The scene is 2.3 units tall and its horizon sits
     0.652 of the way up, as tools/site_art.py draws it. */
  --unit: min(var(--hero-h) * 0.30, 64vw);
  --scene-h: calc(var(--unit) * 2.3);
  --sky-h: calc(100% - var(--scene-h) * 0.652);

  position: relative;
  isolation: isolate;
  height: var(--hero-h);
  overflow: hidden;
  color: var(--deep);
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0,
    var(--sky-mid) calc(var(--sky-h) * 0.55),
    var(--sky-horizon) var(--sky-h)
  );
}

@supports (height: 100svh) {
  .hero {
    --hero-h: clamp(620px, 100svh, 1000px);
  }
}

.cloud {
  position: absolute;
  z-index: -2;
  left: 0;
  top: var(--y);
  width: var(--w);
  aspect-ratio: 5 / 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--fog), 0.30), rgba(var(--fog), 0));
  transform: translate(calc(var(--start) * 100vw - 50%), -50%);
  animation: drift var(--time) linear infinite;
  animation-delay: calc(var(--time) * var(--start) * -1);
}

@keyframes drift {
  from { transform: translate(-100%, -50%); }
  to { transform: translate(100vw, -50%); }
}

.scene {
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--scene-h);
}

.scene-art {
  width: 100%;
  height: 100%;
}

/* The light breathes: one slow swell about every four seconds. */
.light-glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: breathe 4.2s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { transform: scale(0.88); }
  to { transform: scale(1.12); }
}

.hero-top {
  padding: max(26px, env(safe-area-inset-top)) var(--gutter) 0;
  text-align: center;
}

.brand {
  display: block;
  letter-spacing: 0.54em;
  /* Tracking adds a gap after the last letter; this puts the word back in the middle. */
  padding-left: 0.54em;
  text-decoration: none;
}

.hero-nav {
  position: absolute;
  top: max(26px, env(safe-area-inset-top));
  right: var(--gutter);
  letter-spacing: 0.2em;
  text-decoration: none;
  opacity: 0.8;
}

.hero-nav:hover {
  opacity: 1;
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.12;
}

.hero-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 440px;
  margin-inline: auto;
  color: var(--cream);
  text-align: center;
}

.hero-panel p {
  font-size: 16px;
  line-height: 1.5;
  color: var(--cream-soft);
  text-wrap: pretty;
}

.hero-panel .button {
  margin: 16px 0 14px;
}

.hero-panel .caps {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cream-quiet);
}

/* The sections under the opening screen. */

.section {
  max-width: 1088px;
  margin: 0 auto;
  padding: clamp(64px, 9vw, 104px) var(--gutter) 0;
}

.section > .caps,
.promise > .caps {
  color: var(--cream-quiet);
}

.section h2,
.promise h2 {
  margin: 14px 0 18px;
  max-width: 17em;
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.15;
}

.section p,
.promise p {
  max-width: 60ch;
  color: var(--cream-soft);
  text-wrap: pretty;
}

.section p + p,
.promise p + p {
  margin-top: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--cream-line);
  border-radius: 28px;
  padding: 24px;
}

.card .caps {
  font-size: 11px;
  color: var(--cream-quiet);
}

.card h3 {
  margin: 10px 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

.card p {
  font-size: 16px;
  line-height: 1.55;
}

/* The fourteen mountains: a row to swipe through on a phone, as in the app. */

.peaks {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 22px 14px;
  margin: 32px 0 28px;
  padding: 0;
  list-style: none;
}

.peaks img {
  width: 100%;
  height: auto;
  aspect-ratio: 6 / 5;
  border-radius: 16px;
  background: var(--ground);
}

.peaks h3 {
  margin: 10px 0 1px;
  font: 500 15px/1.3 var(--sans);
}

.peaks p {
  font-size: 13px;
  line-height: 1.4;
  color: var(--cream-quiet);
}

@media (max-width: 860px) {
  .peaks {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(44%, 200px);
    margin-inline: calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }

  .peaks::-webkit-scrollbar {
    display: none;
  }

  .peaks li {
    scroll-snap-align: start;
  }
}

/* The promise. Cream is the app's one accent; text on cream is plum. */

.promise {
  background: var(--cream);
  color: var(--deep);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 56px);
}

.promise > .caps {
  color: var(--deep-quiet);
}

.promise p {
  color: rgba(59, 31, 61, 0.86);
}

.text-link {
  display: inline-block;
  margin-top: 28px;
  font-weight: 500;
}

/* The foot of every page. */

.footer {
  max-width: 1088px;
  margin: clamp(64px, 9vw, 104px) auto 0;
  padding: 32px var(--gutter) max(40px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--cream-line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  align-items: center;
  font-size: 15px;
  color: var(--cream-soft);
}

.footer img {
  grid-row: span 2;
  width: 56px;
  height: 56px;
  border-radius: 13px;
}

.footer .caps {
  color: var(--cream);
}

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

.footer small {
  grid-column: 1 / -1;
  margin-top: 16px;
  font-size: 13px;
  color: var(--cream-quiet);
}

/* The privacy page: the same sky, seen from far off, over plain text. */

.page-head {
  --unit: clamp(84px, 14vw, 120px);
  --scene-h: calc(var(--unit) * 2.3);
  --sky-h: calc(100% - var(--scene-h) * 0.652);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: max(26px, env(safe-area-inset-top)) var(--gutter) calc(var(--unit) * 2.25);
  text-align: center;
  color: var(--deep);
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0,
    var(--sky-mid) calc(var(--sky-h) * 0.55),
    var(--sky-horizon) var(--sky-h)
  );
}

.page-head h1 {
  margin-top: 22px;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.12;
}

.page-head .date {
  margin-top: 8px;
  font-size: 15px;
  color: var(--deep-quiet);
}

.page-head .scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

.prose {
  max-width: 688px;
  margin: 0 auto;
  padding: 40px var(--gutter) 0;
}

.prose h2 {
  margin: 44px 0 10px;
  font-size: 26px;
  line-height: 1.25;
}

.prose p,
.prose li {
  color: var(--cream-soft);
}

.prose p + p {
  margin-top: 14px;
}

.prose ul {
  margin: 0;
  padding-left: 1.2em;
}

.prose li + li {
  margin-top: 6px;
}

.prose .lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--cream);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cloud,
  .light-glow {
    animation: none;
  }
}
