/* ==========================================================================
   Fields of activity (sections/fields.php, assets/js/fields.js): a row of cards bent around the viewer over a dark
   survey floor (drawn by fields.js); over each card a button with its number and name, placed by the script; a card
   opens a portal (drawn too) with the field's text set in it.
   Animated mode: the stage is pinned while the row turns (--fld-t of scroll, set by fields.js).
   ========================================================================== */
.fld { --bg: #05080B; position: relative; z-index: 3; background: var(--bg); color: var(--white); }
html.js:not(.gr-static) .fld:not(.is-flat) { height: calc(100vh + var(--fld-t, 400vh)); height: calc(100svh + var(--fld-t, 400vh)); }
/* where the row has arrived and where it ends: scroll gates (app.js) */
.fld__gate { position: absolute; top: 0; width: 1px; height: 1px; pointer-events: none; }
.fld__gate--end { top: var(--fld-t, 400vh); }
html:not(.js) .fld__gate, html.gr-static .fld__gate, .fld.is-flat .fld__gate { display: none; }

.fld__stage { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; overflow: clip; }
html.js:not(.gr-static) .fld:not(.is-flat) .fld__stage { position: sticky; top: 0; }
.fld__gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- head and hint ---------- */
.fld__head { position: absolute; z-index: 3; top: calc(var(--header-h) + 26px); inset-inline-start: var(--gutter); max-width: 560px; pointer-events: none; transition: opacity .5s; }
.fld__title { font-size: clamp(32px, 3.8vw, 62px); font-weight: 300; line-height: 1.25; }
.fld__lead { margin-top: 10px; color: var(--muted); font-size: 14.5px; line-height: 1.9; }
.fld__hint {   /* the field in view: its number, a short line with its place on it, the count; the hint under it */
  position: absolute; z-index: 3; bottom: 30px; left: 50%; display: flex; flex-direction: column; align-items: center; gap: 9px; transform: translateX(-50%);
  white-space: nowrap; pointer-events: none; transition: opacity .4s;
}
.fld__idx { display: flex; align-items: center; gap: 12px; color: rgb(255 255 255 / .42); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fld__idx b { min-width: 1.4em; color: var(--white); font-weight: 600; text-align: center; }
.fld__bar { position: relative; width: 132px; height: 1px; background: rgb(255 255 255 / .18); }
.fld__bar::after {
  content: ""; position: absolute; top: -1px; height: 3px; width: calc(100% / var(--n)); border-radius: 2px; background: var(--wire);
  inset-inline-start: 0; transform: translateX(calc(var(--p, 0) * (var(--n) - 1) * 100% * var(--dir, -1))); transition: transform .45s var(--ease-out);
}
[dir="ltr"] .fld__bar { --dir: 1; }
.fld__tip { color: rgb(255 255 255 / .5); font-size: 11.5px; font-weight: 500; }

/* ---------- the cards' buttons (fields.js sets their place and size over the drawn cards) ---------- */
.fld__cards { position: absolute; z-index: 2; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; transition: opacity .4s; }
.fld-card {
  position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; border-radius: 22px; background: none; color: var(--white);
  font: inherit; text-align: start; cursor: pointer; pointer-events: none; opacity: 0;
}
.fld-card__no { position: absolute; top: calc(var(--st, 0px) + 18px); inset-inline-start: 22px; font-size: 13px; font-weight: 750; opacity: .85; text-shadow: 0 1px 10px rgb(0 0 0 / .6); }
.fld-card__name {
  position: absolute; bottom: calc(var(--sb, 0px) + 20px); inset-inline-start: 22px; inset-inline-end: 76px; font-size: clamp(20px, 2vw, 32px); font-weight: 400; line-height: 1.35;
  text-shadow: 0 2px 18px rgb(0 0 0 / .7);
}
.fld-card__go {
  position: absolute; bottom: calc(var(--eb, 0px) + 20px); inset-inline-end: 20px; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgb(5 8 11 / .62); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .22);   /* no backdrop blur: it would be redrawn every frame the row turns */
  transition: background-color .3s, transform .45s var(--ease-out);
}
.fld-card__go .arrow { width: 18px; height: 18px; transform: rotate(-45deg); }                 /* ↖ in RTL: into the card */
[dir="rtl"] .fld-card__go .arrow { transform: scaleX(-1) rotate(-45deg); }
.fld-card:hover .fld-card__go, .fld-card:focus-visible .fld-card__go { background: var(--green); transform: scale(1.08); }
.fld-card:focus-visible { outline: 2px solid var(--wire); outline-offset: 4px; }

/* ---------- the portal's text ---------- */
.fld__portal { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.fld.is-open .fld__portal { pointer-events: auto; cursor: zoom-out; }                    /* a click outside the text closes it */
.fld.is-open .fld__head, .fld.is-open .fld__hint, .fld.is-open .fld__cards { opacity: 0; pointer-events: none; }
.fld__infos {
  position: absolute; left: var(--cx, 50%); top: var(--cy, 50%); width: var(--cw, 480px); max-height: var(--ch, 70%); overflow: auto; overscroll-behavior: contain;
  transform: translate(-50%, -50%); text-align: center; cursor: auto; scrollbar-width: none;
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s;
}
.fld__infos::-webkit-scrollbar { display: none; }
.fld.is-shown .fld__infos { opacity: 1; visibility: visible; transition: opacity .6s .05s, visibility 0s; }
.fld-info { display: none; }
.fld-info.is-on { display: block; }
.fld-info:focus { outline: none; }
.fld-info__pic { display: none; }
.fld__close {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / .08); color: var(--white); cursor: pointer; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); transition: background-color .3s, transform .4s var(--ease-out);
}
.fld__close svg { width: 18px; height: 18px; }
.fld__close:hover { background: rgb(255 255 255 / .16); transform: rotate(90deg); }
.fld__close:focus-visible { outline: 2px solid var(--wire); outline-offset: 3px; }
.fld-info__no { color: var(--wire); font-size: 13px; font-weight: 750; }
.fld-info__name { margin-top: 6px; font-size: clamp(30px, 3vw, 46px); font-weight: 300; line-height: 1.3; }
.fld-info__desc { margin: 12px auto 0; max-width: 30em; color: rgb(255 255 255 / .74); font-size: 15px; line-height: 2; }
.fld-info__pts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.fld-info__pts li { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650; color: rgb(255 255 255 / .86); box-shadow: inset 0 0 0 1px rgb(91 230 198 / .32); background: rgb(91 230 198 / .06); }
.fld-info__grade { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--amber); font-size: 13px; font-weight: 750; }
.fld-info__grade::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.fld-info__prj { margin-top: 10px; color: rgb(255 255 255 / .62); font-size: 13px; line-height: 1.9; }
.fld-info__prj small { display: block; font-size: 11.5px; font-weight: 750; color: rgb(255 255 255 / .45); }
.fld-info__more { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding-bottom: 3px; color: var(--white); font-size: 14px; font-weight: 800; text-decoration: none; box-shadow: inset 0 -1.5px 0 var(--green-hi); }
.fld-info__more .arrow { width: 18px; height: 18px; }
.fld-info__more:focus-visible { outline: 2px solid var(--wire); outline-offset: 4px; }

