/* ── NIQUAL project page ──
   Niqual-system typeface is Manrope, loaded via <link> in the page head
   (Google Fonts) with the Space Grotesk fallback below for offline use.
   Scoped to this page. Uses global tokens only.
   The site outer shell (.article-page .site-canvas) has overflow:hidden;
   all deliberate block offsets stay inside the canvas — no page scrollbar,
   no horizontal page overflow. */

main#content.niqual-shell { display: block; padding: clamp(16px, 2vw, 28px) clamp(24px, 5vw, 72px) 0; }

.niqual-article {
  width: 100%;
}

/* ── Micro / index system ──
   Niqual's local labels: thin, uppercase, letter-spaced. */

.niqual-micro {
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.niqual-eyebrow { margin: 0; font-size: .6rem; line-height: 1.2; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* ── Hero: asymmetric identity + sand scene ── */

.niqual-hero {
  display: grid;
  grid-template-columns: 46% 54%;
  min-height: clamp(360px, 46.5vh, 480px);
}

.niqual-identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 5vw, 72px) clamp(8px, 2vw, 24px) clamp(56px, 6vw, 88px) 0;
}

.niqual-identity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.niqual-hero-rule {
  height: 1px;
  background: var(--ink);
  opacity: .55;
  margin: 18px 0 26px;
}

.niqual-identity h1 {
  margin: 0 0 20px;
  font-family: "Manrope", "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(3.2rem, 7vw, 6.2rem);
  font-weight: 500;
  line-height: .9;
  letter-spacing: -.05em;
}

.niqual-lead {
  margin: 0;
  max-width: 38ch;
  font-size: clamp(1.02rem, 1.6vw, 1.25rem);
  line-height: 1.5;
  color: var(--ink);
}

/* Sand scene — right column. Escapes the inner frame at Nikkalma scale. */
.niqual-sand {
  position: relative;
  z-index: 1;
  margin-bottom: -52px;
  margin-right: calc(-1 * clamp(96px, 9.5vw, 150px));
  overflow: hidden;
  isolation: isolate;
  background-image: image-set(
    url("/assets/images/niqual-hero.webp") 1x,
    url("/assets/images/niqual-hero@2x.webp") 2x
  );
  background-position: center 40%;
  background-size: cover;
  background-repeat: no-repeat;
}

.niqual-hero-caption {
  position: absolute;
  right: clamp(16px, 2.4vw, 28px);
  bottom: clamp(14px, 2vw, 24px);
  margin: 0;
  z-index: 2;
  pointer-events: none;
  line-height: 1.25;
  text-align: right;
  color: var(--paper);
}
/* ── Problem — asymmetric multi-part composition ──
   01 / ПРОБЛЕМА · main statement · gap · body column · projecting fragment.
   Proportional tracks: headline is the dominant left mass, a dedicated gap
   separates it from the body, microcopy holds the right edge. */

.niqual-problem {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 5.6fr) clamp(48px, 4.2vw, 56px) minmax(0, 4.6fr) clamp(32px, 3vw, 40px) minmax(0, 1.5fr);
  padding: clamp(48px, 6vw, 84px) 0 clamp(8px, 1vw, 16px);
  background: var(--paper);
}

.niqual-problem-index {
  grid-column: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

.niqual-problem-index-label {
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.niqual-problem-title {
  grid-column: 2 / 3;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.035em;
}

.niqual-problem-body {
  grid-column: 4 / 5;
  padding-top: 6px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}
.niqual-problem-body p { margin: 0 0 1em; }
.niqual-problem-body p:last-child { margin-bottom: 0; }

/* Narrow structural zone, slightly beyond local alignment. */
.niqual-problem-fragment {
  grid-column: 6 / 7;
  margin-right: calc(-1 * clamp(12px, 1.5vw, 28px));
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 2.4vw, 34px);
}
.niqual-problem-fragment p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 500;
}

/* ── Strict clean 4-column grid 01–04 ──
   Figuratively: the point where Niqual's system is strongest. No overlaps. */

.niqual-grid { padding: clamp(48px, 5vw, 72px) 0 clamp(14px, 1.6vw, 22px); }

