/* rubyscope web page. One stylesheet for the landing page and the docs. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* A dark page, a little darker than the Tokyo Night screenshots, so they still stand out. */
  --paper: #0f1018;
  --paper-2: #1a1c29;
  --ink: #e4e7f2;
  --ink-2: #9aa1bd;
  --rule: #2c3046;
  /* The red of the app icon. */
  --ruby: #c2183d;
  --ruby-bright: #e8254a;
  /* The underline the app draws under a name you can click. */
  --link: #7aa2f7;
  /* Tokyo Night, the background of the screenshots. */
  --night: #1a1b26;
  --night-2: #16161e;
  --night-ink: #c0caf5;
  --night-blue: #7aa2f7;

  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* A modular scale of 1.25 on 18px. */
  --step--1: 0.889rem;
  --step-0: 1.125rem;
  --step-1: 1.406rem;
  --step-2: 1.758rem;
  --step-3: 2.197rem;
  --step-4: clamp(2.4rem, 1.6rem + 3.4vw, 4.6rem);

  --wrap: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 30px 60px -30px rgb(0 0 0 / 0.8),
    0 12px 24px -12px rgb(0 0 0 / 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "ss01";
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--ruby-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

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

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

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.86em;
}

code {
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--paper-2);
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.1em 0.45em 0.16em;
  border: 1px solid var(--rule);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.78em;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

pre {
  margin: 0 0 1.25em;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--night);
  color: var(--night-ink);
  line-height: 1.6;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

pre .c {
  color: #565f89;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

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

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #fff;
}

/* Header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid transparent;
  background: rgb(15 16 24 / 0.85);
  backdrop-filter: saturate(1.4) blur(10px);
}

.site-head.scrolled {
  border-bottom-color: var(--rule);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
  font-size: var(--step--1);
  font-weight: 550;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--link);
  text-decoration: underline;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.3rem;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--step--1);
  font-weight: 650;
  text-decoration: none;
  transition: background-color 120ms, color 120ms;
}

.button:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.button.primary {
  border-color: var(--ruby);
  background: var(--ruby);
  color: #fff;
}

.button.primary:hover {
  border-color: #9c1131;
  background: #9c1131;
}

/* Hero */

.hero {
  padding-block: clamp(3rem, 8vw, 6rem) 0;
}

.hero-text {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.5rem 4rem;
  align-items: end;
}

.hero h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.hero .lede {
  max-width: 34rem;
  margin: 0;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.45;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero .facts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: var(--step--1);
}

.hero .facts li::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.55em;
  transform: rotate(45deg) translateY(-0.12em);
  background: var(--ruby);
}

/* The demo: real screenshots with places to click */

.demo {
  margin-inline: 0;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.demo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.demo-tabs button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms, color 120ms, border-color 120ms;
}

.demo-tabs button:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}

.demo-tabs button[aria-pressed="true"] {
  border-color: var(--ruby);
  background: var(--ruby);
  color: #fff;
}

.demo-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid #0d0e14;
  border-radius: 12px;
  background: var(--night);
  box-shadow: var(--shadow);
}

.demo-frame img {
  width: 100%;
}

.demo-frame img[hidden] {
  display: none;
}

.spot {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgb(232 37 74 / 0.9);
  animation: spot 2.4s ease-in-out 1.2s 3;
}

.spot[hidden] {
  display: none;
}

.spot:hover,
.spot:focus-visible {
  outline: none;
  background: rgb(122 162 247 / 0.18);
  box-shadow: 0 0 0 2px var(--night-blue);
}

.spot .tip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: var(--ruby);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
}

.spot .tip::after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-right-color: var(--ruby);
}

@keyframes spot {
  50% {
    box-shadow: 0 0 0 6px rgb(232 37 74 / 0.25);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spot {
    animation: none;
  }
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: var(--step--1);
}

.demo-bar p {
  margin: 0;
}

.demo-bar strong {
  color: var(--ink);
}

.demo-reset {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* Sections */

.section {
  padding-block: clamp(4.5rem, 10vw, 8rem) 0;
}

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head h2 {
  font-size: var(--step-3);
}

.section-head p {
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.45;
}

/* A feature: the text on the left stays in view while its pictures scroll. */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 5vw, 5rem);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--rule);
}

.feature-text {
  align-self: start;
  position: sticky;
  top: 6rem;
}

.feature h3 {
  margin-bottom: 0.9rem;
  font-size: var(--step-2);
}

.feature-text p {
  color: var(--ink-2);
}

.feature-text ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-2);
  font-size: var(--step--1);
}

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

