/* The public website. Its look is taken from the product: the page is laid out with UML's own
   shapes (a class box, packages, notes), in the colours and with the shadow the editor gives them.
   One family of type, one set of icons, square corners, no script. See docs/DECISIONS.md, D117. */

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113;
}

@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ibm-plex-sans-condensed-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2');
}

/* Six colours, each with one job. The blue, the grey and the two yellows are the ones the editor
   gives classes, packages, states and notes. */
:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --sheet: #f4f6fa;
  --ink: #14181f;
  --graphite: #4a5462;
  --rule: #c9d1de;
  /* A class: outline, name band, body. */
  --class-line: #3d5a99;
  --class-band: #dce8ff;
  --class-body: #f6f9ff;
  /* A package. */
  --package-line: #55627a;
  --package-body: #eff2f7;
  /* A state: the one colour that means "press here". */
  --act: #ffd983;
  --act-line: #946200;
  /* A note. */
  --note: #fff8cc;
  --note-line: #8f7b1f;
  --yes: #1b6e3c;
  --no: #a32020;
  --warn-bg: #fff4d6;
  --warn-line: #b7791f;
  /* The editor's shadow: two faint copies of the outline, each a little lower. No blur. */
  --drop: 0 1px 0 rgb(30 41 59 / 12%), 1px 3px 0 rgb(30 41 59 / 7%);
  --dots: #d5dbe5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14171d;
    --sheet: #1a1e26;
    --ink: #eef1f5;
    --graphite: #a9b2bf;
    --rule: #333b48;
    --class-line: #a9bbe0;
    --class-band: #36405a;
    --class-body: #262d3d;
    --package-line: #b3bac6;
    --package-body: #262b34;
    --act: #ffd983;
    --act-line: #ffd983;
    --note: #3b3620;
    --note-line: #cbbc6e;
    --yes: #6fd39a;
    --no: #f08a8a;
    --warn-bg: #3a2d0b;
    --warn-line: #e0b252;
    --drop: none;
    --dots: #262c37;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  font:
    17px/1.55 'IBM Plex Sans',
    Arial,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.wrap {
  width: min(1160px, 100% - 48px);
  margin: 0 auto;
}

.wrap.narrow {
  width: min(760px, 100% - 48px);
}

a {
  color: var(--class-line);
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: 'IBM Plex Sans Condensed', 'Arial Narrow', Arial, sans-serif;
  font-weight: 600;
  line-height: 1.05;
  text-wrap: balance;
}

h1 {
  max-width: 14em;
  font-size: clamp(42px, 7.2vw, 88px);
}

h2 {
  max-width: 16em;
  margin-bottom: 20px;
  font-size: clamp(30px, 4vw, 46px);
}

h3 {
  font-size: 22px;
}

p {
  max-width: 34em;
  margin: 0 0 1em;
}

code,
pre,
.mono-line,
.slots {
  font-family: 'IBM Plex Mono', Consolas, monospace;
}

code {
  overflow-wrap: anywhere;
}

pre {
  padding: 14px 16px;
  margin: 0 0 1em;
  overflow-x: auto;
  font-size: 15px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

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

.skip:focus {
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 8px 12px;
  background: var(--paper);
}

.lead {
  margin: 28px 0 0;
  font-size: 21px;
  color: var(--graphite);
}

.small {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--graphite);
}

/* Top and bottom bars */

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.bar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  align-items: center;
}

.bar nav a:not(.button) {
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
}

.bar nav a:not(.button):hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-family: 'IBM Plex Sans Condensed', Arial, sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.bottom {
  font-size: 15px;
  color: var(--graphite);
  border-top: 1px solid var(--rule);
}

/* One kind of button, in the colour the editor gives a state. */

.button {
  display: inline-block;
  padding: 8px 16px;
  font-weight: 600;
  color: #14181f;
  text-decoration: none;
  background: var(--act);
  border: 1px solid var(--act-line);
  box-shadow: var(--drop);
}

.button:hover {
  background: #ffe7a8;
}

.button:active {
  box-shadow: none;
  transform: translateY(1px);
}

.button.big {
  padding: 13px 26px;
  font-size: 18px;
}

/* A link that says where it goes, underlined like a link. */
.plain {
  font-weight: 600;
  color: var(--ink);
  text-underline-offset: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  max-width: none;
  margin: 36px 0 0;
}

/* The top of the start page: a sentence, then the editor itself. */

.hero {
  position: relative;
  padding: 80px 0 0;
  overflow: clip;
  border-bottom: 1px solid var(--rule);
}

/* The editor's dotted canvas, behind everything. */
.hero::before {
  position: absolute;
  inset: -160px 0 0;
  z-index: -1;
  content: '';
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px);
  background-size: 24px 24px;
}

.plain-hero {
  padding-bottom: 72px;
}

.shot {
  width: min(1280px, 100% - 48px);
  margin: 56px auto -4px;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-bottom: 0;
  box-shadow: 0 0 0 6px rgb(30 41 59 / 5%);
}

/* Sections. They are not all the same height or shape on purpose: each holds a different kind of thing. */

.band {
  padding: 104px 0;
}

.band.tinted {
  background: var(--sheet);
  border-block: 1px solid var(--rule);
}

.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 48px 72px;
  align-items: start;
}

@media (min-width: 980px) {
  .pair.wide-right {
    grid-template-columns: 5fr 7fr;
    align-items: center;
  }
}

.mono-line {
  display: inline-block;
  max-width: 100%;
  padding: 10px 14px;
  margin: 8px 0 20px;
  font-size: 18px;
  overflow-wrap: anywhere;
  background: var(--paper);
  border: 1px solid var(--ink);
}

