/* CloudDW site. Colour, type, space and shape all come from tokens.css. */

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-stretch: var(--text-stretch);
  font-size: var(--type-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, h1, h2, h3, figure, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; }
cite { font-style: italic; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }

.wrap { max-width: calc(var(--max) + 2 * var(--margin)); margin-inline: auto; padding-inline: var(--margin); }

.skip {
  position: absolute; left: var(--margin); top: -100px; z-index: 20;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip:focus { top: var(--s-3); }

/* ---- Type styles ---------------------------------------------------------- */
.display-xl, .display-l {
  font-family: var(--font-display);
  font-stretch: var(--display-stretch);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.display-xl { font-size: var(--type-display-xl); line-height: 0.96; }
.display-l { font-size: var(--type-display-l); line-height: 1.04; letter-spacing: -0.02em; }
.title { font-size: var(--type-title); font-stretch: 112%; font-weight: 650; line-height: 1.2; letter-spacing: -0.005em; }
.lede { font-size: var(--type-lede); line-height: 1.5; max-width: 36em; }
.small { font-size: var(--type-small); line-height: 1.5; color: var(--text-2); }
.label {
  font-family: var(--font-data);
  font-size: var(--type-label);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---- Pressable things: pills ---------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--s-5);
  border: var(--hairline) solid var(--text); border-radius: var(--r-pill);
  background: transparent; color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--text); color: var(--bg); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn--small { min-height: 40px; padding: 0 var(--s-4); font-size: var(--type-small); }
.link { font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.link:hover { text-decoration-color: currentColor; }
.tag {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--s-3);
  border: var(--hairline) solid var(--line); border-radius: var(--r-pill);
  font-family: var(--font-data); font-size: var(--type-label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-5); }
.row--tight { gap: var(--s-2); }

/* ---- Top bar ---------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: var(--hairline) solid var(--line); }
.bar__inner { display: flex; align-items: center; gap: var(--s-5); min-height: 64px; }
.bar__logo { flex: none; margin-right: auto; }
.bar__logo svg { height: 30px; width: auto; }
.bar__nav { display: flex; gap: var(--s-5); font-size: var(--type-small); font-weight: 550; }
.bar__nav a { padding-block: var(--s-2); color: var(--text-2); text-decoration: none; transition: color var(--t-fast) var(--ease); }
.bar__nav a:hover { color: var(--text); }
.bar__toggle { display: none; }

/* ---- Stage: a 3D object and the copy that goes with it -------------------- */
.stage { position: relative; overflow: clip; }
.stage + .stratum, .strip + .stratum { border-top: var(--hairline) solid var(--line); }

/* Holds the WebGL canvas. scene.js moves one canvas between the stages. */
.stage__mount { position: absolute; inset: 0; pointer-events: none; }
.stage__mount canvas {
  display: block; width: 100%; height: 100%;
  opacity: 0; transition: opacity var(--t-slow) var(--ease);
  /* The floor is the page colour, so fading the last rows leaves no edge. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 96px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 96px), transparent);
}
.stage.is-live .stage__mount canvas { opacity: 1; }

.stage__ledger {
  position: relative;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: center;
  min-height: clamp(520px, 74vh, 720px);
  padding-block: var(--s-9);
}
.stage--hero .stage__ledger { min-height: clamp(560px, 80vh, 780px); }
.stage__copy { grid-column: 1 / span 5; display: grid; gap: var(--s-5); justify-items: start; }
.stage__copy .display-l { max-width: 12em; }

/* The seven columns the object is framed in. scene.js measures this box. */
.stage__zone {
  grid-column: 6 / -1; align-self: stretch; margin-block: calc(-1 * var(--s-9));
  display: grid; place-items: center;
}
/* A flat drawing of the same object: shown until the 3D scene is running. */
.stage__still { width: min(58%, 380px); height: auto; transition: opacity var(--t-slow) var(--ease); }
.stage__still--wide { width: min(76%, 520px); }
.stage.is-live .stage__still { opacity: 0; }
.m-gold { fill: var(--cdw-gold); }
.m-silver { fill: var(--cdw-silver); }
.m-bronze { fill: var(--cdw-bronze); }
.m-concrete { fill: var(--line); }

/* ---- Metrics ---------------------------------------------------------------- */
.strip { border-top: var(--hairline) solid var(--line); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { display: grid; gap: var(--s-1); align-content: start; padding: var(--s-6) var(--s-4) var(--s-6) 0; }
.metric + .metric { padding-left: var(--s-5); border-left: var(--hairline) solid var(--line); }
.metric__value {
  font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 750;
  font-size: clamp(2rem, 3.6vw, 3.25rem); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: var(--s-2);
}

/* ---- Strata: a sticky head and a body ----------------------------------------- */
.stratum { border-top: var(--hairline) solid var(--line); padding-block: var(--s-9); }
.stratum--first { border-top: 0; }
.stratum__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-7); }
.stratum__head { grid-column: 1 / span 4; align-self: start; position: sticky; top: 104px; display: grid; gap: var(--s-4); justify-items: start; }
.stratum__head > p:not(.label) { color: var(--text-2); max-width: 30em; }
.stratum__body { grid-column: 5 / -1; display: grid; gap: var(--s-7); min-width: 0; }

/* ---- Services ----------------------------------------------------------------- */
.service { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 6fr); column-gap: var(--gutter); row-gap: var(--s-2); padding-block: var(--s-6); border-top: var(--hairline) solid var(--line); }
.service:first-child { padding-top: 0; border-top: 0; }
.service:last-child { padding-bottom: 0; }
.service > .label { padding-top: 5px; }
.service__body { display: grid; gap: var(--s-3); justify-items: start; }
.service__body > p { color: var(--text-2); max-width: var(--measure); }

