/* ==========================================================================
   IPS — system v2: compact rhythm, type fixes, page transitions, shared
   components for the inner pages (projects, brands, directions, blog).
   Loaded after main.css + extra.css on every page. Page-specific styles live
   in their own files (home.css, p-projects.css, p-brands.css, ...).
   ========================================================================== */

/* ---------- Compact rhythm (less empty space between blocks) ---------- */
:root {
  --sec: clamp(56px, 6.4vw, 112px);
  --sec-tight: clamp(40px, 4.2vw, 72px);
  --head-gap: clamp(22px, 2.6vw, 44px);
  --card-gap: clamp(22px, 2.4vw, 36px);
}
.section { padding-top: var(--sec); padding-bottom: var(--sec); }
.section--tight { padding-top: var(--sec-tight); padding-bottom: var(--sec-tight); }
.sec-head { margin-bottom: var(--head-gap); }
.sec-head .marker { margin-bottom: 14px; }
.t-display { font-size: clamp(34px, 4.7vw, 82px); }
.cta-band__frame { min-height: clamp(420px, calc(var(--vh, 1vh) * 64), 680px); }
.footer__top { padding-top: clamp(56px, 6vw, 100px); padding-bottom: clamp(40px, 4.4vw, 72px); }

/* ---------- Type: nothing clipped, nothing overlapping ----------
   Word masks used for the rise-in animation get enough head/foot room for
   Georgian capitals (Mtavruli) and Mkhedruli ascenders/descenders. */
.split .w { padding-top: .24em; margin-top: -.24em; padding-bottom: .2em; margin-bottom: -.2em; }
.phero__title .w { padding-bottom: .2em; }
html[lang="ka"] .t-display { line-height: 1.06; }
html[lang="ka"] .t-h1 { line-height: 1.1; }
html[lang="ka"] .t-h2 { line-height: 1.14; }
html[lang="ka"] .t-h3 { line-height: 1.24; }
html[lang="ka"] .t-lead { line-height: 1.36; }
html[lang="ka"] .cta-band__title { line-height: 1.04; }
html[lang="ka"] .hero__title { line-height: .94; }
html[lang="ka"] .phero__title, html[lang="ka"] .next__title { line-height: .98; }

/* phones: blur behind fixed/sticky bars is expensive while scrolling — use a near-solid fill instead */
@media (max-width: 760px) {
  .header::before { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(241, 242, 244, .97); }
  .fbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  /* bigger, easier tap targets */
  .filter { min-height: 42px; }
  .lang a, .lang button { padding: 10px 9px; }
}

/* long Georgian words in the big CTA title must fit a phone screen */
@media (max-width: 560px) { .cta-band__title { font-size: min(9vw, 40px); } }

/* ---------- Header: current page ---------- */
.header__nav a.is-current::after { transform: scaleX(1); transform-origin: left; }
.mmenu__list a.is-current span { opacity: .55; }

/* ---------- Page transitions ----------
   Chrome / Edge / Safari 18.2+: native cross-document View Transitions (the page
   glides out, the next one rises in; a clicked card image morphs into the next
   page's cover). Other browsers keep the curtain (main.js decides). */
@view-transition { navigation: auto; }
/* pages: one even cross-fade (old and new share duration and curve, so with the browser's additive blending the
   picture never dips or flashes in between), plus a short rise of the new page; nothing slides the other way */
