/* Final layout refinements and ultrawide-screen handling */
.case-card {
  border: 1px solid #d7d4cc;
}

.intro-kicker {
  margin: 0 0 .85rem !important;
  color: var(--red) !important;
  font-size: .62rem !important;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.intro-copy h1 em {
  color: var(--red);
  font-weight: 400;
}

.intro-copy > p:last-child {
  max-width: 650px;
  font-size: clamp(.9rem, 1.05vw, 1.02rem);
}

/* Compact editorial opening: headline and text stay balanced at every width. */
.portfolio-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.intro-copy {
  display: grid;
  grid-template-columns: minmax(420px, .95fr) minmax(300px, .65fr);
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: clamp(3rem, 7vw, 8rem);
}

.intro-kicker {
  grid-column: 1 / -1;
}

.intro-copy h1 {
  grid-column: 1;
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.8rem, 3.8vw, 4.8rem);
  line-height: .96;
  letter-spacing: -.04em;
}

.intro-copy > p:last-child {
  grid-column: 2;
  max-width: 520px;
  margin-bottom: .35rem;
}

.project-tools {
  width: 100%;
  grid-template-columns: minmax(260px, 1fr) auto;
}

@media (max-width: 1200px) {
  .intro-copy {
    grid-template-columns: 1fr;
    row-gap: 1.1rem;
  }

  .intro-copy h1,
  .intro-copy > p:last-child {
    grid-column: 1;
  }

  .intro-copy > p:last-child {
    max-width: 650px;
    margin-bottom: 0;
  }
}

@media (max-width: 600px) {
  .portfolio-intro { gap: 1.5rem; }
  .intro-copy { display: block; }
  .intro-kicker { margin-bottom: .7rem !important; }
  .intro-copy h1 { margin-bottom: 1rem; font-size: clamp(2.25rem, 11vw, 3rem); line-height: .98; }
}

/* The Snurr ad is a real interactive preview; its choices need pointer input. */
.snurr-case.live-preview > iframe {
  pointer-events: auto;
}

.case-image.live-preview > iframe {
  overflow: hidden;
  scrollbar-width: none;
}

.case-image.live-preview > iframe::-webkit-scrollbar {
  display: none;
}

.desktop-only-notice {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  place-content: center;
  padding: clamp(2rem, 7vw, 5rem);
  color: #f8f5ee;
  background:
    radial-gradient(circle at 82% 18%, rgba(223,73,44,.22), transparent 30%),
    #22221f;
  text-align: center;
}

.desktop-only-notice > .desktop-only-symbol {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 1.5rem;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font-size: 1.2rem;
}

.desktop-only-notice .eyebrow { color: #ff765e; }
.desktop-only-notice h3 { margin: .55rem 0 1.2rem; font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.8rem); font-weight: 400; line-height: .98; }
.desktop-only-notice > p:last-child { max-width: 560px; margin: 0 auto; color: rgba(255,255,255,.65); font-size: .82rem; line-height: 1.65; }
.project-live-frame.desktop-unavailable::before { display: none; }
.project-live-frame.desktop-unavailable .desktop-only-notice { display: grid; }
.project-dialog.desktop-project-unavailable .project-dialog-details > a { display: none; }

.project-dialog-details > p {
  max-width: 760px;
  line-height: 1.72;
}

/* Stable project modal: one internal scroll area and an anchored close button. */
.project-dialog {
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  overflow: auto;
  border-radius: .8rem;
  overscroll-behavior: contain;
}

.project-dialog-close {
  position: sticky;
  z-index: 10;
  top: 1rem;
  float: right;
  margin: 1rem 1rem -3.25rem 0;
}

.project-browser {
  clear: both;
}

.project-dialog-info {
  min-height: 220px;
}

.project-dialog-details > p {
  color: rgba(255,255,255,.7);
}

/* Soft modal motion with the preview and project details arriving in sequence. */
.project-dialog[open],
.contact-dialog[open] {
  animation: dialog-enter .46s cubic-bezier(.22,.75,.2,1) both;
  transform-origin: center 42%;
}

.project-dialog[open]::backdrop,
.contact-dialog[open]::backdrop {
  animation: dialog-backdrop-enter .32s ease-out both;
}

.project-dialog[open] .project-browser,
.contact-dialog[open] .contact-intro {
  animation: dialog-content-enter .48s .05s cubic-bezier(.22,.75,.2,1) both;
}

