/* ==========================================================================
   Graphix Design — base stylesheet

   Colour, type and spacing tokens are NOT defined here. They live in
   theme.json and arrive as --wp--preset--* custom properties. This file only
   aliases them to short names, and owns the one thing theme.json has no slot
   for: motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Token aliases (source of truth is theme.json — do not redefine values)
   -------------------------------------------------------------------------- */

:root {
  /* Ink system */
  --gx-paper:     var(--wp--preset--color--paper);
  --gx-ink:       var(--wp--preset--color--ink);
  --gx-press:     var(--wp--preset--color--press);
  --gx-turmeric:  var(--wp--preset--color--turmeric);
  --gx-overprint: var(--wp--preset--color--overprint);
  --gx-halftone:  var(--wp--preset--color--halftone);

  /* Type */
  --gx-font-display: var(--wp--preset--font-family--display);
  --gx-font-body:    var(--wp--preset--font-family--body);
  --gx-font-utility: var(--wp--preset--font-family--utility);

  --gx-size-display-xl: var(--wp--preset--font-size--display-xl);
  --gx-size-display-l:  var(--wp--preset--font-size--display-l);
  --gx-size-display-m:  var(--wp--preset--font-size--display-m);
  --gx-size-lead:       var(--wp--preset--font-size--lead);
  --gx-size-body:       var(--wp--preset--font-size--body);
  --gx-size-small:      var(--wp--preset--font-size--small);
  --gx-size-label:      var(--wp--preset--font-size--label);
  --gx-size-numeral:    var(--wp--preset--font-size--numeral);

  /* Space */
  --gx-gutter:  var(--wp--preset--spacing--05);
  --gx-space-3xs: var(--wp--preset--spacing--10);
  --gx-space-2xs: var(--wp--preset--spacing--20);
  --gx-space-xs:  var(--wp--preset--spacing--30);
  --gx-space-s:   var(--wp--preset--spacing--40);
  --gx-space-m:   var(--wp--preset--spacing--50);
  --gx-space-l:   var(--wp--preset--spacing--60);
  --gx-space-xl:  var(--wp--preset--spacing--70);
  --gx-space-2xl: var(--wp--preset--spacing--80);
  --gx-space-3xl: var(--wp--preset--spacing--90);
  --gx-section:   var(--wp--preset--spacing--95);

  /* Form */
  --gx-radius-plate: var(--wp--custom--radius--plate);
  --gx-radius-image: var(--wp--custom--radius--image);
  --gx-radius-chip:  var(--wp--custom--radius--chip);
  --gx-measure:      var(--wp--custom--measure);
  --gx-hairline:     var(--wp--custom--hairline);
  --gx-split-major:  var(--wp--custom--grid--split-major);
  --gx-split-minor:  var(--wp--custom--grid--split-minor);
}

/* --------------------------------------------------------------------------
   2. Motion tokens — the only place timings are declared.
      No section may invent its own duration or curve.
   -------------------------------------------------------------------------- */

:root {
  --gx-ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --gx-ease-exit:  cubic-bezier(0.7, 0, 0.84, 0);

  --gx-dur-micro: 150ms;
  --gx-dur-std:   400ms;
  --gx-dur-expr:  800ms;

  --gx-reveal-y:  72px;
  --gx-stagger:   75ms;
  --gx-parallax:  0.12;
  --gx-hover-img: 600ms;
  --gx-marquee:   42s;

  --gx-plate-scale:   0.96;
  --gx-plate-opacity: 0.72;
  --gx-plate-offset:  24px;
}

/* --------------------------------------------------------------------------
   3. Reduced motion — non-negotiable.
      Collapsing the tokens neutralises every consumer at once. Individual
      rules that cannot be expressed as a token are handled explicitly below.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  :root {
    --gx-dur-micro: 1ms;
    --gx-dur-std:   1ms;
    --gx-dur-expr:  1ms;
    --gx-reveal-y:  0px;
    --gx-stagger:   0ms;
    --gx-parallax:  0;
    --gx-hover-img: 1ms;
    --gx-plate-scale:   1;
    --gx-plate-opacity: 1;
    --gx-plate-offset:  0px;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   4. Reset and base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Fallback only. See the overflow note below — `hidden` here silently
     breaks position: sticky and IntersectionObserver root bounds. */
  overflow-x: hidden;
}

