/* Design tokens from Figma */
:root {
  --text-strong: #333333;
  --text: #0a0a0a;
  --text-muted: #6f6f6f;
  --accent: #1100a8;
  --divider: #d3d3d3;
  --nav-bg: #fbf9f9;
  --imessage-blue: #0b84fe;
  --bg: #ffffff;
  --content-width: 926px;
  --font: "Work Sans", system-ui, sans-serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
img { display: block; }

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  height: 48px;
  background: var(--nav-bg);
}

.site-nav a {
  color: var(--text);
  font-weight: 300;
  font-size: 16px;
  text-decoration: none;
}

.site-nav a:hover { text-decoration: underline; }

/* Layout */
.container {
  max-width: calc(var(--content-width) + 48px);
  margin: 0 auto;
  padding: 80px 24px 48px;
}

/* Intro */
.intro {
  padding-bottom: 48px;
  border-bottom: 1px solid var(--divider);
}

.avatar {
  position: relative;
  z-index: 3;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 32px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.avatar img { pointer-events: none; }

.avatar img {
  width: 75.97px;
  height: 75.97px;
  margin: -5.84px;
  object-fit: cover;
}

.intro-text {
  max-width: 878px;
  color: var(--text-strong);
  font-size: 24px;
  font-weight: 500;
  line-height: normal;
}

.intro-text em {
  font-weight: 400;
  font-style: italic;
}

/* Rotating job title in the headline */
.role-rotator {
  display: inline-block;
  white-space: nowrap;
  vertical-align: bottom;
  transition: width 0.4s ease;
}

.role-text {
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.role-text em { color: var(--accent); }

.role-text.is-leaving {
  opacity: 0;
  transform: translateY(-0.5em);
}

.role-text.is-entering {
  opacity: 0;
  transform: translateY(0.5em);
  transition: none;
}

.location {
  margin-top: 20px;
  font-size: 16px;
  font-weight: 300;
}

/* Projects */
.projects {
  display: flex;
  flex-direction: column;
  gap: 80px;
  margin-top: 80px;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 32px;
  color: inherit;
  text-decoration: none;
}

.project-head {
  display: grid;
  grid-template-columns: 1fr minmax(0, 570px);
  align-items: center;
  gap: 24px;
}

.project-title {
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 400;
}

.project-years {
  margin-top: 20px;
  color: var(--accent);
  font-size: 12px;
}

.project-desc {
  color: var(--text-muted);
  font-size: 16px;
}

/* Project cards: children are placed in Figma's 926×364 coordinates
   and scaled as percentages, so the collage keeps its shape at any width. */
.card {
  position: relative;
  aspect-ratio: 926 / 364;
  border-radius: 20px;
  overflow: hidden;
}

.card--blue { background: #c3e7ff; }
.card--pink { background: #ffecec; }
.card--mint { background: #f8fbf9; }

.shot {
  position: absolute;
  left: calc(var(--x) / 926 * 100%);
  top: calc(var(--y) / 364 * 100%);
  width: calc(var(--w) / 926 * 100%);
  height: calc(var(--h) / 364 * 100%);
  overflow: hidden;
}

.shot img {
  position: absolute;
  max-width: none;
}

.shot--glow { box-shadow: 0 0 7.8px 3px rgba(107, 151, 254, 0.25); }
.shot--soft { box-shadow: 0 0 6.5px rgba(0, 0, 0, 0.11); }

.card-tint {
  position: absolute;
  inset: 0;
  background: rgba(221, 221, 221, 0.2);
}

/* The logo SVG includes its drop-shadow padding (157.4×57.4 around a 138×38 mark) */
.card-logo {
  position: absolute;
  right: calc(10.3 / 926 * 100%);
  bottom: calc(10.3 / 364 * 100%);
  width: calc(157.4 / 926 * 100%);
  height: auto;
}

.card-media {
  position: absolute;
  inset: 0;
}

/* Hover: zoom the thumbnail slightly inside the card */
a.project .card-media { transition: transform 0.4s ease; }
a.project:hover .card-media,
a.project:focus-visible .card-media { transform: scale(1.04); }
a.project:hover .project-title { text-decoration: underline; }

/* Work-in-progress card: iOS-style message bubble with a typewriter effect */
.project--wip { cursor: pointer; }
.project--wip:focus-visible { outline: none; }
.project--wip:focus-visible .card { outline: 2px solid var(--imessage-blue); outline-offset: 4px; }

.project-meta { position: relative; }

/* Floats just below the year, so it doesn't push the layout around */
.wip-bubble {
  position: absolute;
  z-index: 2;
  left: 24px;
  top: calc(100% + 12px);
  display: grid;
  width: max-content;
  max-width: 260px;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--imessage-blue);
  color: #fff;
  font-size: 16px;
  line-height: 1.35;
  opacity: 0;
  transform: scale(0.6);
  transform-origin: 0 0;
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.project--wip.is-open .wip-bubble {
  opacity: 1;
  transform: scale(1);
}

/* iMessage tail: a blue curve, then a card-colored curve that carves it */
.wip-bubble::before,
.wip-bubble::after {
  content: "";
  position: absolute;
  bottom: 0;
  height: 20px;
}

.wip-bubble::before {
  left: -7px;
  width: 20px;
  background: var(--imessage-blue);
  border-bottom-right-radius: 16px 14px;
}

.wip-bubble::after {
  left: -26px;
  width: 26px;
  background: var(--bg);
  border-bottom-right-radius: 10px;
}

/* Ghost text reserves the final size so the bubble doesn't grow while typing */
.wip-bubble-ghost,
.wip-bubble-text { grid-area: 1 / 1; }
.wip-bubble-ghost { visibility: hidden; }

.wip-bubble-text.is-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: caret-blink 0.8s steps(1) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wip-bubble { transition: opacity 0.2s ease; }
}

/* ---------- Case study pages ---------- */
.case { padding-bottom: 216px; }

.case-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
}

.case-nav a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 16px;
  text-decoration: none;
}

.case-nav a:hover { text-decoration: underline; }
.case-nav img.flip { transform: scaleX(-1); }

/* Info notice (blue bar on top) */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 20px 20px 17px 16px;
  border: 1px solid #aad2ff;
  border-top: 0;
  border-radius: 4px;
  background: #eef6ff;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
}

.notice::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #235ae4;
}