::view-transition-old(root) { animation: ips-vt-out .6s cubic-bezier(.4, 0, .2, 1) both; }
::view-transition-new(root) { animation: ips-vt-in .6s cubic-bezier(.4, 0, .2, 1) both, ips-vt-rise .9s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes ips-vt-out { to { opacity: 0; } }
@keyframes ips-vt-in { from { opacity: 0; } }
@keyframes ips-vt-rise { from { transform: translateY(16px); } }
.header { view-transition-name: ips-header; }
::view-transition-group(ips-header) { animation-duration: .6s; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
/* the clicked photo grows into the next cover: a quick start and a long, soft landing; it keeps the site's rounded
   corners the whole way (the captured image itself is a plain rectangle) and is never stretched (cover crop) */
::view-transition-group(ips-morph) { animation-duration: .9s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); border-radius: 6px; overflow: clip; }
::view-transition-image-pair(ips-morph) { isolation: isolate; }
::view-transition-old(ips-morph), ::view-transition-new(ips-morph) { height: 100%; width: 100%; object-fit: cover; overflow: clip; }
::view-transition-old(ips-morph) { animation: ips-vt-fade .4s cubic-bezier(.4, 0, .2, 1) both; }
::view-transition-new(ips-morph) { animation: ips-vt-unfade .4s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes ips-vt-fade { to { opacity: 0; } }
@keyframes ips-vt-unfade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
/* the curtain is light (page colour + the colour logo): pages appear from white, never from navy */
.curtain { background: var(--paper); }
.curtain__logo { width: 96px; }
/* a fresh load starts under the curtain (class set by an inline script in <head>), so nothing flashes */
.ips-cover .curtain { clip-path: inset(0 0 0 0); }
.ips-cover .curtain__logo { opacity: 1; transform: none; }
/* softer curtain for browsers without view transitions */
.curtain.is-in { animation-duration: .62s; }
.curtain.is-out { animation-duration: .85s; }

/* ---------- QA mode (?qa=1): everything visible, no intro — for screenshots ---------- */
.qa [data-reveal], .qa .split .wi, .qa .scrub .w { opacity: 1 !important; transform: none !important; clip-path: none !important; }
.qa [data-reveal="img"] img { transform: none !important; }
.qa .curtain { display: none !important; }
.qa img[data-src], .qa img { opacity: 1 !important; }

/* ==========================================================================
   Shared components for inner pages
   ========================================================================== */

/* ---------- Inner page header ---------- */
.phead { padding-top: calc(var(--header-h) + clamp(18px, 2.6vw, 44px)); padding-bottom: clamp(22px, 2.6vw, 40px); }
.phead .crumbs { margin-bottom: clamp(18px, 2.2vw, 30px); }
.phead__row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: end; }
.phead__title { grid-column: 1 / span 8; }
.phead__title .marker { display: flex; margin-bottom: 14px; }
.phead__aside { grid-column: 9 / span 4; justify-self: end; text-align: right; max-width: 400px; color: var(--text-2); }
.phead__aside p + p { margin-top: .6em; }
@media (max-width: 1024px) {
  .phead__title, .phead__aside { grid-column: 1 / -1; }
  .phead__aside { justify-self: start; text-align: left; margin-top: 16px; }
}

/* ---------- Filter bar (sticky) ---------- */
.fbar {
  position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
  padding: 12px 0; margin-bottom: clamp(20px, 2.2vw, 30px); background: rgba(241, 242, 244, .9);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line-2);
}
.fbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fbar__label { font-family: var(--f-latin); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-right: 6px; }
.fbar__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fselect { position: relative; }
.fselect select {
  appearance: none; -webkit-appearance: none; height: 38px; padding: 0 34px 0 14px; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; font-size: 13.5px; cursor: pointer; transition: border-color .4s var(--ease);
}
.fselect select:hover, .fselect select:focus { border-color: var(--ink); outline: none; }
.fselect::after { content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.fsearch { position: relative; }
.fsearch input {
  height: 38px; width: clamp(160px, 18vw, 260px); padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 2px; background: transparent; font-size: 13.5px;
  transition: border-color .4s var(--ease);
}
.fsearch input:focus { outline: none; border-color: var(--ink); }
.fsearch svg { position: absolute; left: 11px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.fcount { font-size: 13px; color: var(--text-3); }
.freset { font-size: 13px; color: var(--text-2); }
.freset:hover { color: var(--ink); }
@media (max-width: 760px) {
  .fbar { position: relative; }
  .fsearch input { width: 100%; }
  .fsearch, .fbar__tools { width: 100%; }
}

/* ---------- Mobile filter sheet (IPS_LIB.filterSheet) ---------- */
.fsheet-btn, .fsheet, .fsheet__shade { display: none; }
@media (max-width: 760px) {
  .fsheet-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 2px;
    font-size: 14px; background: var(--white); transition: border-color .3s;
  }
  .fsheet-btn:active { border-color: var(--ink); }
  .fsheet-btn svg { width: 16px; height: 16px; }
  .fsheet-btn b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--white); font-family: var(--f-latin); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
  .fsheet-btn b[hidden] { display: none; }
  .fsheet__shade { display: block; position: fixed; inset: 0; z-index: 88; background: rgba(20, 28, 45, .42); opacity: 0; pointer-events: none; transition: opacity .45s var(--ease); }
  .fsheet__shade.is-on { opacity: 1; pointer-events: auto; }
  .fsheet {
    display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 89; max-height: 84svh;
    background: var(--paper); border-radius: 16px 16px 0 0; box-shadow: 0 -24px 60px -24px rgba(20, 28, 45, .4);
    transform: translateY(104%); transition: transform .55s cubic-bezier(.22, 1, .36, 1); visibility: hidden;
  }
  .fsheet.is-open { transform: none; visibility: visible; }
  .fsheet:not(.is-open) { transition: transform .45s cubic-bezier(.65, 0, .35, 1), visibility 0s .45s; }
  .fsheet__grip { width: 42px; height: 4px; border-radius: 2px; background: var(--mist-2); margin: 10px auto 0; flex: none; }
  .fsheet__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 12px; border-bottom: 1px solid var(--line); flex: none; touch-action: none; }
  .fsheet__head strong { font-weight: 500; font-size: 18px; }
  .fsheet__x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); position: relative; }
  .fsheet__x::before, .fsheet__x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.4px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
  .fsheet__x::after { transform: translate(-50%, -50%) rotate(-45deg); }
  .fsheet__body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px 18px 22px; display: grid; gap: 18px; }
  /* controls inside the sheet: full width, stacked, big tap targets */
  .fsheet__body .fbar__group { flex-wrap: wrap; }
  .fsheet__body .fselect, .fsheet__body .fselect select, .fsheet__body .fsearch, .fsheet__body .fsearch input { width: 100%; }
  .fsheet__body select, .fsheet__body input { height: 46px; font-size: 16px; }
  .fsheet__foot { display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
  .fsheet__foot .btn { flex: 1; height: 48px; }
  .sheet-open, .sheet-open body { overflow: hidden; }
}

