/* AICFI site. Dwaar's design system (dwaar-site/DESIGN.md): its type, numbered sheets, ruled ledgers and
   8-bit details. AICFI's own palette: a sky → peacock → indigo ramp on a cooler paper ground, running light at the
   top of the stack to deep at its base. The ramp belongs to the stack motif and to layer status only. */

@font-face { font-family: "Anek Latin"; src: url("fonts/anek-latin.woff2") format("woff2"); font-weight: 600 800; font-stretch: 80% 100%; font-display: swap; }
@font-face { font-family: "Mukta"; src: url("fonts/mukta-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mukta"; src: url("fonts/mukta-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Mukta"; src: url("fonts/mukta-600.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #F6F6F1;            /* surface */
  --bg-2: #ECEDE5;          /* surface-2 */
  --ink: #111318;           /* text */
  --ink-2: #2A2D33;         /* text-2 */
  --muted: #5F625C;         /* text-muted, 5.7:1 on surface */
  --rule: #DEDFD5;
  --line: #8E9188;
  --sky: #6FC6D9;
  --peacock: #2E8BB3;
  --peacock-text: #1D6F80;  /* accent text: 5.3:1 on surface, 4.9:1 on surface-2 */
  --indigo: #314485;
  --night: #23215C;
  --on-dark-2: #B9BCC2;
  --display: "Anek Latin", sans-serif;
  --body: "Mukta", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --notch-4: polygon(0 4px,4px 4px,4px 0,calc(100% - 4px) 0,calc(100% - 4px) 4px,100% 4px,100% calc(100% - 4px),calc(100% - 4px) calc(100% - 4px),calc(100% - 4px) 100%,4px 100%,4px calc(100% - 4px),0 calc(100% - 4px));
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.6 var(--body); }
a { color: inherit; }
img, svg { max-width: 100%; }
p { margin: 0 0 16px; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
[id] { scroll-margin-top: 96px; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 40px; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 16px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.close a:focus-visible { outline-color: var(--bg); }
::selection { background: #BEE5EE; color: var(--ink); }
.close ::selection { background: var(--indigo); color: var(--bg); }

/* ---- Type ---- */
h1 { font-family: var(--display); font-weight: 760; font-stretch: 100%; font-size: clamp(44px, 5.4vw, 78px); line-height: 0.98; letter-spacing: -0.02em; margin: 0 0 28px; }
h2 { font-family: var(--display); font-weight: 720; font-stretch: 96%; font-size: 46px; line-height: 1; letter-spacing: -0.015em; margin: 0 0 20px; }
h3 { font-family: var(--display); font-weight: 650; font-stretch: 90%; font-size: 22px; line-height: 1.15; margin: 0 0 6px; }
h1, h2, h3 { text-wrap: balance; }
.lede { font-size: 21px; line-height: 1.5; color: var(--ink-2); max-width: 38ch; margin: 0 0 36px; }
.sub { color: var(--ink-2); max-width: 62ch; }
.fine-print { font-size: 15px; color: var(--muted); border-left: 2px solid var(--rule); padding-left: 14px; margin-top: 28px; max-width: 72ch; }

/* ---- Actions ---- */
.btn { display: inline-flex; align-items: center; height: 44px; padding: 0 20px; background: var(--ink); color: var(--bg); font: 600 15px/1 var(--body); text-decoration: none; border-radius: 2px; white-space: nowrap; }
.btn:hover { background: #2a2d33; }
.btn.inv { background: var(--bg); color: var(--ink); }
.btn.inv:hover { background: var(--bg-2); }
.link { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 2px; position: relative; }
/* Grow the tap area to 44px without moving the text or its rule. */
.link::after, .mark::after { content: ""; position: absolute; inset: -8px -4px; }
.ctas { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }

/* ---- 8-bit details ---- */
.ptag { display: inline-block; font: 600 14px/1 var(--body); color: var(--ink); background: var(--bg-2); padding: 10px 16px; clip-path: var(--notch-4); margin-bottom: 28px; }
.idx { font: 500 12px/1.5 var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.idx b { display: block; font-weight: 500; color: var(--ink); font-size: 13px; margin-bottom: 4px; }
.idx b::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--peacock); margin-right: 8px; vertical-align: 1px; }
ul.plain { padding-left: 0; list-style: none; margin: 8px 0 0; max-width: 72ch; }
ul.plain li { padding: 10px 0 10px 22px; border-bottom: 1px solid var(--rule); position: relative; color: var(--ink-2); }
ul.plain li::before { content: ""; position: absolute; left: 0; top: 1.15em; width: 8px; height: 8px; background: var(--indigo); }
ul.plain b { color: var(--ink); font-weight: 600; }

/* The ground line the stack stands on: the ramp, light to deep, with a checker cluster at each end. */
.band { position: relative; height: 8px; background: linear-gradient(90deg, var(--sky), var(--peacock) 35%, var(--indigo) 70%, var(--night)); }
.band svg { position: absolute; bottom: 8px; height: 16px; width: 56px; }
.band .l { left: 0; }
.band .r { right: 0; transform: scaleX(-1); }

/* ---- Header ---- */
header.site { position: sticky; top: 0; background: rgba(246,246,241,0.94); backdrop-filter: blur(6px); z-index: 5; border-bottom: 1px solid var(--rule); }
.nav { display: flex; align-items: center; height: 72px; gap: 40px; }
.mark { display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--ink); position: relative; }
.mark .ab { font-family: var(--display); font-weight: 760; font-size: 28px; line-height: 1; letter-spacing: -0.01em; }
.mark .full { font: 500 12px/1 var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.links { display: flex; gap: 32px; margin-left: auto; font: 500 15px/1 var(--body); }
.links a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; text-decoration-color: var(--peacock); }
/* The compact menu: shown below 1000px, where the section links fold into a panel under the header. */
.menu { display: none; }
.menu i, .menu i::before, .menu i::after { display: block; width: 18px; height: 2px; background: currentColor; transition: transform 160ms ease-out, background-color 160ms ease-out; }
.menu i { position: relative; }
.menu i::before, .menu i::after { content: ""; position: absolute; left: 0; }
.menu i::before { top: -6px; }
.menu i::after { top: 6px; }
.menu[aria-expanded="true"] i { background-color: transparent; }
.menu[aria-expanded="true"] i::before { transform: translateY(6px) rotate(45deg); }
.menu[aria-expanded="true"] i::after { transform: translateY(-6px) rotate(-45deg); }
.menu:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .menu i, .menu i::before, .menu i::after { transition: none; } }

/* ---- Hero and the stack motif (the one authored motion: the stack builds from its base up) ---- */
.hero { display: grid; grid-template-columns: 7fr 5fr; gap: 48px; padding: 64px 40px 56px; align-items: center; }
.hero > * { min-width: 0; }
.hero .copy { padding-bottom: 0; }
.stackfig { width: 100%; max-width: 520px; margin-left: auto; }
.stackpx { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  /* The one authored motion: plates settle into place one at a time, from the base up. */
  .stackpx .pl { animation: settle 520ms cubic-bezier(.2,.7,.2,1) both; }
  .stackpx .plate:nth-of-type(1) .pl { animation-delay: 0.10s; }
  .stackpx .plate:nth-of-type(2) .pl { animation-delay: 0.18s; }
  .stackpx .plate:nth-of-type(3) .pl { animation-delay: 0.26s; }
  .stackpx .plate:nth-of-type(4) .pl { animation-delay: 0.34s; }
  .stackpx .plate:nth-of-type(5) .pl { animation-delay: 0.42s; }
  .stackpx .plate:nth-of-type(6) .pl { animation-delay: 0.50s; }
  .stackpx .plate:nth-of-type(7) .pl { animation-delay: 0.58s; }
  .stackpx .plate:nth-of-type(8) .pl { animation-delay: 0.66s; }
  .stackpx .plate:nth-of-type(9) .pl { animation-delay: 0.74s; }
  .stackpx .plate:nth-of-type(10) .pl { animation-delay: 0.82s; }
  .stackpx .plate:nth-of-type(11) .pl { animation-delay: 0.90s; }
  .stackpx .grp, .stackpx .brk { animation: fade 400ms ease-out 0.9s both; }
  .stackfig .legend { animation: fade 400ms ease-out 1.1s both; }
  @keyframes settle { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
.hero .legend { display: flex; gap: 20px; flex-wrap: wrap; justify-content: flex-start; font: 500 12px/1 var(--mono); color: var(--muted); margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; }
.sw.solid { background: var(--indigo); }
.sw.adopt { background: #6FA9C8; }
.sw.half { background: repeating-linear-gradient(45deg, var(--peacock) 0 2px, #B5DCE8 2px 4px); }
.sw.hollow { border: 1.5px dashed var(--peacock); }

/* ---- Sections: numbered sheets ---- */
section.sheet { border-top: 1px solid var(--rule); padding: 88px 0; display: grid; grid-template-columns: 200px 1fr; gap: 40px; }
section.sheet > * { min-width: 0; }
.band + .wrap > section.sheet:first-child { border-top: 0; }

ul.stats { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); max-width: 960px; }
.stats li { padding: 14px 16px 0 0; }
.stats li + li { padding-left: 16px; border-left: 1px solid var(--rule); }
.stats b { display: block; font: 760 40px/1.05 var(--display); color: var(--ink); }
.src { font: 400 12.5px/1.5 var(--mono); color: var(--muted); margin: 16px 0 0; }
.stats i { display: block; font: 400 14.5px/1.45 var(--body); color: var(--muted); font-style: normal; margin-top: 4px; }

/* Objects and members: ruled rows, never card grids. */
ol.rows { list-style: none; padding: 0; margin: 36px 0 0; border-top: 1px solid var(--ink); max-width: 960px; counter-reset: r; }
ol.rows li { counter-increment: r; display: grid; grid-template-columns: 64px 280px 1fr; gap: 0 24px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
ol.rows li::before { content: counter(r, decimal-leading-zero); font: 500 14px/1.9 var(--mono); color: var(--muted); }
ol.rows.plainnum li::before { content: ""; width: 8px; height: 8px; background: var(--indigo); margin-top: 10px; }
ol.rows p { color: var(--ink-2); font-size: 17px; margin: 0; }


/* ---- The stack: one ruled row per layer ---- */
.layer.l7 { --c: #6FC6D9; }
.layer.l6 { --c: #52B3CC; }
.layer.l5 { --c: #3A9FBE; }
.layer.l4 { --c: #2E8BB3; }
.layer.l3 { --c: #2B77A8; }
.layer.l2 { --c: #2D649D; }
.layer.l1b { --c: #305391; }
.layer.l1 { --c: #314485; }
.layer.l0 { --c: #2F3878; }
.layer.lm1 { --c: #2A2C6A; }
.layer.lm2 { --c: #23215C; }
.layer.lmod { --c: #1D6F80; }
.stackpx .ln { font: 500 14px var(--mono); fill: var(--muted); }
.stackpx .lt { font: 600 17px var(--body); fill: var(--ink); }
.stackpx .grp { font: 500 10.5px var(--mono); letter-spacing: .08em; fill: var(--muted); }
.stackpx .plate { transition: transform 200ms cubic-bezier(.2,.7,.2,1); }
.stackpx .pl { transform-box: view-box; }
.stackpx a { cursor: pointer; }
.stackpx a:focus-visible { outline: none; }
.stackpx .hit { fill: transparent; }
.stackpx .brk { fill: none; stroke: var(--peacock-text); stroke-width: 2.5; }
.stackpx .grp.mod { fill: var(--peacock-text); font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.stackpx a.k-mod:hover .mod { text-decoration: underline; }
.stackpx a:hover .lt { text-decoration: underline; }
.stackpx a:focus-visible .ring { stroke: var(--ink); stroke-width: 2; }
.stackpx:has(.k-l7:hover) .p-l7, .stackpx:has(.k-l7:focus-visible) .p-l7 { transform: translateY(-6px); }
.stackpx:has(.k-l6:hover) .p-l6, .stackpx:has(.k-l6:focus-visible) .p-l6 { transform: translateY(-6px); }
.stackpx:has(.k-l5:hover) .p-l5, .stackpx:has(.k-l5:focus-visible) .p-l5 { transform: translateY(-6px); }
.stackpx:has(.k-l4:hover) .p-l4, .stackpx:has(.k-l4:focus-visible) .p-l4 { transform: translateY(-6px); }
.stackpx:has(.k-l3:hover) .p-l3, .stackpx:has(.k-l3:focus-visible) .p-l3 { transform: translateY(-6px); }
.stackpx:has(.k-l2:hover) .p-l2, .stackpx:has(.k-l2:focus-visible) .p-l2 { transform: translateY(-6px); }
.stackpx:has(.k-l1:hover) .p-l1, .stackpx:has(.k-l1:focus-visible) .p-l1 { transform: translateY(-6px); }
.stackpx:has(.k-l0:hover) .p-l0, .stackpx:has(.k-l0:focus-visible) .p-l0 { transform: translateY(-6px); }
.stackpx:has(.k-lm1:hover) .p-lm1, .stackpx:has(.k-lm1:focus-visible) .p-lm1 { transform: translateY(-6px); }
.stackpx:has(.k-lm2:hover) .p-lm2, .stackpx:has(.k-lm2:focus-visible) .p-lm2 { transform: translateY(-6px); }
ol.why { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); max-width: 1000px; }
.why li { padding: 20px 24px 0 0; }
.why li + li { padding-left: 24px; border-left: 1px solid var(--rule); }
.why p { color: var(--ink-2); font-size: 16.5px; margin: 0; }
.layers { margin-top: 40px; border-top: 1px solid var(--ink); max-width: 1000px; }
.layer { display: grid; grid-template-columns: 112px 1fr 340px; gap: 0 32px; padding: 32px 0; border-bottom: 1px solid var(--rule); }
.layer > * { min-width: 0; }
.lnum { display: flex; gap: 16px; align-items: stretch; }
.lnum .bar { width: 12px; flex: none; min-height: 72px; }
.bar.solid { background: var(--c); }
.bar.hollow { box-shadow: inset 0 0 0 3px var(--c); }
.bar.half { background: linear-gradient(180deg, transparent 50%, var(--c) 50%); box-shadow: inset 0 0 0 3px var(--c); }
.lnum .n { font: 760 56px/0.9 var(--display); letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.lmain h3 { font-size: 28px; margin-bottom: 10px; }
.lmain p { color: var(--ink-2); font-size: 17px; max-width: 52ch; }
.built { font-size: 15px !important; color: var(--muted) !important; margin: 0; }
.built span, .lside dt { display: block; font: 500 11.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.lside { margin: 0; display: grid; gap: 18px; align-content: start; }
.lside dd { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.st { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1 var(--mono); color: var(--ink); margin: 2px 0 6px; width: 100%; }
.st::before { content: ""; width: 10px; height: 10px; flex: none; }
.st.solid::before { background: var(--c); }
.st.half::before { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); box-shadow: inset 0 0 0 2px var(--c); }
.st.hollow::before { box-shadow: inset 0 0 0 2px var(--c); }
.layer:target { background: var(--bg-2); outline: 8px solid var(--bg-2); }
@media (max-width: 1000px) {
  ol.why { grid-template-columns: 1fr; }
  .why li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); margin-top: 20px; }
  .layer { grid-template-columns: 72px 1fr; gap: 16px 20px; }
  .lside { grid-column: 2; }
  .lnum .n { font-size: 40px; }
  .lmain h3 { font-size: 24px; }
}
@media (max-width: 520px) {
  .layer { grid-template-columns: 1fr; }
  .lside { grid-column: 1; }
  .lnum .bar { min-height: 0; height: 40px; }
}

/* ---- Closing band ---- */
.close { background: var(--ink); color: var(--bg); }
.close .wrap { padding-top: 96px; padding-bottom: 96px; display: grid; grid-template-columns: 7fr 5fr; gap: 56px; align-items: end; }
.close h2 { font-size: 64px; color: var(--bg); margin: 0; }
.close p { color: var(--on-dark-2); max-width: 46ch; }
.close .idx { color: var(--on-dark-2); margin-bottom: 24px; }
.close .idx b { color: var(--bg); }

/* ---- Footer ---- */
footer.site { padding: 32px 0 40px; }
.fine { font: 400 12.5px/1.6 var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

/* ---- Responsive: approved at 320px first in Dwaar's system ---- */
@media (max-width: 1000px) {
  .wrap { padding: 0 16px; }
  .nav { gap: 8px; }
  .menu:not([hidden]) { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 0; border-radius: 2px; background: transparent; color: var(--ink); cursor: pointer; }
  .menu[aria-expanded="true"] { background: var(--bg-2); }
  .links { display: none; }
  .menu[hidden] ~ .btn { margin-left: auto; }
  header.site.open .links { display: flex; flex-direction: column; gap: 0; position: absolute; top: 100%; left: 0; right: 0; padding: 4px 16px 12px; background: var(--bg); border-bottom: 1px solid var(--ink); font: 650 22px/1 var(--display); }
  header.site.open .links a { min-height: 56px; color: var(--ink); border-bottom: 1px solid var(--rule); }
  header.site.open .links a:last-child { border-bottom: 0; }
  header.site.open .links a::before { content: ""; width: 8px; height: 8px; margin-right: 14px; background: var(--peacock); }
  .wrap.hero { grid-template-columns: 1fr; gap: 8px; padding: 48px 16px 48px; }
  .hero .copy { padding-bottom: 32px; }
  .stackfig { margin: 0 auto; max-width: 460px; }
  section.sheet { grid-template-columns: 1fr; gap: 20px; padding: 64px 0; }
  h2 { font-size: 36px; }
  ol.rows li { grid-template-columns: 48px 1fr; }
  ol.rows li p { grid-column: 2; margin-top: 6px; }
  .close .wrap { grid-template-columns: 1fr; gap: 32px; padding-top: 72px; padding-bottom: 72px; }
  .close h2 { font-size: 44px; }
}
@media (max-width: 640px) {
  .stackpx .lt { font-size: 23px; }
  .stackpx .ln { font-size: 18px; }
  .stackpx .grp { font-size: 14px; }
  .stackpx .grp.mod { font-size: 18px; }
  .mark .full { display: none; }
  ul.stats { grid-template-columns: 1fr; }
  .stats li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); margin-top: 16px; }
}

/* ---- Print: keep the swatches and buttons, drop the sticky header and the animation ---- */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  header.site { position: static; }
  .skip, .stackpx .pl { animation: none !important; }
  .layer, ol.rows li, .why li, .stats li { break-inside: avoid; }
  section.sheet { padding: 40px 0; }
}

/* ---- Inner pages: a page head, then the same numbered sheets ---- */
.phead { padding-top: 72px; padding-bottom: 56px; }
.phead > * { max-width: 900px; }
.phead h1 { font-size: clamp(40px, 4.6vw, 64px); }
.phead .lede { max-width: 52ch; margin-bottom: 0; }
.phead + .band { margin-bottom: 0; }
.sheet h2 + .sub { margin-top: 0; }
.sheet .sub + .sub { margin-top: 0; }
.sheet ul.plain { margin-top: 28px; }
.links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; text-decoration-color: var(--peacock); }
/* Questions and answers: question left, answer right, ruled like the rows. */
dl.qa { margin: 8px 0 0; border-top: 1px solid var(--ink); max-width: 1000px; }
dl.qa > div { display: grid; grid-template-columns: 340px 1fr; gap: 8px 40px; padding: 24px 0; border-bottom: 1px solid var(--rule); }
dl.qa dt { font-family: var(--display); font-weight: 650; font-stretch: 90%; font-size: 22px; line-height: 1.2; text-wrap: balance; }
dl.qa dd { margin: 0; color: var(--ink-2); font-size: 17px; }
dl.qa dd p { margin: 0 0 10px; }
.fine a { color: var(--muted); }
.fine nav { display: flex; gap: 20px; flex-wrap: wrap; }
@media (max-width: 1000px) {
  .phead { padding-top: 48px; padding-bottom: 40px; }
  dl.qa > div { grid-template-columns: 1fr; }
}
.sub.after { margin-top: 28px; }