.notice img { flex: none; }

.notice p {
  color: #2e2e32;
  font-size: 14px;
  line-height: 21px;
}

.case-head .project-title {
  font-size: 20px;
  font-weight: 700;
}

.case-head .project-years { color: var(--text-muted); }
.case-head strong { color: var(--text); font-weight: 400; }

.case-hero {
  margin: 40px 0 0;
}

.case-hero img {
  width: 100%;
  aspect-ratio: 926 / 364;
  object-fit: cover;
  border-radius: 20px;
}

.case-hero figcaption {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.case-section { margin-top: 60px; }

.case-section h2 {
  margin-bottom: 20px;
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 700;
}

.challenges {
  margin: 0;
  padding-left: 24px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.challenges li + li { margin-top: 12px; }

.challenges strong { color: var(--text); font-weight: 400; }

.features {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

.feature h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.feature p,
.case-muted {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.case-contact { font-size: 16px; }
.case-contact a { color: var(--accent); text-decoration: none; }
.case-contact a:hover { text-decoration: underline; }

/* Body copy on case study pages */
.case-text {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.case-text + .case-text { margin-top: 24px; }

.research-steps { margin-top: 40px; gap: 40px; }

/* Browser mockup around a product screenshot */
.browser-frame {
  max-width: 850px;
  margin: 58px auto 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31, 46, 77, 0.18);
}

.browser-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  background: #f2f5fa;
}

.browser-dots {
  position: absolute;
  left: 13px;
  display: flex;
  gap: 5px;
}

.browser-dots i {
  width: 7.3px;
  height: 7.3px;
  border-radius: 50%;
  background: #ff5e57;
}

.browser-dots i:nth-child(2) { background: #ffbd2e; }
.browser-dots i:nth-child(3) { background: #33c75c; }

.browser-address {
  width: 60%;
  height: 20.4px;
  padding-left: 12px;
  border-radius: 4.86px;
  background: #fff;
  color: #596375;
  font: 7.9px/20.4px Inter, system-ui, sans-serif;
}

.browser-shot {
  width: 100%;
  aspect-ratio: 851 / 462;
  object-fit: cover;
  object-position: top;
}

/* Two-column grid of grey cards */
.case-section .h2-loose { margin-bottom: 32px; }

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 24px;
}

.info-card {
  min-height: 162px;
  padding: 32px 38px;
  border-radius: 20px;
  background: #f7f7f7;
}

.info-card h3,
.solution-text h3 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.info-card p,
.solution-text p {
  max-width: 375px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

/* Captioned images */
.case-figure {
  margin: 40px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.case-figure figcaption {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.case-figure img { width: 100%; height: auto; }

/* Image cropped the same way as in Figma */
.crop {
  position: relative;
  aspect-ratio: var(--ratio);
  overflow: hidden;
}

.crop img {
  position: absolute;
  max-width: none;
}

.flow-diagram {
  max-width: 850px;
  margin: 32px auto 0;
}

/* Solution: text on the left, visual on the right */
.solution-rows {
  display: flex;
  flex-direction: column;
  gap: 48px;
  margin-top: 60px;
}

.solution-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.solution-row .solution-text p { max-width: none; }
.solution-text p + p { margin-top: 24px; }

.next-up { margin-top: 40px; }
.next-up p { max-width: none; }

.case-section > .case-contact { margin-top: 40px; }

/* Phones and small tablets */
@media (max-width: 760px) {
  .container { padding: 48px 16px 40px; }
  .case { padding-bottom: 96px; }
  .case-section { margin-top: 48px; }
  .case-hero img { border-radius: 12px; }
  .card-grid,
  .solution-row { grid-template-columns: 1fr; }
  .card-grid { gap: 16px; }
  .info-card { min-height: 0; padding: 24px; }
  .solution-rows { gap: 40px; margin-top: 40px; }
  .browser-frame { margin-top: 40px; }
  .intro-text { font-size: 20px; }
  .projects { gap: 56px; margin-top: 48px; }
  .project { gap: 20px; }
  .project-head { grid-template-columns: 1fr; gap: 12px; }
  .project-years { margin-top: 8px; }
  .card { border-radius: 12px; }
  /* Single-column layout: open the bubble in place instead of covering the description */
  .wip-bubble {
    position: relative;
    top: auto;
    left: 0;
    margin-left: 12px;
    max-height: 0;
    padding: 0 14px;
    font-size: 14px;
    transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
      max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  }
  .project--wip.is-open .wip-bubble {
    max-height: 160px;
    margin-top: 12px;
    padding: 8px 14px;
  }
}
