/* The product pages (/about-wicked-glass): Davis's palette, type and spacing
   (themes/davis/assets/theme.css), so they sit beside the default theme. They
   follow the visitor's device for light and dark; the screenshots are always
   the dark set. No script: everything here is progressive CSS. */

:root {
  --accent: #c2410c;
  --bg: #f6f5f2;
  --fg: #141413;
  /* Secondary text: at least 4.5:1 against the background, in light and dark (WCAG AA). */
  --muted: color-mix(in oklab, var(--fg) 68%, var(--bg));
  --line: color-mix(in oklab, var(--fg) 12%, var(--bg));
  --surface: color-mix(in oklab, var(--fg) 5%, var(--bg));
  /* Behind a screenshot while it loads: Davis's dark background. */
  --shot: #0e0e0d;
  --shot-rim: color-mix(in oklab, var(--fg) 16%, transparent);
  --shot-shadow: 0 2.5rem 5rem -2.5rem rgb(20 20 19 / 0.45);
  --pad: clamp(1rem, 0.5rem + 2.5vw, 3rem);
  --wide: 84rem;
  --header-h: 4.5rem;
  --radius: 3px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 180ms;
  --slow: 650ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0d;
    --fg: #ecebe7;
    --shot-shadow: 0 2.5rem 5rem -2.5rem rgb(0 0 0 / 0.8);
    color-scheme: dark;
  }
}

@view-transition {
  navigation: auto;
}

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

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

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  max-width: 16ch;
  font-size: clamp(2.5rem, 1rem + 5.5vw, 5.5rem);
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.75rem, 1rem + 2.4vw, 3rem);
  letter-spacing: -0.035em;
}

p,
li,
dd,
dt {
  text-wrap: pretty;
}

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

::selection {
  background: var(--accent);
  color: white;
}

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

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.5rem 1rem;
  background: var(--fg);
  color: var(--bg);

  &:focus {
    top: 1rem;
  }
}

/* Small print: eyebrows, counts, the footer. */
.eyebrow,
.soon,
.numbers dt,
.back,
.site-footer {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
}

.lede {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.3rem);
  line-height: 1.5;
}

/* The way back to the owner's site: a line above the header, which scrolls away. */
.back {
  margin: 0;
  padding: 0.75rem max(var(--pad), (100% - var(--wide)) / 2) 0;
  color: var(--muted);

  & a {
    transition: color var(--fast) ease;

    &:hover {
      color: var(--fg);
    }
  }
}

/* Header: sticky and translucent, as in Davis. */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  /* The bar spans the window; what's in it keeps to the page's column. */
  padding-inline: max(var(--pad), (100% - var(--wide)) / 2);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  view-transition-name: site-header;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity var(--fast) ease;

  &:hover {
    opacity: 0.65;
  }
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.35rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9375rem;
  white-space: nowrap;
  transition:
    color var(--fast) ease,
    background-color var(--fast) ease,
    border-color var(--fast) ease;

  &:hover {
    color: var(--fg);
  }

  &[aria-current] {
    border-color: var(--line);
    background: var(--surface);
    color: var(--fg);
  }
}

@media (width < 30rem) {
  .site-nav a {
    padding-inline: 0.55rem;
    font-size: 0.875rem;
  }

  .site-nav ul {
    gap: 0;
  }

  /* Four links don't fit beside the name: the name itself goes to the overview. */
  .site-nav li:first-child {
    display: none;
  }
}

/* The page: one centred column, as wide as a screenshot at its own size. */

main,
.site-footer {
  max-width: calc(var(--wide) + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* "Coming soon": a pill with a dot that breathes. */
.soon {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.soon__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

.hero {
  padding-block: clamp(3.5rem, 2rem + 8vw, 9rem) clamp(2.5rem, 2rem + 3vw, 5rem);

  & h1 {
    margin-top: 1.75rem;
  }

  & .lede {
    margin-top: 1.75rem;
  }
}

/* Screenshots: always dark, with a hairline rim so they hold their edge on a dark page. */

.shot {
  margin: 0;

  & img {
    width: 100%;
    border-radius: 0.5rem;
    background: var(--shot);
    box-shadow:
      0 0 0 1px var(--shot-rim),
      var(--shot-shadow);
  }

  & figcaption {
    margin-top: 0.9rem;
    color: var(--muted);
    font-size: 0.8125rem;
  }
}

.shots {
  display: grid;
  gap: clamp(1.5rem, 1rem + 2vw, 3rem);
}

@media (width >= 48rem) {
  .shots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones stand three to a row, however narrow the screen. */
.phones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 13rem));
  justify-content: center;
  gap: clamp(0.75rem, 0.25rem + 2vw, 2rem);

  & img {
    border-radius: clamp(0.75rem, 0.25rem + 1.5vw, 1.5rem);
  }
}

@media (width >= 64rem) {
  .phones--many {
    grid-template-columns: repeat(6, minmax(0, 13rem));
  }
}

/* A workflow: each step is its screen, its number, its name and a line about it. */
.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem clamp(1rem, 0.5rem + 2vw, 3rem);
  margin-bottom: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;

  & li {
    counter-increment: step;
  }

  & .shot {
    max-width: 15rem;
  }

  & img {
    border-radius: clamp(0.75rem, 0.25rem + 1.5vw, 1.5rem);
  }

  & h3 {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 1.05rem;
    line-height: 1.3;
    letter-spacing: -0.015em;

    &::before {
      display: block;
      margin-bottom: 0.5rem;
      color: var(--accent);
      content: counter(step, decimal-leading-zero);
      font-size: 0.75rem;
      font-weight: 500;
      letter-spacing: 0.08em;
      font-variant-numeric: tabular-nums;
    }
  }

  & p {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
  }
}

