:root {
  --paper: #f3eee4;
  --paper-deep: oklch(0.925 0.018 82);
  --ink: oklch(0.21 0.008 70);
  --ink-soft: oklch(0.42 0.012 70);
  --rule-line: #dcd3c2;
  --margin-line: rgb(217 72 28 / 0.5);
  --accent: oklch(0.6 0.19 38);
  --night: #0e1213;
  --night-ink: oklch(0.9 0.012 84);

  --rule: 2rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --margin-x: calc(var(--gutter) + clamp(2.5rem, 7vw, 6rem));

  --wide: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  /* the ledger: horizontal rules + a red margin line */
  background-image:
    linear-gradient(90deg, transparent calc(var(--margin-x) - 1px), var(--margin-line) calc(var(--margin-x) - 1px), var(--margin-line) var(--margin-x), transparent var(--margin-x)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), var(--rule-line) calc(var(--rule) - 1px), var(--rule-line) var(--rule));
  color: var(--ink);
  font-family: var(--wide);
  font-variation-settings: "wdth" 100;
  font-size: 1.0625rem;
  line-height: var(--rule);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 10;
}
.skip:focus { top: 1rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- masthead ---------- */

.masthead {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  height: calc(var(--rule) * 3);
  padding: 0 var(--gutter);
}

.lockup {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none;
}

.mark { width: 2rem; height: 2rem; fill: var(--ink); overflow: visible; }
.mark-kick {
  fill: var(--accent);
  transform-box: view-box;
  transform-origin: 4px 33.5px;
  transform: rotate(13deg);
  animation: kick 1.1s var(--ease-out) 0.9s backwards;
}
.lockup:hover .mark-kick { transform: rotate(24deg); transition: transform 0.5s var(--ease-out); }

@keyframes kick { from { transform: rotate(0deg); fill: var(--ink); } }

.wordmark {
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.masthead-nav {
  display: flex; gap: 1.5rem;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.masthead-nav a { color: var(--ink-soft); text-decoration: none; }
.masthead-nav a:hover { color: var(--accent); }

.masthead-right { display: flex; align-items: center; gap: 1.75rem; }

.langs {
  display: flex;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em;
  border: 1px solid var(--ink);
}
.langs a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.5rem; line-height: 1;
  color: var(--ink); text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.langs a + a { border-left: 1px solid var(--ink); }
.langs a:hover { background: var(--paper-deep); }
.langs a[aria-current] { background: var(--ink); color: var(--paper); }

/* flags wave in four stepped frames, like a sprite */
.flag {
  display: block; width: 1.125rem; height: 0.75rem; flex: none;
  shape-rendering: crispEdges;
  outline: 1px solid oklch(0 0 0 / 0.15); outline-offset: -1px;
  transform-origin: left center;
}
.langs a:hover .flag, .denia-title:hover .flag { animation: wave 0.6s steps(4) infinite; }
@keyframes wave {
  0%   { transform: skewY(0deg) scaleX(1); }
  25%  { transform: skewY(-5deg) scaleX(0.94); }
  50%  { transform: skewY(0deg) scaleX(0.9); }
  75%  { transform: skewY(5deg) scaleX(0.94); }
}
.flag--big {
  display: inline-block; vertical-align: 0.05em;
  width: 0.9em; height: 0.6em; margin-left: 0.1em;
  outline: none;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-content: center;
  padding: calc(var(--rule) * 4) var(--gutter) calc(var(--rule) * 3);
  isolation: isolate;
}

.ledger {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  background: var(--paper);
}

.hero-inner { padding-left: calc(var(--margin-x) - var(--gutter) + 1.25rem); }

.eyebrow {
  margin: 0 0 var(--rule);
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0 0 0 -0.06em;
  font-variation-settings: "wdth" 125;
  font-weight: 900;
  font-size: clamp(3.25rem, 13.2vw, 15rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero-title .line > span { display: inline-block; animation: rise 1.2s var(--ease-out) backwards; }
.hero-title .line:nth-child(2) > span { animation-delay: 0.12s; }
.hero-title em { font-style: normal; color: var(--accent); }

@keyframes rise { from { transform: translateY(105%); } }

.hero-lede {
  max-width: 34ch;
  margin: calc(var(--rule) * 1.5) 0 0;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: var(--rule);
  animation: fade 1s var(--ease-out) 0.5s backwards;
}

@keyframes fade { from { opacity: 0; transform: translateY(0.5rem); } }

.hero-down {
  position: absolute; left: var(--gutter); bottom: var(--rule);
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; color: var(--ink-soft);
  animation: fade 1s var(--ease-out) 0.8s backwards;
}
.hero-down:hover { color: var(--ink); }

/* ---------- section heads ---------- */

.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.5rem;
  padding: 0 var(--gutter) 0 calc(var(--margin-x) + 1.25rem);
  margin-bottom: var(--rule);
}
.section-head h2 {
  margin: 0;
  font-family: var(--mono); font-weight: 500; font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}
.section-head p { margin: 0; color: var(--ink-soft); }

/* ---------- catalogue ---------- */

.catalogue { padding: calc(var(--rule) * 3) 0 calc(var(--rule) * 4); }

.titles { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }

.title { border-bottom: 2px solid var(--ink); }

.title-link {
  position: relative; isolation: isolate;
  display: grid;
  grid-template-columns: calc(var(--margin-x) - var(--gutter)) minmax(0, 1fr) minmax(14rem, 28rem) clamp(7rem, 13vw, 12rem);
  grid-template-areas:
    "no name name logo"
    ".  line desc logo"
    ".  url  desc logo";
  column-gap: 1.25rem;
  row-gap: 0.75rem;
  align-items: start;
  padding: var(--rule) var(--gutter);
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: color 0.45s var(--ease-out);
  cursor: pointer;
}
.title-link::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--c-bg);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.55s var(--ease-out);
}
.title-link:hover, .title-link:focus-visible { color: var(--c-fg); outline: none; }
.title-link:hover::before, .title-link:focus-visible::before { transform: scaleY(1); }

.title-no {
  grid-area: no;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em;
  line-height: 1;
  padding-top: 0.6rem;
}
.title-name {
  grid-area: name;
  font-variation-settings: "wdth" 125;
  font-weight: 850;
  font-size: clamp(2.5rem, 9vw, 9rem);
  line-height: 0.9;
  white-space: nowrap;
  letter-spacing: -0.045em;
  transition: transform 0.55s var(--ease-out);
}
.title-link:hover .title-name { transform: translateX(0.12em); }

.title-line { grid-area: line; font-weight: 700; padding-top: 0.15rem; }
.title-desc { grid-area: desc; opacity: 0.78; font-size: 0.9375rem; line-height: 1.5rem; }

.title-url {
  grid-area: url; white-space: nowrap;
  font-family: var(--mono); font-size: 0.8125rem;
}

.title-tag {
  display: inline-block; margin-left: 0.6rem; padding: 0.05rem 0.45rem;
  border: 1px solid currentColor;
  font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
  line-height: 1.25rem;
}

/* logos sit as 1-bit ink dither on the paper, and dissolve into colour on hover */
.title-logo {
  grid-area: logo; justify-self: end; align-self: center;
  position: relative;
  width: clamp(4rem, 8vw, 7.5rem); aspect-ratio: 1;
}
.title-logo--wide { width: clamp(7rem, 13vw, 12rem); aspect-ratio: 843 / 522; }
.title-logo canvas, .title-logo img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain;
}
.title-logo canvas { image-rendering: pixelated; }
.title-logo img { opacity: 0; transition: opacity 0.2s linear; }
.title-logo.is-color img { opacity: 1; }
.title-logo.is-color canvas { visibility: hidden; }

/* ---------- ai consulting ---------- */

.ai {
  background: var(--night); color: var(--night-ink);
  padding: calc(var(--rule) * 4) var(--gutter) calc(var(--rule) * 4);
}
.ai-inner { margin-left: calc(var(--margin-x) - var(--gutter) + 1.25rem); }
.ai .eyebrow { margin-bottom: var(--rule); }
.ai-title {
  margin: 0;
  font-variation-settings: "wdth" 125;
  font-weight: 900;
  font-size: clamp(2.25rem, 6.4vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}
.ai-title span { color: var(--accent); }
.ai-lede {
  max-width: 40ch;
  margin: calc(var(--rule) * 1.5) 0 calc(var(--rule) * 1.5);
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
}
.ai-list {
  list-style: none; margin: 0 0 calc(var(--rule) * 1.5); padding: 0;
  max-width: 44rem;
  border-top: 1px solid oklch(0.36 0.01 220);
}
.ai-list li {
  display: grid; grid-template-columns: 3.5rem 1fr;
  padding: 0.75rem 0;
  border-bottom: 1px solid oklch(0.36 0.01 220);
  line-height: 1.5rem;
}
.ai-list li span { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); }
.ai-cta {
  display: inline-flex; gap: 0.6rem; align-items: center;
  padding: 0.9rem 1.4rem;
  background: var(--accent); color: var(--paper);
  font-variation-settings: "wdth" 125; font-weight: 800;
  text-decoration: none;
  transition: background-color 0.3s var(--ease-out);
}
.ai-cta span { transition: transform 0.4s var(--ease-out); }
.ai-cta:hover { background: oklch(0.66 0.19 40); }
.ai-cta:hover span { transform: translateX(0.25rem); }

/* ---------- house rules ---------- */

.rules { padding: calc(var(--rule) * 2) 0 calc(var(--rule) * 5); }

.rulebook {
  list-style: none; margin: 0;
  padding: 0 var(--gutter) 0 calc(var(--margin-x) + 1.25rem);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: clamp(1.5rem, 3.6vw, 3rem);
  line-height: calc(var(--rule) * 2);
  letter-spacing: -0.025em;
}
.rulebook li { max-width: 34ch; }
/* a background-drawn strike so it follows the text across wrapped lines */
.rulebook s {
  text-decoration: none; color: var(--ink-soft);
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 56% / 0% 0.09em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 0.8s var(--ease-out) calc(var(--i, 0) * 160ms);
}
.rulebook.is-in s { background-size: 100% 0.09em; }
.rulebook .survivor {
  margin-top: var(--rule);
  color: var(--ink);
  font-variation-settings: "wdth" 125;
  font-weight: 900;
}

/* ---------- the house ---------- */

.house {
  background: var(--night);
  color: var(--night-ink);
  padding: calc(var(--rule) * 4) var(--gutter) calc(var(--rule) * 2);
  overflow: hidden;
}

.house-title {
  margin: 0 0 calc(var(--rule) * 2) calc(var(--margin-x) - var(--gutter) + 1.25rem);
  font-variation-settings: "wdth" 125;
  font-weight: 900;
  font-size: clamp(2.5rem, 7vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.people {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.5rem, 3vw, 3rem);
  max-width: 76rem; margin: 0 auto;
}

.person { margin: 0; position: relative; }
.person img {
  display: block; width: 100%; height: auto;
  filter: grayscale(1) contrast(1.08);
  -webkit-mask-image: radial-gradient(ellipse 58% 64% at 50% 44%, #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 64% at 50% 44%, #000 45%, transparent 100%);
  transition: filter 0.8s var(--ease-out);
}
.person:hover img { filter: grayscale(0) contrast(1); }
.person figcaption {
  position: absolute; left: 0; right: 0; bottom: 4%;
  text-align: center;
  font-variation-settings: "wdth" 125;
  font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.75rem, 5vw, 4.5rem);
  letter-spacing: -0.04em; line-height: 1;
}

/* ---------- colophon ---------- */

.colophon {
  background: var(--night); color: var(--night-ink);
  border-top: 1px solid oklch(0.32 0.01 235);
}

/* Dénia: a 1-bit dither that loads into the photo, top to bottom, like it's 1996 */
.denia { margin: 0; position: relative; }
.denia-frame {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 7;
  background: var(--night);
}
.denia-frame canvas, .denia-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 40%;
}
.denia-frame canvas { image-rendering: pixelated; }
.denia-frame img { opacity: 0; transition: opacity 0.6s linear; }
.denia-frame.is-color img { opacity: 1; }
.denia-frame::after {
  content: ""; position: absolute; inset: 35% 0 0 0;
  background: linear-gradient(to bottom, transparent, oklch(0.17 0.006 220 / 0.7) 55%, var(--night));
  pointer-events: none;
}
.denia-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 0 var(--gutter) var(--rule);
}
.denia-title {
  font-variation-settings: "wdth" 125; font-weight: 900; text-transform: uppercase;
  font-size: clamp(2.5rem, 8vw, 8rem); line-height: 0.9; letter-spacing: -0.045em;
}
.denia-sub {
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}