/* A UML class, as the editor draws it: a name band, then compartments. */

.classifier {
  background: var(--class-body);
  border: 1.5px solid var(--class-line);
  box-shadow: var(--drop);
}

.classifier .name {
  padding: 14px 18px;
  text-align: center;
  background: var(--class-band);
}

.classifier .name p {
  max-width: none;
  margin: 0 0 2px;
  font-size: 15px;
}

.classifier .name h2,
.classifier .name h3 {
  max-width: none;
  margin: 0;
  font-size: 28px;
}

/* An object, not a class: its name is underlined. */
.classifier.object .name h3 {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.slots {
  padding: 14px 18px;
  margin: 0;
  font-size: 16px;
  list-style: none;
  border-top: 1.5px solid var(--class-line);
}

.slots li {
  padding: 3px 0;
  overflow-wrap: anywhere;
}

/* What the product does: an icon, a few words, one line. A list, not a wall of boxes. */

.ops {
  display: grid;
  gap: 22px;
  margin: 0;
}

.ops div {
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 16px;
}

.ops .icon {
  grid-row: span 2;
  margin-top: 2px;
}

.ops dt {
  font-family: 'IBM Plex Sans Condensed', Arial, sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.ops dd {
  max-width: 32em;
  margin: 2px 0 0;
  color: var(--graphite);
}

/* Material Symbols: filled shapes that take the colour of the text. */
.icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  vertical-align: -7px;
  fill: currentcolor;
}

/* Diagrams drawn by the app. */

.figure {
  margin: 0;
}

.figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 480px;
}

.tinted .figure,
.depth .figure {
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.tinted .figure img {
  margin: 0 auto;
}

/* Two drawings, one large and one small, overlapping a little. */
.depth {
  display: grid;
  grid-template-columns: 7fr 4fr;
  gap: 28px;
  align-items: start;
  margin: 36px 0 120px;
}

.depth .figure:last-child {
  margin-top: 56px;
}

.depth .figure img {
  margin: 0 auto;
}

/* UML packages: a tab with the name, then the contents. */

.packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 36px;
}

.package h3 {
  display: inline-block;
  padding: 6px 16px;
  margin-bottom: -1.5px;
  font-size: 20px;
  background: var(--package-body);
  border: 1.5px solid var(--package-line);
  border-bottom: 0;
}

.package ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 20px;
  padding: 18px;
  margin: 0;
  list-style: none;
  background: var(--package-body);
  border: 1.5px solid var(--package-line);
  box-shadow: var(--drop);
}

/* UML notes: the corner is folded. */

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 20px;
  align-items: start;
  margin-top: 28px;
}

.notes details {
  padding: 0 18px;
  background: var(--note);
  border: 1px solid var(--note-line);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

summary {
  padding: 14px 0;
  font-weight: 600;
  cursor: pointer;
}

details p,
details pre {
  margin-bottom: 14px;
}

.plain-steps {
  padding-left: 1.2em;
  margin: 0;
}

.plain-steps li {
  padding-left: 6px;
  margin-bottom: 12px;
}

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

.marks li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.marks .icon {
  flex: none;
  color: var(--yes);
  vertical-align: 0;
}

.marks.no .icon {
  color: var(--no);
}

/* Text pages */

.prose {
  max-width: 780px;
}

.prose h1 {
  font-size: clamp(36px, 5vw, 56px);
}

.prose h2 {
  margin: 1.8em 0 0.4em;
  font-size: 28px;
}

.prose h3 {
  margin: 1.4em 0 0.3em;
}

.prose p {
  max-width: none;
}

.prose .ops {
  margin: 28px 0;
}

.prose li {
  margin-bottom: 8px;
}

table {
  width: 100%;
  margin: 0 0 1em;
  font-size: 15px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--rule);
}

th {
  background: var(--sheet);
}

/* Shown on the legal pages until the operator's details are filled in. */
.incomplete {
  padding: 14px 18px;
  font-weight: 600;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
}

/* Depth while scrolling, where the browser can do it without script and the visitor has not asked
   for less motion: the canvas dots fall behind, the editor comes up to meet the reader, and the two
   drawings pass each other. Three effects, and no others. Only `transform` moves. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero::before {
      animation: fall-behind linear both;
      animation-timeline: scroll(root);
      animation-range: 0 120vh;
    }

    .shot {
      animation: come-up linear both;
      animation-timeline: scroll(root);
      animation-range: 0 80vh;
    }

    .depth .figure:first-child {
      animation: pass-slow linear both;
      animation-timeline: view();
    }

    .depth .figure:last-child {
      animation: pass-fast linear both;
      animation-timeline: view();
    }
  }
}

@keyframes fall-behind {
  to {
    transform: translateY(150px);
  }
}

@keyframes come-up {
  from {
    transform: translateY(72px);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes pass-slow {
  from {
    transform: translateY(28px);
  }

  to {
    transform: translateY(-28px);
  }
}

@keyframes pass-fast {
  from {
    transform: translateY(72px);
  }

  to {
    transform: translateY(-72px);
  }
}

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

@media (max-width: 700px) {
  .hero {
    padding-top: 56px;
  }

  .band {
    padding: 64px 0;
  }

  .shot {
    margin-top: 48px;
  }

  .depth {
    grid-template-columns: 1fr;
  }

  .depth .figure:last-child {
    margin-top: 0;
  }

  .prose table,
  .prose thead,
  .prose tbody,
  .prose tr,
  .prose th,
  .prose td {
    display: block;
  }

  .prose thead {
    position: absolute;
    left: -9999px;
  }

  .prose tr {
    margin-bottom: 14px;
  }
}
