/* The introduction flows normally; only the case rail is held while reading. */
#work {
  --work-support-size: clamp(12px, 1.08vw, 16px);
  height: auto !important;
}
#work .work-stage {
  position: relative !important;
  top: auto !important;
  display: block;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
  padding-top: max(108px, var(--work-header-space, 108px));
  padding-bottom: 90px;
}
#work .section-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 48px;
  flex-shrink: 0;
}
#work .work-intro { min-width: 0; }
#work #work-title {
  font-size: clamp(28px, 3.2vw, 54px);
  line-height: 1.32;
  letter-spacing: -.055em;
}
#work .work-title-mask { display: block; overflow: hidden; color: inherit; }
#work .work-title-reveal { display: inline-block; color: inherit; }
#work .work-title-highlight {
  display: inline-block;
  position: relative;
  isolation: isolate;
  color: inherit;
}
#work .work-title-highlight::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 48% -.025em 5%;
  border-radius: 3px;
  background: #f5c0a7;
  transform-origin: left;
}
#work .work-subtitle {
  margin: 13px 0 0;
  font-size: var(--work-support-size);
  line-height: 1.7;
  letter-spacing: -.025em;
  color: #62705a;
  white-space: nowrap;
}
#work .work-subtitle-text { white-space: pre; }
#work .work-subtitle-accessible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#work .work-all-button {
  align-self: flex-start;
  width: fit-content;
  min-height: 28px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #263127;
  font-size: var(--work-support-size);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -.025em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  box-shadow: none;
  transition: color .2s;
}
#work .project-viewport {
  position: relative;
  height: auto;
  overflow: visible !important;
  overscroll-behavior: auto;
}
#work .project-track {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: var(--work-card-width, min(86%, 1440px));
  max-width: calc(100% - 36px);
  height: auto;
  margin-inline: auto;
  padding: 0;
  gap: 72px;
  transform: none !important;
  will-change: auto;
}
.mobile-story-enabled #work .project-track { transform: none !important; }
#work .project-card {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: center;
  align-self: start;
  column-gap: clamp(28px, 4vw, 64px);
  width: 100%;
  min-width: 0;
  max-width: none;
  text-align: left;
  opacity: 1;
}
#work .project-image {
  width: 100%;
  min-width: 0;
  border-radius: 16px;
  overflow: hidden;
}
#work .project-image img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 1200 / 834;
  object-fit: contain;
  object-position: center;
  transform: none;
  transition: none;
}
#work .project-copy { min-width: 0; text-align: left; }
#work .project-meta {
  margin: 0;
  color: #6b785f;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .025em;
}
#work .project-card h3 {
  margin: 12px 0 0;
  font-size: clamp(26px, 2.3vw, 38px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.05em;
  text-align: left;
}
#work .project-card .project-description {
  max-width: none;
  margin: 20px 0 0;
  color: #64715a;
  font-size: clamp(14px, 1.15vw, 17px);
  line-height: 1.8;
  letter-spacing: -.025em;
  text-align: left;
}
#work .project-description-line { display: block; }
#work .project-view {
  position: static;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  margin-top: 20px;
  padding: 7px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #263127;
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  backdrop-filter: none;
}
#work + #plans { margin-top: 0 !important; }
@media screen and (prefers-reduced-motion: no-preference) {
  #work[data-work-layout='split'] + #plans {
    margin-top: calc(-1 * var(--work-exit-hold, 0px)) !important;
  }
}

/* Every case remains a complete vertical entry until JavaScript enhances it. */
#work [data-work-line] { opacity: 1; transform: none; }
#work[data-work-layout='split'] .project-viewport {
  height: calc(var(--work-stage-height) + var(--work-travel, 0px) + var(--work-exit-hold, 0px));
}
#work[data-work-layout='split'] .project-track {
  position: sticky;
  top: var(--work-header-space, 84px);
  height: var(--work-stage-height, auto);
  gap: 0;
}
#work[data-work-layout='split'] .project-card {
  grid-area: 1 / 1;
  opacity: var(--case-opacity, 0);
}
#work[data-work-layout='split'] .project-card:first-child { --case-opacity: 1; }
#work[data-work-layout='split'] .project-card[aria-hidden='true'] { pointer-events: none; }
#work[data-work-layout='split'] [data-work-line] {
  opacity: var(--line-progress, 1);
  transform: translateY(calc((1 - var(--line-progress, 1)) * 10px));
}
@media (hover: hover) {
  #work .work-all-button:hover { color: #b84328; background: transparent; box-shadow: none; }
}
#work .work-all-button:focus-visible { outline: 2px solid #b84328; outline-offset: 3px; }

