/*
 * Aamin AI inner pages (HAFR workspace): pages/css/countries.css, the six country pages (ae, sa, qa, kw,
 * bh, om; EN + AR). Linked by pages/templates/country.mjs. Owner: pages-countries (2026-11-28).
 *
 * Built on the home's one template (lib/story.css: .hf-chapter, .hf-row, .hf-eyebrow) and the shared
 * inner-page pieces (pages/pages.css: .pg-*). This file only adds the country story's own parts, all
 * scoped to main.pg--country or a .cn-* class:
 *   - the hero's dotted map, wider (5/7), this country lifted in sea-blue, the other five faint, and the
 *     In-country model standing on the country's pin (.cn-map__bot);
 *   - "How we work here" (.cn-how), the rulebook ledger (.cn-ledger), where your AI can run with the
 *     In-country model on a dotted floor (.cn-host), Build · Secure · Lead (.cn-pillars) and the other
 *     five countries (.cn-gulf).
 * House rules kept: plain CSS, one amber accent per view (only the chapter eyebrow), 44 px targets, visible
 * focus (page.css), AA text colours, Arabic mirrored with logical properties (the map never mirrors), and
 * only transform and opacity change over time (the hover nudges below; entrances are lib/transitions.js).
 */

/* NEW TOKENS */
.pg--country {
  --cn-col: 1040px;                     /* the ledger's measure */
  --cn-line: rgb(11 13 16 / 0.1);       /* hairlines between rows (pages.css --pg-line) */
  --cn-bot: 64px;                       /* the In-country model on the map */
  --cn-faint: #8E9AA4;                  /* the other five states' pins */
}

/* ---------------------------------------------------------------- 1. hero: the dotted map, wider */
.pg--country .pg-hero--visual .pg-hero__inner { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 4vw, 64px); }
.pg--country .pg-hero__lead { max-inline-size: 46ch; }
.pg--country .pg-hero__visual { display: block; }

/* the map: this country in sea-blue (map.js mixes the active state 55 % toward --pg-map-sea), the others faint */
.pg-map.cn-map {
  --pg-map-dot: #8E99A4;                /* inside dots of the six states: faint */
  --pg-map-edge: #7F98A1;               /* their edges: faint */
  --pg-map-context: #C9D0D6;            /* the neighbours' silhouette: fainter still */
  --pg-map-sea: #00404B;                /* the lifted country (deep, so the 55 % mix reads as lifted) */
  --pg-map-signal: #0097B1;             /* the in-country pulses */
}
.cn-map .pg-map__pin:not(.is-focus) .pg-map__dot { left: -3px; top: -3px; inline-size: 6px; block-size: 6px; background: var(--hf-ground-pearl); box-shadow: inset 0 0 0 1.5px var(--cn-faint); }
.cn-map .pg-map__pin:not(.is-focus) .pg-map__name {
  left: 8px; min-block-size: 0; padding: 0; background: none; box-shadow: none;
  font-size: 12px; font-weight: 500; color: var(--hf-color-text-3);
}
:lang(ar) .cn-map .pg-map__pin:not(.is-focus) .pg-map__name { font-size: 12.5px; }

/* the In-country model stands on the pin: its feet on the point, its name chip beside it */
.cn-map .pg-map__pin.is-focus { z-index: 2; }
.cn-map .pg-map__pin.is-focus .pg-map__dot { opacity: 0; }
.cn-map__bot {
  position: absolute; left: calc(var(--cn-bot) * -0.5); top: calc(var(--cn-bot) * -0.86);
  inline-size: var(--cn-bot); block-size: var(--cn-bot); line-height: 0;
}
.cn-map__bot .hf-agent { --hf-agent-size: var(--cn-bot) !important; }
/* its name flies above its head, centred (lib/page.js keeps every name inside the map's box) */
.cn-map .pg-map__pin.is-focus .pg-map__name { left: 0; top: calc(var(--cn-bot) * -0.86 - 18px); translate: -50% -50%; font-weight: 600; }
/* Kuwait sits at the map's top edge: its name goes beside the agent instead of above it */
.cn-map .pg-map__pin.is-focus[data-pin="kw"] .pg-map__name { left: calc(var(--cn-bot) * 0.4); top: calc(var(--cn-bot) * -0.5); translate: 0 -50%; }
html:not(.hf-js) .cn-map__bot { display: none; }