/* ---------- Card grids ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--card-gap) var(--gap); }
.cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1024px) { .cards, .cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cards, .cards--4, .cards--2 { grid-template-columns: 1fr; } }

/* project card with the title over the photo */
.pcard--ov { position: relative; display: block; border-radius: var(--radius); overflow: hidden; color: var(--white); isolation: isolate; background: transparent; }
.pcard--ov .media { margin: 0; height: 100%; border-radius: 0; }
/* the darkening gradient lives inside the (clipped) photo, so the card reveals from the light page with its photo;
   the title fades in once the photo is there */
.pcard--ov .media::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(20, 28, 45, 0) 42%, rgba(20, 28, 45, .82) 100%); }
.pcard--ov .pcard__info { transition: opacity .9s var(--ease) .35s; }
.js .pcard--ov:has(.media[data-reveal]:not(.is-in)) .pcard__info { opacity: 0; }
.qa .pcard--ov .pcard__info { opacity: 1 !important; }
.pcard--ov .pcard__info { position: absolute; left: clamp(14px, 1.4vw, 22px); right: clamp(14px, 1.4vw, 22px); bottom: clamp(12px, 1.3vw, 20px); z-index: 2; }
.pcard--ov .pcard__meta { color: rgba(255, 255, 255, .78); margin-bottom: 6px; }
.pcard--ov .pcard__title { color: var(--white); font-size: clamp(18px, 1.45vw, 24px); }
.pcard--ov:hover .pcard__title { color: var(--white); }

