/* Home page */
.home main { position: relative; overflow-x: clip; }
.center { display: flex; justify-content: center; }
.card { border: 1px solid var(--line); border-radius: 30px; background: #000; }

.section-title { font-size: 76px; line-height: 1.2; text-align: center; letter-spacing: -0.01em; }
.section-title.sm { font-size: 64px; }
.kicker { text-align: center; font-size: 16px; margin-bottom: 4px; }

/* ---- Hero ---------------------------------------------------------------- */
.hero { position: relative; padding-top: 120px; }
.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.hero-role { margin-top: 36px; font-size: 28px; line-height: 1.2; color: var(--fg-soft); }
.hero-title { margin-top: 36px; font-size: 92px; line-height: .9; color: var(--fg-soft); }

.services {
  position: relative; z-index: 1; max-width: 1440px; margin: 76px auto 0; padding: 0 96px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 64px; align-items: start;
}
.service { position: relative; display: block; margin-top: var(--y, 0); aspect-ratio: 373 / 460; overflow: hidden; isolation: isolate; }
.service-media { position: absolute; inset: -8% 0; }
.service-media img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.68); transform: scale(1); will-change: transform; transition: transform .6s linear, filter .6s linear; }
.service:hover .service-media img { filter: brightness(.82); transform: scale(1.05); }
.service-label {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
  font-family: "Inter", var(--font-sans); font-size: 24px; letter-spacing: 4px; text-transform: uppercase; text-align: center;
  padding-left: 4px; /* balances the trailing letter-spacing so the word is optically centered */
  transform: scale(1); will-change: transform; backface-visibility: hidden; transition: transform .6s linear;
}
.service:hover .service-label { transform: scale(1.08); }

.extra-services { position: relative; z-index: 1; width: fit-content; margin: 26px auto 0; text-align: center; padding-bottom: 12px; border-bottom: 1px solid #2a2a2a; }
.extra-title { font-size: 20px; margin-bottom: 12px; }
.extra-services ul { display: flex; gap: 16px; justify-content: center; font-size: 16px; }

/* ---- Case study tiles ----------------------------------------------------- */
.cases { position: relative; padding: 200px var(--page-pad) 0; isolation: isolate; }
.cases .glow-center { top: 58%; width: 1600px; height: 1100px; opacity: .9; }
.cs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 500px)); justify-content: center; gap: 32px; margin: 60px auto 64px; }
/* Case card — transform-only, linear motion. Logo and tags keep permanent GPU layers
   (will-change) and never animate opacity, so Safari can't re-rasterize/shift them. */
.cs-tile {
  position: relative; display: block;
  width: 100%; height: 0; padding-bottom: 60%;            /* 5:3 without aspect-ratio */
  border-radius: var(--radius-lg); background: var(--tile); overflow: hidden; cursor: pointer;
  box-shadow: 0 0 4px #121212;
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* keeps rounded clip with composited children in Safari */
}
.cs-logo {
  position: absolute; inset: 0; margin: auto; max-width: 66%; pointer-events: none; object-fit: contain; /* raster logos keep their ratio when max-height kicks in */
  /* drawn at hover size (1.1×) and scaled down at rest, so it rasterizes sharp */
  transform: translate3d(0, 0, 0) scale(0.9091); will-change: transform;
  transition: transform .35s linear;
}
.cs-tile:hover .cs-logo, .cs-tile:focus-visible .cs-logo { transform: translate3d(0, 0, 0) scale(1); }
.cs-tags {
  position: absolute; left: 0; right: 0; bottom: 36px; line-height: 24px; display: flex; justify-content: center; gap: 10px; white-space: nowrap; pointer-events: none;
  transform: translate3d(0, 80px, 0); will-change: transform;
  transition: transform .35s linear;
}
.cs-tile:hover .cs-tags, .cs-tile:focus-visible .cs-tags { transform: translate3d(0, 0, 0); }
.cs-tag { font-size: 18px; text-transform: uppercase; color: var(--tag); font-weight: 500; letter-spacing: .02em; }

