/* Shared layout rules for personal portfolio case pages.
   Imported only by cases, not the homepage or SkillLab. */
body.personal-case {
  --case-chapter-gap:clamp(100px,11vw,144px);
  --case-image-gap:clamp(44px,6vw,72px);
  --case-related-image-gap:20px;
}

/* Footer layout and hover effects live in footer-shared.css.
   Keep only case-specific content spacing in this file. */

/* Text-and-image rhythm for 1024px-class laptops. */
@media(min-width:921px) and (max-width:1199px){
  body.personal-case .case-about .case-challenge-copy{
    width:calc(100% + 20px);max-width:none;min-width:0;
  }
  body.personal-case .case-about .case-challenge-copy > p{
    width:100%;max-width:none;
  }
  body.personal-case .case-section,
  body.personal-case .case-exploration{
    margin-top:var(--case-chapter-gap);
  }
  body.personal-case .case-experience-hero{margin-top:var(--case-image-gap)}
  body.personal-case .case-story-intro{
    row-gap:var(--case-image-gap);padding-top:18px;
  }
  /* Both supporting paragraphs stack on the centre line; the section keeps
     its original three-column grid, and photos remain independently positioned. */
  body.personal-case .case-experience-note{
    grid-template-columns:repeat(3,minmax(0,1fr));
    column-gap:0;row-gap:26px;
    margin:var(--case-chapter-gap) 0 var(--case-related-image-gap);
  }
  body.personal-case .case-experience-note p:first-child,
  body.personal-case .case-experience-note p:last-child{
    grid-column:2 / span 2;
    width:min(360px,100%);max-width:100%;
    padding:0;margin:0;justify-self:start;
  }
  body.personal-case .case-experience-note p:first-child{grid-row:1}
  body.personal-case .case-experience-note p:last-child{grid-row:2}
  body.personal-case .case-experience-note + .case-experience-hero{
    margin-top:var(--case-related-image-gap);
  }
  body.personal-case .case-experience-gallery .case-gallery-language-note{
    width:260px;max-width:100%;padding-right:0;
    margin-bottom:16px;overflow-wrap:normal;
  }
  body.personal-case .case-gallery-language-note .case-language-break{display:block}
  body.personal-case .case-outro{
    margin:var(--case-chapter-gap) 0 var(--case-chapter-gap);
    grid-template-columns:repeat(2,minmax(0,1fr));
    column-gap:20px;align-items:end;
  }
  body.personal-case .case-outro > .case-live{
    grid-column:2;grid-row:1;justify-self:end;align-self:end;
    width:max-content;max-width:100%;margin:0;
    font-size:calc(var(--meta-size,14px) * 1.5);
    line-height:1.15;text-transform:uppercase;white-space:nowrap;
    gap:8px;
  }
  body.personal-case .case-outro > .case-live .case-live-arrow{
    width:10.5px;height:10.5px;
  }
}
@media(prefers-reduced-motion:reduce){
  body.personal-case .footer-logo-flip,
  body.personal-case .footer-slide > span,
  body.personal-case .portfolio-contact-footer__cta-prism{transition:none!important}
  body.personal-case .portfolio-contact-footer__cta:hover .portfolio-contact-footer__cta-prism{transform:none}
}

/* 2026-11-05 — Apura case: compact MOBILE vertical rhythm only.
   921px+ desktop and laptop layouts are intentionally unchanged.
   Major chapters: 52-64px; related picture/caption: 16-24px. */
@media (max-width: 600px) {
  body.personal-case .case-hero {
    min-height:0!important;
    padding-top:52px!important;
  }
  body.personal-case .case-hero .case-title {
    margin-bottom:38px!important;
  }
  body.personal-case .case-hero .case-intro {
    margin:0 0 28px!important;
  }
  body.personal-case .case-hero .case-facts {
    margin:0 0 24px!important;
    gap:12px!important;
  }
  body.personal-case .case-hero .case-brand {
    margin:0 0 26px!important;
  }
  body.personal-case .case-hero .case-cover {
    margin:0 0 52px!important;
  }

  /* "О проекте" and "Задача": remove accumulated 80–130px gaps. */
  body.personal-case .case-about {
    row-gap:0!important;
    padding:14px 0 54px!important;
  }
  body.personal-case .case-about .case-about-copy {
    margin:38px 0 48px!important;
    gap:22px!important;
  }
  body.personal-case .case-about .case-challenge-heading {
    margin:0!important;
  }
  body.personal-case .case-about .case-challenge-copy {
    margin:22px 0 0!important;
    gap:18px!important;
  }

  /* Consistent section rhythm; the illustration follows its own text. */
  body.personal-case .case-main .case-story-intro {
    padding-top:18px!important;
    row-gap:0!important;
  }
  body.personal-case .case-main .case-story-statement,
  body.personal-case #case-exploration .case-story-statement {
    margin-top:32px!important;
  }
  body.personal-case .case-main figure.case-experience-hero {
    margin-top:24px!important;
    margin-bottom:0!important;
  }
  body.personal-case .case-main .case-experience-note {
    margin:50px 0 20px!important;
    row-gap:18px!important;
    column-gap:0!important;
  }
  body.personal-case .case-main .case-experience-note p {
    margin:0!important;
    padding:0!important;
  }
  body.personal-case .case-main .case-experience-note + figure.case-experience-hero {
    margin-top:20px!important;
  }
  body.personal-case .case-main .case-experience-gallery {
    margin-bottom:0!important;
    gap:8px!important;
  }
  body.personal-case .case-experience-gallery .case-gallery-language-note {
    grid-column:1!important;
    grid-row:auto!important;
    justify-self:start!important;
    align-self:start!important;
    margin:10px 0 0!important;
    padding:0!important;
    width:min(265px,100%)!important;
    max-width:100%!important;
    line-height:1.35!important;
  }
  body.personal-case .case-gallery-language-note .case-language-break {
    display:block!important;
  }
  body.personal-case #case-exploration,
  body.personal-case .case-main .case-section {
    margin-top:64px!important;
    padding-bottom:0!important;
  }
  body.personal-case .case-motion-section {
    gap:20px!important;
  }
  body.personal-case .case-motion-section > figure.case-experience-hero {
    margin-top:0!important;
  }
  body.personal-case .case-outro {
    margin:64px 0 56px!important;
    gap:26px!important;
  }
  body.personal-case .case-outro > figure.case-experience-hero {
    margin:0!important;
  }
}

