/* Phone layout and type scale, loaded last on every page.
   Type follows the maxshirko.me mobile scale: 28px statements, 14–15px body at 1.45, 12–13px labels.
   First screens fit the small viewport (100svh): media takes what the text block leaves. */

@media (max-width: 600px) {
  /* ---------- Home: first screen ---------- */
  .hero:not(.case-hero) .hero-canvas { --text-block: 330px; --ph: clamp(190px, calc(max(100svh, 560px) - var(--text-block)), 122.5vw); height: max(100svh, calc(var(--ph) + var(--text-block))); min-height: 0; max-height: none; }
  .hero:not(.case-hero) .hero-photo { height: var(--ph); }
  .hero:not(.case-hero) .hero-ai-note { top: calc(var(--ph) - 12px); bottom: auto; left: 16px; right: 16px; width: auto; max-width: none; transform: translateY(-100%); text-align: center; white-space: nowrap; }
  .hero:not(.case-hero) .header { top: calc(var(--ph) + 14px); }
  .hero:not(.case-hero) .ai-coded { top: calc(var(--ph) + 82px); }
  .hero:not(.case-hero) .digital { top: calc(var(--ph) + 144px); }
  .hero:not(.case-hero) .designer { top: calc(var(--ph) + 206px); }
  .hero:not(.case-hero) .location { bottom: 26px; }

  /* ---------- Home: second screen ---------- */
  .intro { box-sizing: border-box; display: flex; flex-direction: column; gap: 32px; padding-block: 56px; margin-block: 0; }
  .intro h2,:lang(ru) .intro h2 { font-size: 36px; line-height: 1.05; letter-spacing: -.02em; white-space: normal; }
  .intro .intro-copy .statement { font-size: 28px; line-height: 1.12; letter-spacing: -.4px; }
  .intro .eyebrow,.intro-copy>.eyebrow { font-size: 13px; line-height: 1.45; }
  /* the eyebrow belongs to the heading: keep them close */
  .intro>.eyebrow+h2 { margin-top: -20px; }

  /* ---------- Section headings and statements ---------- */
  .section-heading h2,.about-heading h2,.more .section-heading h2 { font-size: 32px; line-height: 1.05; letter-spacing: -.02em; }
  .case-heading h2 { font-size: 32px; line-height: 1.05; letter-spacing: -.02em; }
  .case-conclusion,.case-conclusion .case-ink { font-size: 24px; line-height: 1.15; letter-spacing: -.3px; }
  .project-caption h3,.job h3 { font-size: 20px; line-height: 1.15; }

  /* ---------- Body copy: readable line height ---------- */
  .case-heading p,.pro-explanation,.case-section p:not(.case-conclusion):not(.pro-label),
  .intro p:not(.statement),.about-copy p,.gallery figcaption p,.job p,.project-caption p { font-size: 15px; line-height: 1.45; }
  /* experience: the role, then the dates smaller and paler right under it (styles.css) */
  .job p { line-height: 1.3; }
  .job p.eyebrow { font-size: 13px; }

  /* ---------- Labels and controls: nothing below 12px ---------- */
  .case-breadcrumb,.case-breadcrumb a { font-size: 13px; }
  .header .header-actions .button,.header .header-actions .language,.header .name { font-size: 13px; }
  .case-meta { font-size: 13px; line-height: 1.45; }
  .eyebrow,.pro-label,.logo-comparison figcaption,figcaption { font-size: 13px; }

  /* ---------- Case pages: first screen ---------- */
  .case-cover { height: clamp(220px, calc(100svh - 330px), 110vw) !important; max-height: none !important; aspect-ratio: auto !important; }
  .case-identity { margin-top: 4px; }
  .case-introduction h1,.case-introduction p { font-size: 26px; line-height: 1.15; letter-spacing: -.4px; }
}

/* Tiny phones (iPhone SE): keep the first screen readable. */
@media (max-width: 600px) and (max-height: 600px) {
  .hero:not(.case-hero) .hero-canvas { --text-block: 300px; }
  .hero:not(.case-hero) .ai-coded { top: calc(var(--ph) + 70px); }
  .hero:not(.case-hero) .digital { top: calc(var(--ph) + 126px); }
  .hero:not(.case-hero) .designer { top: calc(var(--ph) + 182px); }
}

/* Finger-sized tap areas without moving anything visually. */
footer .footer-inner nav a { padding-block: 12px; margin-block: -12px; }
.case-breadcrumb a { padding-block: 13px; margin-block: -13px; }
@media (max-width: 600px) {
  .header .theme-toggle { flex: 0 0 32px; width: 32px; min-width: 32px; }
  .case-breadcrumb,.enta-page .case-breadcrumb,.leaf-page .case-breadcrumb { font-size: 12px; gap: 4px; min-width: 0; overflow: hidden; }
  .case-breadcrumb>span:last-child { overflow: hidden; text-overflow: ellipsis; }
  footer .footer-inner .social-link { min-width: 40px; min-height: 40px; }
}

