/* The look of every page on kcb.dev. */

@font-face {
  font-family: "Albert Sans";
  src: url("/assets/fonts/albert-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #050505;
  --paper: #f5f5f5;
  /* Dark enough to read at small sizes on the paper colour: 4.7 to 1. */
  --grey: #6e6e6e;
  --grey-on-ink: #8c8c8c;
  --line: rgba(5, 5, 5, .12);
  --line-on-ink: rgba(245, 245, 245, .16);

  --small: 15px;
  --text: 17px;
  --lead: 19px;
  --prose: clamp(19px, 1.5vw, 22px);
  --sub: clamp(24px, 2.4vw, 34px);
  --statement: clamp(26px, 3.25vw, 46px);
  --title: clamp(38px, 5.4vw, 80px);
  --name: clamp(40px, 6.2vw, 92px);
  --huge: clamp(50px, 9.6vw, 140px);

  --gutter: 28px;
  --gap: 24px;
  --row: 26px 0 34px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --section: clamp(72px, 10vw, 150px);
}

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

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

body {
  font-family: "Albert Sans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: var(--text);
  line-height: 1.3;
  letter-spacing: -.02em;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-weight: 400;
}

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

ul {
  list-style: none;
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.grey {
  color: var(--grey);
}

.label {
  font-size: var(--small);
  line-height: 1.3;
  letter-spacing: -.02em;
  color: var(--grey);
}

.lead {
  font-size: var(--lead);
  line-height: 1.3;
  text-wrap: balance;
}

.huge {
  font-size: var(--huge);
  line-height: .9;
  letter-spacing: -.045em;
}

.name {
  font-size: var(--name);
  line-height: .92;
  letter-spacing: -.045em;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--gap);
}

.section {
  margin-top: var(--section);
}

.link {
  display: inline-block;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.link:hover,
.link:focus-visible {
  color: var(--grey);
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 22px 0;
  font-size: var(--small);
}

.bar > :nth-child(2) {
  text-align: center;
}

.bar > :nth-child(3) {
  text-align: right;
}

.bar a:hover,
.bar a:focus-visible {
  color: var(--grey);
}

.headline {
  margin-top: clamp(56px, 9vw, 132px);
}

.headline > span {
  display: block;
  text-wrap: balance;
}

.slice {
  position: relative;
  display: inline-block;
  margin-right: .06em;
}

.slice-top {
  display: block;
  clip-path: inset(-10% -20% 47% -20%);
}

/* The lower half is drawn from data-text, so the word is in the page once. */
.slice::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  clip-path: inset(53% -20% -20% -20%);
  transform: translateX(.13em);
}

/* With the script running, the word starts whole and slips once the page is ready. */
.js .slice::after {
  transform: none;
  transition: transform .7s var(--ease);
}

.js.is-broken .slice::after {
  transform: translateX(.13em);
}

.link,
.bar a,
.foot a,
.prose a,
.entry-title,
.entry-nav a {
  transition: color .2s var(--ease);
}

.email {
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .js .slice::after,
  .link,
  .bar a,
  .foot a,
  .prose a,
  .entry-title,
  .entry-nav a,
  .email {
    transition: none;
  }
}

.photo {
  margin-top: clamp(28px, 4vw, 56px);
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding-top: 12px;
  font-size: var(--small);
}

.statement,
.entry-title {
  font-size: var(--statement);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.statement + .statement {
  margin-top: .55em;
}

.logos {
  margin-top: clamp(48px, 6vw, 88px);
  padding: 30px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}

.logos ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px clamp(36px, 6vw, 96px);
}

.logos li {
  flex: none;
}

.logos svg {
  display: block;
  width: auto;
  fill: currentColor;
  overflow: visible;
}

.logo-google svg {
  height: 30px;
}

.logo-avalara svg {
  height: 21px;
}

.logo-salesforce svg {
  height: 44px;
}

.logo-immersive svg {
  height: 22px;
}

.logo-softcat svg {
  height: 20px;
}

/* Lines are drawn only between two rows, never above the first or under the last. */

.service + .service,
.entries li + li .entry,
.promises li + li {
  border-top: 1px solid var(--line);
}

.work + .work {
  border-top: 1px solid var(--line-on-ink);
}

.service,
.entry {
  padding: var(--row);
  align-items: start;
}

.service .lead {
  max-width: 33em;
  padding-top: 8px;
}

.service .label {
  padding-top: 12px;
}

.promises li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
  gap: var(--gap);
  padding: 14px 0;
  font-size: var(--lead);
  text-wrap: balance;
}

.own {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(56px, 8vw, 120px) 0;
}

.own .label {
  color: var(--grey-on-ink);
  padding-bottom: 26px;
}

.work {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--row);
  align-items: start;
}

.work .lead {
  max-width: 23em;
  padding-top: 8px;
  text-wrap: balance;
}

.work .link {
  margin-top: 18px;
}

.own .link:hover,
.own .link:focus-visible {
  color: var(--grey-on-ink);
}

.contact .lead {
  padding-top: 22px;
}

.email {
  display: inline-block;
  margin-top: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--sub);
  line-height: 1.1;
  letter-spacing: -.03em;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.email:hover,
.email:focus-visible {
  color: var(--grey);
  border-bottom-color: currentColor;
}

.email-hint {
  padding-top: 10px;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 16px;
  white-space: nowrap;
  margin-top: var(--section);
  padding: 22px 0 26px;
  border-top: 1px solid var(--line);
  font-size: var(--small);
  color: var(--grey);
}

.foot a:hover,
.foot a:focus-visible {
  color: var(--ink);
}

.journal-head {
  margin-top: clamp(56px, 9vw, 132px);
}

