/* ==========================================================================
   ClinicOS - programmatic pages (/for, /in, /problems, products, company) and free tools (/tools)
   Loaded after styles.css. Uses its variables; adds only what those pages need.
   Flat bordered cards, plain pill buttons, calm off-white, no gradients.
   ========================================================================== */

/* ---------- hero ---------- */
.page-hero .h1--wide { max-width: 24ch; }
.page-hero .lead { margin-inline: auto; }
.page-hero .crumbs { display: flex; justify-content: center; margin-bottom: 18px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.fact { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.fact i { color: var(--teal-600); font-size: 15px; }
.fact b { font-weight: 500; color: var(--ink); }

/* ---------- section rhythm ---------- */
.section--line { border-top: 1px solid var(--line); }
.section .center .lead { margin-top: 0; }
.section__intro { max-width: 60ch; margin: 0 auto; }
.pg-note { max-width: 64ch; margin: 18px auto 0; text-align: center; font-size: 13px; line-height: 1.55; color: var(--muted); }
.pg-note a, .note-card a, .qcard a, .when a, .tl__item a, .cmp-table a { color: var(--teal-600); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- question cards ---------- */
.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 36px; text-align: left; }
.qcard { display: flex; flex-direction: column; padding: 22px 24px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); }
.qcard__ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-tint); color: var(--teal-600); font-size: 18px; margin-bottom: 14px; }
.qcard h3 { font: 500 16px/1.35 var(--font-sans); margin-bottom: 8px; }
.qcard p { font-size: 14px; line-height: 1.55; color: var(--muted); }
.qcard__next { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.qcard__next::before { content: ""; }
.qcard__next-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.qcard__next i { flex: none; color: var(--teal-600); margin-top: 3px; }

/* ---------- scripted thread ---------- */
.thread-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 48px); align-items: start; margin-top: 8px; text-align: left; }
.thread-wrap .h2 { margin-bottom: 14px; }
.thread-wrap .lead { margin-bottom: 18px; }
.thread-notes { display: grid; gap: 8px; }
.thread-notes li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.thread-notes li i { flex: none; color: var(--teal-600); margin-top: 3px; }
.thread { border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); overflow: hidden; }
.thread .journey__chat-head { background: #fff; }
.thread__msgs { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; }
.thread .jmsg { opacity: 1; transform: none; transition: none; }
.jmsg__tr { display: block; margin-top: 5px; font-size: 12px; line-height: 1.4; opacity: 0.72; }

/* ---------- tables (services, comparison) ---------- */
.table-card { margin-top: 32px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-elev); overflow-x: auto; -webkit-overflow-scrolling: touch; text-align: left; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; }
.table-card th, .table-card td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.table-card th { font: 500 11.5px/1.3 var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--bg-soft); white-space: nowrap; }
.table-card tr:last-child td { border-bottom: 0; }
.table-card td:first-child { color: var(--ink); font-weight: 500; }
.svc-table { min-width: 520px; }
.svc-table td.dur { font-family: var(--font-mono); font-size: 13px; color: var(--teal-600); white-space: nowrap; }
.cmp-table { min-width: 640px; }
.cmp-table th:first-child, .cmp-table td:first-child { width: 22%; }
.cmp-table td.us { background: rgba(15, 143, 143, 0.045); }
.cmp-table th.us { color: var(--teal-600); }
.disclaimer { margin-top: 14px; font-size: 12.5px; line-height: 1.5; color: var(--muted); max-width: 72ch; }

