/* ==========================================================================
   Page-specific sections: home hero, company tree, care loop,
   QALY meter, orange dot timeline, Ask QALY, company pages.
   ========================================================================== */

/* ---- Home hero ---- */
.hero { padding-block: var(--s7) var(--s8); background:
  radial-gradient(900px 480px at 85% 10%, var(--ice), transparent 70%), var(--white); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--s7); align-items: center; }
@media (max-width: 960px) { .hero__grid { grid-template-columns: 1fr; } }
.hero__copy .display { max-width: 11ch; }
:lang(ar) .hero__copy .display { max-width: 14ch; }
.hero__vision { border-inline-start: 2px solid var(--sky); padding-inline-start: var(--s4); color: var(--text); font-size: 1.05rem; }
@keyframes flow { to { stroke-dashoffset: -28; } }

/* ---- Company structure ----
   The Qaly system: tree.js puts the cards on orbits round Qaly (future.css, section 18).
   These are the plain rules: without JavaScript the six cards simply sit in rows. */
.tree-layout { display: grid; gap: var(--s6); }
.tree { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s4); padding-block: var(--s3); }
.tree__node {
  position: relative; z-index: 1; background: none; border: 0; padding: 6px; border-radius: 18px; cursor: pointer;
  transition: transform var(--fast) var(--ease);
}
.tree__node--main { flex: 0 0 auto; }
/* Logo sizes (logo artwork: no shadows or effects, brand rule). tree.js sets data-mode from the width. */
.tree__node img { width: 184px; height: auto; }
.tree__node--main img { width: 272px; }
.tree__node--sub img { width: 204px; }
.tree__node--moon img { width: 172px; }
.tree[data-mode="mid"] .tree__node img { width: 146px; }
.tree[data-mode="mid"] .tree__node--main img { width: 232px; }
.tree[data-mode="mid"] .tree__node--sub img { width: 160px; }
.tree[data-mode="mid"] .tree__node--moon img { width: 138px; }
.tree[data-mode="small"] .tree__node img { width: 96px; }
.tree[data-mode="small"] .tree__node--main img { width: 124px; }
.tree[data-mode="small"] .tree__node--sub img { width: 100px; }
.tree[data-mode="small"] .tree__node--moon img { width: 92px; }
.tree[data-mode="small"] .tree__cap { display: none; }
.tree__node:hover { transform: translateY(-2px); }
.tree-panel { position: relative; background: var(--white); border-radius: var(--radius-l); padding: var(--s6); border: 1px solid var(--line); width: 100%; max-width: 880px; margin-inline: auto; }
.tree-panel__body { display: grid; gap: var(--s4); justify-items: start; }