/* `overflow-x: hidden` makes the element a scroll container. That does two
   things we cannot afford: it kills `position: sticky` on descendants, which
   is the entire services ink stack, and it changes the root bounds that
   IntersectionObserver measures against, so scroll reveals never fire.
   `clip` prevents horizontal overflow without creating a scroll container. */
@supports (overflow: clip) {
  html,
  body.gx { overflow-x: clip; }
}

body.gx {
  margin: 0;
  background-color: var(--gx-paper);
  color: var(--gx-ink);
  font-family: var(--gx-font-body);
  font-size: var(--gx-size-body);
  line-height: 1.65;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
video,
svg { max-width: 100%; height: auto; display: block; }

/* Reserve aspect ratio so lazy images cannot move the layout (CLS budget). */
img[width][height] { height: auto; }

/* --------------------------------------------------------------------------
   5. Type primitives
   -------------------------------------------------------------------------- */

.gx-display-xl,
.gx-display-l {
  font-family: var(--gx-font-display);
  font-weight: 700;
  text-transform: lowercase;
  margin: 0;
}

.gx-display-xl {
  font-size: var(--gx-size-display-xl);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 96;
}

.gx-display-l {
  font-size: var(--gx-size-display-l);
  line-height: 0.96;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 72;
}

.gx-lead {
  font-size: var(--gx-size-lead);
  line-height: 1.5;
  max-width: var(--gx-measure);
  margin: 0;
}

.gx-label {
  font-family: var(--gx-font-utility);
  font-size: var(--gx-size-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--gx-halftone);
  margin: 0;
}

.gx-numeral {
  font-family: var(--gx-font-utility);
  font-size: var(--gx-size-numeral);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  /* Tabular + fixed min-width keeps the LKR/USD toggle from shifting layout. */
}

/* --------------------------------------------------------------------------
   6. Layout primitives
   -------------------------------------------------------------------------- */

.gx-shell {
  width: 100%;
  max-width: 90rem;
  margin-inline: auto;
  padding-inline: var(--gx-gutter);
}

.gx-section { padding-block: var(--gx-section); }

/* The one asymmetric split the whole site is built on. Mobile-first: stacked
   below 64rem, 7/5 above. No visible column rules anywhere. */
.gx-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gx-space-xl);
}

@media (min-width: 64rem) {
  .gx-split {
    grid-template-columns: var(--gx-split-major) var(--gx-split-minor);
    gap: var(--gx-space-l);
    align-items: start;
  }
}

/* --------------------------------------------------------------------------
   7. Focus — visible on every interactive element, no exceptions.
   -------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--gx-press);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Never remove the outline without replacing it. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}

.gx-skip-link {
  position: absolute;
  left: var(--gx-gutter);
  top: -100%;
  z-index: 999;
  background: var(--gx-ink);
  color: var(--gx-paper);
  font-family: var(--gx-font-utility);
  font-size: var(--gx-size-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--gx-space-xs) var(--gx-space-s);
  border-radius: var(--gx-radius-chip);
  transition: top var(--gx-dur-micro) var(--gx-ease-enter);
}

.gx-skip-link:focus { top: var(--gx-space-s); }

.gx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   8. Scroll reveal — the shared entrance. transform + opacity only.
   -------------------------------------------------------------------------- */

.gx-reveal {
  opacity: 0;
  transform: translate3d(0, var(--gx-reveal-y), 0);
  transition:
    opacity   var(--gx-dur-expr) var(--gx-ease-enter),
    transform var(--gx-dur-expr) var(--gx-ease-enter);
  transition-delay: calc(var(--gx-reveal-i, 0) * var(--gx-stagger));
  will-change: transform, opacity;
}

