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

:root {
  --side-bg: #262f34;
  --nav: #a4a4a4;
  --btn-bg: #c6cad6;
  --btn-text: #212329;
  --heading: 'Roundo', 'Karla', system-ui, sans-serif;
  --body: 'Karla', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(20px, 2.6vw, 38px);
}

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

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

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

.btn,
.gate-row button {
  display: inline-block;
  border: 0;
  border-radius: 4px;
  padding: 12px 22px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font: 600 16px/1.2 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.2s;
}

.btn:hover,
.gate-row button:hover {
  filter: brightness(0.94);
}

/* ---------- Password gate ---------- */
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px;
}

.gate[hidden] {
  display: none;
}

.gate-brand {
  font: 500 20px/1 var(--heading);
  letter-spacing: 0.01em;
}

.gate-form {
  margin-top: 145px;
  width: min(532px, 100%);
  text-align: center;
}

.gate-lock {
  width: 62px;
  height: 62px;
  margin: 0 auto 26px;
  border-radius: 50%;
  background: #e2e2e2;
  display: grid;
  place-items: center;
}

.gate-lock svg {
  width: 20px;
  height: 20px;
}

.gate h1 {
  font: 500 24px/1.4 var(--heading);
  max-width: 440px;
  margin: 0 auto 48px;
}

.gate-row {
  display: flex;
  gap: 12px;
}

.gate-row input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 18px;
  border: 1px solid #000;
  border-radius: 8px;
  font: 16px var(--body);
}

.gate-row button {
  width: 100px;
  border-radius: 8px;
  padding: 0;
  height: 48px;
  align-self: center;
}

.gate-row button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.gate-error {
  color: #c62828;
  margin: 16px 0 0;
}

.noscript {
  text-align: center;
  padding: 40px;
}

/* ---------- Encrypted images ---------- */
img.enc:not(.loaded) {
  background: #f1f2f4;
}

img.enc.loaded,
.enc-bg.loaded {
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------- Rich text ---------- */
.rt > :first-child {
  margin-top: 0;
}

.rt > :last-child {
  margin-bottom: 0;
}

.rt p {
  margin: 0 0 1em;
}

.rt ul,
.rt ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}

.rt li p {
  margin: 0;
}

.rt a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- 12-column section grid ---------- */
.sec {
  padding-top: var(--pt, 40px);
  padding-bottom: var(--pb, 40px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 24px;
  align-items: center;
}

.cell {
  grid-column: var(--cs) / var(--ce);
  min-width: 0;
}

.sec-columns .grid {
  align-items: start;
}

.sec-header .rt {
  text-align: center;
}

.media {
  margin: 0;
}

.media img {
  width: 100%;
}

.media.mode-small img {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.media figcaption {
  margin-top: 14px;
  text-align: center;
}

.cell-column .media {
  margin-bottom: 28px;
}

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Portfolio pages (sidebar layout) ---------- */
.pf {
  display: flex;
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  flex: 0 0 35%;
  max-width: 600px;
  background: var(--side-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 40px 44px;
  z-index: 10;
}

.side-bar {
  display: none;
}

.side-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 60px;
}

.side-avatar img {
  width: 145px;
  height: 145px;
  border-radius: 50%;
  object-fit: cover;
}

.side-social {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 22px 0 28px;
  padding: 0;
}

.side-social a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #3b454b;
  color: #56616a;
  transition: color 0.2s, border-color 0.2s;
}

.side-social a:hover {
  color: #fff;
  border-color: #fff;
}

.side-social svg {
  width: 16px;
  height: 16px;
}

.side-desc h1 {
  font: 500 40px/1.2 var(--heading);
  margin: 0 0 22px;
  color: #fff;
}

.side-desc p {
  margin: 0 auto;
  max-width: 400px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
}

.side-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 32px;
}