/* ---------- reminders timeline ---------- */
.tl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 36px; text-align: left; }
.tl__item { position: relative; padding: 20px 22px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); }
.tl__when { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-600); margin-bottom: 12px; }
.tl__item h3 { font: 500 15.5px/1.3 var(--font-sans); margin-bottom: 8px; }
.tl__item p { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tl__msg { margin-top: 12px; padding: 9px 12px; border-radius: 12px; border-bottom-right-radius: 4px; background: var(--teal); color: #fff; font-size: 13px; line-height: 1.45; }

/* ---------- proof band ---------- */
.proof-band .stats { margin-top: clamp(24px, 3vw, 36px); }

/* ---------- note card (local context) ---------- */
.note-card { max-width: 820px; margin: 32px auto 0; padding: 26px 28px; border-radius: var(--radius-lg); border: 1px solid rgba(15, 143, 143, 0.2); background: var(--bg-tint); text-align: left; }
.note-card h3 { font: 500 16px/1.3 var(--font-sans); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.note-card h3 i { color: var(--teal-600); font-size: 18px; }
.note-card p { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.note-card ul { margin-top: 14px; display: grid; gap: 6px; }
.note-card li { display: flex; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.note-card li i { flex: none; color: var(--teal-600); margin-top: 3px; }

/* ---------- languages ---------- */
.lang-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 32px; text-align: left; }
.lang { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-elev); }
.lang__name { font-weight: 500; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.lang__name i { color: var(--teal-600); }
.lang__sample { margin-top: 10px; font-size: 15.5px; line-height: 1.45; color: var(--ink); }
.lang__tr { margin-top: 4px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

/* ---------- comparison: when X is right ---------- */
.when-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 36px; text-align: left; }
.when { padding: 26px 28px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); }
.when--us { border-color: rgba(15, 143, 143, 0.35); }
.when h3 { display: flex; align-items: center; gap: 10px; font: 500 17px/1.3 var(--font-sans); margin-bottom: 10px; }
.when h3 i { color: var(--teal-600); font-size: 18px; }
.when > p { font-size: 14px; line-height: 1.55; color: var(--muted); margin-bottom: 8px; }
.when li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.when li i { flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; margin-top: 3px; background: rgba(15, 143, 143, 0.12); color: var(--teal-600); }

/* ---------- also see ---------- */
.also { margin-top: 36px; text-align: center; }
.also h3 { font: 500 11.5px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.also__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.also__row a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font: 500 13px/1 var(--font-sans); color: var(--ink-2); transition: border-color 0.2s ease, color 0.2s ease; }
.also__row a:hover { border-color: var(--ink); color: var(--ink); }
.also__row a i { color: var(--teal-600); font-size: 14px; }

/* ---------- tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 40px; text-align: left; }
.tool-card { display: flex; flex-direction: column; padding: 26px 28px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); transition: border-color 0.25s ease, transform 0.3s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .tool-card:hover { border-color: var(--line-strong); transform: translateY(-2px); } }
.tool-card__ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-tint); color: var(--teal-600); font-size: 20px; margin-bottom: 18px; }
.tool-card h2 { font: 500 20px/1.25 var(--font-display); letter-spacing: -0.01em; margin-bottom: 8px; }
.tool-card p { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin-bottom: 20px; }
.tool-card__cta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tool-card__tag { display: inline-flex; margin-left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--bg-soft); font: 500 10.5px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); vertical-align: middle; }

/* calculators reuse .roi, .roi__card, .field, .roi__results, .roi__big, .roi__mini */
.calc .roi { margin-top: 36px; }
.calc .roi__big .v small { font: 500 14px/1 var(--font-sans); color: rgba(255, 255, 255, 0.7); margin-left: 6px; letter-spacing: 0; }
.calc .field__val input { width: 96px; }
.calc .field__val select { max-width: 90px; }
.calc .roi__mini .v { font-size: 24px; }
.calc .roi__bar { height: 10px; border-radius: 999px; background: rgba(16, 28, 34, 0.1); overflow: hidden; margin-top: 10px; }
.calc .roi__bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--teal); transition: width 0.4s var(--ease-out); }
.embed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.embed-row span { font-size: 13px; color: var(--muted); }
.method { max-width: 720px; margin: 0 auto; text-align: left; }
.method h2 { font: 500 clamp(20px, 2vw, 24px) / 1.25 var(--font-display); margin-bottom: 12px; }
.method p, .method li { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.method ol { list-style: decimal; padding-left: 22px; display: grid; gap: 6px; margin-bottom: 14px; }
.method li::marker { color: var(--teal); font-weight: 500; }
.method a { color: var(--teal-600); text-decoration: underline; text-underline-offset: 3px; }

/* ?embed=1 : hide chrome, keep the calculator */
.is-embed .nav, .is-embed .footer, .is-embed .cta, .is-embed .embed-hide { display: none !important; }
.is-embed .page-hero { padding-top: 20px; }
.is-embed .page-hero .h1 { font-size: clamp(22px, 3vw, 30px); }
.is-embed .calc .roi { margin-top: 20px; }
.is-embed .doc-spacer { height: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .thread-wrap { grid-template-columns: 1fr; }
  .tl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .when-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-hero .h1--wide { max-width: none; }
  .qgrid, .tl, .lang-grid { grid-template-columns: 1fr; }
  .qcard, .when, .note-card, .tool-card, .tl__item { padding: 20px; }
  .table-card th, .table-card td { padding: 10px 12px; font-size: 13.5px; }
  .hero-actions .btn { width: 100%; }
  .calc .field__val input { width: 84px; }
}

/* phones: wide tables scroll sideways, say so */
.swipe-hint { display: none; margin: 10px 0 0; font: 500 11px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left; }
.swipe-hint i { margin-right: 6px; color: var(--teal-600); }
@media (max-width: 640px) { .swipe-hint { display: block; } }

/* ---------- added 19 Nov 2026 for the product, country, problem and company pages ---------- */
.page-hero .facts { margin-top: 24px; }
.qgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qcard__link { display: inline-flex; align-items: center; gap: 6px; font: 500 13.5px/1 var(--font-sans); color: var(--teal-600); }
.qcard__link i { font-size: 14px; }
.flist--wide { max-width: 760px; margin: 32px auto 0; text-align: left; }
.flist--wide p:empty { display: none; }
.cs__callout--center { max-width: 760px; margin: 28px auto 0; text-align: left; font-size: 15px; line-height: 1.6; }
.cs__callout--center p + p { margin-top: 14px; }
.doc--tight { margin-top: 28px; }
.sp-grid a.sp { color: inherit; transition: border-color 0.2s ease, transform 0.3s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .sp-grid a.sp:hover { border-color: var(--line-strong); transform: translateY(-2px); } }
.sp-grid .sp__glyph i { font-size: 18px; color: var(--teal-600); }
.int__glyph--mark { font: 500 12px/1 var(--font-sans); letter-spacing: 0.04em; color: var(--teal-600); }
.int-grid .tool-card__tag { margin-left: 6px; }
.section .lang-grid, .section .tl, .section .qgrid, .section .int-grid, .section .sp-grid, .section .tool-grid, .section .table-card, .section .note-card { margin-top: 32px; }
.section .int-grid--3 { margin-top: 32px; }
.section .center + .int-grid { margin-top: 36px; }
@media (max-width: 900px) { .qgrid--3 { grid-template-columns: 1fr 1fr; } .sp-grid { grid-template-columns: 1fr 1fr; } .int-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .qgrid--3, .sp-grid, .int-grid { grid-template-columns: 1fr; } }

/* ---------- hero fills the viewport; the next section only peeks above the fold ---------- */
.page-hero { min-height: calc(100svh - 180px); display: flex; flex-direction: column; justify-content: center; padding-bottom: 34px; box-sizing: border-box; }
.page-hero.calc, .is-embed .page-hero { min-height: 0; display: block; }
.page-hero + .section--line { border-top: 0; }
@media (max-width: 640px) { .page-hero { min-height: calc(100svh - 150px); } }

/* ---------- localised country pages ---------- */
.lang-switch { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.lang-switch a { color: var(--teal-600); text-decoration: underline; text-underline-offset: 3px; }
/* Thai and Japanese have no word spaces: let headings break anywhere and size them a step down */
html[lang="th"] .h1, html[lang="ja"] .h1, html[lang="th"] .h2, html[lang="ja"] .h2 { word-break: normal; overflow-wrap: normal; line-break: strict; }
/* Chrome breaks Japanese at phrase boundaries with auto-phrase; other browsers fall back to per-character CJK breaking */
html[lang="ja"] .h1, html[lang="ja"] .h2 { word-break: auto-phrase; }
html[lang="th"] .page-hero .h1, html[lang="ja"] .page-hero .h1 { font-size: clamp(26px, 3.6vw, 44px); max-width: 26ch; }
html[lang="th"] .h2, html[lang="ja"] .h2 { font-size: clamp(22px, 2.6vw, 34px); max-width: 34ch; }
html[lang="ja"] .h1, html[lang="ja"] .h2, html[lang="th"] .h1, html[lang="th"] .h2 { text-wrap: balance; }
html[lang="th"] .split .w, html[lang="ja"] .split .w { white-space: normal; }
