/* How we treat (S05). The signature is the condition matrix; only the lines and the pen move. */

/* ---------- The condition matrix. ---------- */
.tx-matrix { display: flex; flex-direction: column; gap: 48px; border-top: 1px solid var(--color-border); }
.tx-matrix .sec-head__words { max-width: 760px; }
.tx-chips { width: 400px; flex-shrink: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tx-chip {
  position: relative; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--color-background); color: var(--color-foreground);
  font-size: 15px; line-height: 18px; font-weight: 500; white-space: nowrap;
}
.tx-chip[aria-pressed="true"] { background: var(--color-foreground); color: #FFFFFF; font-weight: 600; }

.tx-table, .tx-thead, .tx-group { display: block; width: 100%; border-collapse: collapse; }
.tx-group[hidden] { display: none; }
.tx-row {
  display: grid; column-gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--color-border); text-align: left;
  grid-template-columns: minmax(0, 200fr) minmax(0, 140fr) minmax(0, 260fr) minmax(0, 200fr) minmax(0, 240fr) minmax(0, 120fr);
  grid-template-areas: "name where starts measure better plan";
}
.tx-row > * { display: block; padding: 0; text-align: left; font-weight: 400; }
.tx-row--head { padding: 0 0 12px; border-bottom-color: var(--color-foreground); }
.tx-name { grid-area: name; }
.tx-where { grid-area: where; position: relative; }
.tx-starts { grid-area: starts; }
.tx-measure { grid-area: measure; }
.tx-better { grid-area: better; }
.tx-plan { grid-area: plan; }
.tx-row .tx-name:not(.t-label) { font-weight: 700; }
.tx-row .tx-where:not(.t-label) { color: var(--color-muted-foreground); }
.tx-row .tx-measure:not(th) { line-height: 27px; }
.tx-group__head { display: block; padding: 28px 0 6px; }
.tx-group__head th { display: block; padding: 0; text-align: left; font-weight: 400; }

/* The pen circles "Lower back" and points at where it starts. Drawn at 1440 only, as on the board. */
.tx-pen { position: absolute; left: -38px; top: -29px; width: 230px; height: 110px; pointer-events: none; }
.tx-pen img { position: absolute; max-width: none; }
.tx-pen__circle { left: 5%; top: 19%; width: 59.57%; height: 43.73%; }
.tx-pen__arrow { left: 59.96%; top: 49.09%; width: 27.22%; height: 24.91%; }

.tx-matrix__foot { display: flex; justify-content: space-between; align-items: center; gap: 32px; }
.tx-matrix__more { display: flex; align-items: center; gap: 16px; }
.tx-matrix__pills { display: flex; align-items: center; gap: 8px; }

/* 1024 to 1279: four columns; where it hurts and the usual plan move under the condition name. */
@media (max-width: 1279px) {
  .tx-row {
    grid-template-columns: minmax(0, 200fr) minmax(0, 260fr) minmax(0, 200fr) minmax(0, 240fr);
    grid-template-areas: "name starts measure better" "where starts measure better" "plan starts measure better";
    grid-template-rows: auto auto 1fr;
  }
  .tx-row--head .tx-where, .tx-row--head .tx-plan { display: none; }
  .tx-row .tx-where:not(.t-label), .tx-row .tx-plan:not(.t-label) { font-size: var(--text-secondary); line-height: var(--leading-secondary); color: var(--color-muted-foreground); padding-top: 2px; }
  .tx-pen { display: none; }
  .tx-matrix .sec-head { flex-direction: column; align-items: flex-start; gap: 24px; }
  .tx-chips { width: auto; justify-content: flex-start; }
}

/* 768 to 1023: three columns; better means and the plan open under each row. */
@media (max-width: 1023px) {
  .tx-matrix { gap: 32px; }
  .tx-chips { width: auto; justify-content: flex-start; }
  .tx-chip::after { content: ""; position: absolute; inset: -4px 0; }
  .tx-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    grid-template-areas: "name starts measure" "where starts measure" "plan better better";
    grid-template-rows: auto 1fr auto;
    row-gap: 2px;
  }
  .tx-row--head .tx-better { display: none; }
  .tx-row .tx-better { padding-top: 10px; }
  .tx-row .tx-plan:not(.t-label) { padding-top: 12px; }
  .tx-matrix__foot { flex-direction: column; align-items: flex-start; gap: 20px; }
}