/* ---- Care loop ---- */
.loop-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: center; }
@media (max-width: 960px) { .loop-layout { grid-template-columns: 1fr; gap: var(--s6); } .loop-visual { order: -1; } }
.loop-visual { max-width: 520px; width: 100%; justify-self: center; }
.loop { width: 100%; height: auto; overflow: visible; }
.loop__ring { fill: none; stroke: var(--ice); stroke-width: 18; }
.loop__arcs path { fill: none; stroke: var(--blue-light); stroke-width: 2; stroke-linecap: round; opacity: 0; transition: opacity var(--slow) var(--ease); }
.loop__arcs path.is-on { opacity: 1; stroke: var(--ink); stroke-dasharray: 6 7; }
@media (prefers-reduced-motion: no-preference) { .loop__arcs path.is-on { animation: flow 1.6s linear infinite; } }
.loop__center circle { fill: var(--white); stroke: var(--blue-light); }
.loop__node circle { fill: var(--white); stroke: var(--blue-light); stroke-width: 1.5; transition: fill var(--slow) var(--ease), stroke var(--slow) var(--ease); }
.loop__node use { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.loop__node text { font-family: var(--font); font-size: 13px; font-weight: 700; fill: var(--ink); }
.loop__node.is-on circle { fill: var(--sky); stroke: var(--ink); }
.loop__node.is-dim { opacity: 0.45; }
.loop__node { transition: opacity var(--slow) var(--ease); }
.loop-controls .steps { margin-top: var(--s3); }

/* ---- QALY meter ---- */
.meter-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: center; }
@media (max-width: 960px) { .meter-layout { grid-template-columns: 1fr; gap: var(--s6); } }
.field-range { display: grid; gap: var(--s2); }
.field-range label { display: flex; justify-content: space-between; font-weight: 700; color: var(--ink); }
.field-range output { font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--sky) var(--fill, 50%), var(--blue-light) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--blue-light); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--sky); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
.meter-card { background: var(--white); border-radius: var(--radius-l); padding: var(--s6); display: grid; gap: var(--s4); }
.meter-card__value { font-size: clamp(3.2rem, 2.4rem + 3vw, 5rem); font-weight: 700; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.meter-card__unit { font-size: 1.4rem; color: var(--sky); }
.meter-years { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.meter-years span { aspect-ratio: 1; border-radius: 5px; border: 1px solid var(--blue-light); background: linear-gradient(to top, var(--sky) var(--q, 0%), var(--white) var(--q, 0%)); transition: background var(--fast) var(--ease); }
.meter-years span.is-off { opacity: 0.25; background: var(--white); }

/* ---- Orange dot timeline ---- */
.dot-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: start; }
@media (max-width: 960px) { .dot-layout { grid-template-columns: 1fr; gap: var(--s6); } }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: var(--s6); }
.timeline::before { content: ""; position: absolute; inset-inline-start: 34px; top: 12px; bottom: 12px; width: 2px; background: var(--blue-light); }
.timeline__item { position: relative; display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.timeline__year { position: relative; z-index: 1; display: grid; place-items: center; width: 70px; height: 32px; border-radius: 999px; background: var(--white); border: 1.5px solid var(--ink); color: var(--ink); font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.timeline__item--mars .timeline__year { border-color: var(--ink); background: var(--ice); }
.timeline__item--mars .timeline__year::after { content: ""; position: absolute; inset-inline-end: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--orange); }

/* ---- Ask QALY ---- */
.ask-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s8); align-items: center; }
@media (max-width: 760px) { .ask-layout { grid-template-columns: 1fr; gap: var(--s6); } .ask-orb { width: 120px; } }
.ask-orb { width: 200px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, var(--ice) 0 60%, transparent 61%); position: relative; }
.ask-orb::before, .ask-orb::after { content: ""; position: absolute; border-radius: 50%; border: 1px dashed var(--blue-light); inset: -8%; }
.ask-orb::after { inset: 14%; border-style: solid; border-color: var(--sky); }
.ai-orb--big { width: 34%; height: 34%; }
@media (prefers-reduced-motion: no-preference) { .ask-orb::before { animation: spin 40s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Company and inner pages ---- */
.facts { display: grid; gap: var(--s5); list-style: none; margin: 0; padding: 0; }
.fact { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.fact h3 { font-size: 1.15rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: var(--s6); } }
.quote { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); font-weight: 700; color: var(--ink); line-height: 1.25; max-width: 24ch; text-wrap: balance; }
.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.pill-list li { padding: 0.45rem 0.95rem; border-radius: 999px; background: var(--white); border: 1px solid var(--line); color: var(--ink); font-weight: 500; font-size: var(--fs-small); }
.section--ice .pill-list li { border-color: transparent; }
.company-logo { width: min(100%, 360px); }
.partner-card { display: grid; gap: var(--s4); align-content: start; }
.partner-card__logo { height: 110px; display: grid; place-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.partner-card__logo img { max-height: 74px; width: auto; max-width: 100%; object-fit: contain; }
.sitemap-list { columns: 2; column-gap: var(--s8); }
@media (max-width: 640px) { .sitemap-list { columns: 1; } }
.sitemap-list section { break-inside: avoid; margin-bottom: var(--s6); display: grid; gap: var(--s3); }
.sitemap-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.notfound .display { margin-inline: auto; }
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s8); align-items: start; }
@media (max-width: 960px) { .contact-layout { grid-template-columns: 1fr; } }
.form-result { background: var(--ice); border-radius: var(--radius); padding: var(--s5); display: grid; gap: var(--s3); }
.form-result pre { white-space: pre-wrap; font-family: var(--font); margin: 0; font-size: var(--fs-small); background: var(--white); padding: var(--s4); border-radius: var(--radius-s); border: 1px solid var(--line); max-height: 260px; overflow: auto; }

/* Larger diagram labels on small screens (the SVGs scale down) */
@media (max-width: 640px) {
  .loop__node text { font-size: 17px; }
}
.partner-card__logo img { max-height: 64px; }
