/* Customise page: hero tags, misfit chips, upgrade-risk chart and table,
   API links, the six SDLC phases as a checklist, then the pedagogy card. */

/* Hero: the topic heading is long, so it runs a size below the shared hero. */
.custom-hero h1 { font-size: clamp(40px, 6.8vw, 116px); }
.custom-hero .lede { max-width: 58ch; }
.custom-hero .float.panel {
  width: 230px; padding: var(--space-4); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.custom-hero .float.panel b { font-weight: 600; font-size: 16px; }
.custom-hero .float.panel span { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.custom-hero .float.panel span::after { content: ""; flex: none; width: 26px; height: 8px; background: var(--color-accent); }
.custom-hero .float.soft { max-width: 220px; background: var(--color-accent-100); color: var(--color-accent-900); font-size: 15px; }
.custom-hero .float.dark { background: var(--color-text); color: var(--color-bg); box-shadow: none; font-size: 16px; font-weight: 600; }
.custom-hero .float.tag {
  background: color-mix(in srgb, var(--color-process-yellow) 32%, var(--color-bg));
  font-size: 22px; font-weight: 600; letter-spacing: .04em;
}

/* Shared section rhythm */
.misfit, .spectrum, .later, .api, .sdlc, .sa, .pedagogy {
  padding-top: clamp(60px, 10vh, 120px); padding-bottom: clamp(60px, 10vh, 120px);
}
.later .section-head, .api .section-head, .sa .section-head { max-width: 900px; }
.later .section-head p, .api .section-head p, .sa .section-head p { max-width: 66ch; }

/* Misfit: heading, then the paragraph beside the four real misfits. */
.misfit { display: flex; flex-direction: column; gap: var(--space-6); }
.misfit-body {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px); align-items: center;
}
.misfit-body p { margin: 0; max-width: 60ch; font-size: 19px; line-height: 1.55; text-wrap: pretty; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-3); align-content: center; }
.chip {
  padding: var(--space-2) var(--space-3); font-size: 17px; box-shadow: var(--shadow-md);
  background: var(--color-neutral-100); transition: transform .5s;
}
.chip:nth-child(1) { transform: rotate(-3deg); background: var(--color-accent-100); color: var(--color-accent-900); }
.chip:nth-child(2) { transform: rotate(2deg); }
.chip:nth-child(3) { transform: rotate(-1.5deg); background: var(--color-accent-2-100); color: var(--color-accent-2-900); }
.chip:nth-child(4) { transform: rotate(3deg); background: color-mix(in srgb, var(--color-process-yellow) 32%, var(--color-bg)); }

/* Spectrum chart: bar height is upgrade risk, light tailoring in accent. */
.spectrum { display: flex; flex-direction: column; gap: var(--space-8); --p: 1; }
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); }
.chart .axis {
  display: flex; flex-direction: column-reverse; justify-content: space-between;
  font-size: 13px; color: var(--color-neutral-700); height: 200px; text-align: right;
  border-right: 1.5px solid var(--color-text); padding-right: var(--space-3);
}
.chart .cols { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: var(--space-3); }
.chart .col { display: flex; flex-direction: column; gap: var(--space-3); }
.chart .bar {
  display: block; height: 200px; background: var(--color-neutral-200); position: relative; overflow: hidden;
}
.chart .bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background: var(--color-accent-2); transform-origin: bottom;
  transform: scaleY(calc(var(--v) * var(--p)));
}
.chart .col.easy .bar::after { background: var(--color-accent); }
.chart .name { font-size: 14px; line-height: 1.3; hyphens: auto; }
.chart .col.easy .name { color: var(--color-accent-700); }

