/* Tarsi landing. One screen of drifting tiles, a centered message and a style picker.
   The page recolors itself for the style on screen through --bg / --ink / --soft. */

:root {
  --paper: #e8dccb;
  --ink-default: #1f1d1a;
  --ink-soft-default: #5d564c;
  --dark: #1b1b1b;
  --mustard: #e8b45f;

  --bg: var(--paper);
  --ink: var(--ink-default);
  --soft: var(--ink-soft-default);

  --font-display: "Gambarino", "Iowan Old Style", Georgia, serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --gutter: clamp(16px, 3vw, 32px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 0.75, 0.2);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --recolor: 1.1s cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light;
}

/* Gambarino by Indian Type Foundry, from Fontshare (ITF Free Font License), served from this site. */
@font-face {
  font-family: "Gambarino";
  src: url("fonts/Gambarino-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color var(--recolor), color var(--recolor);
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mustard); outline-offset: 4px; border-radius: 8px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
h1 { font-family: var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }

/* Drawn as a mask so the wordmark takes the current text color on every style. */
.logo {
  display: block; width: 136px; height: 24px;
  background-color: currentColor;
  -webkit-mask: url("logo.svg") no-repeat center / contain;
  mask: url("logo.svg") no-repeat center / contain;
}

/* =================================================================== Landing */
.no-transitions body, .no-transitions .message .lede { transition: none !important; }
.page-landing { overflow: hidden; overscroll-behavior: none; }
.stage {
  position: relative;
  height: 100vh; height: 100dvh; min-height: 520px;
  overflow: hidden;
  overflow: clip;   /* hidden alone still lets focus or scrollIntoView shift the whole stage */
  touch-action: none;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }

/* ---------- Tiles ----------
   .tile    position, updated every frame
   .lift    hover: rises
   .face    style-change animation
*/
/* Shared perspective for the drum effect while scrolling, and a soft fade at the top and bottom
   edges so tiles melt into the background there, as if the surface curved away. */
.field {
  position: absolute; inset: 0;
  perspective: 1400px; perspective-origin: 50% 50%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
}
.tile { position: absolute; left: 0; top: 0; will-change: transform, filter; }
.lift {
  width: 100%; height: 100%;
  transition: transform 0.6s var(--ease-out);
}
.face { width: 100%; height: 100%; }
.face img {
  width: 100%; height: 100%;
  border-radius: 17.5%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 10px 24px -8px rgba(0, 0, 0, 0.28);
  transition: box-shadow 0.6s var(--ease-out);
  pointer-events: none; -webkit-user-drag: none;
}
@media (hover: hover) {
  .tile:hover .lift { transform: translateY(-6px) scale(1.06); }
  .tile:hover .face img { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 24px 40px -12px rgba(0, 0, 0, 0.36); }
  .stage.is-dragging .tile:hover .lift { transform: none; }
}


/* Style change: each tile sinks and fades, swaps, then springs back. */
.face { transition: transform 0.7s var(--spring), opacity 0.5s ease, filter 0.5s ease; }
.face.is-out {
  transform: scale(0.72);
  opacity: 0;
  filter: blur(4px);
  transition: transform 0.36s var(--ease-in), opacity 0.3s ease, filter 0.3s ease;
}

/* ---------- Corners ---------- */
.corner-top {
  position: absolute; z-index: 4; inset: 0 0 auto 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) 20px;
  pointer-events: none;
}
.corner-top > * { pointer-events: auto; }
.corner-links { display: flex; gap: 24px; font-size: 14px; font-weight: 500; }
.corner-links a { text-decoration: none; opacity: 0.72; transition: opacity 0.2s ease; }
.corner-links a:hover { opacity: 1; }
.corner-note {
  position: absolute; z-index: 4; right: var(--gutter); bottom: max(28px, env(safe-area-inset-bottom));
  margin: 0; font-size: 12px; color: var(--soft);
  transition: color var(--recolor);
}