#work [data-work-reveal='pending'] .work-title-reveal { transform: translateY(110%); }
#work [data-work-reveal='pending'] .work-title-highlight { opacity: 0; }
#work [data-work-reveal='pending'] .work-subtitle-text { opacity: 0; }
#work [data-work-reveal='entered'] .work-title-reveal { animation: work-mask-in 900ms cubic-bezier(.22,.65,.28,1) both; }
#work [data-work-reveal='entered'] .work-title-highlight { animation: work-text-in 450ms ease 600ms both; }
#work [data-work-reveal='entered'] .work-title-highlight::before { animation: work-highlight-in 850ms cubic-bezier(.2,.6,.3,1) 650ms both; }
#work [data-work-reveal='entered'] .work-subtitle-text > span { animation: work-letter-in 1ms linear calc(1450ms + var(--work-letter) * 38ms) both; }
#work .section-heading:has([data-work-reveal='pending']) .work-all-button { opacity: 0; }
#work .section-heading:has([data-work-reveal='entered']) .work-all-button { animation: work-text-in 450ms ease 1600ms both; }
@keyframes work-mask-in { from { transform: translateY(110%); } to { transform: translateY(0); } }
@keyframes work-text-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes work-highlight-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes work-letter-in { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 901px) and (max-height: 760px) {
  #work { --work-support-size: 13px; }
  #work .work-stage { padding-top: max(90px, var(--work-header-space, 90px)); padding-bottom: 85px; }
  #work #work-title { font-size: clamp(28px, 3vw, 40px); line-height: 1.25; }
  #work .work-subtitle { margin-top: 10px; line-height: 1.6; }
}
@media (max-width: 900px) {
  #work { --work-support-size: clamp(10px, 3.15vw, 14px); }
  #work .work-stage,
  .mobile-story-enabled #work .work-stage {
    padding-top: var(--work-header-space, 84px);
    padding-bottom: var(--work-bottom-space, 92px);
  }
  #work .section-heading {
    width: calc(100% - 36px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0 auto 28px;
  }
  #work #work-title { font-size: clamp(17px, 5.15vw, 30px); line-height: 1.42; letter-spacing: -.055em; }
  #work .work-title-mask, #work .work-title-highlight { white-space: nowrap; }
  #work .work-subtitle { margin-top: 7px; line-height: 1.6; }
  #work .project-track { width: var(--work-card-width, calc(100% - 36px)); gap: 52px; }
  /* Supersede the older live-height landscape rules: toolbar changes must
     not change the captured layout or the image ratio in flow mode either. */
  #work .project-card,
  .mobile-story-enabled #work .project-card { width: 100%; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  #work .project-image img,
  .mobile-story-enabled #work .project-image img { height: auto; aspect-ratio: 1200 / 834; object-fit: contain; }
  #work .project-image { border-radius: 12px; }
  #work .project-meta { font-size: 11px; margin: 0; }
  #work .project-card h3 { font-size: 22px; line-height: 1.35; margin-top: 8px; }
  #work .project-card .project-description { font-size: 14px; line-height: 1.7; margin-top: 12px; }
  #work .project-view { font-size: 12px; padding: 7px 0; margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce), print {
  #work[data-work-layout] .project-viewport { height: auto; }
  #work[data-work-layout] .project-track { position: relative; top: auto; height: auto; gap: 52px; }
  #work[data-work-layout] .project-card { grid-area: auto; opacity: 1; pointer-events: auto; }
  #work[data-work-layout] [data-work-line] { opacity: 1; transform: none; }
  #work [data-work-reveal] :is(.work-title-reveal,.work-title-highlight,.work-subtitle-text,.work-subtitle-text > span),
  #work [data-work-reveal] .work-title-highlight::before,
  #work .section-heading .work-all-button {
    animation: none;
    transition: none;
    transform: none;
    opacity: 1;
  }
}
