/* STQRY training: lessons, course and product pages.
   Brand guidelines v4 (April 2023): navy for type and chrome, one sub-brand
   colour per product as the accent, backgrounds no stronger than a 40% tint.
   Tiempos Fine for headlines, Mier B for everything else. */

@font-face { font-family: "Tiempos Fine"; src: url("../fonts/tiempos-fine-web-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Mier B"; src: url("../fonts/mierb-book.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mier B"; src: url("../fonts/mierb-bookitalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Mier B"; src: url("../fonts/mierb-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #24125F;
  --navy-70: color-mix(in srgb, var(--navy) 70%, white);
  --navy-10: color-mix(in srgb, var(--navy) 10%, white);
  --accent: var(--navy);               /* set per product on <body> */
  --paper: #FFFFFF;
  --serif: "Tiempos Fine", Georgia, serif;
  --sans: "Mier B", system-ui, sans-serif;
  --measure: 42rem;
}

/* Tints are worked out wherever --accent is set, not once on :root, or they
   would all be tints of navy. */
:root, [style*="--accent"] {
  --accent-40: color-mix(in srgb, var(--accent) 40%, white);
  --accent-12: color-mix(in srgb, var(--accent) 12%, white);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--navy); font: 400 1.0625rem/1.6 var(--sans); }
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--navy); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }
p, ul, ol, table { margin: 0 0 1em; }

/* Top bar: logo and where you are. */
.bar { display: flex; align-items: center; gap: 1.25rem; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--navy-10); }
.bar img { height: 1.6rem; width: auto; display: block; }
.crumbs { font-size: 0.9rem; color: var(--navy-70); }
.crumbs a { color: inherit; }

/* The one bold thing: a band in the product's colour with the Q cropped
   off its right edge, as the guidelines use the Q as a holding device. */
.band { position: relative; overflow: hidden; background: var(--accent); color: var(--paper); padding: clamp(2.5rem, 7vw, 5rem) clamp(1rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem); }
.band::after {
  content: ""; position: absolute; right: -6rem; top: -3rem; width: 26rem; height: 30rem;
  background: var(--paper); opacity: 0.16;
  -webkit-mask: url("../img/q.png") center / contain no-repeat; mask: url("../img/q.png") center / contain no-repeat;
}
.band > * { position: relative; z-index: 1; max-width: var(--measure); }
.band h1 { margin-bottom: 0.3em; }
.band p { font-size: 1.15rem; margin: 0; }
.band a { color: inherit; text-decoration-color: currentColor; }
.band .button { color: var(--navy); text-decoration: none; }
.band .button.secondary { color: inherit; }
.band .meta { margin-top: 1rem; font-size: 0.95rem; opacity: 0.85; }
/* Yellow and the lighter accents need navy type to stay readable. */
.on-light .band { color: var(--navy); }
.on-light .band::after { background: var(--navy); opacity: 0.1; }

main { padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 3rem) 4rem; }
.column { max-width: var(--measure); }

/* Objectives open every lesson and course. */
.objectives { border-left: 4px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; margin: 0 0 2.5rem; }
.objectives h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.objectives ul { margin: 0; padding-left: 1.1rem; }

/* A slide as it appears on screen, then its notes as prose. */
.slide { border: 1px solid var(--accent-40); background: var(--accent-12); border-radius: 6px; padding: 1.5rem 1.75rem 0.75rem; margin: 2.5rem 0 1.25rem; }
.slide h1, .slide h2 { font-size: 1.6rem; }
.slide img { border-radius: 4px; margin-bottom: 1em; }
.slide + .notes { margin-bottom: 1rem; }
.notes { font-size: 1.0625rem; }

/* Lists of things you can open: products, courses, lessons. */
.list { max-width: 52rem; list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.list a { display: block; text-decoration: none; padding: 1.1rem 1.25rem; border: 1px solid var(--navy-10); border-left: 6px solid var(--accent); border-radius: 6px; }
.list a:hover { border-color: var(--accent-40); border-left-color: var(--accent); background: var(--accent-12); }
.list .title { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; display: block; margin-bottom: 0.2rem; }
.list .sub { color: var(--navy-70); font-size: 0.95rem; }
.list .product { --accent: inherit; }
ol.list { counter-reset: lesson; }
ol.list a .title::before { counter-increment: lesson; content: counter(lesson) ". "; color: var(--navy-70); }

/* Callouts: > [!NOTE] and friends. */
.markdown-alert { border-left: 4px solid var(--accent); background: var(--navy-10); border-radius: 0 6px 6px 0; padding: 0.9rem 1.1rem 0.1rem; margin: 0 0 1.25rem; }
.markdown-alert-title { font-weight: 700; margin-bottom: 0.3rem; }
.markdown-alert-warning, .markdown-alert-caution { border-left-color: #FF8200; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--navy-10); vertical-align: top; }
th { font-weight: 700; }
code { font-size: 0.92em; background: var(--navy-10); padding: 0.1em 0.3em; border-radius: 3px; }
pre { background: var(--navy-10); padding: 1rem; border-radius: 6px; overflow-x: auto; }
pre code { background: none; padding: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0; }
.button { display: inline-block; font-weight: 700; text-decoration: none; padding: 0.6rem 1.1rem; border-radius: 999px; background: var(--paper); color: var(--navy); }
.button.secondary { background: transparent; box-shadow: inset 0 0 0 2px currentColor; color: inherit; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--navy-10); }
.pager a { max-width: 48%; }
.pager .next { margin-left: auto; text-align: right; }

footer { padding: 2rem clamp(1rem, 4vw, 3rem); color: var(--navy-70); font-size: 0.9rem; border-top: 1px solid var(--navy-10); }

/* `rake training:serve` writes build errors here. */
.build-error { position: fixed; inset: auto 1rem 1rem 1rem; z-index: 99; background: #B0008E; color: #fff; padding: 1rem 1.25rem; border-radius: 6px; font: 0.95rem/1.4 var(--sans); white-space: pre-wrap; }

@media (prefers-reduced-motion: no-preference) {
  .list a { transition: background-color 120ms ease; }
}
@media print {
  .bar, .actions, .pager, footer { display: none; }
  .band { background: none; color: var(--navy); padding: 0 0 1rem; }
  .band::after { display: none; }
}

/* Diagrams are inline SVG, drawn on a 1600-wide canvas. */
svg.diagram { display: block; width: 100%; height: auto; margin: 0 0 1em; font-family: var(--sans); }
svg.diagram .label { font-family: var(--sans); fill: var(--navy); }
svg.diagram .title { font-family: var(--serif); font-weight: 700; fill: var(--navy); }
svg.diagram .accent { fill: var(--accent); }
svg.diagram .accent-line { stroke: var(--accent); }
svg.diagram .tint { fill: var(--accent-12); }
svg.diagram .navy { fill: var(--navy); }
svg.diagram .on-dark { fill: #fff; }

/* Big figures read as a row on the lesson page too. */
.slide.layout-numbers ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; }
.slide.layout-numbers li { border-top: 4px solid var(--accent); padding-top: 0.6rem; }
.slide.layout-numbers li strong { display: block; font-family: var(--serif); font-size: 2.6rem; line-height: 1; margin-bottom: 0.3rem; }
.slide.layout-statement h1, .slide.layout-statement h2 { font-size: 2rem; }
