/* Mobile audit fixes: shared rails, readable navigation, and touch targets. */
@media(max-width:540px){
 :root{--mobile-nav-height:104px;}
 header.nav,body.page--plain header.nav{height:var(--mobile-nav-height)!important;min-height:var(--mobile-nav-height)!important;padding:8px var(--site-gutter) 8px!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:44px 44px!important;align-content:center!important;justify-items:center!important;gap:0!important;}
 header.nav .nav__mark{font-size:24px!important;min-height:44px;justify-content:center;}
 header.nav .nav__links{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;gap:0!important;}
 header.nav .nav__links a{font-size:14px!important;min-width:0;min-height:44px;justify-content:center;}
 header.nav .nav__links a[aria-current="page"]::after{left:12px;right:12px;bottom:5px;}
 .page-inner .contact-wrap{padding-top:var(--mobile-nav-height);}
 .page-inner #main.contact.contact--split{min-height:calc(100svh - var(--mobile-nav-height))!important;}
 .page-inner .plain-top{padding-top:calc(var(--mobile-nav-height) + 48px);}
 .page-inner .hero--single{padding-top:calc(var(--mobile-nav-height) + 48px);}
 .page-inner .cs__sec{scroll-margin-top:calc(var(--mobile-nav-height) + 24px);}
}
@media(max-width:820px){
 .page-inner .contact__links .pill{min-height:44px;display:inline-flex;align-items:center;justify-content:center;}
}

@media(max-width:820px){
 .page-inner .btn{max-width:100%;white-space:normal;height:auto;min-height:56px;padding:14px 24px;text-align:center;line-height:1.35;}
 .page-inner .hero__facts small{font-size:13px;line-height:1.4;}
}
@media(max-width:540px){
 .page-inner .hero--single .hero__facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin-top:32px;}
 .page-inner .hero__facts li{font-size:15px;line-height:1.5;}
 .page-inner .hero__facts li:last-child:nth-child(odd){grid-column:1 / -1;}
}
/* Project cards grow with their text on phones, so type stays readable. */
@media(max-width:820px){
 .page-home #work.hero{height:auto!important;min-height:0!important;display:block;}
 .page-home #work .hero__viewport{position:relative!important;height:auto!important;min-height:0!important;padding:calc(var(--mobile-nav-height,64px) + 32px) 0 40px;display:flex;flex-direction:column;gap:28px;}
 .page-home #work .hero__projects{position:relative;inset:auto;display:block;order:1;}
 .page-home #work .work{padding:0;touch-action:pan-y pinch-zoom;container-type:inline-size;}
 .page-home #work .work__track{align-items:stretch!important;}
 .page-home #work .slide{display:flex;flex-direction:column;}
 .page-home #work .slide .frame{flex:1 1 auto;}
 .page-home #work .slide__meta{align-items:stretch!important;}
 .page-home #work .slide{width:min(calc(100vw - 48px),400px)!important;width:min(calc(100cqw - 48px),400px)!important;}
 .page-home #work .slide .frame{aspect-ratio:auto!important;padding:16px 16px 24px!important;}
 .page-home #work .slide__media{height:auto!important;min-height:0!important;flex:none!important;aspect-ratio:3 / 2!important;}
 .page-home #work .slide__title{font-size:24px!important;line-height:1.15!important;padding:24px 0 0!important;}
 .page-home #work .aside-project-info{padding:16px 0 0!important;}
 .page-home #work .aside-project-info .label{font-size:12px!important;line-height:1.5;letter-spacing:.04em;}
 .page-home #work .aside-project-info .body{font-size:16px!important;line-height:1.5!important;margin-top:12px!important;}
 .page-home #work .slide .slide__detail{margin-top:16px!important;}
 .page-home #work .slide__meta a{font-size:13px!important;line-height:1.4!important;height:auto!important;min-height:48px;padding:12px 10px!important;}
 .page-home #work .hero__facts{order:2;position:relative!important;inset:auto!important;display:grid!important;grid-template-columns:minmax(0,auto) auto!important;justify-content:space-between!important;gap:16px 24px!important;width:calc(100% - 48px)!important;margin:0 auto!important;max-width:400px;align-items:center!important;}
 .page-home #work .hero__facts li{font-size:13px!important;line-height:1.5;max-width:none!important;}
 .page-home #work .hero__facts li.hero__slider-cell{grid-column:1 / -1;grid-row:1;width:100%!important;gap:16px;}
 .page-home #work .hero__slider-cell input[type="range"]{height:44px;}
 .page-home #work .aside-slider-count{font-size:13px;}
 .page-home #work .hero__facts li:first-child{grid-column:1;grid-row:2;}
 .page-home #work .hero__facts li:last-child{grid-column:2;grid-row:2;}
}