/* 2026-11-05 / Apura-only phone review, no shared/homepage changes. */
@media (max-width:600px) {
  /* Match the homepage's 75x34 header-logo box: no horizontal centering
     inside the old 92.8px generic SkillLab logo box. */
  body.personal-case .site-header > a.logo {
    width:75px!important;
    height:34px!important;
    justify-content:flex-start!important;
    align-items:flex-start!important;
    justify-self:start!important;
  }
  body.personal-case .site-header .header-logo-flip {
    width:75px!important;
    height:34px!important;
  }

  /* The gallery's 8px row gap + 12px caption margin = 20px.
     Standalone image figcaptions use a direct 20px spacing. */
  body.personal-case .case-experience-gallery .case-gallery-language-note {
    margin-top:12px!important;
  }
  body.personal-case figure.case-experience-hero .case-media-caption {
    margin-top:20px!important;
  }

  /* The footer wrapper's global animation has a 90px reveal buffer.
     At phone width it adds an unwanted white band above the real footer.
     Preserve the reveal transform/opacity, remove just that reserved space. */
  body.personal-case .case-outro {
    margin-bottom:20px!important;
  }
  body.personal-case #footer-reveal {
    margin-top:0!important;
    padding-top:0!important;
  }
}

/* Apura: tall iPhones (including Pro Max). Keep the short iPhone SE
   layout untouched. The hero finishes at the bottom of the first
   stable viewport; the "О проекте" section begins after its divider. */
@media (min-width:390px) and (max-width:600px) and (min-height:800px) {
  body.personal-case .case-hero {
    box-sizing:border-box;
    min-height:calc(100svh - 44px)!important;
    padding-bottom:14px!important;
  }
  body.personal-case .case-hero .case-cover {
    margin-top:auto!important;
    margin-bottom:0!important;
    flex-shrink:0;
  }
  body.personal-case .case-about {
    padding-top:24px!important;
  }
}

/* Apura tablet rhythm, 601–920px. Keep phone (<=600px) and desktop intact.
   Short 20px relationships within a block; larger gaps only between chapters. */
@media (min-width:601px) and (max-width:920px) {
  /* The wordmark should not touch the collage below it. */
  body.personal-case .case-hero .case-brand {
    margin:0 0 24px!important;
  }
  body.personal-case .case-hero .case-cover {
    margin:0 0 70px!important;
  }

  /* Reading flow in About / Challenge: halve the old text-only gaps. */
  body.personal-case .case-about {
    padding:18px 0 72px!important;
  }
  body.personal-case .case-about .case-about-copy {
    margin:54px 0 62px!important;
    gap:24px!important;
  }
  body.personal-case .case-about .case-challenge-copy {
    margin-top:40px!important;
    gap:20px!important;
  }

  /* Label and lead remain aligned; statement follows in 50px, not 100px. */
  body.personal-case .case-main .case-story-intro {
    padding-top:22px!important;
    row-gap:0!important;
  }
  body.personal-case .case-main .case-story-intro .case-story-statement {
    margin-top:50px!important;
  }
  body.personal-case .case-main .case-story-intro + figure.case-experience-hero {
    margin-top:60px!important;
  }

  /* Notes introduce the nearby collage rather than floating far above it. */
  body.personal-case .case-main .case-experience-note {
    margin:64px 0 24px!important;
  }
  body.personal-case .case-main .case-experience-note + figure.case-experience-hero,
  body.personal-case .case-main .case-experience-note + .case-experience-gallery {
    margin-top:20px!important;
  }

  /* Three image rows come first. English-language note follows ALL three. */
  body.personal-case .case-experience-gallery {
    grid-template-columns:minmax(0,1fr)!important;
    row-gap:12px!important;
  }
  body.personal-case .case-experience-gallery > figure {
    grid-column:1!important;
    grid-row:auto!important;
  }
  body.personal-case .case-experience-gallery > .case-gallery-language-note {
    grid-column:1 / -1!important;
    grid-row:auto!important;
    justify-self:start!important;
    align-self:start!important;
    width:min(260px,100%)!important;
    max-width:100%!important;
    margin:8px 0 0!important; /* 12px row gap + 8px = 20px */
    padding:0!important;
  }
  body.personal-case .case-gallery-language-note .case-language-break {
    display:block!important;
  }
  body.personal-case figure.case-experience-hero > .case-media-caption {
    margin-top:20px!important;
  }

  /* Clear semantic chapter gaps; don't stack 130px bottom padding on top
     of another section's 130px margin. */
  body.personal-case .case-main .case-exploration {
    margin-top:92px!important;
    padding-bottom:0!important;
  }
  body.personal-case .case-main .case-section {
    margin-top:92px!important;
    padding-bottom:0!important;
  }
  body.personal-case .case-main .case-motion-section {
    gap:28px!important;
  }
  body.personal-case .case-main .case-motion-section > figure.case-experience-hero {
    margin-top:0!important;
  }
  body.personal-case .case-outro {
    margin:92px 0 70px!important;
    gap:24px!important;
  }
  body.personal-case .case-outro > figure.case-experience-hero {
    margin:0!important;
  }
}