/* ---------- phones: the portal fills the screen; the text has the whole width ---------- */
@media (max-width: 760px) {
  .fld__head { top: calc(var(--header-h) + 14px); inset-inline-end: var(--gutter); }
  .fld__title { font-size: clamp(28px, 8vw, 38px); }
  .fld__lead { font-size: 13.5px; }
  .fld__hint { bottom: 92px; }                                   /* above the next-section pill */
  .fld__tip { display: none; }
  .fld-card__name { font-size: 22px; inset-inline-end: 66px; }
  .fld-card__go { width: 38px; height: 38px; }
  .fld-info__desc { font-size: 14px; }
}

/* ---------- without the motion (no JavaScript, reduced motion, no WebGL2): a grid of the fields with their text ---------- */
html:not(.js) .fld__stage, html.gr-static .fld__stage, .fld.is-flat .fld__stage { height: auto; min-height: 0; padding: calc(var(--header-h) + 40px) var(--gutter) 120px; }
html:not(.js) .fld__gl, html:not(.js) .fld__cards, html:not(.js) .fld__hint, html:not(.js) .fld__close,
html.gr-static .fld__gl, html.gr-static .fld__cards, html.gr-static .fld__hint, html.gr-static .fld__close,
.fld.is-flat .fld__gl, .fld.is-flat .fld__cards, .fld.is-flat .fld__hint, .fld.is-flat .fld__close { display: none; }
html:not(.js) .fld__head, html.gr-static .fld__head, .fld.is-flat .fld__head,
html:not(.js) .fld__portal, html.gr-static .fld__portal, .fld.is-flat .fld__portal { position: static; }
html:not(.js) .fld__infos, html.gr-static .fld__infos, .fld.is-flat .fld__infos {
  position: static; width: auto; max-height: none; overflow: visible; transform: none; opacity: 1; visibility: visible; text-align: start;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 32px;
}
html:not(.js) .fld-info, html.gr-static .fld-info, .fld.is-flat .fld-info { display: block; padding-bottom: 22px; border-radius: 20px; overflow: hidden; background: #0E151C; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08); }
html:not(.js) .fld-info > :not(img), html.gr-static .fld-info > :not(img), .fld.is-flat .fld-info > :not(img) { margin-inline: 20px; }
html:not(.js) .fld-info__pic, html.gr-static .fld-info__pic, .fld.is-flat .fld-info__pic { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; margin-bottom: 16px; }
html:not(.js) .fld-info__pts, html.gr-static .fld-info__pts, .fld.is-flat .fld-info__pts { justify-content: flex-start; }