/* The blurred project backdrop had no height on phones, so the section rendered flat. */
@media(max-width:820px){
 .page-home #work .hero__viewport{overflow:hidden;isolation:isolate;}
 .page-home #work .hero__blur{position:absolute!important;inset:0!important;height:auto!important;min-height:0!important;z-index:0;overflow:hidden;}
 .page-home #work .hero__blur img{height:100%;object-fit:cover;}
 .page-home #work .hero__projects,.page-home #work .hero__facts{z-index:2;}
}

/* Minimum readable label size and tap heights on phones. */
@media(max-width:820px){
 .hotspot{font-size:12px!important;line-height:1.4;max-width:calc(100% - 48px);white-space:normal!important;letter-spacing:.04em;}
 .page-inner .contact__links .pill{font-size:12px!important;}
}

/* Images declare their real size so the page reserves space before they load. */
:where(img[width][height]){height:auto;}

/* The statement's left rule was removed earlier, which left its two end caps sitting on the first letters. */
.page-inner .statement__body::before,.page-inner .statement__body::after{content:none;}
@media(max-width:540px){
 .page-inner .statement__label{top:calc(var(--mobile-nav-height) + 24px);}
}

/* Homepage intro: same 24px rails as the rest of the site, a larger reading size, and a soft edge where lines leave. */
@media(max-width:820px){
 .statement--landing .statement__pin{padding-left:var(--site-gutter)!important;padding-right:var(--site-gutter)!important;}
 .statement--landing .statement__text{font-size:clamp(20px,5.4vw,24px)!important;line-height:1.26!important;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 40px,#000 calc(100% - 96px),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 40px,#000 calc(100% - 96px),transparent 100%);}
}
@media(prefers-reduced-motion:reduce){
 .statement--landing .statement__text{-webkit-mask-image:none!important;mask-image:none!important;}
}

/* Underlined text links keep their underline tight to the text while the tap area grows to 44px. */
@media(max-width:820px){
 .page-inner .resume__item .link,.page-inner .contact--split .contact__email,.page-inner p > a.link{position:relative;}
 .page-inner .resume__item .link::before,.page-inner .contact--split .contact__email::before,.page-inner p > a.link::before{content:"";position:absolute;left:0;right:0;top:50%;height:44px;transform:translateY(-50%);}
}
/* "Nathan Tran" no longer fits a half-width footer column, so the name gets its own row. */
@media(max-width:820px){
 .footer .footer__top>div:first-child{grid-column:1 / -1;}
 .footer__mark{white-space:nowrap;}
 .footer__tag{max-width:none;}
}

/* Faster, blur-free scroll reveal on phones, only for visitors who have not asked for reduced motion. */
@media(max-width:820px) and (prefers-reduced-motion:no-preference){
 .js [data-in]{filter:none!important;transition-duration:300ms!important;transition-delay:0ms!important;transform:translateY(8px);}
 .js [data-in].is-in{transform:none;}
}

/* Narrowest phones: both card buttons reserve two lines so the row never shifts between projects. */
@media(max-width:360px){
 .page-home #work .slide__meta a{min-height:62px;}
}
/* Inline paragraph links get a slightly shorter tap area so it does not reach into the line above. */
@media(max-width:820px){
 .page-inner p > a.link::before{height:36px;}
}