.gx-reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* If JS never runs, content must still be visible. */
.no-js .gx-reveal { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   9. Line-masked display reveal
   -------------------------------------------------------------------------- */

.gx-lines { display: block; }

/* The display face is set at 0.9 line-height, so the line box is shorter than
   the glyphs it contains. Clipping straight to the line box guillotines the
   descenders on y, g and p. Padding opens the clip area and an equal negative
   margin gives the space straight back, so the mask grows without the layout
   moving a pixel. */
.gx-line {
  display: block;
  overflow: hidden;
  padding-block: 0.1em 0.22em;
  margin-block: -0.1em -0.22em;
}

.gx-line > span {
  display: block;
  /* Must clear the padded mask, not just the line box. */
  transform: translate3d(0, 115%, 0);
  transition: transform var(--gx-dur-expr) var(--gx-ease-enter);
  transition-delay: calc(var(--gx-line-i, 0) * 90ms);
}

.is-in .gx-line > span { transform: translate3d(0, 0, 0); }

/* Applied for a single frame when a headline has to be snapped to its final
   state: after a resize re-split, or by the settle failsafe. Suppresses the
   transition so the text lands instantly instead of replaying. */
.gx-no-anim,
.gx-no-anim * {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .gx-line { overflow: visible; }
  .gx-line > span { transform: none; }
}

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */

.gx-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gx-space-2xs);
  font-family: var(--gx-font-utility);
  font-size: var(--gx-size-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1.05rem 2rem;
  border: 0;
  border-radius: var(--gx-radius-chip);
  background: var(--gx-press);
  color: var(--gx-paper);
  cursor: pointer;
  transition:
    background-color var(--gx-dur-std) var(--gx-ease-enter),
    color            var(--gx-dur-std) var(--gx-ease-enter),
    transform        var(--gx-dur-std) var(--gx-ease-enter);
}

.gx-btn:hover { background: var(--gx-ink); }

.gx-btn--ghost {
  background: transparent;
  color: var(--gx-ink);
  box-shadow: inset 0 0 0 var(--gx-hairline) var(--gx-ink);
}

.gx-btn--ghost:hover { background: var(--gx-ink); color: var(--gx-paper); }

/* Underline draws left to right on text links. */
.gx-link {
  color: var(--gx-press);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--gx-dur-std) var(--gx-ease-enter);
}

.gx-link:hover,
.gx-link:focus-visible { background-size: 100% 1px; }

/* --------------------------------------------------------------------------
   11. Chips (service sub-capabilities)
   -------------------------------------------------------------------------- */

.gx-chip {
  display: inline-block;
  font-family: var(--gx-font-utility);
  font-size: var(--gx-size-label);
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.95rem;
  border-radius: var(--gx-radius-chip);
  box-shadow: inset 0 0 0 var(--gx-hairline) currentColor;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   12. Contextual cursor

   The node is only created by cursor.js, which refuses to run on touch or
   under reduced motion. .gx-has-cursor is therefore the single gate: if the
   script stood down, the native cursor is never hidden.
   -------------------------------------------------------------------------- */

.gx-has-cursor,
.gx-has-cursor a,
.gx-has-cursor button,
.gx-has-cursor [role="button"] { cursor: none; }

/* Text entry always keeps its real caret. Hiding it is user-hostile. */
.gx-has-cursor input,
.gx-has-cursor textarea,
.gx-has-cursor select { cursor: auto; }

.gx-cursor {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 10px;
  block-size: 10px;
  border-radius: var(--gx-radius-chip);
  background: var(--gx-press);
  color: var(--gx-paper);
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transition:
    inline-size var(--gx-dur-std) var(--gx-ease-enter),
    block-size  var(--gx-dur-std) var(--gx-ease-enter),
    background-color var(--gx-dur-std) var(--gx-ease-enter),
    opacity     var(--gx-dur-micro) linear;
  will-change: transform;
}

.gx-cursor.is-live { opacity: 1; }

/* Ring: hollow, over any interactive element. */
.gx-cursor.is-ring {
  inline-size: 44px;
  block-size: 44px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--gx-press);
}

/* Pill: labelled, over work cards. */
.gx-cursor.is-pill {
  inline-size: 132px;
  block-size: 44px;
  background: var(--gx-ink);
  box-shadow: none;
}

.gx-cursor__label {
  font-family: var(--gx-font-utility);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--gx-dur-micro) linear;
}

.gx-cursor.is-pill .gx-cursor__label { opacity: 1; }

.gx-cursor.is-down { background: var(--gx-turmeric); }

/* Belt and braces: even if the class were somehow applied, reduced motion
   removes the cursor entirely and restores the native pointer. */
@media (prefers-reduced-motion: reduce) {
  .gx-cursor { display: none; }
  .gx-has-cursor,
  .gx-has-cursor a,
  .gx-has-cursor button,
  .gx-has-cursor [role="button"] { cursor: auto; }
}

@media (hover: none), (pointer: coarse) {
  .gx-cursor { display: none; }
  .gx-has-cursor,
  .gx-has-cursor a,
  .gx-has-cursor button { cursor: auto; }
}
