/* T1 site style. The tokens and components are described in docs/design/t1-website.md ("Visual style"). */

:root {
  --ink: #14202e;
  --ink-muted: #4b5866;
  --paper: #ffffff;
  --surface: #f3f5f7;
  --rule: #d4dae0;
  --field-border: #6b7785;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #e3f1ef;
  --on-ink: #ffffff;
  --on-ink-muted: #c3ccd5;
  --on-ink-rule: #2c3a4a;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;

  --page: 68rem;
  --measure: 40rem;
  --radius: 0.375rem;
}

/* Base */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  /* Keep the footer at the bottom of the window on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
  max-width: 22ch;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
}

h3 {
  font-size: 1.1875rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.slides:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.prose {
  max-width: var(--measure);
}

.lead {
  font-size: 1.25rem;
  color: var(--ink-muted);
  max-width: var(--measure);
}

/* A short technical label above a heading or on a card */
.label {
  display: inline-block;
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--accent-dark);
}

.tag {
  display: inline-block;
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-dark);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

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

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.site-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* On a phone the navigation takes its own row under the name and button */
@media (max-width: 47.99rem) {
  .site-nav {
    order: 3;
    flex-basis: 100%;
  }
}

@media (min-width: 48rem) {
  .site-nav {
    margin-left: auto;
  }
}

/* Buttons: a raised step that lifts a level on hover and drops flat when pressed */

.button,
button {
  display: inline-block;
  padding: 0.6875rem 1.125rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--accent);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out, background-color 120ms ease-out;
}

/* The step mark: three bars rising, after the label */
.button::after,
button::after {
  content: "";
  display: inline-block;
  width: 0.875em;
  height: 0.75em;
  margin-left: 0.625em;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 0.2em 34% no-repeat,
    linear-gradient(currentColor, currentColor) 50% 100% / 0.2em 67% no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 0.2em 100% no-repeat;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
  color: var(--paper);
}

/* Only where there's a pointer, so a tapped button on a phone doesn't stay lifted */
@media (hover: hover) {
  .button:hover,
  button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
  }
}

.button:active,
button:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

.button:focus-visible,
button:focus-visible {
  outline-offset: 4px;
}

.button-secondary {
  background: var(--paper);
  color: var(--ink);
}

.button-secondary:hover {
  background: var(--surface);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .button,
  button {
    transition: none;
  }

  .button:hover,
  button:hover,
  .button:active,
  button:active {
    transform: none;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}

/* Page sections */

main {
  display: block;
  flex: 1 0 auto;
}

.section {
  padding: var(--space-6) 0;
}

.section + .section {
  border-top: 1px solid var(--rule);
}

.section-band {
  background: var(--surface);
}

.section + .section-band,
.section-band + .section {
  border-top: 0;
}

.hero {
  padding: var(--space-6) 0;
}

@media (min-width: 48rem) {
  .hero {
    padding: var(--space-7) 0 var(--space-6);
  }

  .section {
    padding: var(--space-7) 0;
  }
}

/* Cards: a grid of service areas or case studies */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
}

.card h3 {
  margin-bottom: var(--space-2);
}

.card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.card h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

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

/* Result: the working result a customer gets */

.result {
  padding: var(--space-5) var(--space-4);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
}

.result p {
  color: var(--on-ink-muted);
  max-width: var(--measure);
}

.result .label {
  color: var(--on-ink-muted);
}

@media (min-width: 48rem) {
  .result {
    padding: var(--space-6);
  }
}

/* A list of what's done, each with a tick */

.checks {
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: var(--space-2);
}

.checks li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--accent);
}

.result .checks li::before {
  color: var(--on-ink);
}

/* Case study: problem, what was built, result */

.case {
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}

.case dl {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
}

.case dt {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-dark);
}

.case dd {
  margin: 0;
}

@media (min-width: 48rem) {
  .case dl {
    grid-template-columns: 10rem 1fr;
    gap: var(--space-3) var(--space-4);
  }
}

/* Images and video: a fixed shape frame with a caption under it */

.media {
  margin: 0 0 var(--space-4);
}

.media-frame {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule);
  background: var(--surface);
  overflow: hidden;
}

.media-square .media-frame {
  aspect-ratio: 1 / 1;
}

/* Shown whole, so a screenshot or video that isn't the frame's shape loses nothing */
.media-frame img,
.media-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* A photo cut to fill the frame */
.media-fill img {
  object-fit: cover;
}

.media figcaption {
  margin-top: var(--space-2);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

/* Text and an image side by side on a desktop */
@media (min-width: 48rem) {
  .media-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    align-items: center;
  }
}

/* Style reference page only: stands in for an image until one is approved */
.placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.placeholder-video::before {
  content: "";
  width: 0;
  height: 0;
  margin-bottom: var(--space-2);
  border-style: solid;
  border-width: 0.75rem 0 0.75rem 1.25rem;
  border-color: transparent transparent transparent var(--ink-muted);
}

.placeholder-video {
  align-content: center;
}

/* Slide show: slides scroll sideways and snap into place, with numbered links to each */

.slides {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0 0 var(--space-2);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

/* Narrower than the row, so the next slide shows at the edge */
.slide {
  flex: 0 0 88%;
  scroll-snap-align: start;
}

.slide .media {
  margin: 0;
}

.slide-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.slide-links a {
  display: inline-block;
  min-width: 2.25rem;
  padding: 0.375rem var(--space-2);
  border: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
}

.slide-links a:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

/* Questions and answers */

.qa {
  max-width: var(--measure);
}

.qa dt {
  font-weight: 700;
  margin-top: var(--space-4);
}

.qa dt:first-child {
  margin-top: 0;
}

.qa dd {
  margin: var(--space-1) 0 0;
}

/* Enquiry prompt at the end of a content page */

.prompt {
  padding: var(--space-6) 0;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}

.prompt h2 {
  max-width: 28ch;
}

.prompt p {
  max-width: var(--measure);
}

/* Form */

form {
  max-width: 36rem;
  margin-top: var(--space-4);
}

.field {
  margin: 0 0 var(--space-4);
}

label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--ink-muted);
}

input,
textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.hidden {
  position: absolute;
  left: -10000px;
}

/* Footer */

.site-footer {
  padding: var(--space-6) 0 var(--space-5);
  background: var(--ink);
  color: var(--on-ink-muted);
  font-size: 0.9375rem;
}

.site-footer a {
  color: var(--on-ink);
}

.site-footer a:hover {
  color: var(--on-ink);
  text-decoration-thickness: 2px;
}

.site-footer a:focus-visible {
  outline-color: var(--on-ink);
}

.site-footer .wordmark {
  color: var(--on-ink);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-5);
}

.footer-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-grid li {
  margin-bottom: var(--space-2);
}

.footer-heading {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--on-ink-muted);
}

.footer-base {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--on-ink-rule);
}

.footer-base p {
  margin: 0;
}

/* Style reference page only: a frame round each sample */

.sample {
  margin: var(--space-3) 0 var(--space-5);
  border: 1px dashed var(--field-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-3);
  padding: 0;
  list-style: none;
}

.swatch {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.swatch span {
  display: block;
  height: 3.5rem;
}

.swatch code {
  display: block;
  padding: var(--space-2);
}
