/* front-page (главная) — извлечено из grid-home.html */
/* hide translatable text until the language is applied (prevents EN→RU flash) */
  html:not(.i18n-ready) [data-i18n],
  html:not(.i18n-ready) [data-lang-en],
  html:not(.i18n-ready) [data-i18n-html] { visibility: hidden; }

  /* ============================================================
     COLOR PORTFOLIO — grid homepage
     One clean grid, branded + animated.
     ============================================================ */

  /* ---------- ATMOSPHERE (photo backdrop) ---------- */
  html { background: var(--bg); }
  body { background: transparent; }
  .atmosphere { position: fixed; inset: -180px 0 0; z-index: -1; pointer-events: none; overflow: hidden; }
  .atmo-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; filter: saturate(0.92) contrast(1.02); transition: opacity 1.8s ease; }
  .atmo-slide.is-on { opacity: 0.25; }
  .atmosphere::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(from var(--bg) r g b / 0.93) 0%, rgb(from var(--bg) r g b / 0.74) 32%, rgb(from var(--bg) r g b / 0.67) 58%, rgb(from var(--bg) r g b / 0.89) 100%); }

  /* ---------- HEADER ---------- */
  .work-head { padding: 132px var(--pad-x) 30px; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: end; }
  .work-head .lead { display: flex; flex-direction: column; gap: 22px; }
  .work-head h1 { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: clamp(48px, 7.4vw, 112px); line-height: 0.9; letter-spacing: -0.05em; color: var(--ink); }
  .work-head h1 .row { display: block; overflow: hidden; padding: 2px 0; }
  .work-head h1 .row > span { display: inline-block; transform: translateY(110%); will-change: transform; }
  .work-head h1 .dot { color: var(--red); }
  .work-head h1 .w-color { transition: color .5s ease; }
  body[data-title="split"] .work-head h1 .w-color { color: var(--red); }
  /* ---------- FILTER BUTTON STYLES (tweakable) ---------- */
  body[data-filterstyle="underline"] .filters { gap: 26px; }
  body[data-filterstyle="underline"] .filter-btn { background: none; border: none; border-radius: 0; padding: 8px 1px; position: relative; }
  body[data-filterstyle="underline"] .filter-btn::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--easing); }
  body[data-filterstyle="underline"] .filter-btn:hover { color: var(--ink); }
  body[data-filterstyle="underline"] .filter-btn:hover::after { transform: scaleX(1); }
  body[data-filterstyle="underline"] .filter-btn.is-active { background: none; color: var(--ink); }
  body[data-filterstyle="underline"] .filter-btn.is-active::after { transform: scaleX(1); }

  /* ---------- FILTER BAR ---------- */
  .filterbar { padding: 24px var(--pad-x) 30px; border-top: 1px solid var(--line); margin-bottom: 6px; }
  .filters { display: flex; gap: 6px; flex-wrap: wrap; }
  /* category typography */
  :root { --cat-font: 'Rubik', sans-serif; --cat-ls: 0.05em; --cat-weight: 600; --cat-scale: 1.12; }
  .cat .cat-year { font-variant-numeric: tabular-nums; }

  .filter-btn { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 9px 15px; border-radius: 999px; cursor: pointer; font-family: var(--cat-font); font-size: calc(11px * var(--cat-scale)); letter-spacing: var(--cat-ls); text-transform: uppercase; font-weight: var(--cat-weight); display: inline-flex; gap: 7px; align-items: baseline; transition: background-color .35s ease, color .35s ease, border-color .35s ease; }
  .filter-btn:hover { border-color: var(--ink-soft); color: var(--ink); }
  .filter-btn.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

  /* ---------- THE GRID ---------- */
  .work { padding: 0 var(--pad-x) 40px; }

  .card { position: relative; cursor: pointer; display: block; flex: 1 1 0; min-width: 0; }
  .card-media { position: relative; width: 100%; overflow: hidden; border-radius: 11px; background: var(--bg-2); box-shadow: 0 24px 60px -34px rgba(0,0,0,0.8); transition: box-shadow .7s ease; container-type: inline-size; }
  .card.is-hidden { display: none; }
  /* will-change only while the card is actually moving — a permanent hint pins a GPU layer per card */
  .card:is(:hover, .is-live) .card-img { will-change: transform, filter; }
  .card-img { position: absolute; inset: -8%; background-size: cover; background-position: center; transition: transform 1.3s var(--easing), filter 1.1s var(--easing); }
  .card:is(:hover, .is-live) .card-media { box-shadow: 0 38px 84px -30px rgba(0,0,0,0.9); }
  .card-media::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(0deg, rgba(0,0,0,0.74) 0%, rgba(0,0,0,0.30) 36%, rgba(0,0,0,0.05) 62%, transparent 100%); opacity: 0; transition: opacity .6s var(--easing); }
  .card:is(:hover, .is-live) .card-media::after { opacity: 1; }

  /* treatments (color only — motion is handled per hover-mode) */
  /* color = untouched: skipping the filter pipeline looks the same and paints far cheaper */
  [data-treat="color"] .card-img { filter: none; }

  /* hover motion modes */
  body[data-hover="zoom"] .card:is(:hover, .is-live) .card-img { transform: scale(1.06); }

  /* view tag */
  .view-tag { position: absolute; top: 14px; right: 14px; z-index: 3; font-family: 'Rubik', sans-serif; font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; padding: 5px 10px; background: rgba(28,26,21,0.42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); border-radius: 5px; opacity: 0; transform: translateY(-5px); transition: opacity .4s ease, transform .4s var(--easing); }
  .view-tag .av { color: var(--red); display: inline-block; vertical-align: -4px; }
  .view-tag .av svg { width: 14px; height: 14px; display: block; }
  .card:is(:hover, .is-live) .view-tag { opacity: 1; transform: translateY(0); }

  /* captions */
  html { interpolate-size: allow-keywords; }
  .ttl i { font-style: normal; color: var(--red); }
  .cap-over { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 22px; display: flex; flex-direction: column; gap: 6px; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.16) 46%, transparent 76%); }
  .cap-over::before { content: ""; width: 26px; height: 2px; background: var(--red); margin-bottom: 2px; transform: scaleX(0); transform-origin: left; transition: transform .5s var(--easing); }
  .card:is(:hover, .is-live) .cap-over::before { transform: scaleX(1); }
  .cap-over .cat { font-family: var(--cat-font); font-size: calc(11px * var(--cat-scale)); letter-spacing: var(--cat-ls); text-transform: uppercase; color: rgba(255,255,255,0.78); opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .5s var(--easing); font-weight: var(--cat-weight); }
  .card:is(:hover, .is-live) .cap-over .cat { opacity: 1; transform: translateY(0); }
  .cap-over .ttl { font-family: 'Rubik', sans-serif; font-weight: 700; font-size: clamp(21px, 1.7vw, 30px); letter-spacing: -0.022em; line-height: 1.02; text-shadow: 0 2px 16px rgba(0,0,0,0.55); }

  /* title plate — ink */
  body[data-titlestyle="ink"] .card-media { --glass-ease: cubic-bezier(0.22, 1, 0.36, 1); }
  body[data-titlestyle="ink"] .cap-over {
    left: 16px; right: auto; bottom: 16px;
    width: max-content; max-width: calc(100% - 32px);
    padding: 6px 16px; gap: 0;
    border-radius: 14px;
    border: 1px solid transparent;
    transition: width .68s var(--glass-ease), max-width .68s var(--glass-ease), padding .68s var(--glass-ease), background .55s ease, box-shadow .55s ease, border-color .55s ease;
    overflow: hidden;
  }
  body[data-titlestyle="ink"] .cap-over::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  }
  body[data-titlestyle="ink"] .card:is(:hover, .is-live) .cap-over {
    width: calc(100% - 32px); max-width: calc(100% - 32px);
    padding: 13px 16px;
    gap: 4px;
  }
  body[data-titlestyle="ink"] .cap-over::before { height: 0; margin: 0; transition: transform .6s var(--glass-ease), height .6s var(--glass-ease), margin .6s var(--glass-ease); }
  body[data-titlestyle="ink"] .card:is(:hover, .is-live) .cap-over::before { height: 2px; margin-bottom: 6px; }
  body[data-titlestyle="ink"] .cap-over .ttl {
    text-shadow: none; white-space: normal; text-wrap: pretty;
    font-size: clamp(20px, 1.7vw, 25px); line-height: 1.12;
    min-width: 0; max-width: calc(100cqw - 64px);
  }
  body[data-titlestyle="ink"] .card:is(:hover, .is-live) .cap-over .ttl { font-size: clamp(20px, 1.7vw, 25px); }
  body[data-titlestyle="ink"] .cap-over .cat {
    max-height: 0; max-width: 0; margin: 0; overflow: hidden; white-space: nowrap;
    transition: opacity .5s ease .04s, transform .6s var(--glass-ease), max-height .6s var(--glass-ease), max-width .6s var(--glass-ease);
  }
  body[data-titlestyle="ink"] .card:is(:hover, .is-live) .cap-over .cat { max-height: 1.4em; max-width: 100%; }






  /* ----- INK (flat) ----- */
  body[data-titlestyle="ink"] .cap-over { background: rgb(from var(--bg) r g b / 0.58); border: none; box-shadow: 0 12px 30px -16px rgba(0,0,0,0.7); }
  body[data-titlestyle="ink"] .card:is(:hover, .is-live) .cap-over { background: rgb(from var(--bg) r g b / 0.66); }



  /* ===== LAYOUT: UNIFORM (clean 4-col) ===== */
  body[data-layout="uniform"] .cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px 22px; }
  body[data-layout="uniform"] .card-media { aspect-ratio: 4 / 5; }

  /* ---------- INTRO / SIGN-OFF STRIP ---------- */
  .signoff { padding: 90px var(--pad-x) 30px; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; border-top: 1px solid var(--line); margin-top: 40px; }
  .signoff h2 { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: clamp(40px, 6.4vw, 104px); letter-spacing: -0.05em; line-height: 0.9; }
  .signoff h2 a { display: inline-block; transition: color .4s ease; }
  .signoff h2 a:hover { color: var(--red); }
  .signoff h2 .dot { color: var(--red); }
  .signoff .right { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; align-self: center; }

  /* ---------- RESPONSIVE ---------- */
  @media (max-width: 880px) {
    .work-head { grid-template-columns: 1fr; gap: 30px; align-items: start; }
  }
  @media (max-width: 1100px) {
    body[data-layout="uniform"] .cards { grid-template-columns: repeat(3, 1fr); }
  }
  @media (max-width: 760px) {
    .work-head { padding-top: 104px; }
    body[data-layout="uniform"] .cards { grid-template-columns: 1fr; gap: 30px; }
    body[data-layout="uniform"] .card-media { aspect-ratio: 4 / 5; }
    .signoff { grid-template-columns: 1fr; }
    .signoff .right { align-items: flex-start; }
  }
