/* ==========================================================================
   tiagogoncalv.es
   ========================================================================== */

@font-face {
  font-family: "Suspiria";
  src: url("../fonts/Suspiria-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Suspiria";
  src: url("../fonts/Suspiria-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Suspiria";
  src: url("../fonts/Suspiria-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Inter's arrows (← → ↑ …), loaded only when a page uses one */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Arrows.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+2190-21FF;
}

:root {
  color-scheme: light;

  --ink: #26233a;
  --gray-900: #111827;
  --gray-600: #4b5563;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --label: rgba(38, 35, 58, 0.4);
  --hairline: rgba(3, 7, 18, 0.08);
  --highlight: #dbf5ff;
  --white: #ffffff;

  --font-display: "Suspiria", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --container: 880px;
  --gutter: 24px;
  --label-col: 214px;
}

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

html {
  /* Reserve scrollbar space so short pages don't shift the layout sideways */
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.52;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

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

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

p,
h1,
h2,
h3,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  padding-top: 47px;
}

/* Copy of the header that slides in when scrolling back up (menu.js) */
.site-header--sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 12px 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.site-header--sticky.is-shown {
  transform: none;
  visibility: visible;
  transition: transform 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .site-header--sticky,
  .site-header--sticky.is-shown {
    transition: none;
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.identity__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

.identity__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.identity__name {
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  /* Suspiria caps sit high in the line box; shift them down to look centred */
  padding: 8px 10px 4px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.21;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
  transition: color 0.15s ease, background-color 0.15s ease;
}

@supports (text-box: trim-both cap alphabetic) {
  .nav__link {
    padding: 9px 10px;
    text-box: trim-both cap alphabetic;
  }
}

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

.nav__link[aria-current="page"] {
  background: var(--gray-100);
  color: var(--ink);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.menu-toggle .icon-close {
  display: none;
}

/* Mobile menu panel */
.mobile-menu {
  display: none;
}

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */

.label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.21;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}

.display {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 38px;
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--gray-400);
}

.display strong {
  font-weight: 300;
  color: var(--ink);
}

.display .hl {
  background: var(--highlight);
  border-radius: 10px;
  /* Suspiria's box hangs ~0.24em below the baseline; extra top padding
     centres the highlight on the letters instead */
  padding: 0.2em 0.1em 0;
  margin: 0 -0.1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.muted {
  color: var(--gray-400);
}

.stat__value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.21;
  color: var(--ink);
  white-space: nowrap;
}

.stat__value .sym {
  color: var(--gray-400);
}

.stat__value .sym--inter {
  font-family: var(--font-body);
  /* Inter's taller metrics would otherwise push the line down */
  line-height: 1;
}

.stat__label {
  margin-top: 1px;
  color: var(--gray-400);
}

/* --------------------------------------------------------------------------
   Main / footer
   -------------------------------------------------------------------------- */

main {
  display: block;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  margin-top: 244px;
  color: var(--gray-400);
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Projects page
   -------------------------------------------------------------------------- */

.hero {
  margin-top: 141px;
}

.hero .display {
  max-width: 880px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 67px;
}

.stats .stat {
  padding-left: 24px;
  padding-right: 8px;
  border-left: 1px solid var(--gray-200);
}

.stats .stat:first-child {
  padding-left: 0;
  border-left: 0;
}

.projects {
  margin-top: 141px;
}

.projects > .label {
  margin-bottom: 24px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.project-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.project--compact {
  gap: 32px;
}

.project__media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  aspect-ratio: 880 / 477.35;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project__media img {
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project__media:hover img {
  transform: scale(1.015);
}

.project--compact .project__media {
  aspect-ratio: 428 / 330;
}

/* Exported compositions: one image fills the card */
.project__media--image picture,
.project__media--image img {
  width: 100%;
  height: 100%;
}

.project__media--image img {
  object-fit: cover;
}

/* Intaker: desktop app screenshot bleeding off the bottom-right */
.media-intaker {
  background: #e8f7fc;
}

.media-intaker img {
  position: absolute;
  left: 11.932%;
  top: 13.826%;
  width: 88.068%;
  border-radius: 8px 0 0 0;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.15);
}

/* Paytient: three phone screens */
.media-paytient {
  background: #dce5f2;
  aspect-ratio: 881 / 477.35;
}

/* The phones scale as one group, not individually */
.media-paytient .phones {
  position: absolute;
  inset: 0;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.media-paytient:hover .phones {
  transform: scale(1.015);
}

.media-paytient:hover .phone {
  transform: none;
}

.media-paytient .phone {
  position: absolute;
  width: 23.84%;
  border-radius: 20px;
  box-shadow: 0 4.66px 6.99px -1.4px rgba(0, 0, 0, 0.05),
    0 1.87px 2.8px -1.87px rgba(0, 0, 0, 0.05);
}

.media-paytient .phone--1 {
  left: 9.42%;
  top: 17.6%;
}

.media-paytient .phone--2 {
  left: 37.91%;
  top: -5.24%;
}

.media-paytient .phone--3 {
  left: 66.29%;
  top: 17.6%;
}

.media-paytient .media-mobile {
  display: none;
}

/* Knok: telehealth call UI */
.media-knok {
  background: #d2dfef;
}

.media-knok img {
  position: absolute;
  left: 50%;
  top: 4.04%;
  width: 78.6%;
  transform: translateX(-50%);
}

.media-knok:hover img {
  transform: translateX(-50%) scale(1.015);
}

.project__body {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 24px;
}

.project--compact .project__body {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.project__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.21;
  color: var(--ink);
}

.project__date {
  margin-top: 4px;
  color: var(--gray-400);
}

.project__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
}

.project__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project__title {
  font-weight: 600;
  font-size: 17px;
  line-height: 1.52;
  letter-spacing: -0.01em;
}

.project__desc {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

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

/* Project cards on Projects use slightly smaller metric values */
.project__stats .stat__value {
  font-size: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 59px;
  background: var(--gray-100);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.52;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.pill:hover {
  background: var(--gray-200);
}

/* --------------------------------------------------------------------------
   About page
   -------------------------------------------------------------------------- */

.about {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-top: 57px;
}

.row {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.row > .label {
  min-height: 24px;
  display: flex;
  align-items: center;
}

.row--intro .label {
  /* aligns with the first line of the 38px headline */
  min-height: 30px;
}

.portrait {
  grid-column: 2;
  width: 290px;
  height: 290px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.intro__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 4px;
  color: var(--ink);
}

/* Small logo set before an inline text link */
.inline-logo {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}

.contacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
}

.contacts__line {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
}

.contacts__key {
  color: var(--gray-400);
}

.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gray-200);
  text-decoration-thickness: from-font;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
  transition: text-decoration-color 0.15s ease;
}

.link:hover {
  text-decoration-color: var(--gray-400);
}

.list {
  display: flex;
  flex-direction: column;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
}

.list > li:last-child .item {
  border-bottom: 0;
}

.item__icon {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--gray-100);
  overflow: hidden;
}

.item__icon img {
  width: 16px;
  height: auto;
}

.item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
}

.item__title {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.item__name {
  color: var(--ink);
  white-space: nowrap;
}

.item__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-400);
  white-space: nowrap;
  text-align: right;
}

.item__meta img {
  width: 16px;
  height: auto;
}

/* Hover fills the whole row, bleeding past the column so text stays aligned */
/* Linked rows: content sits inset so the hover fill spans exactly the divider width */
a.item {
  position: relative;
  isolation: isolate;
  padding-inline: 9px; /* matches the 9px top and bottom padding */
}

a.item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--gray-50);
  opacity: 0;
  transition: opacity 0.15s ease;
}

a.item:hover::before {
  opacity: 1;
}

/* Side-quest icon tiles */
.icon-wire {
  background: #fff2cf;
}
.icon-wire img {
  width: 18px;
  height: 18px;
}
.icon-leaf {
  background: #d4f1ce;
}
.icon-leaf img {
  width: 20px;
  height: 20px;
}
.icon-indie {
  background: none;
}
.icon-indie img {
  width: 32px;
  height: 32px;
}
.icon-mail {
  background: linear-gradient(169.5deg, #00a2ff 2.8%, #d0eeff 86.6%);
}
.icon-mail img {
  width: 18px;
  height: 11.49px;
}
.icon-pencil {
  background: #caf2e5;
}
.icon-pencil img {
  width: 15px;
  height: 15px;
}

.about + .site-footer {
  margin-top: 155px;
}

/* --------------------------------------------------------------------------
   Feed page
   -------------------------------------------------------------------------- */

/* Same gap under the header as case-study covers */
.feed {
  margin-top: 48px;
}

/* Row order reads newest first, left to right */
.feed__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

/* feed.js turns the grid into two staggered columns */
.feed__grid.is-masonry {
  display: flex;
  align-items: flex-start;
}

.feed__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.feed__item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--gray-100);
}