/* Below 768: a block for each condition, as the S95 phone. */
@media (max-width: 767px) {
  .tx-matrix { background: var(--color-background); border-top: 0; gap: 12px; }
  .tx-matrix .sec-head { gap: 12px; }
  .tx-chips, .tx-thead, .tx-matrix__more .btn, .tx-matrix__pills { display: none; }
  .tx-group[hidden] { display: block; }
  .tx-group__head { padding: 16px 0 12px; }
  .tx-row {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0; row-gap: 5px;
    padding: 14px 0; border-bottom: 0; border-top: 1px solid var(--color-border);
  }
  .tx-group__head + .tx-row { border-top-color: var(--color-foreground); }
  .tx-group:last-child .tx-row:last-child { border-bottom: 1px solid var(--color-border); }
  .tx-row .tx-name { flex: 1 1 auto; padding-right: 8px; line-height: 24px; }
  .tx-row .tx-where:not(.t-label) {
    margin-left: auto; padding-top: 0; text-align: right; color: var(--color-muted-foreground);
    font-family: var(--font-mono); font-size: var(--text-label); line-height: 16px; letter-spacing: var(--tracking-label); text-transform: uppercase;
  }
  .tx-row .tx-starts { flex: 0 0 100%; font-size: var(--text-secondary); line-height: var(--leading-secondary); }
  .tx-row .tx-measure { flex: 0 0 100%; line-height: var(--leading-label); }
  .tx-row .tx-better, .tx-row .tx-plan:not(.t-label) { padding-top: 0; font-size: var(--text-secondary); line-height: var(--leading-secondary); color: var(--color-muted-foreground); }
  .tx-row .tx-plan:not(.t-label)::before { content: "\00a0\00b7\00a0"; }
  .tx-matrix__foot { padding-top: 8px; }
}

