/* The art direction of Agentiq (Arnaud, 18/10): the one place for its colours, faces, logo, buttons and
   arrival animations. Every page of agentiq.hk loads it: the home page and the content pages (index.html),
   the code screen and /stats (middleware.ts), 404, /privacy, the private pages and the documents for
   clients. Nothing is written twice: change a value here and it changes everywhere.
   Reference: agentiq/00 - Société/02 - DA/CLAUDE.md.

   Themes, on <html data-theme>:
   - light, the default of the site since 23/11 (theme.js sets it before the first paint, dark on request);
   - dark, when the visitor chooses it, and the default of our own tools (/stats, /reseau: data-theme-default);
   - document, a page or a PDF handed to a client (a proposal, a spec, a demo): always light, on white.
   .da-night makes any block a night surface, in every theme (the hero, the code screen). */

/* ————— Faces: Host Grotesk for titles and text, Fragment Mono for small lines, eyebrows and short figures.
   Latin subsets from fontsource 5.3.0, under the SIL Open Font License 1.1 (/fonts/OFL-*.txt). ————— */
@font-face {
  font-family: 'Host Grotesk';
  src: url('/fonts/host-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Fragment Mono';
  src: url('/fonts/fragment-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --font-sans: 'Host Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fragment Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Fixed, the same in every theme. */
  --azur: #46b9ff; /* the main action, the selection, the period of agentiq. */
  --azur-deep: #30a3f4; /* azur hovered */
  --glacier: #6be9fe; /* the light that runs: sweeps, glows, never a fill */
  --cobalt: #156cdd; /* the accent written on a light page: links, dots, focus */
  --night: #05070b; /* the deep black, barely blue */
  --on-azur: #0d0f12; /* the ink written on azur */
  --night-text: #ebf1f7; /* text on a night surface */
  --night-soft: #adb7c3; /* secondary text on a night surface */
  --azur-halo: #46b9ff26; /* the ring around a dot or a pressed key */
  --ok: var(--azur); /* a success (a right code): azur, no green (18/10); change it here only */
  --on-ok: var(--on-azur); /* the ink written on --ok */

  /* The logo (/da/logo.svg): its width over its height. */
  --logo-ratio: 4.7684;

  /* Titles in Host Grotesk: one weight and one tracking for every section title (the hero's own is 370). */
  --title-weight: 450;
  --title-tracking: -0.045em;

  /* Shapes and motion. */
  --radius-button: 5px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-wipe: cubic-bezier(0.65, 0, 0.35, 1);

  /* One column for every page (Arnaud, 17/10): one width, one gutter. */
  --container: 1120px;
  --gutter: 16px;

  /* The illustration of "01 / How I work" (Arnaud, 19/10: a cute, slightly cartoon office on a light background,
     and Agentiq's night of particles for the tech moments). A small, soft palette next to the blues; no green.
     Fixed in every theme: the illustration stays light. Read by the canvas through src/da.ts. */
  --toon-bg: #ffffff; /* the page the office stands on */
  --toon-floor: #eef4fb; /* the floor's top */
  --toon-wall: #f7f4ff; /* the back walls */
  --toon-sky: #a8d8ff; /* glass, screens, the floor's edge */
  --toon-peach: #ffd0b6; /* faces, the rug */
  --toon-butter: #ffe08f; /* tables, folders */
  --toon-lilac: #cfc4f6; /* chairs, shirts */
  --toon-coral: #ff9c87; /* shirts, folders */
  --toon-line: #34405a; /* the soft outline of every shape */

  /* The platforms and stores named by their own logo on the home page, as agencies do (Arnaud, 23/11): one colour
     per brand, the one of its logo (simple-icons, /images/logos.svg), and no other brand's logo on our pages. A logo
     sits on a white tile in both themes; a lit path takes the colour of the logo it goes to. Fixed in every theme. */
  --brand-on: #ffffff; /* the tile under a logo */
  --brand-google: #4285f4;
  --brand-youtube: #ff0000;
  --brand-facebook: #0866ff;
  --brand-instagram: #ff0069;
  --brand-tiktok: #000000; /* the logo itself */
  --brand-tiktok-accent: #fe2c55; /* its paths: black would vanish at night */
  --brand-linkedin: #0a66c2;
  --brand-reddit: #ff4500;
  --brand-amazon: #ff9900;
  --brand-shopify: #7ab55c;
  --brand-etsy: #f16521;

  /* The pictograms of our pages, for everything that is not a brand (Arnaud, 23/11: the cartoon drawings were
     "enfantines", the platforms' logos "très pro"): one family, a fine lucide stroke in white on a rounded-square
     tile of one of our three blues, like an app icon next to the logos. Fixed in every theme. */
  --periwinkle: #7894ff; /* the third blue of the hero's orbits, between blue and violet */
  --glyph: #ffffff; /* the stroke of a pictogram on its tile */
}
@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }
}

