/* TexFlow — the front door.
 *
 * The Flows themselves are colourful; every one carries its own gradient. So
 * the site around them is deliberately not: paper, ink, one hairline, and a
 * great deal of air. All the colour on a TexFlow page comes from the tools it
 * is showing, which is also how you can tell at a glance how many there are.
 */

:root {
  --paper: #fbfbfa;
  --paper-2: #ffffff;
  --sunk: #f2f2f0;
  --ink: #14140f;
  --ink-2: #56564e;
  --ink-3: #8f8f86;
  --line: rgba(20, 20, 15, 0.1);
  --line-2: rgba(20, 20, 15, 0.055);
  --accent: #14140f;

  --shadow-1: 0 1px 2px rgba(20, 20, 15, 0.04), 0 1px 3px rgba(20, 20, 15, 0.04);
  --shadow-2: 0 2px 8px rgba(20, 20, 15, 0.05), 0 18px 40px rgba(20, 20, 15, 0.08);
  --shadow-3: 0 20px 60px rgba(20, 20, 15, 0.14);

  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  --gutter: clamp(20px, 5vw, 40px);
  --measure: 1120px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0b0c;
    --paper-2: #141416;
    --sunk: #101012;
    --ink: #f5f5f2;
    --ink-2: #a8a8a1;
    --ink-3: #74746d;
    --line: rgba(255, 255, 255, 0.11);
    --line-2: rgba(255, 255, 255, 0.06);
    --accent: #f5f5f2;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.55);
    --shadow-3: 0 20px 60px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
input { -webkit-appearance: none; appearance: none; }

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

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }

/* ------------------------------------------------------------------ header */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: saturate(1.7) blur(18px);
  -webkit-backdrop-filter: saturate(1.7) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.top.is-stuck { border-bottom-color: var(--line-2); }
.top-in {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.025em;
}
.mark-glyph {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ink);
  position: relative;
  flex: none;
}
.mark-glyph::before, .mark-glyph::after {
  content: "";
  position: absolute;
  left: 6px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--paper);
}
.mark-glyph::before { top: 8.5px; width: 14px; }
.mark-glyph::after { top: 14.5px; width: 9px; }

.top-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-link {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 520;
  color: var(--ink-2);
  transition: color 0.16s, background 0.16s;
}
.top-link:hover { color: var(--ink); background: var(--line-2); }
@media (max-width: 560px) { .top-link.is-optional { display: none; } }

/* ------------------------------------------------------------------ button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: var(--paper);
  font-size: 16px;
  font-weight: 570;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.16s var(--ease), opacity 0.16s;
}
.btn:active { transform: scale(0.975); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--line-2); }
.btn.small { min-height: 40px; padding: 0 15px; font-size: 14.5px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.danger { background: none; color: #d33; border: 1px solid rgba(221, 51, 51, 0.35); }

/* -------------------------------------------------------------------- hero */

.hero { padding: clamp(38px, 7vw, 76px) 0 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 24px;
}
.eyebrow i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

h1, .h1 {
  font-size: clamp(37px, 6.6vw, 62px);
  font-weight: 640;
  letter-spacing: -0.042em;
  line-height: 1.03;
  max-width: 15ch;
}
.h1 em { font-style: normal; color: var(--ink-3); }