.project-dialog[open] .project-dialog-info,
.contact-dialog[open] .contact-form-panel {
  animation: dialog-content-enter .5s .12s cubic-bezier(.22,.75,.2,1) both;
}

.project-dialog.is-closing,
.contact-dialog.is-closing {
  animation: dialog-leave .22s ease-in both;
}

.project-dialog.is-closing::backdrop,
.contact-dialog.is-closing::backdrop {
  animation: dialog-backdrop-leave .22s ease-in both;
}

.project-dialog.is-opening,
.contact-dialog.is-opening {
  overflow: hidden;
  scrollbar-width: none;
}

.project-dialog.is-opening::-webkit-scrollbar,
.contact-dialog.is-opening::-webkit-scrollbar {
  display: none;
}

@keyframes dialog-enter {
  from { opacity: 0; transform: scale(.975); }
}

@keyframes dialog-content-enter {
  from { opacity: 0; clip-path: inset(0 0 7% 0); }
}

@keyframes dialog-backdrop-enter {
  from { opacity: 0; backdrop-filter: blur(0); }
}

@keyframes dialog-leave {
  to { opacity: 0; transform: scale(.985); }
}

@keyframes dialog-backdrop-leave {
  to { opacity: 0; backdrop-filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  .project-dialog[open],
  .contact-dialog[open],
  .project-dialog[open]::backdrop,
  .contact-dialog[open]::backdrop,
  .project-dialog[open] .project-browser,
  .project-dialog[open] .project-dialog-info,
  .contact-dialog[open] .contact-intro,
  .contact-dialog[open] .contact-form-panel {
    animation: none !important;
  }
}

@media (max-width: 760px) {
  .project-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  .project-dialog-close {
    top: .75rem;
    margin: .75rem .75rem -3rem 0;
  }

  .project-browser {
    padding: .65rem .65rem 0;
  }

  .browser-bar {
    padding-right: 3rem;
  }
}

@media (max-width: 760px) {
  .banner-studio-card {
    height: 450px !important;
  }

  .banner-studio-card > a {
    grid-template-rows: 270px minmax(0, 1fr) !important;
  }

  .banner-studio-card .case-description {
    margin-block: .55rem;
  }

  .desktop-only-notice { padding: 2rem 1.35rem; }
  .desktop-only-notice > .desktop-only-symbol { width: 44px; height: 44px; margin-bottom: 1rem; }
  .desktop-only-notice h3 { font-size: clamp(1.75rem, 8vw, 2.5rem); }
  .desktop-only-notice > p:last-child { font-size: .74rem; }
}

@media (max-width: 520px) {
  .banner-studio-card { height: 420px !important; }
  .banner-studio-card > a { grid-template-rows: 235px minmax(0, 1fr) !important; }
}

@media (min-width: 1600px) {
  .portfolio-layout {
    grid-template-columns: clamp(340px, 19vw, 390px) minmax(0, 1fr);
  }

  .topbar,
  .portfolio-section {
    width: min(100%, 1960px);
    margin-inline: auto;
    padding-inline: clamp(64px, 4.5vw, 100px);
  }

  .portfolio-intro {
    grid-template-columns: minmax(320px, .7fr) minmax(0, 1.3fr);
    gap: clamp(3rem, 5vw, 7rem);
    padding-bottom: 2.7rem;
  }

  .intro-copy p {
    max-width: 600px;
    font-size: .94rem;
  }

  .case-grid {
    gap: 24px;
  }

  .case-copy {
    padding: 1.25rem 1.4rem;
  }

  .case-description {
    font-size: .74rem;
  }
}

@media (min-width: 2200px) {
  .portfolio-layout {
    grid-template-columns: 400px minmax(0, 1fr);
  }

  .profile {
    padding-inline: 58px;
  }

  .topbar,
  .portfolio-section {
    padding-inline: 92px;
  }

  .case-card:not(.case-compact) {
    grid-row: span 26;
  }

  .case-card:not(.case-compact) > a {
    grid-template-rows: 520px minmax(0, 1fr);
  }

  .case-copy h2 {
    font-size: 1.6rem;
  }

  .case-feature .case-copy h2 {
    font-size: 2.15rem;
  }

  .project-dialog {
    width: min(1400px, calc(100% - 64px));
  }

  .project-dialog-close {
    right: max(calc((100vw - 1400px) / 2 + 1rem), 2rem);
  }

  .project-live-frame {
    height: min(62vh, 760px);
  }
}

@media (min-width: 3000px) {
  .topbar,
  .portfolio-section {
    width: 2040px;
  }
}

/* Narrow laptops: keep useful card width beside the profile panel. */
@media (min-width: 901px) and (max-width: 1050px) {
  .case-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .case-card:not(.case-compact),
  .case-feature {
    height: 620px;
    grid-column: auto;
    grid-row: auto;
  }

  .case-card:not(.case-compact) > a,
  .case-feature > a {
    grid-template-rows: 445px minmax(0, 1fr);
  }

  .case-compact {
    grid-column: auto;
  }
}

/* Tablets: replace the tall sidebar with a compact horizontal profile. */
@media (max-width: 900px) {
  .portfolio-layout {
    display: block;
  }

  .profile {
    position: relative;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    overflow: visible;
    text-align: left;
  }

  .profile-main { display: contents; }
  .portrait { width: 66px; }
  .signature { width: 104px; max-height: 65px; margin: 0; }
  .role,
  .profile-divider,
  .profile-copy,
  .profile-meta { display: none; }

  .contact-button {
    width: auto;
    align-self: center;
    margin: 0;
    padding: .68rem .85rem;
    gap: .7rem;
  }

  .topbar {
    height: 58px;
    padding-inline: 1.5rem;
  }

  .portfolio-section {
    padding: 1.9rem 1.5rem 4rem;
  }

  .portfolio-intro {
    gap: 1.5rem;
  }

  .project-tools {
    grid-template-columns: 1fr;
  }

  .filters {
    overflow-x: auto;
    padding-bottom: .2rem;
    scrollbar-width: none;
  }

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

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

  .case-card:not(.case-compact),
  .case-feature {
    height: 570px;
    grid-column: auto;
    grid-row: auto;
  }

  .case-card:not(.case-compact) > a,
  .case-feature > a {
    grid-template-rows: 400px minmax(0, 1fr);
  }

  .case-card.banner-studio-card {
    grid-column: 1 / -1;
    height: 510px !important;
  }

  .banner-studio-card > a {
    grid-template-rows: 330px minmax(0, 1fr) !important;
  }

  .case-feature .case-copy {
    display: flex;
    padding: 1.1rem 1.2rem;
  }

  .case-feature .case-copy h2 { font-size: 1.55rem; }
  .case-feature .case-description { font-size: .72rem; }
  .project-dialog-info { grid-template-columns: 1fr; gap: 1.2rem; }
  .project-live-frame { height: min(52vh, 460px); }
  .project-dialog-close { right: 1.4rem; top: 1.4rem; }
}

/* Phones: one readable card per row and compact controls. */
@media (max-width: 600px) {
  .profile {
    grid-template-columns: 58px 1fr auto;
    padding-inline: 1rem;
  }

  .portrait { width: 55px; }
  .signature { width: 88px; }
  .topbar { padding-inline: 1.1rem; }
  .topbar nav { gap: 1.25rem; }
  .portfolio-section { padding: 1.8rem 1.1rem 3.5rem; }
  .intro-copy h1 { font-size: clamp(2.35rem, 12vw, 3.2rem); }
  .intro-copy h1 br { display: none; }

  .filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .45rem;
    overflow: visible;
  }

  .filters button {
    min-width: 0;
    padding: .72rem .3rem;
    white-space: nowrap;
    font-size: clamp(.62rem, 2.8vw, .72rem);
  }

  .case-grid { grid-template-columns: 1fr; gap: 16px; }

  .case-card:not(.case-compact),
  .case-feature {
    height: 600px;
  }

  .case-card:not(.case-compact) > a,
  .case-feature > a {
    grid-template-rows: 430px minmax(0, 1fr);
  }

  .banner-studio-card {
    height: 420px !important;
  }

  .banner-studio-card > a {
    grid-template-rows: 235px minmax(0, 1fr) !important;
  }

  .case-copy { padding: 1rem 1.05rem; }
  .case-description { margin-block: .6rem; }
}