.feed__item img {
  width: 100%;
  height: auto;
}

/* Title pill that appears on hover (always shown on touch screens) */
.feed__title {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(3, 7, 18, 0.08);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.feed__item:hover .feed__title {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .feed__title {
    opacity: 1;
    transform: none;
  }
}

.feed__grid:has(.feed__item) + .feed__empty {
  display: none;
}

.feed__empty {
  padding: 64px 24px;
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
  color: var(--gray-400);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Case study pages
   -------------------------------------------------------------------------- */

.case {
  margin-top: 48px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-400);
  transition: color 0.15s ease;
}

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

.case__intro {
  margin-top: 64px;
}

.case__intro .back {
  margin-bottom: 16px;
}

.case__intro .display {
  color: var(--ink);
}

.case__intro .display .muted {
  color: var(--gray-400);
}

.case__subtitle {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--gray-400);
}

.case__body {
  display: flex;
  flex-direction: column;
  gap: 72px;
  margin-top: 96px;
}

/* Summary facts: the same rows as the About lists, value on the right */
.facts .item__main {
  align-items: baseline;
}

.facts .item__main > :last-child {
  text-align: right;
}

.list.facts > li:last-child .item {
  border-bottom: 1px solid var(--gray-100);
}

.facts + p {
  margin-top: 24px;
}