.lede {
  margin-top: 22px;
  font-size: clamp(17px, 2.1vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 46ch;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* The strip of Flow icons under the hero: two rows drifting in opposite
 * directions, faded out at both edges. It is the product, shown rather than
 * described — and it is the only place on the page that moves. */
.strip {
  margin-top: clamp(40px, 7vw, 68px);
  overflow: hidden;
  /* The fade belongs on the clipping box, not on the row: the row is several
     screens wide, so a mask there would fade somewhere off in the distance. */
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.strip-row {
  display: flex;
  gap: 16px;
  width: max-content;
  padding: 6px 0;
  animation: drift 58s linear infinite;
}
.strip-row.back { animation-duration: 74s; animation-direction: reverse; opacity: 0.62; }
@keyframes drift { to { transform: translateX(-50%); } }
.strip:hover .strip-row { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .strip-row { animation: none; } }

.strip-tile {
  flex: none;
  width: clamp(58px, 12vw, 76px);
  height: clamp(58px, 12vw, 76px);
  border-radius: 22%;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform 0.28s var(--ease);
}
.strip-tile:hover { transform: translateY(-5px) scale(1.05); }
.strip-tile svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- sections */

section.band { padding: clamp(56px, 10vw, 108px) 0; }
section.band + section.band { border-top: 1px solid var(--line-2); }

.kicker {
  font-size: 12px;
  font-weight: 660;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}

h2 {
  font-size: clamp(27px, 4.2vw, 40px);
  font-weight: 630;
  letter-spacing: -0.032em;
  line-height: 1.1;
  max-width: 20ch;
}
h3 { font-size: 19px; font-weight: 620; letter-spacing: -0.02em; }

.sec-lede { margin-top: 16px; font-size: 17.5px; color: var(--ink-2); max-width: 54ch; }

/* three steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 46px; }
@media (max-width: 780px) { .steps { grid-template-columns: 1fr; gap: 14px; } }
.step {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px 24px 28px;
  box-shadow: var(--shadow-1);
}
.step-n {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 660;
  margin-bottom: 18px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--ink-2); font-size: 16px; }

/* the catalogue grid */
.area { margin-top: 44px; }
.area:first-of-type { margin-top: 32px; }
.area-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.area-head h3 { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.area-head span { font-size: 14.5px; color: var(--ink-3); }
@media (max-width: 620px) { .area-head span { display: none; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }

.tool {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s;
}
.tool:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line); }
.tool:active { transform: translateY(0) scale(0.99); }
.tool-mark { flex: none; width: 46px; height: 46px; border-radius: 13px; overflow: hidden; box-shadow: var(--shadow-1); }
.tool-mark svg { width: 100%; height: 100%; }
.tool-copy { min-width: 0; flex: 1; }
.tool-name { font-size: 16px; font-weight: 590; letter-spacing: -0.015em; }
.tool-tag { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-go { flex: none; color: var(--ink-3); opacity: 0; transform: translateX(-4px); transition: all 0.22s var(--ease); }
.tool:hover .tool-go { opacity: 1; transform: translateX(0); }

/* promises */
.notes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 44px; margin-top: 40px; }
@media (max-width: 700px) { .notes { grid-template-columns: 1fr; } }
.note { padding: 22px 0; border-top: 1px solid var(--line-2); }
.note h3 { margin-bottom: 6px; }
.note p { color: var(--ink-2); font-size: 16px; }

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

.foot { padding: 46px 0 60px; border-top: 1px solid var(--line-2); }
.foot-in { display: flex; flex-wrap: wrap; gap: 20px 30px; align-items: baseline; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-left: auto; }
.foot-links a {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: color 0.16s, background 0.16s;
}
.foot-links a:hover { color: var(--ink); background: var(--line-2); }
.foot-note { font-size: 14px; color: var(--ink-3); max-width: 40ch; }

/* --------------------------------------------------------------- app pages */

.page-head { padding: clamp(30px, 6vw, 56px) 0 26px; }
.page-head h1 { font-size: clamp(30px, 5.4vw, 46px); max-width: 20ch; }
.page-head .lede { margin-top: 14px; font-size: 17.5px; }

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  padding: clamp(22px, 4vw, 34px);
}

.field { margin-bottom: 14px; }
.label {
  display: block;
  font-size: 11.5px;
  font-weight: 660;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px 2px;
}
.input {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--ink) 40%, transparent);
  box-shadow: 0 0 0 4px var(--line-2);
}
.input.mono { font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

.token {
  display: block;
  padding: 20px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--sunk);
  font-family: var(--mono);
  font-size: clamp(17px, 5vw, 24px);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: center;
  overflow-wrap: anywhere;
}

.rowbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }

.empty {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-xl);
  color: var(--ink-2);
}
.empty strong { display: block; font-size: 19px; font-weight: 620; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 6px; }

/* a Flow the user owns */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.owned {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.owned:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.owned-mark { flex: none; width: 48px; height: 48px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-1); }
.owned-copy { flex: 1; min-width: 0; }
.owned-name { font-size: 16px; font-weight: 590; letter-spacing: -0.015em; }
.owned-sub { font-size: 13.5px; color: var(--ink-3); }
.iconbtn {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.iconbtn:hover { background: var(--line-2); color: var(--ink); }
.iconbtn svg { width: 19px; height: 19px; }

/* filters on the catalogue */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.chip {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 540;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* --------------------------------------------------------------- overlays */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 20, 15, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s var(--ease);
}
.scrim.open { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 91;
  width: 460px;
  max-width: calc(100vw - 28px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px 24px 22px;
  background: var(--paper-2);
  border-radius: 26px;
  box-shadow: var(--shadow-3);
  transform: translate(-50%, -44%) scale(0.97);
  opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.sheet.open { transform: translate(-50%, -50%); opacity: 1; }
.sheet h2 { font-size: 22px; margin-bottom: 6px; max-width: none; }
.sheet p { color: var(--ink-2); font-size: 15.5px; }
.sheet .stack { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

@media (max-width: 520px) {
  .sheet {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    border-radius: 26px 26px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .sheet.open { transform: translateY(0); }
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 95;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 11px 19px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14.5px;
  font-weight: 520;
  box-shadow: var(--shadow-2);
  animation: toast-in 0.3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.95); } }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