.side-nav a {
  color: var(--nav);
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.side-nav a:hover,
.side-nav a[aria-current='page'] {
  color: #fff;
}

.pf-main {
  flex: 1;
  min-width: 0;
  padding: 0 var(--gutter);
}

.pf .rt h1,
.pf .rt h2,
.pf .rt h3,
.pf .rt h4 {
  font-family: var(--heading);
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 0.6em;
}

.pf .rt h1 {
  font-size: 32px;
}

.pf .rt h2 {
  font-size: 28px;
}

.pf .rt h3 {
  font-size: 24px;
}

.pf .rt h4 {
  font-size: 20px;
}

.pf .media figcaption {
  font-size: 14px;
  font-style: italic;
}

.pf .sec-cta .rt + .rt {
  margin-top: 16px;
}

.cta-wrap {
  margin: 28px 0 0;
}

/* Project tiles on the home page */
.sec-projects {
  padding-top: 48px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px 28px;
}

.tile {
  color: #000;
  text-align: center;
  text-decoration: none;
}

.tile-img {
  aspect-ratio: 1;
  overflow: hidden;
  background: #f1f2f4;
}

.tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tile:hover .tile-img img {
  transform: scale(1.04);
}

.tile-title {
  font: 500 22px/1.3 var(--heading);
  margin: 24px 0 10px;
}

.tile-sub {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.01em;
}

/* Contact form */
.contact {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  font-size: 15px;
}

.contact-greeting {
  margin: 0 0 4px;
}

.contact label {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact input,
.contact textarea {
  font: 15px var(--body);
  padding: 13px 15px;
  border: 1px solid #212329;
  border-radius: 6px;
  resize: vertical;
}

.contact .btn {
  align-self: flex-start;
}

.contact-note {
  margin: 0;
  font-size: 14px;
  color: #666;
}

/* ---------- Case studies ---------- */
.cs {
  position: relative;
  overflow-x: clip;
  font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
  color: var(--p1-color, #353738);
  font-size: var(--p1-size, 18px);
  line-height: var(--p1-lh, 30px);
}

.cs .grid {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  column-gap: 32px;
}

.cs .cell.bleed {
  grid-column: 1 / -1;
  margin-inline: calc(50% - 50vw);
}

.cs .rt h1 {
  font-size: var(--h1-size);
  line-height: var(--h1-lh);
  font-weight: var(--h1-weight);
  font-style: var(--h1-style);
  color: var(--h1-color);
  margin: 0 0 0.4em;
}

.cs .rt h2 {
  font-size: var(--h2-size);
  line-height: var(--h2-lh);
  font-weight: 700;
  font-style: var(--h2-style);
  color: var(--h2-color);
  margin: 0 0 0.5em;
}

.cs .rt h3 {
  font-size: calc(var(--h3-size) * 0.8);
  line-height: 1.25;
  font-weight: var(--h3-weight);
  font-style: var(--h3-style);
  color: var(--h3-color);
  margin: 0 0 0.8em;
}

.cs .rt h4 {
  font-size: var(--h4-size);
  line-height: var(--h4-lh);
  font-weight: var(--h4-weight);
  color: var(--h4-color);
  margin: 0 0 0.6em;
}

.cs .rt p,
.cs .rt li {
  font-size: 16px;
  line-height: 1.85;
}

.cs .sec-header .rt h1,
.cs .sec-header .rt h2 {
  margin: 0;
}

.cs .media figcaption {
  font-size: var(--p2-size, 16px);
  line-height: 1.5;
  color: var(--p1-color, #353738);
}

.cs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 var(--gutter);
  background: var(--side-bg);
}

.cs-brand {
  color: #fff;
  text-decoration: none;
  font: 500 18px/1 var(--heading);
  letter-spacing: 0.04em;
}

.cs-links {
  display: flex;
  gap: 32px;
}

.cs-links a {
  color: #c7ccd0;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.cs-links a:hover,
.cs-links a:focus-visible {
  color: #fff;
}

.cs-burger {
  display: none;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: min(780px, 88vh);
  display: flex;
  align-items: center;
  padding: 120px 0 90px;
  color: #fff;
  isolation: isolate;
}

.hero.tone-light-bg {
  color: var(--h1-color, #353738);
}

.hero-bg {
  position: absolute;
  inset: calc(var(--blur, 0px) * -2);
  background-size: cover;
  background-position: center;
  filter: blur(var(--blur, 0px));
  z-index: -3;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  z-index: -2;
}

.hero-gradient {
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  background: linear-gradient(rgba(0, 0, 0, 0.4), transparent);
  z-index: -1;
}

.hero-grid {
  width: 100%;
}

.hero-title {
  font-size: var(--projectTitle-size, 88px);
  line-height: var(--projectTitle-lh, 91px);
  font-weight: 700;
  margin: 0 0 28px;
  color: inherit;
}

.hero-sub {
  font-size: var(--projectSubTitle-size, 22px);
  line-height: 1.2;
  margin: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px 56px;
  text-align: center;
}

.stat {
  flex: 1 1 220px;
  max-width: 360px;
}

.stat-value {
  font-size: 80px;
  line-height: 1;
  font-weight: 700;
  color: var(--h1-color, #353738);
}

.stat-desc {
  font-size: 25px;
  line-height: 1.25;
  margin-top: 16px;
}

.related {
  max-width: 1440px;
  margin: 0 auto;
  padding: 60px var(--gutter) 90px;
  text-align: center;
}

.related h3 {
  font-size: var(--h3-size, 30px);
  font-weight: 700;
  color: var(--h3-color);
  margin: 0 0 40px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.related-card {
  color: inherit;
  text-decoration: none;
}

.related-img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f1f2f4;
}

.related-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.related-card:hover .related-img img {
  transform: scale(1.04);
}

.related-card h4 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 18px 0 4px;
}

.related-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--p2-color, #7b7e80);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tiles {
    gap: 40px 20px;
  }

  .cs .hero-title {
    font-size: calc(var(--projectTitle-size, 88px) * 0.75);
    line-height: 1.05;
  }
}

@media (max-width: 860px) {
  .cs-burger {
    display: grid;
    align-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    padding: 0 11px;
    background: none;
    border: 0;
    cursor: pointer;
    position: relative;
    z-index: 2;
  }

  .cs-burger span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
  }

  .cs-nav.open .cs-burger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .cs-nav.open .cs-burger span:nth-child(2) {
    opacity: 0;
  }

  .cs-nav.open .cs-burger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .cs-brand {
    position: relative;
    z-index: 2;
  }

  .cs-links {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--side-bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
  }

  .cs-links a {
    font-size: 24px;
  }

  .cs-nav.open .cs-links {
    display: flex;
  }

  .pf {
    flex-direction: column;
  }

  .side {
    position: relative;
    height: auto;
    max-width: none;
    flex: none;
    padding: 0 24px 48px;
  }

  .side-bar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 26px 0 20px;
    position: relative;
    z-index: 31;
  }

  .side-brand {
    color: #a4a4a4;
    text-decoration: none;
    font: 500 18px/1 var(--heading);
  }

  .side-burger {
    width: 40px;
    height: 40px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 0 10px;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .side-burger span {
    display: block;
    height: 2px;
    background: #a4a4a4;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
  }

  .side.open .side-burger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .side.open .side-burger span:nth-child(2) {
    opacity: 0;
  }

  .side.open .side-burger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .side-body {
    padding: 4px 0 0;
  }

  .side-desc h1 {
    font-size: 28px;
    margin-bottom: 16px;
  }

  .side-desc p {
    font-size: 16px;
  }

  .side-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: var(--side-bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
  }

  .side-nav a {
    font-size: 24px;
  }

  .side.open .side-nav {
    display: flex;
  }

  .pf-main {
    padding: 0 24px;
  }

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

  .grid {
    row-gap: 28px;
  }

  .cell,
  .cs .cell.bleed {
    grid-column: 1 / -1;
  }

  .media.mode-small img {
    max-width: 80%;
  }

  .cs .rt h1 {
    font-size: calc(var(--h1-size) * 0.65);
    line-height: 1.1;
  }

  .cs .rt h2 {
    font-size: calc(var(--h2-size) * 0.7);
    line-height: 1.15;
  }

  .cs .rt h3 {
    font-size: 22px;
  }

  .cs .rt h4 {
    font-size: 20px;
    line-height: 1.3;
  }

  .hero {
    min-height: 70vh;
    padding: 110px 0 60px;
  }

  .cs .hero-title {
    font-size: clamp(36px, 11vw, 56px);
    line-height: 1.05;
  }

  .hero-sub {
    font-size: 18px;
  }

  .stat-value {
    font-size: 56px;
  }

  .stat-desc {
    font-size: 20px;
  }

  .related-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .gate-form {
    margin-top: 90px;
  }

  .gate h1 {
    font-size: 20px;
  }
}