/* ---------------------------------------------------------------- 2. how we work here */
.cn-how { padding-block: clamp(72px, 8vw, 120px); }
.cn-how__box {
  max-inline-size: calc(880px + 2 * var(--hf-story-pad-x)); margin-inline: auto; padding-inline: var(--hf-story-pad-x);
  display: grid; justify-items: center; gap: 18px; text-align: center;
}
.cn-how__label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; color: var(--hf-color-text-3); }
.cn-how__label .hf-icon { inline-size: 20px; block-size: 20px; color: var(--hf-color-sea-600, #006776); }
.cn-how__text {
  margin: 0; max-inline-size: 40ch; font-size: clamp(22px, 2.3vw, 30px); font-weight: 500; line-height: 1.42; letter-spacing: -0.018em;
  color: var(--hf-color-text-1); text-wrap: balance;
}

.cn-how--long .cn-how__text { max-inline-size: 48ch; font-size: clamp(20px, 1.9vw, 25px); }

/* ---------------------------------------------------------------- 3. the rulebook: a numbered ledger */
.cn-rules__body {
  max-inline-size: calc(var(--cn-col) + 2 * var(--hf-story-pad-x)); margin-inline: auto;
  padding: 56px var(--hf-story-pad-x) var(--hf-row-pad-y); display: grid; gap: 28px;
}
.cn-ledger { margin: 0; padding: 0; list-style: none; counter-reset: cn-rule; border-block-start: 1px solid var(--cn-line); }
.cn-rule {
  counter-increment: cn-rule;
  display: grid; grid-template-columns: 52px minmax(0, 5fr) minmax(0, 7fr); gap: 8px clamp(24px, 3vw, 44px); align-items: start;
  padding-block: 28px; border-block-end: 1px solid var(--cn-line);
}
.cn-rule::before { content: counter(cn-rule, decimal-leading-zero); padding-block-start: 5px; font: 500 13px/1.4 var(--hf-font-mono); color: var(--hf-color-text-3); }
.cn-rule__name { margin: 0; font-size: 20px; font-weight: 650; line-height: 1.3; letter-spacing: -0.015em; color: var(--hf-color-text-1); text-wrap: balance; }
.cn-rule__ref { margin: 8px 0 0; font: 500 13px/1.45 var(--hf-font-mono); letter-spacing: 0; color: var(--hf-color-text-3); }
.cn-rule__desc { margin: 0; padding-block-start: 2px; font-size: 17px; line-height: 1.6; color: var(--hf-color-text-2); text-wrap: pretty; }
.cn-rule__desc a { color: var(--hf-color-text-1); text-decoration: underline; text-underline-offset: 3px; }
.cn-rules .pg-note { justify-content: center; text-align: start; }

/* ---------------------------------------------------------------- 4. where your AI can run */
.cn-places li > .hf-icon { color: var(--hf-color-sea-600, #006776); }
.cn-places li { font-size: 17px; }
.cn-host { position: relative; display: grid; justify-items: center; inline-size: min(100%, 560px); padding-block: 8px 0; }
.cn-host-dots {
  position: absolute; z-index: 0; left: 50%; top: calc(8px + 232px * 0.86); inline-size: min(100%, 520px); block-size: 150px;
  translate: -50% -50%; pointer-events: none;
  background-image: radial-gradient(circle, rgb(14 111 124 / 0.42) 1.25px, transparent 1.7px);
  background-size: 14px 9px; background-position: center;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, rgb(0 0 0 / 0.45) 66%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 30%, rgb(0 0 0 / 0.45) 66%, transparent 100%);
}
.cn-host .pg-bot { position: relative; z-index: 1; gap: 40px; }
.cn-host .pg-bot__name { font-size: 17px; }
.cn-host .pg-bot__role { max-inline-size: 32ch; font-size: 15px; color: var(--hf-color-text-2); }

/* ---------------------------------------------------------------- 5. what we do here: Build · Secure · Lead */
.cn-work__body {
  max-inline-size: calc(var(--hf-story-max) + 2 * var(--hf-story-pad-x)); margin-inline: auto;
  padding: 56px var(--hf-story-pad-x) var(--hf-row-pad-y); display: grid; gap: var(--pg-gap, 32px);
}
.cn-pillars { display: grid; grid-template-columns: repeat(var(--cn-cols, 3), minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.cn-pillars--n1 { --cn-cols: 1; max-inline-size: 520px; margin-inline: auto; inline-size: 100%; }
.cn-pillars--n2 { --cn-cols: 2; }
.cn-pillar {
  display: grid; align-content: start; gap: 12px; padding: 28px 28px 16px;
  border-radius: var(--pg-card-radius, 20px); background: var(--hf-surface-card); box-shadow: var(--hf-ring-soft);
}
/* one amber accent per view: the cards' labels wear a quiet square */
.cn-pillar__k::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hf-color-text-3); }
.cn-pillar__title { margin: 0 0 6px; font-size: 22px; font-weight: 650; line-height: 1.25; letter-spacing: -0.015em; color: var(--hf-color-text-1); text-wrap: balance; }
.cn-pillar__links { display: grid; margin: 0; padding: 0; list-style: none; border-block-start: 1px solid var(--cn-line); }
.cn-pillar__links > li + li { border-block-start: 1px solid var(--cn-line); }
.cn-pillar__a {
  display: flex; align-items: center; gap: 12px; min-block-size: 56px; padding-block: 8px;
  font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--hf-color-text-1); text-decoration: none;
}
.cn-pillar__ic { flex: none; inline-size: 22px; block-size: 22px; color: var(--hf-color-text-2); }
.cn-pillar__go { flex: none; margin-inline-start: auto; inline-size: 18px; block-size: 18px; color: var(--hf-color-text-3); transition: translate var(--hf-dur-2, 180ms) var(--hf-ease-out, ease-out); }
.cn-pillar__a:hover { color: var(--hf-tone); }
.cn-pillar__a:hover .cn-pillar__go { translate: 3px 0; }
[dir="rtl"] .cn-pillar__a:hover .cn-pillar__go { translate: -3px 0; }
.cn-pillar__plain { padding-block: 14px; font-size: 16px; color: var(--hf-color-text-2); }

/* ---------------------------------------------------------------- 7. the other countries */
.cn-gulf__list {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  max-inline-size: calc(var(--hf-story-max) + 2 * var(--hf-story-pad-x)); margin: 48px auto 0;
  padding: 0 var(--hf-story-pad-x) var(--hf-row-pad-y); list-style: none;
}
.cn-gulf__a {
  position: relative; display: grid; align-content: start; gap: 6px; block-size: 100%; min-block-size: 120px; padding: 20px 20px 48px;
  border-radius: 16px; background: var(--hf-surface-card); box-shadow: var(--hf-ring-soft);
  color: var(--hf-color-text-1); text-decoration: none;
  transition: transform var(--hf-dur-3, 240ms) var(--hf-ease-out, ease-out);
}
.cn-gulf__a:hover { transform: translateY(-3px); }
.cn-gulf__name { font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
.cn-gulf__cities { font-size: 14.5px; line-height: 1.45; color: var(--hf-color-text-3); }
.cn-gulf__go { position: absolute; inset-block-end: 18px; inset-inline-start: 20px; inline-size: 18px; block-size: 18px; color: var(--hf-color-text-2); }

/* ---------------------------------------------------------------- Arabic */
:lang(ar) .cn-how__text { letter-spacing: 0; line-height: 1.75; font-weight: 500; }
:lang(ar) .cn-how__label, :lang(ar) .cn-rule__name, :lang(ar) .cn-pillar__title, :lang(ar) .cn-gulf__name { letter-spacing: 0; }
:lang(ar) .cn-rule__name, :lang(ar) .cn-pillar__title { font-weight: 700; line-height: 1.5; }
:lang(ar) .cn-rule__desc, :lang(ar) .cn-gulf__cities { line-height: 1.8; }
:lang(ar) .cn-rule__ref { font-family: var(--hf-font-arabic, "HF Alexandria", sans-serif); font-size: 14px; }

/* ---------------------------------------------------------------- tablets and phones */
@media (max-width: 63.99rem) {
  .pg--country .pg-hero--visual .pg-hero__inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .cn-pillars { --cn-cols: 1; max-inline-size: 640px; margin-inline: auto; inline-size: 100%; }
  .cn-gulf__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cn-rules__body, .cn-work__body { padding-block-start: 40px; }
}
@media (max-width: 47.99rem) {
  .pg--country { --cn-bot: 48px; }
  .cn-map .pg-map__pin:not(.is-focus) .pg-map__name { display: none; }   /* phones: only this country is named */
  .cn-rule { grid-template-columns: 36px minmax(0, 1fr); padding-block: 22px; gap: 10px 12px; }
  .cn-rule__desc { grid-column: 2; font-size: 16px; }
  .cn-rule__name { font-size: 18px; }
  .cn-host-dots { block-size: 96px; top: calc(8px + 150px * 0.86); }
  .cn-host .pg-bot__figure { --pg-bot-size: 150px !important; }
  .cn-host .pg-bot__figure .hf-agent { --hf-agent-size: 150px !important; }
  .cn-pillar { padding: 24px 22px 12px; }
  .cn-gulf__list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cn-gulf__a { grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-block-size: 64px; padding: 14px 18px; gap: 2px 12px; }
  .cn-gulf__name { grid-column: 1; }
  .cn-gulf__cities { grid-column: 1; }
  .cn-gulf__go { position: static; grid-column: 2; grid-row: 1 / span 2; }
}
@media (prefers-reduced-motion: reduce) {
  .cn-gulf__a, .cn-pillar__go { transition: none; }
  .cn-gulf__a:hover { transform: none; }
}