.results-box {
  grid-template-columns: calc(var(--label-col) - 20px) minmax(0, 1fr);
  padding: 20px;
  border-radius: 8px;
  background: var(--gray-50);
}

.case__section {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Text column follows the About page rhythm: label left, content right */
.prose {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prose h3 {
  margin-top: 16px;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.52;
  letter-spacing: -0.01em;
}

.prose h3:first-child {
  margin-top: 0;
}

.prose .stat__value {
  white-space: normal;
}

.bullets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
  list-style: disc;
}

.bullets li::marker {
  color: var(--gray-400);
}

.timeline .item {
  align-items: baseline;
  gap: 16px;
}

.timeline .item__when {
  flex: none;
  width: 128px;
  color: var(--gray-400);
}

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

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

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  background: var(--gray-50);
}

.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}

/* Title sits closer to its text than the card gap (12px) */
.card__title + * {
  margin-top: -6px;
}

.principles {
  display: flex;
  flex-direction: column;
}

/* Lists of principles or cards get more air after their intro paragraph */
.prose > p + .principles,
.prose > p + .cards {
  margin-top: 16px;
}

.principle {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}

.principle:first-child {
  padding-top: 0;
}

.principle:last-child {
  border-bottom: 0;
}

.principle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  background: var(--gray-50);
  color: var(--ink);
}

/* Inside a grey card the tile turns white so it still stands out */
.card .principle__icon {
  background: var(--white);
}

.principle__icon svg {
  width: 32px;
  height: 32px;
}

.principle__title {
  font-weight: 600;
}

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

/* Two metrics share the width in halves instead of leaving a third column empty */
.case-stats:has(> li:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.quote {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--gray-50);
}

.quote p {
  margin-bottom: 12px;
}

.quote .quote__stars {
  margin-bottom: 8px;
  color: #f5b301;
  letter-spacing: 0.1em;
}

.quote footer {
  color: var(--gray-400);
}

/* Figures span the full width; captions sit under the content column */
.figure {
  margin: 0;
}

.figure > img,
.figure .ph {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

/* Carousel (carousel.js): one image slot, arrows and dots to switch */
.carousel__viewport {
  position: relative;
}

.carousel__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

.carousel__track::-webkit-scrollbar {
  display: none;
}

.carousel__track:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.carousel__slide img {
  display: block;
  width: 100%;
}

.carousel__btn {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(3, 7, 18, 0.08);
  transform: translateY(-50%);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.carousel__btn:hover {
  background: var(--gray-50);
}

.carousel__btn svg {
  width: 20px;
  height: 20px;
}

.carousel__btn--prev {
  left: 12px;
}

.carousel__btn--next {
  right: 12px;
}

.carousel__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.carousel__dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gray-200);
  cursor: pointer;
}

.carousel__dots button[aria-current] {
  background: var(--ink);
}

@media (max-width: 640px) {
  .carousel__btn {
    width: 32px;
    height: 32px;
  }

  .carousel__btn--prev {
    left: 8px;
  }

  .carousel__btn--next {
    right: 8px;
  }
}

/* Thumbnails reused as covers keep their own crop, without the card hover */
.case__cover .project__media:hover img {
  transform: none;
}

/* knok's screenshot is centred with a transform; keep it, minus the zoom */
.case__cover .media-knok:hover img {
  transform: translateX(-50%);
}

/* Product screenshots sit on a tinted panel instead of the page white */
.figure--tint {
  padding: 5%;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #e8f7fc;
}

.figure--tint > img {
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(3, 7, 18, 0.06);
}

