/* Memory MCP page, loaded after giblex.css.
   Editorial layout: confident type, generous space, one surface, and illustrations with
   real depth (gradients, soft light, fine strokes) instead of boxes inside boxes. */

:root {
  --hair: rgba(73,91,114,.14);
  --hair-2: rgba(73,91,114,.2);
  --steel-3: #8FAAC5;
}

/* Cool blue-grey with a soft pink cast, echoing the Memory MCP mark. */
body.mm {
  --char: #E5E9F0;
  --line: rgba(73,91,114,.17);
  --text: #252A33;
  --dim: #626B78;
  --steel: #547A9F;
  --steel-2: #3F5F80;
  background-color: #E5EAF1;
  background-image:
    radial-gradient(ellipse 30% 20% at 14% 14%, rgba(239,174,211,.38) 0%, rgba(239,174,211,.2) 36%, rgba(239,174,211,.07) 62%, transparent 82%),
    radial-gradient(ellipse 27% 20% at 84% 34%, rgba(234,171,211,.34) 0%, rgba(234,171,211,.17) 38%, rgba(234,171,211,.06) 64%, transparent 84%),
    radial-gradient(ellipse 33% 23% at 31% 66%, rgba(241,183,216,.32) 0%, rgba(241,183,216,.16) 38%, rgba(241,183,216,.05) 64%, transparent 84%),
    radial-gradient(ellipse 29% 20% at 78% 91%, rgba(232,168,207,.36) 0%, rgba(232,168,207,.18) 38%, rgba(232,168,207,.06) 64%, transparent 84%),
    linear-gradient(135deg, #E3EAF2 0%, #EAE3EF 52%, #E5EAF1 100%);
  color: var(--text);
}
.mm .btn { border-color: rgba(54,72,94,.22); color: var(--text); }
.mm .btn:hover { border-color: var(--steel); }
.mm .btn--primary { background: #344B63; border-color: #344B63; color: #F4F6F9; }
.mm .btn--primary:hover { background: #293E54; border-color: #293E54; }
.mm .link { color: var(--steel); }

/* ── type and rhythm ─────────────────────────────────────── */
.mm main > section { padding: clamp(5rem, 11vw, 9rem) 0; border-top: 0 !important; }
.mm main > section.opening { padding-top: clamp(4rem, 9vw, 7rem); }
.mm .t-display { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -.035em; max-width: 13ch; }
.mm .h-sec { font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.06; letter-spacing: -.03em; font-weight: 600; max-width: 18ch; margin: 0; }
.mm .lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--dim); max-width: 36em; margin: 1.25rem 0 0; }
.mm .sec-head { max-width: 760px; }
.mm .sec-head--center { margin: 0 auto; text-align: center; }
.mm .sec-head--center .h-sec, .mm .sec-head--center .lead { margin-left: auto; margin-right: auto; }
.mm .kicker { color: var(--steel); font-weight: 500; font-size: .95rem; margin: 0 0 1rem; }

/* ── hero ─────────────────────────────────────────────────── */
.mm .mm-page-title { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.mm .mm-page-title img { width: 80px; height: 80px; object-fit: contain; flex: none; }
.mm .mm-page-title .kicker { margin: 0; color: #456B90; font-size: 1.35rem; font-weight: 600; }
.mm .hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.mm .hero-art { position: relative; }
.mm .hero-art::before { content: ''; position: absolute; inset: 10% 5% 0; background: radial-gradient(closest-side, rgba(231,190,216,.5), transparent); filter: blur(10px); z-index: -1; }
@media (max-width: 900px) { .mm .hero-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) {
  .mm .brand-suite { display: inline-flex; padding-left: .5rem; font-size: .6rem; letter-spacing: .08em; }
  .mm .brand-wrap { gap: .5rem; }
  .mm .brand { gap: .4rem; font-size: .9rem; letter-spacing: .15em; }
}

/* ── illustrations ────────────────────────────────────────── */
.illo { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.illo .lbl { fill: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.illo .sub { fill: var(--dim); font-size: 13px; }
.illo .mono { font-family: var(--mono); font-size: 13px; fill: var(--steel-2); }
.illo .cap { fill: #69717D; font-size: 12px; font-weight: 500; }
.illo .cap--hi { fill: var(--steel-2); }
.illo .dark { fill: #1B1E22; }
.illo .dark-sub { fill: #3A4652; }
.illo .line { fill: none; stroke: rgba(77,103,137,.4); stroke-width: 1.5; }
.illo .line--hi { stroke: #6185AA; stroke-width: 1.8; }
.illo .line--dash { stroke: rgba(90,74,68,.35); stroke-dasharray: 3 5; stroke-linecap: round; }
.illo .card { fill: url(#g-card); stroke: rgba(86,114,149,.3); stroke-width: 1.2; }
.illo .card--hi { fill: url(#g-steel-v); stroke: rgba(63,86,108,.45); stroke-width: 1.5; }
.illo .halo { paint-order: stroke; stroke: var(--char); stroke-width: 7px; stroke-linejoin: round; }
.hero-art .layer-code { fill: #344253; font: 500 10px var(--mono); letter-spacing: 0; }
.hero-art .layer-input { fill: #4E5B6A; font: 400 10px var(--sans); }
.hero-art .layer-copy--core .layer-code,
.hero-art .layer-copy--core .layer-input { fill: #F2F6FA; }
.hero-art .context-paths path { fill: none; stroke: rgba(79,104,137,.62); stroke-width: 1.35; stroke-dasharray: 3 4; }
.hero-art .context-paths rect { fill: rgba(246,247,250,.88); stroke: rgba(79,104,137,.32); stroke-width: 1; }
.hero-art .context-paths text { fill: #3F5F80; font: 500 11px var(--sans); }
.hero-art .context-paths path { animation: context-flow 8s linear infinite; }
.hero-art .context-paths rect { filter: drop-shadow(0 2px 3px rgba(71,93,128,.1)); }
.diagram-panel { padding: clamp(.75rem, 2vw, 1.75rem); border: 1px solid rgba(83,111,148,.18); border-radius: 24px; background: radial-gradient(ellipse at 70% 30%, rgba(226,178,213,.22), transparent 65%), linear-gradient(135deg, rgba(250,252,255,.55), rgba(218,230,243,.32)); box-shadow: 0 24px 60px -45px rgba(52,80,118,.4); }
.diagram-panel--loop { background: radial-gradient(ellipse at center, rgba(177,201,231,.32), transparent 60%), linear-gradient(135deg, rgba(250,252,255,.5), rgba(235,217,235,.3)); }
.diagram-flow path { fill: none; stroke: #527EA8; stroke-width: 2.8; stroke-linecap: round; stroke-dasharray: 8 48; animation: diagram-flow 5.6s linear infinite; pointer-events: none; }
.diagram-flow path:nth-child(2n) { animation-delay: -1.4s; }
.diagram-flow path:nth-child(3n) { animation-delay: -2.8s; }
.diagram-flow--alternative path { stroke: #A57198; stroke-width: 2; animation-duration: 8.4s; }
@keyframes diagram-flow { to { stroke-dashoffset: -112; } }
@keyframes context-flow { to { stroke-dashoffset: -70; } }
#loop .illo .line { stroke: rgba(83,111,143,.38); }
#loop .illo .line--dash { stroke: rgba(104,116,132,.48); }
#loop .illo .halo { stroke: var(--char); }
#loop .loop-trail {
  fill: none;
  stroke: #AC709B;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 22 978;
  animation: loop-travel 18s linear infinite;
  filter: drop-shadow(0 0 3px rgba(88,127,162,.32));
}
#loop .loop-node {
  transform-box: fill-box;
  transform-origin: center;
  animation: loop-node-arrive 18s ease-in-out var(--node-delay) infinite;
  animation-fill-mode: backwards;
}
#loop .loop-node--1 { --node-delay: 0s; }
#loop .loop-node--2 { --node-delay: 2.25s; }
#loop .loop-node--3 { --node-delay: 4.5s; }
#loop .loop-node--4 { --node-delay: 6.75s; }
#loop .loop-node--5 { --node-delay: 9s; }
#loop .loop-node--6 { --node-delay: 11.25s; }
#loop .loop-node--7 { --node-delay: 13.5s; }
#loop .loop-node--8 { --node-delay: 15.75s; }
#loop .loop-pulse-halo { filter: blur(2px); }
#loop .pulse { filter: drop-shadow(0 1px 2px rgba(48,70,94,.42)); }
@keyframes loop-travel { to { stroke-dashoffset: -1000; } }
@keyframes loop-node-arrive {
  0%, 8%, 100% { opacity: .32; transform: scale(.95); }
  2% { opacity: .9; transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  #loop .loop-trail { animation: none; }
  #loop .loop-node { animation: none; opacity: .45; transform: none; }
  #loop .loop-pulse-halo, #loop .pulse { display: none; }
}

.wide-only { display: block; }
.narrow-only { display: none; }
@media (max-width: 760px) { .wide-only { display: none; } .narrow-only { display: block; } }
.figcap { color: var(--dim); font-size: .95rem; max-width: 44em; margin: 2rem auto 0; text-align: center; }

/* ── loop, narrow version: a numbered typographic list ── */
.loop-list { list-style: none; padding: 0; margin: 2.5rem 0 0; counter-reset: s; border-top: 1px solid var(--hair); }
.loop-list li { counter-increment: s; display: grid; grid-template-columns: 2.4rem 1fr; padding: 1rem 0; border-bottom: 1px solid var(--hair); }
.loop-list li::before { content: counter(s, decimal-leading-zero); color: var(--steel); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; padding-top: .15rem; }
.loop-list li.core::before { content: ''; }
.loop-list b { font-weight: 600; }
.loop-list span { display: block; color: var(--dim); font-size: .95rem; margin-top: .1rem; }
.loop-list li.core { background: linear-gradient(90deg, rgba(86,113,139,.12), transparent); padding-left: .8rem; }

/* ── system map: four editorial columns ── */
.cols4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); margin-top: 4rem; }
.cols4 h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 1.1rem; padding-top: 1rem; border-top: 1px solid var(--steel); }
.cols4 dl { margin: 0; display: grid; gap: 1.1rem; }
.cols4 dt { font-weight: 500; }
.cols4 dd { margin: .2rem 0 0; color: var(--dim); font-size: .93rem; line-height: 1.5; }
.cols4 .testing { display: inline-block; margin-left: .45rem; font-size: .75rem; font-weight: 600; color: #95661F; }
.profile-grid { margin-top: 3rem; }
.profile-note { max-width: 48rem; margin: 2.5rem auto 0; padding: 1.1rem 1.4rem; border-left: 3px solid var(--steel); background: rgba(255,255,255,.34); color: var(--dim); line-height: 1.55; }
.profile-note b { color: var(--text); font-weight: 600; }
.profile-scene { position: relative; isolation: isolate; margin: 3rem 0 0; padding: clamp(1.2rem, 3vw, 2.5rem); border: 1px solid rgba(92,116,147,.2); border-radius: 28px; background: radial-gradient(ellipse at 50% 45%, rgba(228,173,211,.35), transparent 65%), linear-gradient(135deg, rgba(250,251,255,.7), rgba(217,228,242,.65)); box-shadow: 0 24px 70px -40px rgba(62,88,124,.45); }
.profile-scene--people { background: radial-gradient(ellipse at 50% 45%, rgba(161,195,226,.4), transparent 65%), linear-gradient(135deg, rgba(250,251,255,.7), rgba(238,216,233,.5)); }
.profile-scene__heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 2rem; }
.profile-eyebrow { display: block; color: #526E8C; font: 500 .7rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.profile-example { color: var(--dim); font-size: .75rem; padding: .35rem .65rem; border: 1px solid var(--hair); border-radius: 20px; }
.profile-map { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2.5rem); align-items: center; }
.profile-wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; }
.profile-wires path { fill: none; stroke: rgba(96,129,164,.3); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.profile-wires .profile-signal { stroke: #AC6E9B; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 14 88; animation: profile-flow 8s linear infinite; }
.profile-map__column { display: grid; gap: 1.25rem; }
.profile-card { position: relative; padding: 1.25rem; border: 1px solid rgba(100,127,156,.3); border-radius: 18px; background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(236,242,250,.94)); box-shadow: 0 10px 24px -20px rgba(59,84,116,.4); transition: border-color .25s ease, box-shadow .25s ease; }
.profile-card:hover { border-color: rgba(144,98,140,.55); box-shadow: 0 12px 32px -18px rgba(112,92,145,.35); }
.profile-card::after { content: ''; position: absolute; top: 1.2rem; right: 1rem; width: 5px; height: 5px; border-radius: 50%; background: #A477A1; box-shadow: 0 0 0 4px rgba(164,119,161,.12); animation: profile-node-glow 8s ease-in-out infinite; }
.profile-map__column:last-child .profile-card::after { animation-delay: -4s; background: #6089B1; }
.profile-map__column .profile-card:last-child::after { animation-delay: -2s; }
.profile-card h3 { margin: .8rem 0 .55rem; font-size: 1.12rem; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.profile-card p, .profile-card blockquote { margin: 0; color: var(--dim); font-size: .9rem; line-height: 1.55; }
.profile-card blockquote { margin-top: .8rem; color: var(--text); font-size: 1.12rem; }
.profile-card b { color: var(--text); font-weight: 500; }
.profile-tag { display: inline-block; margin-top: 1rem; padding: .3rem .6rem; border-radius: 20px; background: #E4EDF6; color: #456586; font-size: .72rem; }
.profile-tag--pink { background: #F1E1ED; color: #845574; }
.profile-core { text-align: center; min-width: 0; }
.profile-orb { position: relative; display: flex; flex-direction: column; justify-content: center; gap: .75rem; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(255,255,255,.85); padding: 1.2rem; background: radial-gradient(circle at 30% 25%, #F8F4FB, #DBD4EB 45%, #A7BED8); box-shadow: inset -12px -18px 40px rgba(72,102,141,.12), 0 0 0 9px rgba(255,255,255,.2), 0 15px 45px -20px rgba(87,102,145,.5); }
.profile-orb::before { content: ''; position: absolute; inset: -18px; border: 1px solid rgba(148,111,160,.3); border-radius: 50%; animation: profile-breathe 6s ease-in-out infinite; pointer-events: none; }
.profile-orb::after { content: ''; position: absolute; inset: -10px; border: 2px solid transparent; border-top-color: rgba(156,103,148,.65); border-bottom-color: rgba(89,130,173,.6); border-radius: 50%; animation: profile-orbit 24s linear infinite; pointer-events: none; }
.profile-orb strong { color: #344B68; font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.15; letter-spacing: -.03em; }
.profile-orb > span:last-child { color: #4F6177; font-size: .8rem; line-height: 1.45; }
.profile-core__note { display: block; margin: 2rem auto 0; max-width: 22ch; color: var(--dim); font-size: .75rem; line-height: 1.5; }
.profile-orb--person { background: radial-gradient(circle at 30% 25%, #F4FAFF, #CBDDED 45%, #B5ABCF); }
.profile-avatar { display: grid; place-items: center; margin: 0 auto; width: 3rem; height: 3rem; border-radius: 50%; background: rgba(255,255,255,.65); color: #527399; font-size: 1.5rem; font-weight: 600; }
.profile-facts { margin: .8rem 0 0; display: grid; gap: .5rem; font-size: .85rem; }
.profile-facts > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .75rem; border-bottom: 1px solid var(--hair); padding-bottom: .5rem; }
.profile-facts dt { color: var(--dim); }
.profile-facts dd { margin: 0; color: var(--text); }
.profile-caption { color: var(--dim); max-width: 52rem; margin: 2rem auto 0; text-align: center; font-size: .85rem; line-height: 1.6; }
.profile-caption span { color: #986B91; padding: 0 .25rem; }
@keyframes profile-flow { to { stroke-dashoffset: -204; } }
@keyframes profile-breathe { 50% { transform: scale(1.06); opacity: .4; } }
@keyframes profile-orbit { to { transform: rotate(360deg); } }
@keyframes profile-node-glow { 0%, 100% { opacity: .45; } 40%, 60% { opacity: 1; } }
@media (max-width: 600px) {
  .profile-map { grid-template-columns: 1fr; gap: 2rem; }
  .profile-wires { display: none; }
  .profile-core { padding: 1rem 0; }
  .profile-orb { width: min(100%, 240px); margin: 0 auto; }
  .profile-core__note { max-width: 32ch; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-wires .profile-signal, .profile-orb::before, .profile-orb::after, .profile-card::after, .hero-art .context-paths path { animation: none; }
  .diagram-flow { display: none; }
  .profile-card { transition: none; }
}
@media (max-width: 1000px) { .cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols4 { grid-template-columns: 1fr; } }

/* ── truth: the certainty ladder, typographic ── */
.ladder { display: grid; grid-template-columns: 6px 1fr; gap: 1.6rem; margin-top: 3.5rem; }
.ladder__bar { border-radius: 3px; background: linear-gradient(180deg, var(--steel-2), rgba(86,113,139,.12)); }
.rungs { display: grid; }
.rung { display: grid; grid-template-columns: 170px 1fr 220px; gap: 1.5rem; align-items: baseline; padding: 1.25rem 0; border-bottom: 1px solid var(--hair); }
.rung:first-child { padding-top: 0; }
.rung code { font-family: var(--mono); font-size: .8rem; color: var(--steel); letter-spacing: .04em; }
.rung q { quotes: none; font-size: 1.15rem; letter-spacing: -.01em; }
.rung small { color: var(--dim); font-size: .9rem; text-align: right; }
@media (max-width: 760px) { .rung { grid-template-columns: 1fr; gap: .3rem; } .rung small { text-align: left; } }
.sub-head { font-size: 1.35rem; font-weight: 600; letter-spacing: -.015em; margin: 6rem 0 0; }
.sub-lead { color: var(--dim); max-width: 38em; margin: .7rem 0 0; }

/* ── values + safeguards ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.5rem, 6vw, 6rem); margin-top: 4rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.col-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 1.5rem; padding-top: 1rem; border-top: 1px solid var(--steel); }
.values { display: grid; gap: 1.05rem; }
.value { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1rem; font-size: .95rem; }
.value span:last-of-type { color: var(--dim); font-variant-numeric: tabular-nums; }
.value i { grid-column: 1 / -1; display: block; height: 4px; border-radius: 2px; background: rgba(90,74,68,.12); position: relative; overflow: hidden; }
.value i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 2px; background: linear-gradient(90deg, var(--steel-3), var(--steel-2)); box-shadow: 0 0 10px rgba(86,113,139,.25); }
.col-note { color: var(--dim); font-size: .9rem; margin: 1.6rem 0 0; }
.guards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.35rem; }
.guards b { display: block; font-weight: 500; }
.guards span { display: block; color: var(--dim); font-size: .93rem; margin-top: .2rem; line-height: 1.5; }

/* ── retrieval weights ── */
.weights { max-width: 860px; margin: 3.5rem auto 0; }
.weights__bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; box-shadow: 0 0 0 1px var(--hair), 0 12px 30px -12px rgba(86,113,139,.35); }
.weights__bar i { display: block; height: 100%; }
.weights__keys { display: grid; grid-template-columns: 45fr 30fr 15fr 10fr; margin-top: .9rem; font-size: .9rem; }
.weights__keys span { color: var(--dim); padding-right: .75rem; }
.weights__keys b { display: block; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.k1 { background: #3F566C; } .k2 { background: #6E8AA5; } .k3 { background: #98AEC2; } .k4 { background: #BFCDD9; } .k5 { background: #DCE4EB; }
@media (max-width: 600px) { .weights__keys { grid-template-columns: 1fr 1fr; row-gap: .8rem; } }

/* ── connect ── */
.connect { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3.5rem); margin-top: 4rem; }
.connect h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .9rem; padding-top: 1rem; border-top: 1px solid var(--steel); }
.connect ol { margin: 0; padding-left: 1.1rem; color: var(--dim); font-size: .95rem; }
.connect li + li { margin-top: .45rem; }
.connect p { color: var(--dim); font-size: .95rem; margin: 0 0 .9rem; }
.snippet { background: linear-gradient(180deg, #1A1C20, #16181B); border: 1px solid var(--hair-2); border-radius: 12px; padding: 1rem 1.1rem; font: 12.5px/1.6 var(--mono); color: #C9D1D9; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); }
.snippet .k { color: #8FA6BA; } .snippet .s { color: #D6E2EC; }
@media (max-width: 900px) { .connect { grid-template-columns: 1fr; } }

/* ── closing ── */
.closing { max-width: 44rem; margin: 0 auto; text-align: center; }
.closing .h-sec { margin: 0 auto; }
.closing p { color: var(--dim); font-size: 1.1rem; line-height: 1.6; margin: 1.4rem 0 0; }
.closing .actions { justify-content: center; margin-top: 2.2rem; }
