/* Tally's web pages, in the app's own type and colours: Mulish for reading, Geist Mono for what
   a machine wrote (dates), ink on paper, the champagne mark the only colour. */

@font-face {
  font-family: "Mulish";
  src: url("/assets/fonts/Mulish-Variable.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f7f7;
  --bg2: #fdfdfd;
  --line: #e5e5e5;
  --fg: #181818;
  --fg2: #5c5c5c;
  --fg3: #6b6b6b;
  --gold: #85652a;
  --mark-1: #8e6d2c;
  --mark-2: #a3803a;
  --mark-3: #b8944d;
  --mark-4: #cba964;
  --measure: 40rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --bg2: #171717;
    --line: #242424;
    --fg: #ededed;
    --fg2: #a3a3a3;
    --fg3: #888888;
    --gold: #ddbf7e;
    --mark-1: #f3dda6;
    --mark-2: #ddbf7e;
    --mark-3: #c29f5e;
    --mark-4: #a6834a;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.65 "Mulish", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg2);
  padding: 0.5rem 0.75rem;
}

/* The mark: four champagne columns with the fifth stroke cut through them. */
.mark {
  display: block;
}

.mark .c1 { fill: var(--mark-1); }
.mark .c2 { fill: var(--mark-2); }
.mark .c3 { fill: var(--mark-3); }
.mark .c4 { fill: var(--mark-4); }

/* Header on the inner pages: the small mark and the name, back to the front page. */
.top {
  width: 100%;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top nav {
  display: flex;
  gap: 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--fg2);
}

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

.top nav a:hover {
  color: var(--fg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  min-height: 44px;
}

main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* Inner pages: a quiet document. */
.doc h1 {
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
}

.doc .updated {
  margin: 0.75rem 0 0;
  font: 400 0.8125rem/1.5 "Geist Mono", ui-monospace, monospace;
  color: var(--fg3);
}

.doc .lede {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--fg);
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.doc h2 {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.doc h3 {
  font-weight: 600;
  font-size: 1rem;
  margin: 1.75rem 0 0;
}

.doc p,
.doc ul {
  color: var(--fg2);
  margin: 0.75rem 0 0;
}

.doc ul {
  padding-left: 1.15rem;
}

.doc li + li {
  margin-top: 0.35rem;
}

.doc strong {
  color: var(--fg);
  font-weight: 600;
}

.doc .path {
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
}

footer {
  width: 100%;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  font-size: 0.875rem;
  color: var(--fg3);
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

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

footer nav a:hover,
footer nav a[aria-current="page"] {
  color: var(--fg);
}

/* ------------------------------------------------------------------------------------------------
   Landing page: wide, quiet, one idea per screen. The mark is the only thing that moves. */

.landing {
  --wide: 68rem;
}

.landing .top,
.landing footer,
.landing main {
  max-width: calc(var(--wide) + 3rem);
}

.landing main {
  padding-top: 0;
  padding-bottom: 0;
}

.landing footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

@media (max-width: 34rem) {
  .landing .top nav {
    display: none;
  }
}

.label {
  margin: 0;
  font: 400 0.8125rem/1.5 "Geist Mono", ui-monospace, monospace;
  color: var(--fg3);
}

.status {
  margin: 0;
  font: 400 0.8125rem/1.5 "Geist Mono", ui-monospace, monospace;
  color: var(--fg3);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3rem 4rem;
  padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(4rem, 10vw, 8rem);
}

.hero .mark {
  width: 4.5rem;
  height: 4.5rem;
  margin-left: -0.6rem; /* the tile sits inside its own margin; line its edge up with the text */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero h1 {
  font-weight: 300;
  font-size: clamp(2.75rem, 7.5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 1.75rem 0 0;
}

.hero .lead {
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  line-height: 1.55;
  color: var(--fg2);
  margin: 1.5rem 0 0;
  max-width: 31rem;
}

.hero .status {
  margin-top: 2.25rem;
}

/* The phone: the screenshot in a thin black bezel, no shadow. */
.phone {
  margin: 0;
  width: 18.5rem;
  padding: 0.5rem;
  border-radius: 3.1rem;
  background: #0a0a0a;
  box-shadow: 0 0 0 1px var(--line);
}

.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2.6rem;
}

.hero-phone {
  width: 20rem;
}

@media (max-width: 52rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-phone {
    justify-self: center;
    width: min(18.5rem, 78vw);
  }
}

/* Features: copy on one side, the screen on the other, divided by hairlines. */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2.5rem 4rem;
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--line);
}

.feature:nth-child(even) .feature-copy {
  order: 2;
}

.feature-copy {
  max-width: 28rem;
}

.feature h2,
.block h2,
.closing h2 {
  font-weight: 300;
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0.75rem 0 0;
}

.feature-copy p:not(.label) {
  font-size: 1.0625rem;
  color: var(--fg2);
  margin: 1.25rem 0 0;
}

@media (max-width: 52rem) {
  .feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature:nth-child(even) .feature-copy {
    order: 0;
  }

  .feature .phone {
    justify-self: center;
    width: min(17rem, 74vw);
  }
}

/* Text blocks: cards, privacy, setup, FAQ. */
.block {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--line);
}

.block-lead {
  font-size: 1.0625rem;
  color: var(--fg2);
  margin: 1.25rem 0 0;
  max-width: 40rem;
}

.block .more {
  margin: 2rem 0 0;
  font-size: 0.9375rem;
}

.block .more a {
  text-decoration-color: var(--fg3);
}

.block .more a::after {
  content: " \2192";
}

/* Rules: a two-column list of rows, hairlines between, no boxes. */
.rules {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 3rem;
  border-top: 1px solid var(--line);
}

.rules li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.rules li span:first-child {
  font-weight: 600;
}

.rules li span:last-child {
  color: var(--fg3);
  font-size: 0.9375rem;
  text-align: right;
}

@media (max-width: 40rem) {
  .rules {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Privacy facts: term on the left, sentence on the right. */
.facts {
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--line);
}

.facts div {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 0.25rem 2rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
  color: var(--fg2);
  max-width: 36rem;
}

@media (max-width: 40rem) {
  .facts div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Setup steps. */
.steps {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.steps li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg2);
}

.steps .n {
  font: 400 0.9375rem/1.65 "Geist Mono", ui-monospace, monospace;
  color: var(--gold);
}

.steps strong {
  color: var(--fg);
  font-weight: 600;
}

/* FAQ: native disclosure rows. */
.faq {
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
  padding: 1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font: 300 1.375rem/1 "Mulish", sans-serif;
  color: var(--fg3);
  flex: none;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

.faq details p {
  margin: 0 0 1.25rem;
  color: var(--fg2);
  max-width: 40rem;
}

/* Closing. */
.closing {
  padding: clamp(4rem, 10vw, 7rem) 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.closing .mark {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto;
}

.closing h2 {
  margin-top: 1.5rem;
}

.closing .status {
  margin-top: 1.25rem;
}

/* The mark counting to five, as in the app: each column rises into the tile 100ms after the last
   (settle, 420ms), then the slash cuts left to right with a flash of gold that fades. The resting
   state is the finished mark, so with no animation it simply shows. */
.mark.build .col {
  transform-box: fill-box;
  animation: tally-rise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mark.build .c1 { animation-delay: 0.2s; }
.mark.build .c2 { animation-delay: 0.3s; }
.mark.build .c3 { animation-delay: 0.4s; }
.mark.build .c4 { animation-delay: 0.5s; }

.mark .cut,
.mark .flash {
  fill: none;
  stroke-width: 8;
  stroke-linecap: butt;
  stroke-dasharray: 1 1;
}

.mark .cut {
  stroke: var(--bg);
}

.mark .flash {
  stroke: var(--gold);
  opacity: 0;
}

.mark.build .cut {
  animation: tally-strike 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) 0.9s both;
}

.mark.build .flash {
  animation:
    tally-strike 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) 0.9s both,
    tally-fade 0.6s cubic-bezier(0, 0, 0.58, 1) 1.1s both;
}

@keyframes tally-rise {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes tally-strike {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes tally-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