.shots {
  display: grid;
  gap: 1.25rem;
}

.shots.pair {
  grid-template-columns: 1fr 1fr;
}

.shot {
  margin: 0;
}

.shot img {
  width: 100%;
  border: 1px solid #0d0e14;
  border-radius: 10px;
  background: var(--night);
  box-shadow: var(--shadow);
}

.shot.narrow {
  max-width: 36rem;
}

.shot figcaption {
  margin-top: 0.7rem;
  color: var(--ink-2);
  font-size: var(--step--1);
}

/* The jump from one picture to the next, for "from here to there" pairs. */
.jump {
  position: relative;
}

.jump + .jump::before {
  content: "";
  position: absolute;
  left: 3rem;
  top: -1.25rem;
  width: 2px;
  height: 1.25rem;
  background: var(--ruby);
}

/* What a click understands */

.understands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 2px solid var(--ink);
}

.understands div {
  padding: 1.5rem 1.5rem 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.understands div:not(:nth-child(3n + 1)) {
  padding-left: 1.5rem;
  border-left: 1px solid var(--rule);
}

.understands dt {
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.understands dd {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--step--1);
}

/* Fast, and reads only */

.band {
  margin-top: clamp(4.5rem, 10vw, 8rem);
  padding-block: clamp(3.5rem, 8vw, 6rem);
  background: var(--night);
  color: var(--night-ink);
}

.band h2 {
  max-width: 20ch;
  color: #fff;
  font-size: var(--step-3);
}

.band .cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  margin-top: 3rem;
}

.band h3 {
  margin-bottom: 0.6rem;
  color: #fff;
  font-size: var(--step-1);
}

.band p {
  color: #a9b1d6;
  font-size: var(--step--1);
}

.band a {
  color: var(--night-blue);
}

.band code {
  background: #24283b;
  color: var(--night-ink);
}

/* Install */

.install {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}

.install h3 {
  margin-bottom: 0.75rem;
  font-size: var(--step-1);
}

.install p {
  color: var(--ink-2);
  font-size: var(--step--1);
}

/* Footer */

.site-foot {
  margin-top: clamp(5rem, 10vw, 8rem);
  padding-block: 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: var(--step--1);
}

.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}

.site-foot p {
  margin: 0;
}

.site-foot nav {
  display: flex;
  gap: 1.5rem;
}

/* Docs */

.docs {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

.toc {
  align-self: start;
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  font-size: var(--step--1);
}

.toc p {
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-2);
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
}

.toc a.current {
  border-left-color: var(--ruby);
  color: var(--ink);
  font-weight: 600;
}

.doc {
  max-width: 48rem;
}

.doc h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.doc .lede {
  margin-top: 1.25rem;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.45;
}

.doc section {
  padding-top: 3.5rem;
}

.doc h2 {
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--ink);
  font-size: var(--step-2);
}

.doc h3 {
  margin: 2rem 0 0.75rem;
  font-size: var(--step-1);
}

.doc ul,
.doc ol {
  padding-left: 1.25rem;
}

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

.doc .shot {
  margin: 1.5rem 0 2rem;
}

.note {
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--ruby);
  background: var(--paper-2);
  font-size: var(--step--1);
}

.note p:last-child {
  margin-bottom: 0;
}

table {
  width: 100%;
  margin: 0 0 1.5rem;
  border-collapse: collapse;
  font-size: var(--step--1);
}

caption {
  margin-bottom: 0.5rem;
  color: var(--ink-2);
  text-align: left;
}

th,
td {
  padding: 0.65rem 1rem 0.65rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
}

td:first-child {
  white-space: nowrap;
}

td.wrap-ok {
  white-space: normal;
}

/* Small screens */

@media (max-width: 960px) {
  .hero-text,
  .feature,
  .docs {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature-text,
  .toc {
    position: static;
    max-height: none;
  }

  .understands,
  .band .cols {
    grid-template-columns: 1fr 1fr;
  }

  .understands div:not(:nth-child(3n + 1)) {
    padding-left: 0;
    border-left: 0;
  }

  .understands div:nth-child(even) {
    padding-left: 1.5rem;
    border-left: 1px solid var(--rule);
  }

  .toc ol {
    columns: 2;
  }
}

@media (max-width: 640px) {
  .site-nav {
    gap: 1.1rem;
  }

  .site-nav .wide {
    display: none;
  }

  .shots.pair,
  .understands,
  .band .cols,
  .install {
    grid-template-columns: minmax(0, 1fr);
  }

  .understands div:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }

  .spot .tip {
    display: none;
  }

  td:first-child {
    white-space: normal;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