/* second photo of the project fades in on hover (loaded on first hover) */
.pcard .media .pcard__alt { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s var(--ease), transform 1.4s var(--ease); pointer-events: none; }
.pcard:hover .media .pcard__alt.is-ready { opacity: 1; }
@media (hover: none) { .pcard .media .pcard__alt { display: none; } }

/* ---------- Brand logo tiles ---------- */
.btiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr)); gap: var(--gap); }
.btile {
  position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 16% 13%; border-radius: var(--radius);
  background: var(--white); overflow: hidden; transition: box-shadow .6s var(--ease), transform .8s var(--ease);
}
.btile:hover { box-shadow: 0 18px 40px -24px rgba(20, 28, 45, .45); }
/* the logo box is pinned inside the tile so tall (portrait) logos are limited by height too */
.btile__logo { position: absolute; inset: 20% 14%; display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.btile__logo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: grayscale(1) contrast(1.05); opacity: .72; transition: filter .6s var(--ease), opacity .6s var(--ease), transform .9s var(--ease); }
.btile:hover .btile__logo img { filter: none; opacity: 1; transform: scale(1.05); }
.btile--inv .btile__logo img, .btile--inv:hover .btile__logo img { filter: invert(1) grayscale(1) contrast(1.1); }
.btile__word { font-family: var(--f-latin); font-weight: 600; font-size: clamp(15px, 1.25vw, 20px); letter-spacing: .02em; text-align: center; color: var(--slate); line-height: 1.15; }
.btile__name {
  position: absolute; left: 12px; right: 12px; bottom: 9px; display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--f-latin); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
  opacity: 0; transform: translateY(6px); transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.btile:hover .btile__name { opacity: 1; transform: none; }
@media (hover: none) { .btile__logo img { filter: none; opacity: 1; } }

/* ---------- Blog post cards ---------- */
.post-card { display: flex; flex-direction: column; gap: 12px; }
.post-card .media { aspect-ratio: 16 / 10; }
.post-card .media img { transition: transform 1.4s var(--ease); }
.post-card:hover .media img { transform: scale(1.045); }
.post-card__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--text-3); }
.post-card__meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.post-card__cat { color: var(--accent); }
.post-card__title { font-weight: 500; font-size: clamp(18px, 1.4vw, 23px); line-height: 1.28; transition: color .4s; }
.post-card:hover .post-card__title { color: var(--slate); }
.post-card__ex { color: var(--text-2); font-size: 14.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Misc ---------- */
.empty { padding: clamp(40px, 6vw, 90px) 0; text-align: center; color: var(--text-3); }
.more-row { display: flex; justify-content: center; margin-top: clamp(28px, 3.4vw, 48px); }
.sec-link { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.sec-link .arr { width: 14px; height: 14px; transition: transform .6s var(--ease); }
.sec-link:hover .arr { transform: translate(3px, -3px); }

/* request forms: a required field left empty */
.field.is-error input, .field.is-error textarea { border-color: var(--accent-3); }
.field.is-error label { color: var(--accent-3); }

/* ---------- Static content for crawlers (written by tools/build_pages.py) ----------
   Detail and list pages carry a plain version of their content inside <main data-page-root>; the page script
   replaces it with the real page. With scripts on it stays invisible (no flash before the page is built); without
   scripts (crawlers, link tools, reader modes) it is a readable page. */
.js .prerender { visibility: hidden; }
.prerender { padding-top: calc(var(--header-h) + 40px); padding-bottom: 80px; max-width: 980px; }
.prerender h1 { margin: 18px 0 14px; font-size: clamp(30px, 4.4vw, 56px); line-height: 1.1; font-weight: 500; }
.prerender h2 { margin: 32px 0 10px; font-size: 22px; font-weight: 500; }
.prerender p, .prerender li { font-size: 16px; line-height: 1.6; color: var(--text-2); }
.prerender img { width: 100%; height: auto; margin: 18px 0; border-radius: var(--radius); }
.prerender ul, .prerender ol { padding-left: 1.2em; }
.prerender nav ol { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; font-size: 13px; }
.prerender a { text-decoration: underline; text-underline-offset: 3px; }
