.akhlaq-section { padding-block: clamp(26px, 4vw, 54px); }
.akhlaq-section .frame { max-width: 1360px; }
.map-heading { display: flex; align-items: end; justify-content: space-between; gap: 26px; margin-bottom: 22px; }
.map-heading h1 { font-size: clamp(1.75rem, 3.4vw, 3rem); line-height: 1.55; }
.map-heading p { color: var(--muted); margin-top: 4px; font-size: 1.06rem; }
.map-search { width: min(300px, 100%); flex-shrink: 0; }
.map-search label { display: block; font-weight: 600; margin-bottom: 5px; }
.map-search-field { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-inline: 14px; background: #fffdf7; border: 1px solid #c7b9a4; border-radius: 8px; color: #796249; }
.map-search-field:focus-within { outline: 2px solid var(--bronze); outline-offset: 2px; }
.map-search-field input { width: 100%; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.map-search-field input::-webkit-search-cancel-button { display: none; }
.map-reset { align-self: stretch; color: var(--bronze); border: 0; background: transparent; font-weight: 700; }
.mind-search-status:not(:empty) { margin: 0 0 12px; color: var(--bronze); font-weight: 600; }

[data-branch="0"] { --branch-color: #72d8b1; --branch-ink: #24614d; }
[data-branch="1"] { --branch-color: #edbc79; --branch-ink: #81521d; }
[data-branch="2"] { --branch-color: #ecacaa; --branch-ink: #89484b; }
[data-branch="3"] { --branch-color: #8ccde5; --branch-ink: #306078; }
[data-branch="4"] { --branch-color: #c2adeb; --branch-ink: #664f86; }
[data-branch="5"] { --branch-color: #bfd48c; --branch-ink: #526631; }
.map-ready .map-stage { display: grid; align-items: start; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); gap: 22px; }

/* The button grid is also the graph layout. The canvas only draws its edges. */
.branch-diagram {
  --map-axis: horizontal;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 108px minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(85px, 1fr));
  column-gap: clamp(16px, 2vw, 32px);
  row-gap: 23px;
  padding: 38px clamp(16px, 2vw, 30px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #3c4a4a;
  color: #fff9eb;
  background-color: #15272e;
  background-image: radial-gradient(ellipse at 50% 48%, #384a4499, transparent 63%),
    radial-gradient(#d5c8a72c 1px, transparent 1.2px), linear-gradient(125deg, #14222d, #172f32);
  background-size: auto, 16px 16px, auto;
}
.branch-diagram[hidden] { display: none; }
.branch-diagram::before, .branch-diagram::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #d1b77a24;
}
.branch-diagram::before { width: 54%; }
.branch-diagram::after { width: 82%; border-style: dashed; opacity: .66; }
.branch-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-hub {
  grid-area: 2 / 2;
  width: 100px;
  aspect-ratio: 1;
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  isolation: isolate;
  text-align: center;
  color: #f6d9a2;
}
.map-hub::before, .map-hub::after {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  background: #283b3c;
  border: 1px solid #d7ae6c;
  border-radius: 13px;
}
.map-hub::before { transform: rotate(45deg); box-shadow: 0 0 25px #e7b76e20; }
.map-hub::after { background: linear-gradient(145deg, #35494a, #243638); }
.map-hub span { max-inline-size: 78%; font-family: var(--heading); font-size: .96rem; line-height: 1.5; text-wrap: balance; }
.map-hub small { color: #faf1df; font-size: .85rem; }
.diagram-node {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 72px;
  position: relative;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--branch-color) 60%, #24383c);
  border-radius: 10px;
  background: color-mix(in srgb, var(--branch-color) 10%, #192c33);
  color: #fffcf2;
  line-height: 1.5;
  text-align: center;
  transition: background-color .15s, box-shadow .15s;
}
.diagram-node strong { font-size: 1.08rem; }
.diagram-node small { font-size: .85rem; color: #e0e6df; }
.diagram-node:enabled:hover { border-color: var(--branch-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--branch-color) 30%, transparent); }
.diagram-node[aria-pressed="true"] { background: var(--branch-color); color: #16272a; border-color: #ffffffaa; box-shadow: 0 0 0 3px #111f2588, 0 0 0 4px var(--branch-color); }
.diagram-node[aria-pressed="true"] small { color: #273e3b; }
.diagram-node:focus-visible { outline: 3px solid white; outline-offset: 5px; }
.diagram-node:disabled { opacity: .42; cursor: default; }
.diagram-node[data-branch="0"] { grid-area: 1 / 1; }
.diagram-node[data-branch="1"] { grid-area: 2 / 1; }
.diagram-node[data-branch="2"] { grid-area: 3 / 1; }
.diagram-node[data-branch="3"] { grid-area: 1 / 3; }
.diagram-node[data-branch="4"] { grid-area: 2 / 3; }
.diagram-node[data-branch="5"] { grid-area: 3 / 3; }

.map-ready .mind-branches { display: block; padding: 0; }
.map-ready .mind-branches::before, .map-ready .mind-branches::after, .map-ready .mind-branch::before { display: none; }
.map-ready .mind-branch { padding: clamp(16px, 2vw, 28px); background: #fffdf7; border: 1px solid #ddcfbc; border-block-start: 4px solid var(--branch-ink); border-radius: 14px; }
.map-ready .mind-branch h2 { color: var(--branch-ink); font-size: 1.42rem; scroll-margin-block-start: 12px; }
.virtue-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-block: 12px 18px; }
.virtue-picker button {
  border: 1px solid #d6cbbb; border-radius: 20px; padding: 6px 13px; min-height: 40px;
  color: var(--ink); background: transparent; font-weight: 600;
}
.virtue-picker button:hover { border-color: var(--branch-ink); }
.virtue-picker button[aria-pressed="true"] { background: var(--branch-ink); border-color: var(--branch-ink); color: #fffdf7; }
.map-ready .virtues { display: block; margin: 0; }
.map-ready .virtues > li > details { border: 0; background: transparent; }
.map-ready .virtues > li > details > summary { display: none; }
.map-ready .virtue-evidence { padding: 14px 0 0; border-block-start: 1px solid var(--line); }
.map-ready .virtue-evidence h3 { font-size: 1.3rem; }
.map-ready .virtue-evidence > p { margin-top: 4px; color: var(--ink); }
.evidence-group { margin-top: 16px; }
.evidence-group h4 { margin: 0 0 7px; color: var(--branch-ink, var(--bronze)); font-size: 1rem; }
.evidence-list { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.evidence-list li { padding: 10px 14px; border-inline-start: 3px solid #c6ae84; background: #f4f0e6; border-radius: 5px; overflow-wrap: anywhere; }
.evidence-list blockquote { margin: 0 0 5px; line-height: 1.8; }
.evidence-list .evidence-verse { font-size: 1.12rem; line-height: 2; }
.evidence-citation { display: flex; flex-wrap: wrap; gap: 2px 9px; margin: 0; align-items: baseline; }
.evidence-citation span, .evidence-more summary span { color: var(--muted); font-size: .9rem; }
.virtues .evidence-more { border: 0; background: transparent; }
.virtues .evidence-more > summary { width: fit-content; padding-inline: 2px; color: var(--branch-ink, var(--bronze)); }
.map-references { margin-block-start: 20px; color: var(--muted); }
.map-references summary { width: fit-content; min-height: 44px; padding-block: 8px; cursor: pointer; color: var(--bronze); font-weight: 700; }
.map-references p + p, .map-references ul { margin-top: 7px; }
.map-references a { color: var(--bronze); text-decoration: underline; text-underline-offset: 3px; }
.map-return { display: none; }

@media (max-width: 980px) {
  .map-ready .map-stage { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .branch-diagram { grid-template-rows: repeat(3, minmax(60px, 1fr)); padding-block: 20px; row-gap: 10px; }
  .diagram-node { min-height: 58px; }
  .map-return { display: inline-block; padding: 6px 0; margin-top: 10px; background: transparent; border: 0; color: var(--branch-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
}
@media (max-width: 690px) {
  .map-heading { display: grid; gap: 14px; margin-bottom: 16px; }
  .map-search { width: 100%; }
}
@media (max-width: 540px) {
  .branch-diagram {
    --map-axis: vertical;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto 88px auto;
    padding: 15px 9px;
    column-gap: 7px;
    row-gap: 20px;
  }
  .map-hub { width: 82px; }
  .map-hub span { font-size: .85rem; }
  .map-hub small { font-size: .78rem; }
  .diagram-node { padding: 6px 4px; height: 100%; }
  .diagram-node strong { font-size: .95rem; }
  .diagram-node small { display: none; }
  .is-searching .diagram-node small { display: block; }
  .diagram-node[data-branch="0"] { grid-area: 1 / 1; }
  .diagram-node[data-branch="1"] { grid-area: 1 / 2; }
  .diagram-node[data-branch="2"] { grid-area: 1 / 3; }
  .diagram-node[data-branch="3"] { grid-area: 3 / 1; }
  .diagram-node[data-branch="4"] { grid-area: 3 / 2; }
  .diagram-node[data-branch="5"] { grid-area: 3 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  .diagram-node { transition: none; }
}