/* Tailoring table with a five-step risk meter in the last column. */
.later { display: flex; flex-direction: column; gap: var(--space-8); }
.later .section-head { gap: var(--space-4); }
.table-wrap { max-width: 1200px; width: 100%; }
.tailor { width: 100%; border-collapse: collapse; font-size: 16px; table-layout: fixed; }
.tailor col { width: auto; }
.tailor th, .tailor td {
  text-align: left; vertical-align: top; padding: var(--space-3) var(--space-4) var(--space-3) 0;
  line-height: 1.45; border-bottom: 1px solid var(--color-divider);
}
.tailor thead th { font-size: .9em; font-weight: 400; color: var(--color-neutral-700); border-bottom: 1.5px solid var(--color-text); }
.tailor tbody th { font-weight: 600; }
.tailor thead th:nth-child(1) { width: 19%; }
.tailor thead th:nth-child(2) { width: 25%; }
.tailor thead th:nth-child(3) { width: 30%; }
.tailor .risk-in { display: flex; flex-direction: column; gap: var(--space-2); }
.meter { display: flex; gap: 3px; }
.meter i { display: block; flex: 1; max-width: 28px; height: 8px; background: var(--color-neutral-200); position: relative; overflow: hidden; }
.meter i::after {
  content: ""; position: absolute; inset: 0; background: var(--color-accent-2);
  transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
/* Fill: None shows one pale step; each risk level adds a step. */
tr[data-risk="0"] .meter i:nth-child(1)::after { transform: scaleX(1); background: var(--color-accent-300); }
tr[data-risk="1"] .meter i:nth-child(-n+2)::after,
tr[data-risk="2"] .meter i:nth-child(-n+3)::after,
tr[data-risk="3"] .meter i:nth-child(-n+4)::after,
tr[data-risk="4"] .meter i::after { transform: scaleX(1); }
tr[data-risk="1"] .meter i::after { background: var(--color-accent); }
.meter i:nth-child(2)::after { transition-delay: .08s; }
.meter i:nth-child(3)::after { transition-delay: .16s; }
.meter i:nth-child(4)::after { transition-delay: .24s; }
.meter i:nth-child(5)::after { transition-delay: .32s; }
.js .tailor tbody tr:not(.on) .meter i::after { transform: scaleX(0); }
.tailor tbody tr { transition: background .4s; }
.tailor tbody tr:hover { background: var(--color-neutral-100); }

/* API links: the cloud POS on the left, three links with moving packets. */
.api { display: flex; flex-direction: column; gap: var(--space-8); }
.links-diag {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: repeat(3, auto);
  column-gap: 0; row-gap: var(--space-6); align-items: center; max-width: 1000px;
}
.links-diag .hub {
  grid-row: 1 / span 3; width: clamp(140px, 15vw, 200px); aspect-ratio: 1; border-radius: 50%;
  background: var(--color-text); color: var(--color-bg); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.links-diag .hub span { font-size: clamp(20px, 2.2vw, 28px); font-weight: 600; }
.links-diag .link { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.links-diag .wire { position: relative; height: 2px; background: var(--color-neutral-400); margin: 0 var(--space-3); }
.links-diag .wire em {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  font-style: italic; font-size: 15px; color: var(--color-accent-800); white-space: nowrap;
}
.links-diag .pkt {
  position: absolute; top: -5px; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-accent); margin-left: -6px;
}
.links-diag .link.in .pkt { background: var(--color-accent-2); }
.links-diag .node {
  padding: var(--space-3) var(--space-4); background: var(--color-neutral-100); box-shadow: var(--shadow-md);
  font-size: 17px; width: 210px;
}
.links-diag .link.in .node { background: var(--color-accent-2-100); color: var(--color-accent-2-900); }

/* SDLC checklist: heading and progress stay put while the phases scroll. */
.sdlc { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.sdlc-side { position: sticky; top: 120px; display: flex; flex-direction: column; gap: var(--space-6); }
.progress { display: flex; gap: 6px; max-width: 380px; }
.progress i { flex: 1; height: 8px; background: var(--color-neutral-200); position: relative; overflow: hidden; }
.progress i::after { content: ""; position: absolute; inset: 0; background: var(--color-accent); transform-origin: left; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.js .progress i:not(.on)::after { transform: scaleX(0); }
.phases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
.phase { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.phase .box {
  width: 30px; height: 30px; margin-top: 8px; border: 1.5px solid var(--color-text); position: relative;
  background: var(--color-accent); transition: background .4s;
}
.phase .box::after {
  content: ""; position: absolute; left: 9px; top: 3px; width: 8px; height: 15px;
  border: solid var(--color-bg); border-width: 0 3px 3px 0; transform: rotate(45deg);
  transition: opacity .3s;
}
.js .phase:not(.done) .box { background: transparent; }
.js .phase:not(.done) .box::after { opacity: 0; }
.phase p { margin: 0; font-size: 18px; line-height: 1.55; color: var(--color-neutral-800); max-width: 60ch; text-wrap: pretty; }
.phase .lab { display: block; margin-bottom: var(--space-2); font-size: clamp(26px, 2.6vw, 36px); line-height: 1.1; font-weight: 600; color: var(--color-text); letter-spacing: -.01em; }
.phase .lab .n { color: var(--color-accent); font-weight: 400; }

/* Pedagogy: heading beside a card holding the whole paragraph. */
.pedagogy {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: clamp(32px, 5vw, 80px); align-items: start;
}
.pedagogy .section-head { max-width: 560px; }
.pedagogy .ped-card { background: var(--color-neutral-100); padding: var(--space-6); gap: var(--space-4); }
.pedagogy .ped-card p { margin: 0; font-size: 19px; line-height: 1.5; text-wrap: pretty; }

/* Phones: one column; the chart turns sideways, the table becomes cards. */
@media (max-width: 760px) {
  /* Inline right offsets are for desktop; phones pin the tags to the left. */
  .custom-hero { padding-top: 340px; }
  .custom-hero .float.panel { top: 112px; width: 170px; padding: var(--space-3); font-size: 13px; }
  .custom-hero .float.panel b { font-size: 14px; }
  .custom-hero .float.dark { top: 122px; right: auto !important; left: 20px; font-size: 14px; }
  .custom-hero .float.tag { top: 184px; right: auto !important; left: 44px; font-size: 16px; }
  .custom-hero .float.soft { top: 262px; right: auto !important; left: 20px; max-width: 200px; font-size: 13px; }

  .misfit-body { grid-template-columns: minmax(0, 1fr); }
  .misfit-body p, .phase p { font-size: 16px; }
  .chip { font-size: 14px; }

  .chart { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .chart .axis { flex-direction: row; height: auto; border-right: 0; border-bottom: 1.5px solid var(--color-text); padding: 0 0 var(--space-2) 132px; text-align: left; }
  .chart .cols { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .chart .col { flex-direction: row-reverse; align-items: center; gap: var(--space-3); }
  .chart .name { flex: none; width: 120px; font-size: 13px; }
  .chart .bar { flex: 1; height: 14px; }
  .chart .bar::after { transform-origin: left; transform: scaleX(calc(var(--v) * var(--p))); }

  .tailor, .tailor tbody, .tailor tr, .tailor th, .tailor td { display: block; width: auto; }
  /* Header row stays visible as a compact key, styled like the lines below it. */
  .tailor thead tr { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding-bottom: var(--space-2); border-bottom: 1.5px solid var(--color-text); }
  .tailor thead th { padding: 0; border: 0; font-size: 13px; width: auto !important; }
  .tailor thead th:nth-child(1) { font-weight: 600; color: var(--color-text); }
  .tailor thead th:nth-child(3) { font-style: italic; color: var(--color-accent-800); }
  .tailor tbody tr { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-divider); display: flex; flex-direction: column; gap: var(--space-1); }
  .tailor tbody th, .tailor td { padding: 0; border: 0; font-size: 15px; }
  .tailor tbody th { font-size: 19px; }
  .tailor td:nth-child(3) { font-style: italic; color: var(--color-accent-800); }
  .tailor .risk-in { flex-direction: row; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
  .meter { flex: none; width: 110px; }

  .links-diag { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-8); }
  .links-diag .hub { grid-row: auto; justify-self: center; width: 130px; }
  .links-diag .link { grid-template-columns: minmax(0, 1fr) auto; }
  .links-diag .node { width: 150px; font-size: 15px; padding: var(--space-2) var(--space-3); }
  .links-diag .wire { margin-left: 0; }
  .links-diag .wire em { font-size: 13px; }

  .sdlc { grid-template-columns: minmax(0, 1fr); }
  .sdlc-side { position: static; }
  .phase { grid-template-columns: 26px minmax(0, 1fr); gap: var(--space-3); }
  .phase .box { width: 24px; height: 24px; margin-top: 4px; }
  .phase .box::after { left: 7px; top: 2px; width: 6px; height: 12px; }
  .phase .lab { font-size: 24px; }
  .pedagogy .ped-card { padding: var(--space-4); }
}