@media (max-width: 360px) {
  .profile {
    grid-template-columns: 48px 1fr auto;
    gap: .65rem;
    padding-inline: .75rem;
  }

  .portrait { width: 48px; }
  .signature { width: 72px; }
  .contact-button { padding: .58rem .65rem; font-size: .69rem; }
  .contact-button span { display: none; }
  .topbar nav a,
  .topbar nav button { font-size: .75rem; }
  .portfolio-section { padding-inline: .8rem; }
}

/* Content-driven project cards. Keep this after the legacy breakpoint rules. */
.case-grid {
  grid-auto-flow: row dense;
  grid-auto-rows: auto;
  align-items: stretch;
}

.case-card,
.case-card:not(.case-compact),
.case-feature,
.case-compact,
.banner-studio-card {
  height: auto !important;
  min-height: 0;
  grid-row: auto !important;
  align-self: stretch;
}

.case-card > a,
.case-card:not(.case-compact) > a,
.case-feature > a,
.case-compact > a,
.banner-studio-card > a {
  height: auto;
  display: block;
}

.case-card .case-image,
.case-card:not(.case-compact) .case-image,
.case-compact .snurr-case {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
}

.case-card .case-copy,
.case-feature .case-copy,
.case-compact .case-copy {
  min-height: 158px;
  display: flex;
  flex-direction: column;
  padding: 1.05rem 1.15rem;
}

