/* Phone layout fixes for the portfolio (desktop is unchanged). */
html, body { overflow-x: hidden; }
#root [id] { scroll-margin-top: 16px; }
.px-grid span { animation: none !important; }
@media (max-width: 760px) {
  #root [style*="flex:"]:not([role="img"] *):not([aria-hidden="true"] *) { min-width: 0 !important; }
  #root :is([style*="font-size: 92px"], [style*="font-size: 88px"], [style*="font-size: 84px"], [style*="font-size: 76px"], [style*="font-size: 72px"]):not([role="img"] *):not([aria-hidden="true"] *) { font-size: clamp(40px, 11.5vw, 64px) !important; }
  #root [style*="font-size: 64px"]:not([role="img"] *):not([aria-hidden="true"] *) { font-size: 48px !important; }
  #root :is([style*="minmax(360px"], [style*="minmax(300px"], [style*="minmax(280px"]):not([role="img"] *) { grid-template-columns: minmax(0, 1fr) !important; }
  #root :is([style*="padding: 56px"], [style*="padding: 48px"], [style*="padding: 40px"]):not([role="img"] *):not([aria-hidden="true"] *) { padding: 28px 20px !important; }
  /* Before/after mockups: keep their full layout so they scale down as one picture */
  #root :is([style*="width: 1040px; max-width: 100%; height: 600px"], [style*="width: 640px; max-width: 100%; height: 470px"], [style*="width: 600px; max-width: 100%; height: 400px"], [style*="position: relative; width: fit-content; max-width: 100%"]) { max-width: none !important; flex: none !important; }
  /* Evernear test-results table */
  #root [style*="minmax(180px, 1.4fr) repeat(3, 64px) minmax(140px, 1fr)"] { grid-template-columns: minmax(0, 1.2fr) repeat(3, 44px) minmax(0, 1fr) !important; column-gap: 8px !important; }
}
@media (max-width: 760px) {
  /* Mockup panels (marked by the script): lay out at desktop width, then scale down as one picture */
  #root [data-mock] { width: 900px !important; min-width: 900px !important; max-width: none !important; flex: none !important; }
  /* Card thumbnails: keep the desktop card size, then scale down whole */
  #root [data-mock="thumb"] { width: 390px !important; min-width: 390px !important; }
  /* Racked thumbnail: show the full 16:9 frame */
  #root div:has(> .rk-poster) { height: auto !important; aspect-ratio: 16 / 9; }
  #root .rk-poster { height: 100% !important; aspect-ratio: 16 / 9; }
  #root .rk-poster img { object-position: 50% 50% !important; }
  #root .rk-poster > span:not(.rk-play) { display: none !important; }
  #root .rk-poster .rk-play { width: 64px !important; height: 64px !important; margin: -32px 0 0 -32px !important; }
  #root .rk-poster .rk-play svg { width: 26px; height: 26px; }
  /* Text cards that only had a tall minimum on desktop */
  #root :is([style*="min-height: 420px"], [style*="min-height: 440px"], [style*="min-height: 480px"], [style*="min-height: 520px"], [style*="min-height: 560px"]):not([data-mock]):not([role="img"] *):not([aria-hidden="true"] *) { min-height: 0 !important; }
}
@media (max-width: 560px) {
  #root :is([style*="repeat(4, minmax(0px, 1fr))"], [style*="repeat(2, minmax(0px, 1fr))"]):not([role="img"] *):not([aria-hidden="true"] *) { grid-template-columns: minmax(0, 1fr) !important; }
}

/* The Fold popup on phones: page on top, controls underneath */
@media (max-width: 760px) {
  #root div:has(> #fold-issue) { align-items: flex-start !important; padding: 12px !important; }
  #fold-issue { flex-direction: column !important; padding: 16px !important; gap: 18px !important; width: 100% !important; border-radius: 22px !important; }
  #fold-issue > div:nth-child(2) { width: 100% !important; }
}
@media (max-width: 440px) {
  #fold-issue [style*="repeat(4, 90px)"] { zoom: 0.8; }
}
/* Phone header: name + envelope (Get in touch) on top, the four page links in one even row below */
@media (max-width: 760px) {
  #root header:not([role="img"] *):not([aria-hidden="true"] *) { display: grid !important; grid-template-columns: repeat(4, auto) !important; justify-content: space-between !important; align-items: center !important; gap: 12px 4px !important; padding: 4px 0 4px 4px !important; }
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > a:first-child { grid-column: 1 / 4; grid-row: 1; font-size: 18px !important; }
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > nav { display: contents !important; }
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > nav > a { grid-row: 2; text-align: center; padding: 10px 12px !important; font-size: 15px; white-space: nowrap; }
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > nav > a:last-child { grid-row: 1; grid-column: 4; justify-self: end; width: 44px; height: 44px; padding: 0 !important; font-size: 0 !important; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > nav > a:last-child::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat; }
}
@media (max-width: 370px) {
  #root header:not([role="img"] *):not([aria-hidden="true"] *) > nav > a { padding: 10px 8px !important; font-size: 14px; }
}
/* Portrait: a calmer size on phones */
@media (max-width: 760px) {
  #root div:has(> img[alt^="Portrait of Amanda"]) { min-height: 0 !important; height: 260px !important; flex: 0 0 260px !important; }
  #root img[alt^="Portrait of Amanda"] { min-height: 0 !important; }
}