/* ---------- Your first visit. ---------- */
.tx-visit { display: flex; gap: 80px; border-top: 1px solid var(--color-border); }
.tx-visit__fig { width: 480px; flex-shrink: 0; align-self: flex-start; background: #FFFFFF; }
.tx-visit__fig > img:first-child { width: 100%; height: auto; }
.tx-visit__tag { position: absolute; left: 29.17%; top: 93.33%; padding: 0 4px; background: #FFFFFF; white-space: nowrap; }
.tx-visit__words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.tx-steps { padding-top: 8px; }
.tx-steps li { display: flex; gap: 24px; padding: 16px 0; border-top: 1px solid var(--color-border); }
.tx-steps li:first-child { border-top-color: var(--color-foreground); }
.tx-steps li:last-child { border-bottom: 1px solid var(--color-border); }
.tx-steps__k { width: 140px; flex-shrink: 0; line-height: 27px; }

@media (max-width: 1279px) {
  .tx-visit { gap: 48px; }
  .tx-visit__fig { width: 40%; max-width: 480px; }
}
@media (max-width: 1023px) {
  .tx-visit { flex-direction: column; gap: 16px; }
  .tx-visit__words { display: contents; }
  .tx-visit__label { order: 1; }
  .tx-visit__title { order: 2; }
  .tx-visit__fig { order: 3; width: 420px; max-width: 100%; margin: 4px 0 8px; }
  .tx-steps { order: 4; padding-top: 0; }
}
@media (max-width: 767px) {
  .tx-visit { gap: 12px; }
  .tx-visit__fig { width: 100%; margin: 0; }
  .tx-steps li { flex-direction: column; gap: 6px; padding: 14px 0; }
  .tx-steps__k { width: auto; line-height: var(--leading-label); }
}

/* ---------- How a plan moves: the long line, three phases, then the years you keep. ---------- */
.tx-phases { display: flex; flex-direction: column; gap: 72px; }
.tx-phases .sec-head__words { max-width: 720px; }
.tx-line { --cols: minmax(0, 400fr) minmax(0, 420fr) minmax(0, 270fr) 114px; position: relative; }
.tx-track { display: grid; grid-template-columns: var(--cols); column-gap: 20px; height: 64px; }
.tx-track__line { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: subgrid; height: 64px; }
.tx-track__cell { position: relative; }
.tx-track__cell::before { content: ""; position: absolute; left: 1px; top: 30px; width: 2px; height: 20px; background: var(--color-primary); }
.tx-track__cell::after { content: ""; position: absolute; left: 1px; right: -21px; top: 39px; height: 2px; background: var(--color-primary); }
.tx-track__cell--keep::before { left: -1px; background: var(--color-sage); }
.tx-track__cell--keep::after { left: 0; right: 2px; background: repeating-linear-gradient(90deg, var(--color-sage) 0 6px, transparent 6px 12px); }
.tx-track__pen { grid-column: 2; grid-row: 1; position: relative; pointer-events: none; }
.tx-track__penbox { position: absolute; left: -58px; top: -56px; width: 320px; height: 140px; }
.tx-track__penbox img { position: absolute; max-width: none; }
.tx-track__circle { left: 8.25%; top: 46.57%; width: 20.94%; height: 42.93%; }
.tx-track__arrow { left: 28.75%; top: 13.71%; width: 27.38%; height: 39.07%; }
.tx-track__words { position: absolute; left: 68px; top: -62px; white-space: nowrap; }
.tx-rail, .tx-keep-line, .tx-col__pen { display: none; }

.tx-cols { display: grid; grid-template-columns: var(--cols); column-gap: 20px; margin-top: 24px; }
.tx-col { position: relative; display: flex; flex-direction: column; gap: 12px; padding-right: 24px; }
.tx-col:nth-child(3), .tx-col--keep { padding-right: 0; }
.tx-col__name { font-size: var(--text-body); line-height: var(--leading-body); font-weight: 700; }
.tx-col__measure { padding-top: 4px; }

@media (max-width: 1023px) {
  .tx-phases { gap: 12px; }
  .tx-track { display: none; }
  .tx-line { padding: 20px 0 0 30px; margin-top: 8px; }
  .tx-rail { display: block; position: absolute; left: 6px; top: 26px; bottom: 0; width: 2px; background: var(--color-primary); }
  .tx-cols { display: flex; flex-direction: column; gap: 28px; margin-top: 0; }
  .tx-col { gap: 6px; padding-right: 0; }
  .tx-col:not(.tx-col--keep)::before {
    content: ""; position: absolute; left: -30px; top: 2px; width: 14px; height: 14px; box-sizing: border-box;
    border: 2px solid var(--color-primary); border-radius: 50%; background: var(--color-background); z-index: 1;
  }
  .tx-col > .t-label:first-child { color: var(--color-foreground); }
  .tx-col__pen { display: block; font-family: var(--font-pen); color: var(--color-primary); font-size: 20px; line-height: 24px; }
  .tx-col__name { font-size: 22px; line-height: 28px; }
  .tx-col__text { font-size: var(--text-secondary); line-height: var(--leading-secondary); }
  .tx-col__measure { padding-top: 0; line-height: 16px; color: var(--color-muted-foreground); }
  .tx-col--keep { padding-top: 24px; }
  .tx-col--keep .t-label { color: var(--color-foreground); }
  .tx-keep-line { display: block; position: absolute; left: -24px; top: 0; bottom: 0; width: 2px; background: var(--color-sage); z-index: 1; }
}
@media (max-width: 767px) {
  .tx-line { margin-top: 0; }
}

/* ---------- Tools, not the plan. ---------- */
.tx-tools { display: flex; gap: 64px; }
.tx-tools__head { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.tx-tools__lede { padding-top: 8px; }
.tx-tools__cols { display: flex; gap: 40px; padding-top: 34px; }
.tx-toolcol { width: 230px; flex-shrink: 0; }
.tx-toolcol__head { padding-bottom: 12px; border-bottom: 1px solid var(--color-foreground); }
.tx-toolcol li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }

@media (max-width: 1279px) {
  .tx-tools { flex-direction: column; gap: 40px; }
  .tx-tools__head { width: auto; max-width: 640px; }
  .tx-tools__cols { padding-top: 0; }
  .tx-toolcol { flex: 1; width: auto; min-width: 0; }
}
@media (max-width: 1023px) {
  .tx-tools { gap: 24px; }
  .tx-tools__head { gap: 16px; }
  .tx-tools__lede { padding-top: 0; }
  .tx-tools__cols { gap: 24px; }
}
@media (max-width: 767px) {
  .tx-tools { gap: 12px; }
  .tx-tools__head { gap: 12px; }
  .tx-tools__cols { flex-direction: column; gap: 0; margin-top: 4px; border-top: 1px solid var(--color-foreground); }
  .tx-toolcol { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
  .tx-toolcol:last-child { border-bottom: 0; }
  .tx-toolcol__head { padding-bottom: 6px; border-bottom: 0; color: var(--color-muted-foreground); }
  .tx-toolcol ul { display: block; }
  .tx-toolcol li { display: inline; padding: 0; border: 0; }
  .tx-toolcol li:not(:last-child)::after { content: "\00a0\00b7"; }
  .tx-toolcol li .pill { display: inline-flex; vertical-align: 1px; margin-left: 6px; height: 22px; padding: 0 8px; font-size: 12px; }
}

/* ---------- When we send you to a doctor first. ---------- */
.tx-doctor { display: flex; gap: 64px; }
.tx-doctor__head { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.tx-doctor__lede { padding-top: 8px; }
.tx-flags { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-top: 34px; }
.tx-flags__list li { display: flex; gap: 24px; padding: 16px 0; border-top: 1px solid var(--color-border); }
.tx-flags__list li:first-child { border-top-color: var(--color-foreground); }
.tx-flags__num { width: 32px; flex-shrink: 0; line-height: 27px; }
.tx-flags__urgent { margin-top: 16px; padding: 20px 24px; background: var(--color-foreground); color: #FFFFFF; font-weight: 700; }
.tx-flags__pill { margin-top: 20px; }

@media (max-width: 1279px) {
  .tx-doctor { gap: 48px; }
  .tx-doctor__head { width: 360px; }
}
@media (max-width: 1023px) {
  .tx-doctor { flex-direction: column; gap: 24px; }
  .tx-doctor__head { width: auto; max-width: 640px; }
  .tx-doctor__lede { padding-top: 0; }
  .tx-flags { padding-top: 0; }
}
@media (max-width: 767px) {
  .tx-doctor { gap: 16px; }
  .tx-doctor__head { gap: 12px; }
  .tx-flags__pill { order: -1; margin: 0 0 16px; }
  .tx-flags__list li { gap: 16px; padding: 12px 0; }
  .tx-flags__list li:last-child { border-bottom: 1px solid var(--color-border); }
  .tx-flags__num { width: 20px; }
  .tx-flags__urgent { padding: 20px 16px; border-radius: 12px; }
}

/* The 44 section head keeps the board's display tracking. */
@media (min-width: 768px) {
  .tx-visit__title { letter-spacing: var(--tracking-display); }
}