/* ---------- Message ---------- */
.message {
  position: absolute; z-index: 2; left: 50%; top: 50%;
  width: min(720px, calc(100% - 2 * var(--gutter)));
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.message > * { pointer-events: auto; }
.message h1 { font-size: clamp(44px, 6.4vw, 92px); line-height: 0.98; }
.message .lede {
  margin: 20px auto 0; max-width: 26em;
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--soft);
  transition: color var(--recolor);
  text-wrap: balance;
}
/* ---------- Entrance ----------
   0.3s  headline, phrase by phrase, 0.7s apart (site.js)
   2.3s  description, then the App Store button
   2.9s  tiles: a wave from the middle column outward, each falling a short way into place (site.js)
   3.8s  the columns start falling steadily (site.js)
   4.4s  wordmark, then Support and Privacy, dropping in from above
   4.7s  style picker
   `backwards` so nothing keeps the animation's values afterwards: hover effects still work. */
:root { --enter: 1s; }
.js-entrance .message h1:not(.is-split) { opacity: 0; }
.message h1 .word { display: inline-block; animation: rise var(--enter) var(--ease-out) var(--d, 0s) backwards; }
.message .lede { animation: rise var(--enter) var(--ease-out) 2.3s backwards; }
.message .store-badge { animation: rise var(--enter) var(--ease-out) 2.5s backwards; }
.corner-top .brand,
.corner-links a { animation: drop-in 0.9s var(--ease-out) 4.4s backwards; }
.corner-links a:nth-child(1) { animation-delay: 4.52s; }
.corner-links a:nth-child(2) { animation-delay: 4.62s; }
.styles-toggle { animation: rise var(--enter) var(--ease-out) 4.7s backwards; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}
/* Only a starting point, so each element lands on its own resting style (the links rest at 0.72). */
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-16px); filter: blur(4px); }
}

/* App Store button: black pill, Apple glyph in a ringed circle, two lines of type.
   The glyph is the system's private-use Apple logo (U+F8FF), which only Apple devices draw;
   elsewhere the circle is hidden (see .no-apple-glyph) and the text stands alone. */
.store-badge {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 36px; height: 64px; padding: 0 32px 0 10px;
  border-radius: 999px;
  background: #000; color: #fff;
  text-decoration: none; text-align: left;
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.5s var(--spring), box-shadow 0.5s var(--ease-out);
}
.store-badge:hover { transform: translateY(-3px); box-shadow: 0 22px 36px -16px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.store-badge:active { transform: scale(0.98); }
.store-badge-icon {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#000, #000) padding-box,
    linear-gradient(150deg, #9a9a9a 0%, #3a3a3a 45%, #1a1a1a 60%, #7a7a7a 100%) border-box;
  transition: transform 0.5s var(--spring);
}
.store-badge-icon::before {
  content: "\F8FF";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 400 24px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: #fff;
  transform: translateY(-1px);
}
.store-badge:hover .store-badge-icon { transform: scale(1.06); }
.no-apple-glyph .store-badge-icon { display: none; }
.no-apple-glyph .store-badge { padding-left: 28px; }
.store-badge-text { display: flex; flex-direction: column; line-height: 1; }
.store-badge-small { font-size: 13px; letter-spacing: 0.01em; opacity: 0.92; }
.store-badge-big { margin-top: 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
@media (max-width: 640px) {
  .store-badge { height: 56px; gap: 12px; padding-right: 26px; margin-top: 28px; }
  .store-badge-icon { width: 38px; height: 38px; }
  .store-badge-icon::before { font-size: 21px; }
  .store-badge-small { font-size: 12px; }
  .store-badge-big { font-size: 21px; }
}

/* ---------- Style picker ---------- */
.veil {
  position: absolute; inset: 0; z-index: 3;
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}
.styles-open .veil { opacity: 1; pointer-events: auto; cursor: default; }

.styles {
  position: absolute; z-index: 5;
  left: var(--gutter); bottom: max(20px, env(safe-area-inset-bottom));
  cursor: default;
}
.styles-toggle {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 20px 0 10px;
  border: 0; border-radius: 999px;
  background: rgba(255, 252, 247, 0.9); color: var(--ink-default);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  cursor: pointer;
  transition: transform 0.5s var(--spring), opacity 0.3s ease;
}
.styles-toggle:hover { transform: translateY(-2px); }
.styles-toggle:active { transform: scale(0.97); }
.styles-open .styles-toggle { opacity: 0; transform: scale(0.9); pointer-events: none; }
.styles-toggle-label { color: var(--ink-soft-default); margin-right: 2px; }
.styles-toggle-tiles { display: grid; }
/* The tile of the current style, the same one the panel shows; it rises a little on hover. */
.styles-toggle-tiles img {
  width: 32px; height: 32px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.5s var(--spring);
}
.styles-toggle:hover .styles-toggle-tiles img { transform: translateY(-1px) scale(1.06); }

.styles-panel {
  position: absolute; left: 0; bottom: 0;
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  padding: 20px;
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.94); color: var(--ink-default);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  transform-origin: 24px calc(100% - 24px);
  transform: scale(0.6) translateY(8px);
  opacity: 0; visibility: hidden;
  transition: transform 0.45s var(--ease-out), opacity 0.25s ease, visibility 0s linear 0.45s;
}
.styles-open .styles-panel {
  transform: none; opacity: 1; visibility: visible;
  transition: transform 0.6s var(--spring), opacity 0.3s ease, visibility 0s;
}
.styles-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.styles-panel-head p { margin: 0; font-size: 15px; font-weight: 600; }
.icon-button {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft-default); cursor: pointer;
  transition: color 0.2s ease, transform 0.3s var(--spring);
}
.icon-button:hover { color: var(--ink-default); transform: rotate(90deg); }
.styles-options { position: relative; display: grid; gap: 4px; }
/* The pill behind the chosen style; site.js moves it from row to row. */
.styles-highlight {
  position: absolute; left: 0; right: 0; top: 0; height: 72px;
  border-radius: 20px;
  background: rgba(31, 29, 26, 0.07);
  transition: transform 0.55s var(--spring), height 0.3s var(--ease-out);
}
.styles-highlight.is-instant { transition: none; }
.style-option {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px 8px 8px;
  border: 0; border-radius: 20px; background: transparent; color: inherit;
  text-align: left; cursor: pointer;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.5s var(--ease-out);
}
.styles-open .style-option { opacity: 1; transform: none; }
.styles-open .style-option:nth-child(2) { transition-delay: 0.08s; }
.styles-open .style-option:nth-child(3) { transition-delay: 0.14s; }
.styles-open .style-option:nth-child(4) { transition-delay: 0.2s; }
.styles-open .style-option:nth-child(5) { transition-delay: 0.26s; }
.style-option:focus-visible { outline: 2px solid var(--ink-default); outline-offset: -2px; }
/* Just the tile: it rises a little on hover, and the chosen one stands lifted. */
.style-option-tile {
  flex: none; width: 56px; height: 56px; border-radius: 12px;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.25);
  transition: transform 0.5s var(--spring), box-shadow 0.5s var(--ease-out);
}
.style-option:hover .style-option-tile { transform: translateY(-2px) scale(1.04); }
.style-option[aria-checked="true"] .style-option-tile {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.4);
}
.style-option-name { display: block; font-size: 16px; font-weight: 600; }
.style-option-line { display: block; font-size: 13px; color: var(--ink-soft-default); }