/* ---- Project modal -------------------------------------------------------- */
dialog.modal {
  border: 0; padding: 0; margin: auto; background: transparent; color: #111;
  width: min(1288px, calc(100vw - 48px), calc((100vh - 48px) * 1288 / 666), calc((100dvh - 48px) * 1288 / 666)); max-width: none; max-height: calc(100dvh - 48px); overflow: visible;
  opacity: 0;
  transition: opacity .3s ease-out;
}
dialog.modal::backdrop { background: rgba(0, 0, 10, .6); opacity: 0; transition: opacity .3s ease-out; }
dialog.modal.is-visible { opacity: 1; }
dialog.modal.is-visible::backdrop { opacity: 1; }
.pm-card {
  position: relative; display: grid; grid-template-columns: 720fr 568fr; background: #fff; border-radius: 20px; overflow: hidden;
  max-height: calc(100dvh - 48px); box-shadow: 0 40px 120px -30px rgba(0,0,0,.6);
}
.pm-close {
  position: absolute; top: 20px; right: 20px; z-index: 3; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; color: #111; background: #f3f3f5; transition: background-color .2s;
}
.pm-close:hover { background: #e6e6ea; }
.pm-close svg { width: 20px; height: 20px; }
/* visual: bands dissolve into the white instead of ending on a hard edge */
.pm-visual {
  position: relative; aspect-ratio: 720 / 666; overflow: hidden; align-self: center;
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%), linear-gradient(180deg, #000 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, #000 86%, transparent 100%), linear-gradient(180deg, #000 88%, transparent 100%);
  mask-composite: intersect;
}
/* device mockups are lifted clear of the bottom fade by gen_home.py (uniform stage offset) */
.pm-visual > * { position: absolute; max-width: none; }
.pm-body { display: flex; padding: clamp(24px, 4.3vw, 56px) clamp(28px, 5vw, 64px) clamp(24px, 4.3vw, 56px) 24px; overflow-y: auto; min-height: 0; max-height: calc(100dvh - 48px); }
.pm-card > * { min-height: 0; }
.pm-inner { max-width: 470px; margin: auto 0; } /* auto margins center it but keep the top reachable when the column scrolls */
.pm-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pm-tag {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #1c1b1f;
  padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.pm-title { font-size: 40px; font-weight: 600; line-height: 1.08; letter-spacing: -0.01em; color: #111; }
.pm-desc { margin-top: 16px; font-size: 17px; line-height: 1.6; color: #4a4a52; }
.pm-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.pm-primary { background: #111; color: #fff; height: 46px; padding: 0 20px; font-size: 16px; border-radius: 10px; }
.pm-primary:hover { background: #000; box-shadow: 0 10px 24px -8px rgba(0,0,0,.45); }
.pm-primary.is-disabled { cursor: default; background: #2a2a2e; }
.pm-primary.is-disabled:hover { box-shadow: none; }
.pm-ext { height: 46px; padding: 0 18px; border: 1px solid #d9d9df; color: #111; border-radius: 10px; font-size: 16px; font-weight: 500; background: #fff; }
.pm-ext:hover { border-color: #111; }
.pm-ext svg { width: 18px; height: 18px; }
.pm-meta { margin: 32px 0 0; padding-top: 24px; border-top: 1px solid #ececf0; display: grid; gap: 18px; }
.pm-meta dt { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a8a94; margin-bottom: 6px; }
.pm-meta dd { margin: 0; font-size: 15px; line-height: 1.55; color: #2a2a30; }

/* ---- Bio ----------------------------------------------------------------- */
.bio { padding: 200px var(--page-pad) 0; max-width: 1440px; margin: 0 auto; }
.bio .section-title { margin-bottom: 64px; }
.bio-grid { display: grid; grid-template-columns: minmax(0, 424fr) minmax(0, 864fr); gap: 24px; }
.bio-left, .bio-right { display: flex; flex-direction: column; gap: 24px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stat { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 68px; border-radius: 999px; }
.stat span { font-size: 14px; color: var(--muted-2); }
.stat strong { font-size: 20px; font-weight: 400; }
.timeline { list-style: none; margin: 0; padding: 20px 40px; display: flex; flex-direction: column; justify-content: space-between; flex: 1; }
.timeline li { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 28px; align-items: center; padding: 10px 0; }
.timeline li + li::before { content: ""; position: absolute; top: -6px; left: 134px; width: 50px; height: 1px; background: #6b6b6b; }
.timeline .years { display: flex; flex-direction: column; align-items: center; font-size: 16px; line-height: 1.35; }
.timeline .years i { width: 1px; height: 10px; background: #fff; }
.timeline h3 { font-size: 20px; line-height: 1.2; }
.timeline p { font-size: 15px; margin-top: 4px; color: var(--muted); }
.edu { height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.edu h3 { font-size: 24px; }
.edu p { font-size: 16px; }
.bio-top { flex: 1; display: grid; grid-template-columns: minmax(0, 396fr) minmax(0, 444fr); gap: 24px; }
.bio-photo { width: 100%; height: 100%; aspect-ratio: 396 / 295; object-fit: cover; border-radius: 24px; }
.bio-card { padding: 24px; }
.bio-card h3 { font-size: 36px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
.bio-card p { font-size: 15px; line-height: 1.3; }
.bio-social { height: 80px; display: grid; grid-template-columns: repeat(4, 1fr); place-items: center; }
.bio-social a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; transition: background-color .2s, transform .2s; }
.bio-social a:hover { background: rgba(255,255,255,.1); }
.bio-social svg { width: 28px; height: 28px; }
.certs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cert { height: 112px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 16px; padding: 0 16px; text-align: center; transition: border-color .25s, background-color .25s; }
.cert:hover { border-color: var(--line-strong); background: #0b0b0b; }
.cert img { width: 32px; height: 32px; object-fit: contain; }

/* ---- Tools --------------------------------------------------------------- */
.stack { position: relative; padding-top: 88px; isolation: isolate; }
.stack .glow-center { top: 50%; width: min(1300px, 140vw); height: 800px; opacity: .85; }
.stack-title { text-align: center; font-size: 36px; margin-bottom: 38px; }
.tools-grid { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tools-row { display: flex; justify-content: center; gap: 10px; }
.cta-row { display: flex; justify-content: center; gap: 10px; margin: 56px 0 38px; }
.cta-row .btn { width: 360px; height: 44px; }

/* ---- Clients ------------------------------------------------------------- */
.clients { padding: 180px var(--page-pad) 0; max-width: 1440px; margin: 0 auto; }
.quotes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 42px; max-width: 1248px; margin: 44px auto 0; }
.quote {
  margin: 0; padding: 30px 32px 32px; border-radius: 8px; background: #000;
  border: 1px solid rgba(120, 136, 255, .25);
  box-shadow: 0 0 22px rgba(88, 104, 214, .45);
}
.quote.is-done { transition: transform .7s var(--ease-snap), box-shadow .5s var(--ease-out); }
.quote.is-done:hover { box-shadow: 0 0 34px rgba(88, 104, 214, .7); }
.quote h3 { font-size: 24px; font-weight: 700; }
.quote-sub { font-size: 18px; margin-top: 4px; }
.stars { display: flex; gap: 6px; color: #fb923c; margin: 16px 0 14px; }
.stars svg { width: 20px; height: 20px; }
.quote blockquote { margin: 0; font-size: 16px; line-height: 1.2; }

/* ---- FAQ ----------------------------------------------------------------- */
.faqs { padding: 220px var(--page-pad) 140px; max-width: 1440px; margin: 0 auto; }
.faq-list { max-width: 1152px; margin: 36px auto 0; display: flex; flex-direction: column; gap: 4px; }
.faq-item { border: 1px solid transparent; border-radius: 20px; transition: border-color .35s, box-shadow .35s, background-color .35s; }
.faq-item.is-open { border-color: rgba(255,255,255,.5); box-shadow: 0 0 18px rgba(120, 136, 255, .45); }
.faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 16px; text-align: left; font-size: 20px; font-weight: 500; line-height: 1.4; }
.faq-q:hover span { opacity: .75; }
.faq-icon { position: relative; flex: none; width: 16px; height: 16px; }
.faq-icon::before, .faq-icon::after { content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.6px; background: #fff; transform: translateY(-50%); transition: transform .35s var(--ease-out); }
.faq-icon::after { transform: translateY(-50%) rotate(90deg); }
.faq-item.is-open .faq-icon::after { transform: translateY(-50%) rotate(0deg); }
.faq-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s var(--ease-out); }
.faq-a > div { opacity: 0; transition: opacity .4s ease; }
.faq-item.is-open .faq-a > div { opacity: 1; transition-delay: .1s; }
.faq-a > div { overflow: hidden; padding: 0 16px; font-size: 14px; font-weight: 500; line-height: 1.4; }
.faq-a p + p { margin-top: 14px; }
.faq-item.is-open .faq-a { grid-template-rows: 1fr; }
.faq-item.is-open .faq-a > div { padding-bottom: 18px; margin-top: -10px; }
.faq-q { padding-left: 16px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1199px) {
  .hero-title { font-size: 76px; }
  .services { padding: 0 40px; gap: 32px; margin-top: 140px; }
  .section-title { font-size: 64px; }
  .tools-grid { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: 960px; margin: 0 auto; }
  .tools-row { display: contents; }
  .bio-card h3 { font-size: 30px; }
  .pm-body { padding: 48px 40px 40px 16px; }
  .pm-title { font-size: 32px; }
}
@media (max-width: 1023px) {
  .bio-grid { grid-template-columns: 1fr; }
  .timeline { padding: 24px; }
  .timeline li + li::before { left: 84px; }
  dialog.modal { width: min(640px, calc(100vw - 32px)); }
  .pm-card { grid-template-columns: 1fr; overflow-y: auto; }
  .pm-body { padding: 8px 28px 32px; overflow: visible; max-height: none; }
  .pm-visual { -webkit-mask-image: linear-gradient(180deg, #000 86%, transparent 100%); mask-image: linear-gradient(180deg, #000 86%, transparent 100%); }
  .pm-close { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
  /* the card is the scroller here: keep the close button pinned while the content scrolls */
  .pm-close { position: sticky; top: 16px; right: auto; grid-area: 1 / 1 / 3 / 2; justify-self: end; align-self: start; margin: 16px 16px 0 0; }
  .pm-visual { grid-area: 1 / 1; }
  .pm-body { grid-area: 2 / 1; }
}
@media (max-width: 809px) {
  .hero { padding-top: 110px; }
  .hero-role { font-size: 22px; margin-top: 24px; }
  .hero-title { font-size: 48px; margin-top: 20px; line-height: 1; }
  .services { grid-template-columns: 1fr; max-width: 420px; padding: 0 20px; gap: 20px; margin-top: 72px; }
  .service { margin-top: 0; aspect-ratio: 16 / 11; }
  .service-label { font-size: 20px; }
  .extra-services { margin-top: 28px; padding: 0 12px 12px; }
  .extra-services ul { flex-wrap: wrap; gap: 8px 14px; }
  .section-title, .section-title.sm { font-size: 44px; }
  .cases { padding-top: 120px; }
  .cs-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 36px auto 40px; max-width: 480px; }
  .cs-logo { max-height: 70px; }
  .cs-tags { bottom: 20px; }
  .cs-tag { font-size: 15px; }
  /* touch devices: show tags without hover */
  @media (hover: none) {
    .cs-tags { transform: none; }
    .cs-logo { transform: translate3d(0, 0, 0) scale(0.9091); }
  }
  .bio { padding-top: 120px; }
  .bio .section-title { margin-bottom: 36px; }
  .bio-top, .certs { grid-template-columns: 1fr; }
  .bio-card h3 { font-size: 28px; }
  .timeline h3 { font-size: 19px; }
  .timeline li { gap: 18px; grid-template-columns: 48px 1fr; }
  .timeline li + li::before { left: 66px; }
  .cert { height: 84px; }
  .stack-title { font-size: 28px; }
  .cta-row { flex-direction: column; align-items: stretch; max-width: 420px; margin: 40px auto 30px; }
  .cta-row .btn { width: 100%; }
  .clients { padding-top: 120px; }
  .quotes { grid-template-columns: 1fr; gap: 24px; margin-top: 28px; }
  .quote { padding: 24px; }
  .faqs { padding: 140px var(--page-pad) 96px; }
  .faq-q { font-size: 17px; padding: 16px 12px; }
  .faq-a > div { padding: 0 12px; }
  .pm-title { font-size: 28px; }
  .pm-desc { font-size: 16px; }
  .pm-cta .btn { flex: 1 1 auto; }
  .pm-body { padding: 4px 20px 28px; }
  dialog.modal { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .pm-card { max-height: calc(100dvh - 24px); }
}

/* solid brand panels (no screenshots) end on a clean edge instead of fading */
.pm-visual.is-full { -webkit-mask-image: none; mask-image: none; align-self: stretch; }

/* Involvement / tech stack as chips */
.pm-meta dd { margin: 0; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pm-chip {
  font-size: 13px; line-height: 1; font-weight: 500; color: #25252b;
  padding: 8px 11px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.pm-chip--tool { background: #f4f4f6; box-shadow: inset 0 0 0 1px #e6e6ea; color: #3a3a42; }
.pm-meta { gap: 20px; }
@media (max-width: 809px) { .pm-chip { font-size: 12.5px; padding: 7px 10px; } }

/* Brand panels (projects without a case-study page): centered logo lockup */
.pm-visual.is-full { container-type: inline-size; }
.pm-lockup {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 4cqw;
}
.pm-mark { position: static; height: 20cqw; width: auto; flex: none; }
.pm-word { position: static; color: #fff; font-size: 8.5cqw; font-weight: 600; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; }
/* brand panels fill their grid column exactly (container sizing must not drive the width) */
.pm-visual.is-full { aspect-ratio: auto; width: 100%; height: 100%; min-height: 100%; }
@media (max-width: 1023px) { .pm-visual.is-full { aspect-ratio: 720 / 500; height: auto; } }
.timeline .nw { white-space: nowrap; }

/* Phones: pop-up becomes a bottom sheet — full width, scrolls inside, clears the home indicator */
@media (max-width: 809px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: calc(100dvh - 12px); }
  .pm-card { border-radius: 20px 20px 0 0; max-height: calc(100dvh - 12px); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .pm-body { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .pm-visual.is-full { aspect-ratio: 16 / 9; }
}

/* Phones: tools as an even grid of compact cards; bio photo keeps its landscape crop */
@media (max-width: 809px) {
  .tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; max-width: 560px; }
  .tools-grid .tool { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; height: 100%; }
  .tools-grid .tool img, .tools-grid .tool .tool-icon { width: 36px; height: 36px; border-radius: 8px; }
  .tools-grid .tool h3 { font-size: 15px; line-height: 20px; }
  .tools-grid .tool p { font-size: 12.5px; line-height: 17px; margin-top: 2px; }
  .tools-grid .tool .tool-icon { border: 1px solid #2b2b2b; }
  .bio-photo { height: auto; aspect-ratio: 396 / 295; }
}