/* Light theme, and any white sheet laid on a dark page (.da-paper: a sample report, a document preview). */
:root,
.da-paper {
  color-scheme: light;
  --paper: #f2f5f8; /* the page */
  --paper-2: #e9edf2; /* quiet bands and fills */
  --surface: #ffffff; /* cards */
  --surface-2: #f0f3f6; /* fills inside a card: tags, chips, fields */
  --line: #d6dbe0; /* borders of cards, buttons, fields */
  --line-soft: #e4e9ee; /* rules between zones */
  --ink: #0d0f12; /* text */
  --text-2: #5c656f; /* secondary text, paragraphs */
  --muted: #838990; /* tertiary text, eyebrows */
  --ghost: #b7bcc3; /* separators, chevrons, the empty */
  --accent-text: #156cdd; /* the accent written on the page */
  --stage: #0d0f12; /* a night panel laid on the page */
  --stage-line: transparent;
  --warn: #9a640e; /* alert */
  --warn-soft: #fbf1dc;
  --danger: #b0392a; /* error */
  --danger-soft: #fbe9e5;
  --shadow: #0d0f1229; /* menus and windows only */
  --logo-dot: var(--accent-text); /* the period of the logo */
}

/* Dark theme, and any night surface laid on a light page. */
:root[data-theme='dark'],
.da-night {
  color-scheme: dark;
  --paper: #05070b;
  --paper-2: #0a0d12;
  --surface: #0b0f14;
  --surface-2: #121820;
  --line: #1e252e;
  --line-soft: #151b22;
  --ink: #eaeff5;
  --text-2: #9da7b3;
  --muted: #7f8995;
  --ghost: #3a434d;
  --accent-text: #46b9ff;
  --stage: #080b10;
  --stage-line: #1a2129;
  --warn: #e5b357;
  --warn-soft: #2c2513;
  --danger: #f0907f;
  --danger-soft: #33201b;
  --shadow: #00000080;
  --logo-dot: var(--azur);
}
:where(.da-night) {
  background: var(--night);
  color: var(--ink);
}

/* A document handed to a client: the light theme, on white paper. */
:root[data-theme='document'] {
  --paper: #ffffff;
  --paper-2: #f2f5f8;
}

html {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection {
  background: var(--azur);
  color: var(--on-azur);
}

/* ————— The column ————— */
.da-column {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ————— The logo: <svg class="da-logo" role="img" aria-label="Agentiq"><use href="/da/logo.svg#logo"/></svg>.
   Its height sets its size; the ink is the text colour, the period --logo-dot. The mark alone:
   <svg class="da-mark"><use href="/da/logo.svg#mark"/></svg>. ————— */
.da-logo {
  display: block;
  flex-shrink: 0;
  height: var(--logo-height, 26px);
  width: auto;
  aspect-ratio: var(--logo-ratio);
  fill: currentColor;
  overflow: visible;
}
.da-mark {
  display: block;
  flex-shrink: 0;
  width: var(--mark-size, 28px);
  height: var(--mark-size, 28px);
  fill: currentColor;
}

/* ————— Small lines ————— */
.da-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.da-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-text);
  box-shadow: 0 0 0 4px var(--azur-halo);
}
.da-mono {
  font-family: var(--font-mono);
  font-weight: 400;
}
/* Code reads as typed: Fragment Mono's ligatures off (=> stays two characters). */
code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'calt' 0;
}
/* The period that ends a title, in the accent: <span class="da-period">.</span> */
.da-period {
  display: inline-block;
  color: var(--accent-text);
}