.niqual-grid-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  position: relative;
}
.niqual-grid-list::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: clamp(40px, 5vw, 64px);
  background-image: linear-gradient(to bottom, rgba(25, 24, 20, .28) 0%, rgba(25, 24, 20, 0) 100%);
  background-repeat: no-repeat;
  background-size: 1px 100%;
  background-position: 25% 0, 50% 0, 75% 0;
  pointer-events: none;
}
.niqual-grid-list li {
  padding: clamp(22px, 2.4vw, 34px) clamp(16px, 1.8vw, 26px) clamp(30px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.niqual-grid-num {
  display: block;
  margin-bottom: 22px;
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.niqual-grid-list h3 { margin: 0 0 12px; font-size: clamp(1.02rem, 1.4vw, 1.28rem); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; }
.niqual-grid-list p { margin: 0; font-size: .86rem; line-height: 1.55; color: var(--muted); }

/* ── Products — one object in the system ──
   The catalogue is intentionally withheld: only «Не сейчас» is on the page.
   Product 01 is a compact object tile, slightly offset, not a banner. */

.niqual-products { padding-bottom: clamp(36px, 4.5vw, 64px); }
.niqual-products > .niqual-eyebrow { margin-bottom: 8px; }

.niqual-products-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

/* Product 01 — compact object tile, small left offset at mid-page. */
.niqual-product-featured {
  position: relative;
  width: clamp(280px, 21vw, 320px);
  margin-left: calc(-1 * clamp(20px, 2.5vw, 40px));
  background: var(--paper-deep);
  border: 1px solid rgba(25, 24, 20, .12);
  overflow: hidden;
}

.niqual-product-featured-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(12px, 1.4vw, 16px) clamp(20px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
}

.niqual-product-meta-label {
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.niqual-product-featured-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(12px, 1.2vw, 16px);
  padding: clamp(20px, 2vw, 28px);
}

.niqual-product-mark {
  display: block;
  width: clamp(120px, 11vw, 170px);
  height: auto;
  object-fit: contain;
}

.niqual-product-copy h3 { margin: 0; font-weight: 500; font-size: clamp(1.2rem, 1.6vw, 1.55rem); line-height: 1.1; letter-spacing: -.03em; }
.niqual-product-copy p { margin: 0; max-width: 30ch; font-size: .8rem; line-height: 1.55; color: var(--muted); }

.niqual-product-meta {
  margin: 0;
  font-size: .58rem !important;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted) !important;
  font-weight: 500;
}

.niqual-catalog-link {
  display: inline-block;
  margin-top: 32px;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  text-underline-offset: .25em;
}
.niqual-catalog-link:hover { text-decoration: underline; }

/* ── Nikkalma role — light horizontal structural band ──
   Nikkalma signing the project. Not a banner. */

.niqual-role {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, .9fr);
  align-items: stretch;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.niqual-role > * {
  padding: clamp(22px, 2.6vw, 34px) clamp(16px, 2vw, 28px);
  border-left: 1px solid var(--line);
}
.niqual-role > :first-child { border-left: 0; padding-left: 0; }

.niqual-role-index {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.niqual-role-index-label {
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.niqual-role h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.03em;
}

.niqual-role-text {
  margin: 0;
  max-width: 46ch;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--muted);
}

.niqual-role-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.niqual-cta {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: 13px 20px;
  border: 1px solid var(--ink);
  font-size: .6rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.niqual-cta:hover { background: var(--paper-deep); }
.niqual-cta span { font-size: 1rem; line-height: 1; }
a.niqual-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.niqual-role-micro {
  margin: 0;
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Next project — compact navigation after Role, before the footer ──
   The only portfolio next-destination defined is the homepage projects
   catalogue (#projects); kept as a small text row, not a slab. */

.niqual-next-row {
  padding: clamp(20px, 2.6vw, 32px) 0;
}
.niqual-next-row-link {
  display: inline-flex;
  align-items: center;
  gap: clamp(14px, 1.6vw, 24px);
  color: var(--ink);
  text-decoration: none;
}
.niqual-next-row-label {
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 500;
}
.niqual-next-row-arrow {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform .25s ease;
}
.niqual-next-row-link:hover .niqual-next-row-arrow { transform: translateX(4px); }
a.niqual-next-row-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ── Frame-breaking: let this project page's slabs escape the canvas box ──
   Mirror of article.css notes-index precedent. The central .site-canvas is
   capped at 1120px with overflow:hidden; that boundary clips the deliberate
   protrusions. Page-level protection stays via overflow-x: clip on the body
   (no scrollbar, no document overflow). Protrusions remain visual only. */

@media (min-width: 961px) {
  body.article-page:has(main.niqual-shell) { overflow-x: clip; }
  .article-page .site-canvas:has(> main.niqual-shell) { overflow: visible; }
  .niqual-problem-index {
    margin-top: calc(-1 * clamp(12px, 1.2vw, 18px));
    margin-right: clamp(32px, 2.8vw, 40px);
  }

  .niqual-problem-title { margin-left: clamp(32px, 2.5vw, 40px); }
}

@media (min-width: 961px) and (max-width: 1280px) {
  .niqual-problem {
    grid-template-columns: minmax(0, .9fr) minmax(0, 5.6fr) clamp(56px, 4.8vw, 68px) minmax(0, 4.6fr) clamp(32px, 3vw, 40px) minmax(0, 1.5fr);
  }
}

@media (min-width: 681px) {
  .niqual-problem-index {
    padding-right: 0;
  }

  .niqual-grid-list h3 {
    /* Shared title area so wrapped headings don't push body copy down. */
    min-height: calc(1.15em * 2);
  }
}

/* ── Mid desktop 961–1310 — amplitude capped to fit the canvas ── */

@media (min-width: 961px) and (max-width: 1310px) {
  .niqual-sand { margin-right: calc(-1 * clamp(40px, 7vw, 76px)); }
  .niqual-product-featured { margin-left: calc(-1 * clamp(14px, 2vw, 24px)); }
}

/* ── Tablet 681–960 — amplitude reduced substantially ── */

@media (min-width: 681px) and (max-width: 960px) {
  .niqual-hero { grid-template-columns: 50% 50%; }
  .niqual-sand { margin-bottom: -28px; margin-right: calc(-1 * clamp(20px, 3vw, 28px)); }

  .niqual-problem {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .niqual-problem-index { grid-column: 1 / 4; }
  .niqual-problem-title { grid-column: 1 / 9; }
  .niqual-problem-body { grid-column: 4 / 12; margin-top: 26px; }
  .niqual-problem-fragment { grid-column: 8 / 14; margin-right: 0; margin-top: 34px; flex-direction: row; flex-wrap: wrap; gap: 20px 40px; }

  .niqual-grid-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .niqual-products-wrap { grid-template-columns: minmax(0, 1fr); }
  .niqual-product-featured { width: clamp(240px, 30vw, 280px); margin-left: calc(-1 * clamp(10px, 1.6vw, 16px)); }
  .niqual-product-featured-body { gap: clamp(10px, 1.2vw, 14px); }
  .niqual-product-mark { width: clamp(120px, 16vw, 170px); }

  .niqual-role {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-areas:
      "index title"
      "text  cta";
  }
  .niqual-role-index { grid-area: index; }
  .niqual-role h2 { grid-area: title; }
  .niqual-role-text { grid-area: text; }
  .niqual-role-cta { grid-area: cta; }
  .niqual-role-index { border-left: 0; padding-left: 0; }
}

/* ── Mobile ≤680 — clean stacking ── */

@media (max-width: 680px) {
  main#content.niqual-shell { padding: 8px 0 0; }

  .niqual-hero { display: block; min-height: 0; }
  .niqual-identity { order: 1; padding: 40px 20px 40px; }
  .niqual-sand { order: 0; height: 200px; margin-bottom: 0; margin-right: 0; }
  .niqual-sand-dune--near { bottom: -22%; }

  .niqual-problem { display: block; padding: 64px 20px 56px; }
  .niqual-problem-index { margin-bottom: 24px; }
  .niqual-problem-title { font-size: clamp(2rem, 10vw, 2.6rem); }
  .niqual-problem-body { margin-top: 28px; }
  .niqual-problem-fragment { margin-top: 34px; margin-right: 0; flex-direction: row; flex-wrap: wrap; gap: 18px 32px; }

  .niqual-grid { padding: 48px 0; }
  .niqual-grid-list { grid-template-columns: minmax(0, 1fr); }

  .niqual-products { padding: 0 0 64px; }
  .niqual-products-wrap { display: block; }
  .niqual-product-featured { width: 100%; margin-left: 0; }
  .niqual-product-featured-body { gap: 16px; padding: 24px 20px 28px; }
  .niqual-product-mark { width: clamp(120px, 36vw, 150px); }
  .niqual-catalog-link { margin-left: 20px; }

  .niqual-role { display: block; border-bottom: 1px solid var(--line); }
  .niqual-role > * { padding: 24px 20px; border-left: 0; border-bottom: 1px solid var(--line); }
  .niqual-role > :first-child { padding-left: 20px; padding-top: 32px; }
}

/* Honor the global reduced-motion contract (content.js only animates
   [data-scroll] when the media query allows). */
@media (prefers-reduced-motion: reduce) {
  .niqual-sand { scroll-behavior: auto; }
}