.journal-head .statement {
  max-width: 21em;
  margin-top: .6em;
}

.journal-head .lead {
  margin-top: clamp(28px, 3vw, 44px);
}

/* A short page fills the window, with the foot at the bottom. */
.fill .wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.fill main {
  flex: 1;
}

.entries {
  margin-top: clamp(48px, 6vw, 88px);
}

.entry .label {
  padding-top: 10px;
}

.entry .lead {
  max-width: 33em;
  padding-top: 10px;
  text-wrap: balance;
}

.entry:hover .entry-title,
.entry:focus-visible .entry-title {
  color: var(--grey);
}

.post-head {
  margin-top: clamp(56px, 9vw, 132px);
  align-items: start;
}

.post-head .label {
  padding-top: 10px;
}

.title {
  font-size: var(--title);
  line-height: .95;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.post-body {
  margin-top: clamp(36px, 5vw, 72px);
  padding-top: 26px;
  border-top: 1px solid var(--line);
  align-items: start;
}

.prose {
  max-width: 32em;
  font-size: var(--prose);
  line-height: 1.45;
  letter-spacing: -.015em;
}

.prose p + p {
  margin-top: 1em;
}

.prose p {
  text-wrap: pretty;
}

.prose a {
  border-bottom: 1px solid currentColor;
}

.prose a:hover,
.prose a:focus-visible {
  color: var(--grey);
}

.entry-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  margin-top: clamp(48px, 6vw, 88px);
}

.entry-nav a {
  display: block;
  max-width: 20em;
}

.entry-nav-next {
  margin-left: auto;
  text-align: right;
}

.entry-nav-title {
  display: block;
  padding-top: 4px;
  font-size: var(--lead);
  line-height: 1.2;
}

.entry-nav a:hover,
.entry-nav a:focus-visible {
  color: var(--grey);
}

@media (max-width: 760px) {
  :root {
    --gutter: 18px;
    --section: 56px;
  }

  /* The headline's two sentences stay one line each: the size follows the screen's width. */
  /* A little more room between the two lines, so the tall letters of the second clear the tails of the first. */
  .headline {
    font-size: min(var(--huge), calc((100vw - 2 * var(--gutter)) / 7.7));
    line-height: 1;
  }

  .logos {
    padding-bottom: 6px;
  }

  .logos ul {
    gap: 24px clamp(20px, 7vw, 36px);
  }

  .bar {
    grid-template-columns: 1fr auto;
  }

  .bar > :nth-child(2) {
    display: none;
  }

  .split,
  .work {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .promises li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .post-body {
    gap: 20px;
  }

  .entry-nav {
    flex-direction: column;
    gap: 22px;
  }

  .entry-nav-next {
    margin-left: 0;
    text-align: left;
  }

  .photo figcaption .grey {
    display: none;
  }

  /* Taps: an invisible 44px target around each small link, with nothing moved. */
  .bar a,
  .foot a,
  .link,
  .email {
    position: relative;
  }

  .bar a:first-child {
    justify-self: start;
  }

  .bar a::after,
  .foot a::after,
  .link::after {
    content: "";
    position: absolute;
    inset: -12px -8px;
  }

  .email::after {
    content: "";
    position: absolute;
    inset: -12px -10px;
  }
}

/* Home's two opening paragraphs keep the same number of lines. On a phone their size follows the screen's width, so they break the same way on each; at the widths below both are resized. */

@media (max-width: 760px) {
  .section.split > div > .statement {
    font-size: min(26px, calc((100vw - 2 * var(--gutter)) / 13.8));
  }
}

@media (min-width: 432px) and (max-width: 452px) {
  .section.split > div > .statement {
    font-size: 24.5px;
  }
}

@media (min-width: 542px) and (max-width: 546px) {
  .section.split > div > .statement {
    font-size: 25.5px;
  }
}

@media (min-width: 675px) and (max-width: 726px) {
  .section.split > div > .statement {
    font-size: 24px;
  }
}

/* Small phones: smaller logos, so three still fit on a row. */

@media (max-width: 350px) {
  .logo-google svg {
    height: 27px;
  }

  .logo-avalara svg {
    height: 19px;
  }

  .logo-salesforce svg {
    height: 40px;
  }

  .logo-immersive svg {
    height: 20px;
  }

  .logo-softcat svg {
    height: 18px;
  }
}

@media (min-width: 761px) and (max-width: 1259px) {
  .photo figcaption span {
    text-wrap: balance;
  }

  /* The second caption stays on one line, so the studio's name never breaks. */
  .photo figcaption .grey {
    white-space: nowrap;
  }

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

  .logos ul {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 24px;
  }

  .bar a,
  .foot a,
  .link,
  .email {
    position: relative;
  }

  .bar a::after,
  .foot a::after,
  .link::after {
    content: "";
    position: absolute;
    inset: -12px -8px;
  }

  .email::after {
    content: "";
    position: absolute;
    inset: -12px -10px;
  }
}

/* An upright tablet has no room beside the label, so the logos sit under it. */

@media (min-width: 761px) and (max-width: 899px) {
  .logos.split {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* My own work: the two descriptions break into the same number of lines. */

@media (max-width: 899px) {
  .work .lead {
    max-width: 17em;
  }
}

@media print {
  @page {
    size: A4;
    margin: 16mm 18mm 18mm;
  }

  body {
    background: #fff;
    font-size: 10.5pt;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  .bar {
    display: none;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}

@media (pointer: coarse) {
  .bar a,
  .foot a {
    position: relative;
  }

  .bar a::after,
  .foot a::after {
    content: "";
    position: absolute;
    inset: -12px -4px;
  }
}
