/* TanPro website. Colours and type follow the app (Design/Colors.swift, ColorRoles.swift). */

@font-face { font-family: "Fustat"; src: url("fonts/fustat.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Libre Caslon Display"; src: url("fonts/caslon-display.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; src: url("fonts/caslon-text.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #FFFDF8;          /* cream */
  --text: #191212;        /* ink */
  --text-2: #5E5651;      /* neutral-800 */
  --link: #B14A63;        /* accent-700 */
  --rule: #E6DED8;        /* neutral-200 */
  --wash: #FFE8EA;        /* accent-100 */
  --button-bg: #191212;
  --button-text: #FFFDF8;
  --gutter: 24px;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --serif: "Libre Caslon Text", Georgia, serif;
  --ui: "Fustat", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120D0D;        /* night-0 */
    --text: #FDF5F0;      /* neutral-50 */
    --text-2: #BFB7B1;    /* neutral-400 */
    --link: #FD96A8;      /* accent-400 */
    --rule: #2B2323;      /* night-2 */
    --wash: #3A1F27;
    --button-bg: #FDF5F0;
    --button-text: #191212;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:not(.is-home) {
  background-image: linear-gradient(180deg, var(--wash) 0, color-mix(in srgb, var(--wash) 0%, transparent) 360px);
  background-repeat: no-repeat;
}

main { flex: 1; }

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 4px; }

.wordmark svg, .home-link svg { display: block; width: 100%; height: auto; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 32px;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-text);
  font: 600 17px/1 var(--ui);
  text-decoration: none;
  transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out);
}
.button:hover { text-decoration: none; opacity: 0.9; }
.button:active { transform: scale(0.97); }

/* ---------- front page: the app's Welcome screen ---------- */

.is-home { height: 100vh; height: 100svh; min-height: 0; }

/* One screen tall. The art hangs from the top edge, as in the app, and fades
   slowly into the page; the headline sits in that fade. Its height gives way on
   short screens (cropped from the top, so the arc stays). */
.home {
  --art-w: min(100vw, 560px);
  --art-ratio: 1.1538; /* welcome art is 1170 × 1350 */
  --art-h: min(calc(var(--art-w) * var(--art-ratio)), calc(100svh - 260px));
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.home-moon { --art-ratio: 1.0769; } /* moon art is 1170 × 1260 */

.art { position: relative; flex: none; width: var(--art-w); height: var(--art-h); margin: 0 auto; }
.art picture { display: contents; }
.art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
  -webkit-mask-image: linear-gradient(180deg, #000 40%, rgba(0, 0, 0, 0.55) 68%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 40%, rgba(0, 0, 0, 0.55) 68%, transparent 96%);
}

@media (min-width: 600px) {
  /* Narrower than the screen: soften the sides too. */
  .art img {
    -webkit-mask-image:
      linear-gradient(180deg, #000 40%, rgba(0, 0, 0, 0.55) 68%, transparent 96%),
      linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.15) 6%, rgba(0, 0, 0, 0.5) 14%, rgba(0, 0, 0, 0.85) 24%, #000 32%, #000 68%, rgba(0, 0, 0, 0.85) 76%, rgba(0, 0, 0, 0.5) 86%, rgba(0, 0, 0, 0.15) 94%, transparent);
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(180deg, #000 40%, rgba(0, 0, 0, 0.55) 68%, transparent 96%),
      linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.15) 6%, rgba(0, 0, 0, 0.5) 14%, rgba(0, 0, 0, 0.85) 24%, #000 32%, #000 68%, rgba(0, 0, 0, 0.85) 76%, rgba(0, 0, 0, 0.5) 86%, rgba(0, 0, 0, 0.15) 94%, transparent);
    mask-composite: intersect;
  }
}

.wordmark {
  position: absolute;
  top: 25%;
  left: 50%;
  width: min(59%, 300px);
  margin: 0;
  color: #191212; /* sits on the light window art in both themes */
  transform: translateX(-50%);
}
@media (prefers-color-scheme: dark) { .wordmark { color: #FDF5F0; } }

.intro {
  position: relative;
  flex: none;
  margin-top: calc(var(--art-h) * -0.1); /* headline sits in the art's fade */
  padding: 0 var(--gutter);
  text-align: center;
}

.intro h1, .intro h2 {
  margin: 0;
  font: 400 clamp(40px, 7vw, 56px)/1.05 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.intro p {
  margin: 16px auto 32px;
  color: var(--text-2);
  font-size: 19px;
  line-height: 1.5;
  text-wrap: balance;
}
@media (min-width: 600px) { .intro p { white-space: nowrap; } }

/* Entrance, as in the app's welcomeReveal */
@media (prefers-reduced-motion: no-preference) {
  .art img { animation: settle 900ms var(--ease-out) both; }
  .wordmark { animation: unblur 900ms var(--ease-out) 250ms both; }
  .intro h1, .intro h2 { animation: rise 560ms var(--ease-out) 620ms both; }
  .intro p { animation: rise 560ms var(--ease-out) 740ms both; }
  .intro .button { animation: rise 560ms var(--ease-out) 860ms both; }
}
@keyframes settle { from { transform: scale(1.02); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes unblur { from { filter: blur(4px); opacity: 0; translate: 0 8px; } to { filter: none; opacity: 1; translate: 0 0; } }
@keyframes rise { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }

/* ---------- policy and support pages ---------- */

.top, .doc { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }
.top { padding-top: 40px; }
.home-link { display: block; width: 112px; color: var(--text); }

.doc { padding-bottom: 32px; }
.doc h1 {
  margin: 72px 0 16px;
  font: 400 clamp(40px, 7vw, 56px)/1.05 var(--display);
  letter-spacing: -0.01em;
}
.doc h2 {
  margin: 64px 0 12px;
  font: 400 26px/1.25 var(--serif);
}
.doc h3 {
  margin: 36px 0 8px;
  font: 600 18px/1.4 var(--ui);
}
.doc p, .doc ul { margin: 0 0 16px; }
.doc ul { padding-left: 1.25em; }
.doc li { margin-bottom: 8px; }
.doc li::marker { color: var(--link); }
.doc strong { font-weight: 650; }
.doc a { overflow-wrap: anywhere; }
.doc .meta { color: var(--text-2); font-size: 15px; }
.doc .lead { margin: 0 0 32px; color: var(--text-2); font-size: 20px; line-height: 1.5; }
.doc .button { margin-bottom: 8px; color: var(--button-text); }

/* ---------- footer ---------- */

.footer {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 96px var(--gutter) 48px;
  color: var(--text-2);
  font-size: 15px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 12px 20px;
}
.footer-links { display: contents; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer p { margin: 0; }
.is-home .footer { flex: none; padding-top: 40px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