.figure figcaption {
  margin-top: 12px;
  margin-left: calc(var(--label-col) + 8px);
  color: var(--gray-400);
  font-size: 14px;
}

.figure-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.figure-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Compact thumbnails (RMS, Sony) used as covers take the wide cover ratio */
.case__cover .media-cover-compact {
  aspect-ratio: 880 / 516;
}

/* Image slot until the final image is supplied */
.ph {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-400);
  font-size: 13px;
  text-align: center;
}

.figure .ph {
  border-style: dashed;
  border-color: var(--gray-200);
}

.next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}

.next__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 -16px;
  padding: 16px;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.next__link:hover {
  background: var(--gray-50);
}

.next__link--next {
  align-items: flex-end;
  text-align: right;
}

.next__link .label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

/* Case studies end with the next-project nav, so the footer sits closer */
.case + .site-footer {
  margin-top: 64px;
}

/* --------------------------------------------------------------------------
   Lightbox (case-study images)
   -------------------------------------------------------------------------- */

.is-zoomable {
  cursor: zoom-in;
}

.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 40px 40px;
  background: rgba(17, 24, 39, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: zoom-out;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__img {
  /* Transparent images (device mockups) need a surface on the dark overlay */
  background: var(--white);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  cursor: default;
  transform: scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lightbox.is-open .lightbox__img {
  transform: none;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lightbox__close:hover {
  background: var(--gray-100);
}

.lightbox__close svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 640px) {
  .lightbox {
    padding: 72px 12px 24px;
  }

  .lightbox__close {
    top: 16px;
    right: 16px;
  }
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.notfound {
  margin-top: 141px;
}

.notfound .pill {
  margin-top: 32px;
}

/* --------------------------------------------------------------------------
   Large screens: content sits on a white card over a grey canvas
   -------------------------------------------------------------------------- */

@media (min-width: 1920px) {
  body {
    padding: 40px 0;
    background: var(--gray-100);
  }

  .page {
    display: flex;
    flex-direction: column;
    width: 1534px;
    min-height: calc(100vh - 80px);
    margin-inline: auto;
    border-radius: 24px;
    background: var(--white);
    overflow: hidden;
  }

  .page > main {
    flex: 1;
  }

  /* Sticky bar spans the white card, not the grey page */
  .site-header--sticky {
    left: calc(50% - 767px);
    right: auto;
    width: 1534px;
  }
}

/* --------------------------------------------------------------------------
   Tablet
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
  :root {
    --gutter: 40px;
    --label-col: 180px;
  }

  .hero,
  .projects,
  .notfound {
    margin-top: 104px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 24px;
  }

  .stats .stat:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

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


  .site-footer {
    margin-top: 160px;
  }

  .figure figcaption {
    margin-left: calc(var(--label-col) + 8px);
  }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --gutter: 24px;
  }

  body {
    font-size: 14px;
  }

  .site-header {
    padding-top: 24px;
  }

  .site-header--sticky {
    padding: 12px 0;
  }

  .nav--desktop {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  /* Mobile menu: full-screen sheet below the header */
  .mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 24px var(--gutter) 40px;
    background: var(--white);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }

  .mobile-menu .site-header__inner {
    min-height: 40px;
  }

  .mobile-menu__links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 63px;
  }

  .mobile-menu__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 24px;
    line-height: 1.21;
    letter-spacing: -0.01em;
    color: var(--gray-400);
    transform: translateY(8px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
      opacity 0.35s ease, color 0.15s ease;
  }

  .mobile-menu__link[aria-current="page"] {
    color: var(--ink);
  }


  .mobile-menu__footer {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  /* Email on its own line, socials below */
  .mobile-menu__footer a:first-child {
    flex-basis: 100%;
  }

  .menu-open {
    overflow: hidden;
  }

  .menu-open .mobile-menu {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
  }

  .menu-open .mobile-menu__link {
    transform: none;
    opacity: 1;
  }

  .menu-open .mobile-menu__link:nth-child(2) {
    transition-delay: 0.04s;
  }

  .menu-open .mobile-menu__link:nth-child(3) {
    transition-delay: 0.08s;
  }

  .mobile-menu .menu-toggle .icon-open {
    display: none;
  }

  .mobile-menu .menu-toggle .icon-close {
    display: block;
  }

  .display {
    font-size: 24px;
  }

  .display .hl {
    border-radius: 6px;
  }

  .hero {
    margin-top: 63px;
  }

  .hero .display,
  .hero .display strong,
  .case__intro .display {
    font-weight: 400;
  }

  .stats {
    margin-top: 39px;
    column-gap: 24px;
  }

  .stats .stat {
    padding: 0;
    border: 0;
  }

  .projects,
  .notfound {
    margin-top: 63px;
  }

  .feed {
    margin-top: 32px;
  }

  .project-list {
    gap: 48px;
  }

  .project-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .project,
  .project--compact {
    gap: 24px;
  }

  .project__media,
  .project--compact .project__media,
  .media-paytient {
    aspect-ratio: 345 / 187;
  }

  .project__body,
  .project--compact .project__body {
    gap: 16px;
  }

  .project__content {
    gap: 24px;
  }

  .project__stats,
  .project__stats--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .project__stats .stat:nth-child(odd) {
    padding-right: 8px;
  }

  /* Mobile crops */
  .media-intaker img {
    left: 12.46%;
    top: 19.79%;
    width: 86.93%;
  }

  .media-paytient .phones {
    display: none;
  }

  .media-paytient .media-mobile {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .media-knok img {
    top: 5.88%;
    width: 76.8%;
  }

  .site-footer {
    margin-top: 151px;
  }

  /* About */
  .about {
    margin-top: 40px;
    gap: 40px;
  }

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

  .row--portrait {
    margin-bottom: -8px;
  }

  .portrait {
    grid-column: 1;
    width: 146px;
    height: 146px;
  }

  .row--intro {
    gap: 40px;
  }

  .row--intro > .label {
    order: 2;
    min-height: 0;
    margin-bottom: -36px;
  }

  .row--intro .intro {
    display: contents;
  }

  .row--intro .display {
    order: 1;
  }

  .row--intro .intro__body {
    order: 3;
  }

  .intro__body,
  .contacts {
    padding-left: 0;
  }

  .row > .label {
    min-height: 0;
  }

  .item {
    align-items: center;
  }

  /* Mobile keeps the divider under the last row too */
  .list > li:last-child .item {
    border-bottom: 1px solid var(--gray-100);
  }

  .item__main {
    align-items: center;
  }

  .item__title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .item__desc {
    color: var(--gray-400);
  }

  /* Side quests: meta drops under the name */
  .list--quests .item__main {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .list--quests .item__meta {
    text-align: left;
    white-space: normal;
  }

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

  /* Case study */
  .row > .spacer {
    display: none;
  }

  .case {
    margin-top: 32px;
  }

  .case__intro {
    margin-top: 40px;
  }

  .case__subtitle {
    margin-top: 8px;
    font-size: 18px;
  }

  .results-box {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .case__body {
    gap: 56px;
    margin-top: 48px;
  }

  .case__section {
    gap: 32px;
  }

  .case + .site-footer {
    margin-top: 40px;
  }

  .cards,
  .quotes,
  .figure-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .principle {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 16px;
  }

  .timeline .item {
    flex-direction: column;
    gap: 0;
  }

  .figure figcaption {
    margin-left: 0;
  }

}

/* --------------------------------------------------------------------------
   Page transitions (transitions.js)
   -------------------------------------------------------------------------- */

@view-transition {
  navigation: auto;
}

/* The old page fades out, then the new page's blocks rise in one after
   another, top to bottom (transitions.js adds .pt-rise and --pt-i) */
::view-transition-old(root) {
  animation: 0.18s ease both pt-fade-out;
}

::view-transition-new(root) {
  animation: 0.15s ease 0.05s both pt-fade-in;
}

.pt-rise {
  animation: 0.5s cubic-bezier(0.2, 0, 0, 1) both pt-rise-in;
  animation-delay: calc(0.1s + var(--pt-i, 0) * 0.06s);
}

@keyframes pt-fade-out {
  to { opacity: 0; }
}

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

@keyframes pt-rise-in {
  from { opacity: 0; transform: translateY(32px); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  .pt-rise {
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Password-protected case study (unlock.js)
   -------------------------------------------------------------------------- */

.locked {
  max-width: 560px;
  margin-top: 64px;
}

.locked .back {
  margin-bottom: 16px;
}

.locked__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.locked__text {
  margin-top: 6px;
  color: var(--gray-600);
}

.locked__form {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.locked__input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  font: inherit;
  color: var(--ink);
}

.locked__input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.locked__form .pill {
  border: 0;
  cursor: pointer;
}

/* Arrow-only submit, square to match the input height */
.locked__submit {
  justify-content: center;
  width: 40px;
  padding: 0;
  font-family: var(--font-body);
  font-size: 18px;
}

.locked__form .pill:hover {
  background: var(--gray-200);
}

.locked__error {
  margin-top: 12px;
  color: #b42318;
  font-size: 14px;
}