@media (max-width: 640px) {
  .corner-note { display: none; }
  .styles { left: 50%; transform: translateX(-50%); }
  .styles-panel { left: 50%; margin-left: calc(min(360px, 100vw - 2 * var(--gutter)) / -2); transform-origin: 50% 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .face, .face.is-out, .lift, .styles-panel, .style-option, .styles-highlight { transition-duration: 0.01s !important; }
  .message h1 .word, .message .lede, .message .store-badge,
  .corner-top .brand, .corner-links a, .styles-toggle { animation: none; }
}

/* =================================================================== Text pages (support, privacy) */
.page-doc .topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
/* The same menu as the landing; the page you're on stays at full strength. */
.topnav { display: flex; gap: 24px; font-size: 14px; font-weight: 500; }
.topnav a { text-decoration: none; opacity: 0.72; transition: opacity 0.2s ease; }
.topnav a:hover, .topnav a[aria-current="page"] { opacity: 1; }
.eyebrow {
  margin: 0 0 16px;
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--soft);
}
.doc { max-width: 720px; margin: 0 auto; padding: clamp(48px, 9vw, 112px) var(--gutter) clamp(96px, 12vw, 160px); }
.doc h1 { font-size: clamp(48px, 8vw, 88px); line-height: 1; }
.doc .lede { margin: 32px 0 56px; font-size: clamp(17px, 1.6vw, 20px); color: var(--soft); text-wrap: pretty; }
.doc h2 { font-size: 20px; font-weight: 600; line-height: 1.3; margin: 48px 0 12px; }
.doc p, .doc li { color: var(--soft); }
.doc p { margin: 0 0 16px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.doc .updated { font: 500 12px/1.4 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 24px; }