.colophon-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--rule) 2rem;
  padding: calc(var(--rule) * 1.5) var(--gutter) calc(var(--rule) * 1.5);
}
.colophon-mail {
  font-variation-settings: "wdth" 125; font-weight: 800;
  font-size: clamp(1.25rem, 3.4vw, 2.5rem); letter-spacing: -0.03em;
  text-decoration: none;
}
.colophon-mail:hover { color: var(--accent); }
.colophon-legal {
  font-family: var(--mono); font-size: 0.75rem; line-height: 1.5;
  color: oklch(0.68 0.012 84); text-align: right;
}
.colophon-legal p { margin: 0; }
.colophon-legal .credit { margin-top: 0.5rem; font-size: 0.6875rem; color: oklch(0.55 0.012 84); }
.colophon-legal a { color: inherit; }
.colophon-legal a:hover { color: var(--night-ink); }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .masthead-nav { display: none; }
  .denia-frame { aspect-ratio: 4 / 3; }
  .title-link {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "no logo"
      "name name"
      "line line"
      "desc desc"
      "url url";
    row-gap: 0.25rem;
  }
  .title-url { padding-top: 0.5rem; }
  .title-logo { width: 3.5rem; align-self: start; }
  .title-logo--wide { width: 5rem; }
  .ai-inner { margin-left: 0; }
  .hero-inner, .section-head, .rulebook { padding-left: 0; }
  .section-head, .rulebook { padding-left: var(--gutter); }
  .house-title { margin-left: 0; }
  .rulebook { line-height: var(--rule); }
  .rulebook li + li { margin-top: var(--rule); }
  .colophon-legal { text-align: left; }
  :root { --margin-x: calc(var(--gutter) - 0.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .rulebook s { background-size: 100% 0.09em; }
}
