/* contengy.com, built from contengy's identity (brand/brand.md, brand-sheet.png,
   controls.png) and nothing else. The system, by role: site/style.md.

   Three layers, each reading only the one above it:
   1. Tokens: the brand's values, named once.
   2. Grounds: Paper, Ink and Lemon, the three grounds the marks stand on;
      each sets the roles its components read (--bg, --fg, --strong-bg ...).
   3. Components: read roles alone, so each works on any ground. */

@font-face {
  font-family: "Syne";
  src: url("fonts/syne-var.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}

/* 1. Tokens. */

:root {
  /* The brand's colors: brand/brand.md, Colors. */
  --ink: #1C1B19;
  --paper: #F8F7F5;
  --lemon: #FFF35A;
  --gray-on-paper: #8C8B86;
  --gray-on-ink: #5E5C58;
  /* The ink lifted a step, as the app icon's ground and the dark chrome's
     raised parts are. */
  --ink-raised: #2C2B29;

  /* Words a step quieter than the ground's own, each holding 4.5:1. */
  --soft-on-paper: #5A5954;
  --soft-on-ink: #AAA8A2;
  --soft-on-lemon: #4A4730;

  --danger-on-light: #A3271B;
  --danger-on-ink: #FF8A7E;

  /* Faces: Syne for the few big words, the system face for every other,
     mono for labels, as the brand sheet labels its parts. */
  --display: "Syne", system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* Type. */
  --size-display: clamp(44px, 5.4vw, 76px);
  --size-title: clamp(32px, 3.6vw, 52px);
  --size-lede: clamp(18px, 1.5vw, 21px);
  --size-point: 19px;
  --size-body: 16px;
  --size-small: 14px;
  --size-eyebrow: 12px;

  /* Space: the 4-point grid. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;

  /* Corners: the one scale of the controls, squarish as the mark's posts
     (brand/controls.png): 6, 8, 12, 18. */
  --radius-1: 6px;
  --radius-2: 8px;
  --radius-3: 12px;
  --radius-4: 18px;

  /* Controls and the page. */
  --control-height: 52px;
  --focus-width: 2px;
  --page: 1200px;

  /* The highlighter's shape: brand/highlighter.svg, its ends cut at the
     nib's angle, its edges a little uneven. */
  --stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='18 48 564 113' preserveAspectRatio='none'%3E%3Cpath d='M44.8 50.1L104.4 51.1L164.1 52.1L223.7 53.1L283.4 54.1L343.0 48.6L402.7 49.6L462.3 50.6L522.0 51.6L581.6 52.6L581.6 145.2L555.2 158.7L495.6 157.7L435.9 156.7L376.3 155.7L316.6 154.7L257.0 160.2L197.3 159.2L137.7 158.2L78.0 157.2L18.4 156.2Z'/%3E%3C/svg%3E");

  /* The pointer's grid: cells of a post's own shape, 3:4. */
  --post-width: 48px;
  --post-height: 64px;
  --pointer-reach: 260px;
}

/* 2. Grounds. A section takes one; its components follow. */

.ground-paper {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-soft: var(--soft-on-paper);
  --line: rgba(28, 27, 25, 0.16);
  --strong-bg: var(--ink);
  --strong-fg: var(--paper);
  --field-bg: #FFFFFF;
  --field-fg: var(--ink);
  --danger: var(--danger-on-light);
  --guide: rgba(28, 27, 25, 0.14);
}

.ground-ink {
  --bg: var(--ink);
  --fg: var(--paper);
  --fg-soft: var(--soft-on-ink);
  --line: rgba(248, 247, 245, 0.16);
  --strong-bg: var(--paper);
  --strong-fg: var(--ink);
  --field-bg: var(--ink-raised);
  --field-fg: var(--paper);
  --danger: var(--danger-on-ink);
  --guide: rgba(248, 247, 245, 0.14);
}

/* On Lemon the ground is the mark already: no highlighter stands on it. */
.ground-lemon {
  --bg: var(--lemon);
  --fg: var(--ink);
  --fg-soft: var(--soft-on-lemon);
  --line: rgba(28, 27, 25, 0.2);
  --strong-bg: var(--ink);
  --strong-fg: var(--lemon);
  --field-bg: var(--paper);
  --field-fg: var(--ink);
  --danger: var(--danger-on-light);
  --guide: rgba(28, 27, 25, 0.18);
}

.ground-paper,
.ground-ink,
.ground-lemon {
  background: var(--bg);
  color: var(--fg);
}

/* 3. Components. */

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

body {
  font-family: var(--text);
  font-size: var(--size-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: var(--focus-width) solid var(--fg);
  outline-offset: var(--space-1);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

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

/* The page's measure. */
.measure {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

/* The bar: the logo, one quiet link. */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

/* The logo is at least 96 points wide on a screen (brand/brand.md). */
.logo img {
  width: 152px;
}

.bar-link {
  font-weight: 600;
  text-decoration: none;
}

.bar-link:hover {
  text-decoration: underline;
}

/* The eyebrow: a label in mono capitals, as the brand sheet labels its
   parts; only where the words truly name a part. */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--size-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* The big words: Syne bold, tight. */
.display {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--size-display);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.title {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--size-title);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  font-size: var(--size-lede);
  color: var(--fg-soft);
  text-wrap: balance;
}

/* The highlighter: the brand's one gesture. A lemon marker stroke behind
   one word of a headline, the word in ink over it; one a view, drawn once
   as the view opens, as a marker draws. Never on Lemon. */
mark {
  position: relative;
  isolation: isolate;
  background: none;
  color: var(--ink);
}

mark::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0.34em -0.1em -0.04em;
  background: var(--lemon);
  mask: var(--stroke) center / 100% 100% no-repeat;
  animation: stroke 0.7s 0.35s cubic-bezier(0.3, 0, 0.2, 1) backwards;
}

/* On Ink the marker reaches past the letters' tops, so no stroke of the
   ink word stands on the ink ground. */
.ground-ink mark::before {
  inset: 0.06em -0.1em -0.04em;
}

@keyframes stroke {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

/* The strong action: ink on paper and lemon, paper on ink; one a view. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  padding: 0 var(--space-6);
  border: 0;
  border-radius: var(--radius-3);
  corner-shape: squircle;
  background: var(--strong-bg);
  color: var(--strong-fg);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: color-mix(in srgb, var(--strong-bg) 86%, var(--bg));
}

.button:active {
  background: color-mix(in srgb, var(--strong-bg) 76%, var(--bg));
}

/* The quiet action: a hairline, the ground showing through. */
.button.quiet {
  background: transparent;
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.button.quiet:hover {
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}

/* A field: the ground's field color, a hairline edge. */
.field {
  height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-3);
  corner-shape: squircle;
  background: var(--field-bg);
  color: var(--field-fg);
  font: inherit;
}

.field::placeholder {
  color: var(--fg-soft);
}

.ground-lemon .field::placeholder {
  color: var(--soft-on-paper);
}

.field:focus-visible {
  outline-offset: 0;
}

/* The waitlist: a field and the strong action, a note, what came of it. */
.join {
  width: 100%;
  max-width: 480px;
}

.join-row {
  display: flex;
  gap: var(--space-2);
}

.join-row .field {
  flex: 1;
  min-width: 0;
}

.join-note {
  margin-top: var(--space-3);
  font-size: var(--size-small);
  color: var(--fg-soft);
  text-wrap: balance;
}

.join-said {
  margin-top: var(--space-3);
  font-weight: 600;
  text-wrap: balance;
}

.join-said[data-kind="problem"] {
  color: var(--danger);
}

/* The bot check: no height until Cloudflare needs the visitor to act. */
.join-check {
  margin-top: var(--space-3);
}

/* The window: the app itself, at work on a made-up project, its own corners
   as the capture cuts them (42 of its 2560 by 1600 pixels); a hairline keeps
   its light edge on a light ground. */
.window {
  display: block;
  position: relative;
  max-width: var(--page);
  margin: 0 auto;
}

.window img {
  width: 100%;
  border-radius: 1.64% / 2.625%;
  outline: 1px solid var(--line);
}

/* The hinge: the window standing across two grounds, so the page's halves
   run into each other through it. The section takes the upper ground; the
   lower one is named by the class after it. */
.hinge {
  padding-bottom: var(--space-16);
  background: linear-gradient(to bottom, var(--bg) 0 var(--hinge-at), var(--lower) var(--hinge-at) 100%);
  --hinge-at: 32%;
}

.hinge.to-ink {
  --lower: var(--ink);
}

.hinge.to-lemon {
  --lower: var(--lemon);
}

/* Posts: covers as they go out, 3:4, square corners as a feed shows them;
   the content's color, the only color besides the highlighter. */
.posts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.posts img {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
}

/* Points: what contengy does, each a heading and a line. */
.points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12) var(--space-10);
  list-style: none;
}

/* A list's own indent goes; with no weight of its own, so a measure's
   padding still holds. */
:where(.points) {
  padding: 0;
}

.points h3 {
  font-size: var(--size-point);
  font-weight: 650;
  line-height: 1.3;
}

.points p {
  margin-top: var(--space-2);
  color: var(--fg-soft);
  text-wrap: pretty;
}

/* The foot: who makes it, the legal link, on a ground of its own, whose
   edge parts it from what stands above. */
.foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
  font-size: var(--size-small);
  color: var(--fg-soft);
}

.foot nav {
  display: flex;
  gap: var(--space-6);
  white-space: nowrap;
}

/* A text page: plain words at a reading measure. */
.policy {
  max-width: 38em;
  margin: 0 auto;
  padding: var(--space-16) var(--space-6) var(--space-24);
}

.policy .title {
  margin-bottom: var(--space-3);
}

.policy-date {
  font-size: var(--size-small);
  color: var(--fg-soft);
}

.policy h2 {
  margin-top: var(--space-10);
  font-size: var(--size-point);
  font-weight: 650;
  line-height: 1.3;
}

.policy h2 + p {
  margin-top: var(--space-2);
  text-wrap: pretty;
}

/* 4. Compositions: how the components stand on the page. */

/* The first screen: the headline, the line under it and the waitlist,
   beside three posts, as the brand sheet sets its line beside three
   covers: what contengy makes, shown before how. */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.hero .lede {
  margin-top: var(--space-6);
}

.hero .join {
  margin-top: var(--space-8);
}

.ground-ink .points {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

/* The call: a band of one ground holding a title and the waitlist. */
.call {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px);
  gap: var(--space-12);
  align-items: center;
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

/* The pointer: a grid of posts shows around it, drawn by each ground as
   part of its own background, so it lies under every part standing on the
   ground (a word, the form, the window) and never over one. The grid is
   fixed to the window of the browser, so it runs on as one grid from ground
   to ground; pointer.js writes where the pointer is in each ground's own
   box. Over the hinge, which holds two grounds, white guides take the
   difference with whichever stands under them. */
.ground-paper,
.ground-ink,
.ground-lemon,
.hinge {
  position: relative;
  isolation: isolate;
}

.ground-paper::before,
.ground-ink::before,
.ground-lemon::before,
.hinge::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  background:
    linear-gradient(to right, var(--guide) 1px, transparent 1px) 50% 0 / var(--post-width) var(--post-height) fixed,
    linear-gradient(to bottom, var(--guide) 1px, transparent 1px) 50% 0 / var(--post-width) var(--post-height) fixed;
  mask: radial-gradient(circle var(--pointer-reach) at var(--x, -999px) var(--y, -999px), #000, transparent);
}

.hinge::before {
  --guide: rgba(255, 255, 255, 0.3);
  mix-blend-mode: difference;
}

[data-pointer] .ground-paper::before,
[data-pointer] .ground-ink::before,
[data-pointer] .ground-lemon::before,
[data-pointer] .hinge::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  mark::before {
    animation: none;
  }

  /* The grid follows the pointer, so where the system asks for reduced
     motion it is not drawn at all. */
  .ground-paper::before,
  .ground-ink::before,
  .ground-lemon::before,
  .hinge::before {
    display: none;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .points {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .bar {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
  }

  .logo img {
    width: 120px;
  }

  .join-row {
    flex-direction: column;
  }

  .join-row .field {
    flex: none;
  }

  /* Cut from the window, the phone's picture takes a picture's corner. */
  .window img {
    border-radius: var(--radius-3);
  }

  .points {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .call {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }

  .foot {
    flex-direction: column;
  }
}