/* Personal case endings only, 2026-11-05.
   The line is OUTSIDE #footer-reveal: it is never faded or transformed
   with the shared footer. Footer moves behind it on scroll. */
body.personal-case .case-footer-separator{
  display:block;
  position:relative;
  z-index:5;
  height:1px;
  margin:0 var(--page-inset,10px);
  padding:0;
  background:#d7d7d7;
  pointer-events:none;
}

/* Mebax closing statement: the same quiet section label as elsewhere
   in the cases, with the interim UX result as the large type focal point. */
@media (min-width:921px){
  body.case-mebax .case-outro--mebax{
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:start;
    column-gap:0;
    margin:clamp(105px,12vw,165px) 0 88px!important;
  }
  body.case-mebax .case-outro--mebax .case-outro__label{
    grid-column:1;grid-row:1;
  }
  body.case-mebax .case-outro--mebax .case-outro__statement{
    grid-column:2 / -1;grid-row:1;
  }
}
body.case-mebax .case-outro--mebax .case-outro__label{
  margin:0;
  font-family:var(--text-regular);
  font-size:var(--meta-size,13px);
  line-height:var(--meta-line,1.3);
  font-weight:400;
  letter-spacing:normal;
  text-transform:none;
}
body.case-mebax .case-outro--mebax .case-outro__statement{
  margin:0;
  max-width:760px;
  font-family:inherit;
  font-size:var(--case-large-size,22px);
  line-height:1.2;
  letter-spacing:-.02em;
  font-weight:400;
  overflow-wrap:break-word;
}
@media (min-width:601px) and (max-width:920px){
  body.case-mebax .case-outro--mebax{
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:start;
    column-gap:0;
    margin:92px 0 64px!important;
  }
  body.case-mebax .case-outro--mebax .case-outro__label{
    grid-column:1;grid-row:1;
  }
  body.case-mebax .case-outro--mebax .case-outro__statement{
    grid-column:2;grid-row:1;
    font-size:var(--case-large-size,27px);
  }
}
@media (max-width:600px){
  body.case-mebax .case-outro--mebax{
    grid-template-columns:minmax(0,1fr);
    align-items:start;
    gap:0!important;
    margin:64px 0 36px!important;
  }
  body.case-mebax .case-outro--mebax .case-outro__label{
    grid-column:1;grid-row:1;
  }
  body.case-mebax .case-outro--mebax .case-outro__statement{
    grid-column:1;grid-row:2;
    margin-top:24px;
    font-size:var(--case-large-size,27px);
    line-height:1.18;
  }
}

/* Case-page header baseline and physical footer masking, 2026-11-05.
   Match the 75x34 personal homepage logo box at every breakpoint. The old
   generic 116x55 logo box vertically displaced the 3D mark on case pages. */
body.personal-case .site-header > a.logo{
  width:75px!important;
  height:34px!important;
  align-self:start!important;
  justify-self:start!important;
  align-items:center!important;
  justify-content:center!important;
  transform:translateY(var(--logo-scroll-y,-10px))!important;
}

/* Only the white case section masks the shared footer above the static rule.
   The original homepage footer animation in footer-shared.css/js is unchanged. */
body.personal-case .case-main{
  position:relative;
  z-index:2;
  background:#fff;
}

/* Case captions: compact editorial measures on desktop, on every personal case.
   Gallery note is kept within half its grid track; mobile layout remains intact. */
@media (min-width:1200px){
  body.personal-case .case-experience-gallery > .case-gallery-language-note{
    width:50%;
    max-width:280px;
    padding-right:0;
  }
  body.personal-case .case-experience-gallery > figure > figcaption{
    max-width:50%;
  }
}