/* ProRiski posters: the desktop collage shrinks posters to 53–113px on phones; stack them instead. */
@media (max-width: 600px) {
  .pro-posters { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
  .pro-posters img { position: static; width: 100% !important; height: auto; }
  .pro-posters .pro-poster-three { grid-column: 1 / -1; grid-row: 1; }
  .pro-posters .pro-poster-one { grid-row: 2; }
  .pro-posters .pro-poster-two { grid-row: 2; align-self: end; }
}

/* Leaf Tower banner rails: the tall banner first, then the two small ones stacked to the same height. */
@media (max-width: 700px) {
  .leaf-campaign .campaign-track { --tall: min(72vw, 340px); --stack: calc(var(--tall) * 1910 / 1080); display: grid; grid-auto-flow: column; grid-template-rows: auto auto; grid-template-columns: var(--tall) var(--small); justify-content: start; gap: 12px; }
  /* 774×774 squares: two of them plus the gap equal the 1080×1910 banner's height. */
  .leaf-sales .campaign-track { --small: calc((var(--stack) - 12px) / 2); }
  /* 774×968 warm-up banners: same rule for their 4:5 shape. */
  .leaf-warmup .campaign-track { --small: calc((var(--stack) - 12px) / 2 * 774 / 968); }
  .leaf-campaign .campaign-track img { flex: none; width: 100%; max-width: none; height: auto; margin: 0; }
  .leaf-campaign .campaign-track img[height="1910"] { grid-row: 1 / span 2; grid-column: 1; }
  .leaf-campaign .campaign-track img[src*="-ru"] { grid-row: 1; grid-column: 2; }
  .leaf-campaign .campaign-track img[src*="-ar"] { grid-row: 2; grid-column: 2; }
}

/* ---------- Header (Figma: Portfolio — Header, Variant 4) ----------
   Square white knobs 40×40, radius 8.889px, Inter 14.44px. Desktop: sun · EN · cv · contact me.
   Phones and tablets: name (or breadcrumb) on the left, then sun · EN · CV · envelope (mobile-menu.css). */
html body .header .header-actions .theme-toggle { flex: 0 0 40px; width: 40px; height: 40px; min-width: 40px; padding: 10px; border: 0; border-radius: 8.889px; background: #fff; }
html body .header .header-actions .theme-toggle .theme-sun { grid-area: 1/1; width: 20px; height: 20px; }
html[data-theme="dark"] body .header .header-actions .theme-toggle { background: #161513; color: #f5efe5; }
html body .header .header-actions .theme-toggle:hover { background: var(--yellow-hover); }
html body .header .header-actions .language { min-width: 40px; height: 40px; padding: 0 12.5px; border-radius: 8.889px; }

@media (max-width: 1024px) {
  html body .header { display: flex; align-items: center; justify-content: flex-start; gap: 20px !important; }
  html body .header .header-actions { display: contents; }
  html body .header .name,html body .header .case-breadcrumb { order: 0; flex: 1 1 auto; min-width: 0; justify-content: flex-start; text-align: left; font-size: 13px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: none; }
  html body .header .header-actions .theme-toggle { order: 1; }
  html body .header .header-actions .language { order: 2; flex: 0 0 40px; width: 40px; padding: 0; font: 400 14.444px/1 'Inter', 'Inter Tight', Arial, sans-serif; letter-spacing: -.01em; }
  html body .header .header-actions .button[data-link="cv"] { order: 3; flex: 0 0 40px; width: 40px; height: 40px; min-width: 40px; padding: 0; border-radius: 8.889px; font: 400 14.444px/1 'Inter', 'Inter Tight', Arial, sans-serif; letter-spacing: -.01em; }
  html body .header .header-actions .button[href="#contact"] { display: none; }
}
@media (max-width: 380px) {
  html body .header { gap: 12px !important; }
}

/* Phones and tablets: the heading stacks in its own column, starting under the sun in the header
   (word-board.js gives the three lines one size and rhythm up to 800px). The location note lines up
   with the name, its dot sits in the line so the left edge stays straight. */
@media (min-width: 601px) and (max-width: 800px) {
  .hero:not(.case-hero) .location { left: calc(40% + 12px); }
  .hero:not(.case-hero) .ai-coded, .hero:not(.case-hero) .designer { left: calc(40% + 140px); right: auto; }
}
@media (max-width: 800px) {
  .hero:not(.case-hero) .location { padding-left: 0; }
  .hero:not(.case-hero) .status::before { position: static; display: inline-block; margin-right: 6px; vertical-align: .1em; }
}