.case-feature .case-copy h2,
.case-compact .case-copy h2 {
  font-size: clamp(1.25rem, 1.55vw, 1.65rem);
}

@media (min-width: 1181px) {
  .case-feature {
    grid-column: span 2;
  }

  .case-card.case-feature .case-image {
    aspect-ratio: 2.5 / 1;
  }

  .case-feature .case-copy {
    min-height: 142px;
    display: grid;
    grid-template-columns: .75fr 1.25fr;
    grid-template-rows: auto 1fr;
    column-gap: 2.5rem;
    padding: 1.2rem 1.4rem;
  }

  .case-feature .case-copy h2 { grid-column: 1; grid-row: 1; }
  .case-feature .case-subtitle { grid-column: 1; grid-row: 2; }
  .case-feature .case-description { grid-column: 2; grid-row: 1; margin-top: 0; }
  .case-feature .case-meta { grid-column: 2; grid-row: 2; align-self: end; }

  .case-compact {
    grid-column: auto;
  }
}

@media (min-width: 901px) and (max-width: 1050px) {
  .case-feature { grid-column: auto; }
  .case-card.case-feature .case-image { aspect-ratio: 16 / 9; }
}

@media (max-width: 900px) {
  .case-card.banner-studio-card {
    grid-column: 1 / -1;
  }

  .case-card.banner-studio-card .case-image {
    aspect-ratio: 2.1 / 1;
  }
}

@media (max-width: 600px) {
  .case-card .case-image,
  .case-card:not(.case-compact) .case-image,
  .case-compact .snurr-case,
  .case-card.banner-studio-card .case-image {
    aspect-ratio: 4 / 3;
  }

  .case-card .case-copy,
  .case-feature .case-copy,
  .case-compact .case-copy {
    min-height: 0;
  }

  .case-feature { grid-column: auto; }
}

/* Final intro layout override — must follow all legacy widescreen rules. */
.portfolio-intro {
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 2.5vw, 2.4rem);
}

.intro-copy {
  grid-template-columns: minmax(460px, 1.05fr) minmax(320px, .75fr);
  column-gap: clamp(3rem, 6vw, 7rem);
}

.intro-copy h1 {
  max-width: 820px;
  font-size: clamp(3rem, 3.3vw, 4.35rem);
  line-height: 1.19;
  text-wrap: balance;
}

.intro-copy h1 em {
  display: block;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

.intro-copy > p:last-child {
  align-self: end;
  max-width: 540px;
  margin: 0 0 .3rem;
}

.project-tools {
  grid-template-columns: minmax(300px, 1fr) auto;
}

@media (min-width: 1800px) {
  .intro-copy {
    grid-template-columns: minmax(620px, 1fr) minmax(420px, .72fr);
  }

  .intro-copy h1 {
    font-size: clamp(3.7rem, 3.2vw, 4.75rem);
  }
}

@media (max-width: 1200px) {
  .intro-copy {
    grid-template-columns: 1fr;
    row-gap: 1.1rem;
  }

  .intro-copy h1,
  .intro-copy > p:last-child {
    grid-column: 1;
  }

  .intro-copy > p:last-child {
    max-width: 650px;
    margin: 0;
  }

  .project-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .intro-copy {
    display: block;
  }

  .intro-copy h1 {
    margin-bottom: 1rem;
    font-size: clamp(2.25rem, 11vw, 3rem);
    line-height: 1.19;
  }

  .intro-copy h1 em {
    font-size: .9em;
  }
}

/* Lighter expertise labels. */
.case-meta {
  font-weight: 400;
}

@media (min-width: 1181px) {
  .banner-studio-card .case-copy h2 {
    margin-top: .55rem;
  }
}