@media (width >= 56rem) {
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Sections: a hairline, a small label, then a heading with its introduction beside it. */

.section {
  margin-top: clamp(4rem, 3rem + 5vw, 8rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);

  & > * + * {
    margin-top: clamp(2rem, 1.5rem + 2vw, 3.5rem);
  }
}

.section__head {
  display: grid;
  gap: 1.25rem clamp(2rem, 6vw, 6rem);

  & .eyebrow {
    margin-bottom: clamp(1rem, 0.5rem + 2vw, 2.5rem);
  }

  & h2 {
    max-width: 18ch;
  }
}

@media (width >= 56rem) {
  .section__head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    /* The heading's first line and the introduction's sit on one baseline. */
    align-items: baseline;

    & .eyebrow {
      grid-column: 1 / -1;
    }
  }
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 2.5rem clamp(1.5rem, 1rem + 2vw, 3rem);
  margin-bottom: 0;
  padding: 0;
  list-style: none;

  & li {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }

  & h3 {
    font-size: 1.05rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
  }

  & p {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
  }
}

/* On a wide screen each list takes the columns that leave no item alone on its last row. */
@media (width >= 72rem) {
  .features--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .features--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .features--5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Figures as Davis's statistics page sets them: a hairline, a large numeral, a small label. */
.numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 2rem clamp(1.5rem, 1rem + 2vw, 3rem);
  margin-bottom: 0;

  & div {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }

  & dd {
    margin: 0;
    font-size: clamp(2.5rem, 1.5rem + 3vw, 4rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
  }

  & dt {
    color: var(--muted);
  }
}

/* "See the site →": the arrow leans in on hover. */
.more {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  color: var(--muted);
  font-size: 0.9375rem;
  transition: color var(--fast) ease;

  &::after {
    content: "→";
    transition: translate var(--slow) var(--ease);
  }

  &:hover {
    color: var(--fg);

    &::after {
      translate: 0.25em 0;
    }
  }
}

.section > .more {
  display: flex;
  width: fit-content;
}

/* The last word on every page: it's coming soon. */
.closing {
  margin-top: clamp(4rem, 3rem + 5vw, 8rem);
  padding-block: clamp(3rem, 2rem + 5vw, 7rem);
  border-top: 1px solid var(--line);

  & h2 {
    max-width: 14ch;
    margin-top: 1.75rem;
    font-size: clamp(2.5rem, 1rem + 5.5vw, 5.5rem);
    letter-spacing: -0.04em;
  }

  & .lede {
    margin-top: 1.75rem;
  }
}

.closing__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

/* Who is making it: the maker's mark beside a line of small print. */
.maker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: clamp(2.5rem, 2rem + 2vw, 4rem) 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;

  & a {
    background: linear-gradient(currentColor 0 0) no-repeat 0 100% / 100% 1px;
    color: var(--fg);
    transition: color var(--fast) ease;

    &:hover {
      color: var(--accent);
    }
  }
}

.maker__logo {
  flex: none;
  width: 2rem;
  height: 2rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2rem 3rem;
  color: var(--muted);

  & p {
    margin: 0;
  }

  & a {
    transition: color var(--fast) ease;

    &:hover {
      color: var(--fg);
    }
  }
}

/* Motion, only for visitors who haven't asked for less. */
@media (prefers-reduced-motion: no-preference) {
  .soon__dot {
    animation: breathe 2.4s ease-out infinite;
  }

  /* Screenshots and lists rise into place as they scroll into view. */
  @supports (animation-timeline: view()) {
    .section .shot,
    .steps h3,
    .steps p,
    .features li,
    .numbers div {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

@keyframes breathe {
  from {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent);
  }

  70%,
  to {
    box-shadow: 0 0 0 0.5rem transparent;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 1.5rem;
  }
}