/* ---- Architecture explorer ---------------------------------------------------- */
.tabs { display: grid; gap: 2px; width: 100%; max-width: 22rem; margin-top: var(--s-3); }
.tab {
  display: flex; align-items: center; min-height: 44px; padding: 0 var(--s-4);
  border: var(--hairline) solid transparent; border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--type-small); font-weight: 600; text-align: left; white-space: nowrap; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tab:hover { color: var(--text); border-color: var(--line); }
.tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.explorer { gap: var(--s-8); }
.arch { display: grid; gap: var(--s-5); align-content: start; }
.arch__head { display: grid; gap: var(--s-1); }
.arch__stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6) var(--gutter); }
.arch__stage { display: grid; gap: var(--s-4); align-content: start; padding-top: var(--s-3); border-top: 2px solid var(--text); }
.arch__n { color: var(--text); margin-right: var(--s-2); }
.arch__stage li { display: grid; gap: 2px; padding-block: var(--s-3); border-top: var(--hairline) solid var(--line); }
.arch__stage li:first-child { padding-top: 0; border-top: 0; }
.arch__stage b { font-stretch: 112%; font-weight: 650; line-height: 1.25; }
.arch__stage span:not(.arch__n) { font-size: var(--type-small); line-height: 1.4; color: var(--text-2); }
/* The engine each design turns on: marked with a rule in the text colour. */
.arch__stage .is-engine { padding-left: var(--s-3); border-left: 2px solid var(--text); }
.arch__note { padding-top: var(--s-4); border-top: var(--hairline) solid var(--line); }

/* ---- The platform, in section ------------------------------------------------- */
.layers { display: grid; width: 100%; max-width: 34rem; }
.layer { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: var(--s-4); align-items: baseline; padding-block: var(--s-3); border-top: var(--hairline) solid var(--line); }
.layer dt { display: flex; align-items: center; gap: var(--s-3); font-stretch: 112%; font-weight: 650; }
.layer dd { font-size: var(--type-small); line-height: 1.5; color: var(--text-2); }
.chip { flex: none; width: 14px; height: 14px; border-radius: var(--r-slab); }
.chip--cloud { background: var(--cdw-frost); }
.chip--gold { background: var(--cdw-gold); }
.chip--silver { background: var(--cdw-silver); }
.chip--bronze { background: var(--cdw-bronze); }
.chip--concrete { background: var(--text-2); }

/* ---- Lake line: the platform above it, what has been built with it below ------ */
.lakeline { background: var(--cdw-ice); }
.lakeline__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-1) var(--s-5); padding-block: var(--s-3); }
.lakeline .label { color: var(--cdw-ink); }

/* ---- Work --------------------------------------------------------------------- */
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.case { display: grid; gap: var(--s-3); align-content: start; justify-items: start; padding: var(--s-5); border: var(--hairline) solid var(--line); border-radius: var(--r-slab); }
.case__result { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 700; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.case__title { font-weight: 600; }
.case > .row { margin-top: var(--s-2); }

/* ---- Delivery ----------------------------------------------------------------- */
.terminal {
  display: grid; gap: var(--s-2); align-content: start; padding: var(--s-5);
  border: var(--hairline) solid var(--cdw-reed); border-radius: var(--r-slab);
  background: var(--cdw-vault); color: var(--cdw-frost);
  font-family: var(--font-data); font-size: 0.75rem; font-stretch: 87.5%; line-height: 1.6;
}
.terminal p { padding-left: 4.2em; text-indent: -4.2em; overflow-wrap: anywhere; }
.terminal p.terminal__dim { padding-left: 0; text-indent: 0; }
.terminal__prompt { color: var(--cdw-gold); }
.terminal__pass { color: var(--cdw-pass); }
.terminal__dim { color: var(--cdw-haze); }

.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--gutter); }
.rules > div { display: grid; gap: var(--s-1); align-content: start; padding-top: var(--s-4); border-top: var(--hairline) solid var(--line); }
.rules dt { font-stretch: 112%; font-weight: 650; }
.rules dd { color: var(--text-2); }