/* ————— Buttons. One primary per screen, in azur. ————— */
.da-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}
.da-button:hover {
  transform: translateY(-1px);
}
.da-button:disabled {
  cursor: wait;
  transform: none;
}
.da-button--primary {
  background: var(--azur);
  border-color: var(--azur);
  color: var(--on-azur);
}
.da-button--primary:hover {
  background: var(--azur-deep);
  border-color: var(--azur-deep);
}
/* The secondary: ink on paper, so it turns over with the theme. */
.da-button--dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.da-button--dark:hover {
  background: color-mix(in oklab, var(--ink) 84%, var(--paper));
}
.da-button--line {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.da-button--line:hover {
  background: var(--surface-2);
}
/* The quiet one: text alone, with an arrow that moves. */
.da-text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.da-text-button svg {
  transition: transform 0.2s;
}
.da-text-button:hover svg {
  transform: translate(2px, -2px);
}
:where(.da-button, .da-text-button, .da-field):focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 4px;
}

/* ————— Arrival. The first screen builds itself: the header drops, the eyebrow is wiped in, the title's
   letters gather (.da-gather, on one line; .da-focus for a title that wraps), then the blocks rise one after
   the other (--da-delay, or .da-stagger). Reduced motion shows the final state at once. ————— */
@media (prefers-reduced-motion: no-preference) {
  .da-drop {
    animation: da-drop 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) var(--da-delay, 0s) both;
  }
  .da-wipe {
    animation: da-wipe 0.9s var(--ease-wipe) var(--da-delay, 0.2s) both;
  }
  .da-gather {
    animation: da-gather 2.6s var(--ease-out) var(--da-delay, 0.12s) both;
  }
  .da-gather .da-period {
    transform-origin: 50% 78%;
    animation: da-land 0.9s var(--ease-spring) calc(var(--da-delay, 0.12s) + 1.5s) both;
  }
  /* A title that wraps (a page title, a section): its letters come into focus without spreading, so its lines
     never re-wrap while it arrives. */
  .da-focus {
    animation: da-focus 1.6s var(--ease-out) var(--da-delay, 0.12s) both;
  }
  .da-focus .da-period {
    transform-origin: 50% 78%;
    animation: da-land 0.9s var(--ease-spring) calc(var(--da-delay, 0.12s) + 0.9s) both;
  }
  .da-rise {
    animation: da-rise 0.9s var(--ease-out) var(--da-delay, 0.4s) both;
  }
  .da-stagger > * {
    animation: da-rise 0.9s var(--ease-out) both;
    animation-delay: calc(var(--da-delay, 0.4s) + var(--da-step, 0.1s) * var(--i, 0));
  }
  .da-stagger > :nth-child(2) {
    --i: 1;
  }
  .da-stagger > :nth-child(3) {
    --i: 2;
  }
  .da-stagger > :nth-child(4) {
    --i: 3;
  }
  .da-stagger > :nth-child(5) {
    --i: 4;
  }
  .da-stagger > :nth-child(6) {
    --i: 5;
  }
  .da-stagger > :nth-child(n + 7) {
    --i: 6;
  }
  /* Further down, a block rises as it enters the screen, where the browser ties animations to scrolling. */
  @supports (animation-timeline: view()) {
    .da-reveal {
      animation: da-reveal 0.65s linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 22%;
    }
  }
}
@keyframes da-drop {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}
@keyframes da-wipe {
  from {
    clip-path: inset(-10px 100% -10px -10px);
  }
  to {
    clip-path: inset(-10px);
  }
}
@keyframes da-gather {
  from {
    letter-spacing: 0.42em;
    opacity: 0;
    filter: blur(9px);
  }
  30% {
    opacity: 1;
  }
  60% {
    filter: blur(0);
  }
}
@keyframes da-focus {
  from {
    opacity: 0;
    filter: blur(9px);
    transform: translateY(10px);
  }
  40% {
    opacity: 1;
  }
  70% {
    filter: blur(0);
  }
}
@keyframes da-land {
  from {
    opacity: 0;
    transform: scale(0.15);
  }
  45% {
    opacity: 1;
    text-shadow:
      0 0 18px var(--glacier),
      0 0 4px var(--glacier);
  }
}
@keyframes da-land-late {
  from {
    opacity: 0;
    transform: scale(0.15);
  }
}
@keyframes da-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes da-reveal {
  from {
    opacity: 0.3;
    transform: translateY(22px);
  }
}

/* ————— Light and dark, on our own pages: <button class="da-theme-toggle" data-theme-toggle> with a sun and
   a moon inside (theme.js). Both are in the markup; the theme shows the right one. ————— */
.da-theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.da-theme-toggle:hover {
  background: var(--surface-2);
}
.da-theme-toggle svg {
  width: 18px;
  height: 18px;
}
:root[data-theme='dark'] .da-theme-moon,
:root:not([data-theme='dark']) .da-theme-sun {
  display: none;
}
