/*
  Remind: rememberbetter.app

  The app's "Plain text" look on the web: black words in iA Writer on a warm
  off-white page, turned over after dark. The values come from the app
  (moodsdepot/remind: DESIGN.md, ios/Shared/Look.swift). No accent color:
  what matters is marked by weight, by [brackets], or by turning words over.

  Everything is self-hosted. Nothing loads from another site (see _headers).
*/

@font-face {
  font-family: "iA Writer Duo S";
  src: url("/fonts/iAWriterDuoS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "iA Writer Duo S";
  src: url("/fonts/iAWriterDuoS-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "iA Writer Mono S";
  src: url("/fonts/iAWriterMonoS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Look.swift, by day */
  --page: #f3f1ea;
  --ink: #121211;
  --slate: #5e626b; /* quieter words; 5.5:1 on the page */
  --noise: #c3c8d0; /* texture nobody reads: dotted leaders. Never for words. */
  --edge: rgba(18, 18, 17, 0.12);

  --duo: "iA Writer Duo S", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mono: "iA Writer Mono S", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* The type scale, by role. Only regular and bold, as in the app. */
  --text-small: 0.8125rem; /* 13: small print */
  --text-meta: 0.875rem; /* 14: headings over lists, counts, notices */
  --text-body: 1.0625rem; /* 17: what someone reads, as in the app */
  --text-sentence: 1.1875rem; /* 19: "12 to do. 2 for today." */
  --text-display: clamp(2.125rem, 1.4rem + 3.4vw, 3.25rem);

  --inset: 24px; /* the app's row inset */
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Look.swift, after dark */
    --page: #141413;
    --ink: #eceae3;
    --slate: #a3a199;
    --noise: #45484e;
    --edge: #2e2e2c;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  font-synthesis: none;
  background: var(--page);
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--duo);
  font-size: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--ink);
  color: var(--page);
}

/* One centered column, like a text file, with the app's inset on a phone. */
.page {
  max-width: calc(var(--measure) + 2 * var(--inset));
  margin-inline: auto;
  padding-inline: max(var(--inset), env(safe-area-inset-left))
    max(var(--inset), env(safe-area-inset-right));
}

/* ---------- Links ---------- */

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--noise);
  transition: text-decoration-color 150ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration-color: currentColor;
  }
}

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

.skip {
  position: absolute;
  left: var(--inset);
  top: -100px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--page);
  font-family: var(--mono);
  font-size: var(--text-meta);
  text-decoration: none;
  z-index: 1;
}

.skip:focus {
  top: 12px;
}

/* ---------- Header and footer ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: max(20px, env(safe-area-inset-top));
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: var(--text-body);
  text-decoration: none;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  gap: 4px;
  font-family: var(--mono);
  font-size: var(--text-meta);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 8px;
  color: var(--slate);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .site-nav a:hover {
    color: var(--ink);
  }
}

.site-footer {
  margin-top: 96px;
  padding-block: 28px max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-family: var(--mono);
  font-size: var(--text-meta);
  color: var(--slate);
}

.site-footer nav {
  display: flex;
  gap: 4px;
  margin-inline-start: -8px;
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 8px;
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .site-footer nav a:hover {
    color: var(--ink);
  }
}

/* ---------- Type ---------- */

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.lede {
  max-width: 34rem;
  color: var(--ink);
}

.quiet {
  color: var(--slate);
}

.mono {
  font-family: var(--mono);
}

/* A heading over a list, like the app's ListHeading: name, dotted leader,
   count. The leader is decoration, so it's drawn, not typed. */
.heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: var(--text-meta);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.heading::after {
  content: "";
  flex: 1;
  min-width: 24px;
  border-bottom: 2px dotted var(--noise);
  transform: translateY(-0.2em);
}

.heading .count {
  order: 1;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}

/* ---------- Home: the hero ---------- */

.hero {
  padding-top: clamp(56px, 12vw, 120px);
  display: grid;
  gap: 24px;
}

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: var(--text-meta);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
}

/* ---------- Home: what you say, what you'll find ---------- */

.demo {
  margin: 64px 0 0;
  display: grid;
  /* minmax(0, …): the sorting block is wider than a phone and clipped, so
     it must not set the column's width. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 720px) {
  .demo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Wider than the text column, so the two sides can sit together. */
    margin-inline: -24px;
  }
}

.panel {
  min-width: 0;
  margin: 0;
  padding: 20px var(--inset) 24px;
  border: 1px solid var(--edge);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  user-select: none;
  -webkit-user-select: none;
}

.panel-label {
  font-family: var(--mono);
  font-size: var(--text-small);
  color: var(--slate);
  letter-spacing: 0.01em;
}

.said {
  font-size: var(--text-body);
  line-height: 1.45;
  /* Room for two lines, so the words appearing never move what's below. */
  min-height: calc(2 * 1.45em);
}