/* ---- Team --------------------------------------------------------------------- */
.member { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: var(--s-5); padding-block: var(--s-6); border-top: var(--hairline) solid var(--line); }
.member:first-child { padding-top: 0; border-top: 0; }
.member:last-child { padding-bottom: 0; }
.member__mono {
  display: grid; place-items: center; width: 72px; height: 72px;
  border: var(--hairline) solid var(--line); border-radius: var(--r-slab);
  font-family: var(--font-data); font-size: var(--type-small); font-weight: 600; letter-spacing: 0.06em;
}
.member__body { display: grid; gap: var(--s-3); justify-items: start; }
.member__body > p:not(.label) { color: var(--text-2); max-width: var(--measure); }

/* ---- Contact ------------------------------------------------------------------ */
.stage--contact { border-top: var(--hairline) solid var(--line); }
.trust { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); padding-top: var(--s-4); border-top: var(--hairline) solid var(--line); }

/* ---- Footer ------------------------------------------------------------------- */
.foot { border-top: var(--hairline) solid var(--line); padding-block: var(--s-7); }
.foot__inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-4) var(--s-6); }
.foot__logo svg { height: 28px; width: auto; }
.foot__nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--type-small); font-weight: 550; }
.foot__nav a { color: var(--text-2); text-decoration: none; }
.foot__nav a:hover { color: var(--text); }
.foot__inner > .small { grid-column: 1 / -1; }

/* ---- Narrower layouts --------------------------------------------------------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { padding-left: 0; border-left: 0; }
  .metric:nth-child(n + 3) { border-top: var(--hairline) solid var(--line); }
  .arch__stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .bar__inner { flex-wrap: wrap; column-gap: var(--s-3); }
  .bar__nav { order: 3; width: 100%; gap: var(--s-2) var(--s-5); flex-wrap: wrap; padding-bottom: var(--s-3); }
  /* With JavaScript the links fold away behind a Menu button. */
  .js .bar__toggle { display: inline-flex; }
  .js .bar__nav { display: none; }
  .js .bar__nav.is-open { display: grid; gap: 0; padding-bottom: var(--s-4); font-size: var(--type-body); }
  .js .bar__nav.is-open a { padding-block: var(--s-3); border-top: var(--hairline) solid var(--line); color: var(--text); }

  /* Stages stack: copy first, then the object. */
  .stage__ledger, .stage--hero .stage__ledger { grid-template-columns: minmax(0, 1fr); min-height: 0; padding-block: var(--s-8) 0; }
  .stage__copy, .stage__zone { grid-column: 1; }
  .stage__zone { height: 400px; margin-block: 0; }
  .stage__mount { inset: auto 0 0 0; height: 440px; }
  .stage__still { width: min(64%, 300px); }
  .stage__still--wide { width: min(84%, 380px); }

  .stratum { padding-block: var(--s-8); }
  .stratum__head, .stratum__body { grid-column: 1 / -1; }
  .stratum__head { position: static; }

  /* The platform list becomes a row you can swipe. */
  .tabs { display: flex; gap: var(--s-2); max-width: none; overflow-x: auto; margin-inline: calc(-1 * var(--margin)); padding: 2px var(--margin); width: auto; justify-self: stretch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; border-color: var(--line); }

  .foot__inner { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}

@media (max-width: 640px) {
  .metric { padding-block: var(--s-5); }
  .metric + .metric { padding-left: var(--s-4); }
  .metric:nth-child(3) { padding-left: 0; }
  .service, .cases, .rules, .arch__stages { grid-template-columns: minmax(0, 1fr); }
  .member { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); }
  .member__mono { width: 56px; height: 56px; }
  .layer { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .btn { white-space: normal; }
}

@media (max-width: 380px) {
  /* The narrowest phones: logo, Menu and Contact stay on one row, and the
     logo gives way before a button wraps. */
  .bar__inner { column-gap: var(--s-2); }
  .bar__logo { flex: 1 1 0; min-width: 0; }
  .bar__logo svg { height: 26px; max-width: 100%; }
  .bar .btn--small { padding-inline: var(--s-3); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__mount canvas, .stage__still { transition: none; }
}