.listening {
  font-family: var(--mono);
  font-size: var(--text-meta);
  color: var(--slate);
}

.cursor {
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  /* The app's cursor blinks (0.55s) only while it listens or sorts. */
  [data-live] .cursor {
    animation: blink 1.1s steps(1, end) infinite;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.notice {
  font-family: var(--mono);
  font-size: var(--text-meta);
  line-height: 1.6;
  /* "Added to Reach out [change]" wraps on the narrowest phones; keep room
     for two lines so a longer list name never moves what's below. */
  min-height: calc(2 * 1.6em);
}

.notice .action {
  color: var(--slate);
}

/* "Turned over": ink behind, page-colored letters. One per screen. */
.turned {
  background: var(--ink);
  color: var(--page);
  padding: 0 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.sentence {
  font-family: var(--mono);
  font-size: var(--text-sentence);
  line-height: 1.3;
}

.rows {
  display: grid;
  gap: 2px;
}

.rows .heading {
  margin: 14px 0 6px;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: baseline;
}

.check {
  font-family: var(--mono);
  color: var(--slate);
}

.row .line {
  grid-column: 2;
  font-size: var(--text-meta);
  color: var(--slate);
}

.row .line.today {
  color: var(--ink);
  font-weight: 700;
}

/* ---------- Home: sections ---------- */

.section {
  margin-top: 88px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 28px;
}

.steps li {
  display: grid;
  grid-template-columns: 3ch 1fr;
  column-gap: 16px;
}

.steps .n {
  font-family: var(--mono);
  font-size: var(--text-meta);
  line-height: calc(var(--text-body) * 1.55);
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}

.steps h3,
.features dt {
  font-size: var(--text-body);
  line-height: 1.55;
}

.steps p,
.features dd {
  color: var(--slate);
}

.features {
  margin: 0;
  display: grid;
  gap: 24px;
}

.features div {
  display: grid;
  gap: 2px;
}

.features dt {
  font-weight: 700;
}

.features dd {
  margin: 0;
}

.closing {
  margin-top: 96px;
  display: grid;
  gap: 16px;
}

.closing h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* ---------- Text pages: privacy, support ---------- */

.doc a {
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.doc {
  padding-top: clamp(48px, 9vw, 88px);
}

.doc h1 {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
}

.doc .updated {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: var(--text-meta);
  color: var(--slate);
}

.doc .intro {
  margin-top: 32px;
}

.doc h2 {
  margin-top: 56px;
}

.doc h2.heading {
  margin-bottom: 16px;
}

.doc p + p,
.doc p + ul,
.doc ul + p,
.doc ol + p {
  margin-top: 1.55em;
}

.doc ul,
.doc ol {
  margin: 0;
  padding-inline-start: 1.25em;
  display: grid;
  gap: 12px;
}

.doc ul {
  list-style: none;
  padding-inline-start: 0;
}

.doc ul > li {
  display: grid;
  grid-template-columns: 2ch 1fr;
  column-gap: 8px;
}

.doc ul > li::before {
  content: "-";
  font-family: var(--mono);
  color: var(--slate);
}

.doc ol > li::marker {
  font-family: var(--mono);
  color: var(--slate);
}

.doc strong {
  font-weight: 700;
}

.contact {
  margin-top: 28px;
  display: grid;
  gap: 8px;
}

.contact a {
  font-family: var(--mono);
  font-size: var(--text-sentence);
  overflow-wrap: anywhere;
}

.qa {
  display: grid;
  gap: 32px;
}

.qa h3 {
  font-size: var(--text-body);
  margin-bottom: 6px;
}

.qa p,
.qa ol {
  color: var(--slate);
}

[id] {
  scroll-margin-top: 24px;
}

/* The sorting block, as in the app (SortingBlock.swift): three lines of
   faint letters, the middle one re-forming a word, then the list's name,
   turned over. Mono 14 / 20. demo.js fills it; without it, the settled
   state below is what shows. */
.sorting {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--text-meta);
  line-height: 20px;
  height: 60px;
  white-space: pre;
  overflow: hidden;
  color: var(--noise);
}

.sorting .word {
  color: var(--ink);
}

.sorting .word.turned {
  color: var(--page);
}

.again {
  align-self: flex-start;
  min-height: 44px;
  margin: -6px 0 -12px -8px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--slate);
  font: inherit;
  font-family: var(--mono);
  font-size: var(--text-meta);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: color 150ms ease-out, transform 120ms ease-out;
}

@media (prefers-reduced-motion: no-preference) {
  .again:active {
    transform: scale(0.96);
  }
}

@media (hover: hover) and (pointer: fine) {
  .again:hover {
    color: var(--ink);
  }
}

.again:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}
