/* =========================================================
   Free Contract Maker — what only the lease needs.
   The shared look (tokens, form, buttons, print, invitation) is in
   ../base.css, which the page must load FIRST.
   ========================================================= */

/* The document itself is set in Sarabun, the looped ("with heads") Thai face of official Thai
   documents (the open version of TH Sarabun New), not the page's loopless Noto Sans Thai: a lease
   is expected to look like one. Self-hosted next to the site's other fonts (public/fonts, OFL,
   licence in sarabun-OFL.txt), Thai + Latin only, WOFF so no build step is needed. It embeds as a
   real font in "Save as PDF", so the Thai stays selectable and searchable there. */
@font-face {
    font-family: "Sarabun"; font-style: normal; font-weight: 400; font-display: swap;
    src: url("../../fonts/sarabun-400.woff") format("woff");
}
@font-face {
    font-family: "Sarabun"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("../../fonts/sarabun-700.woff") format("woff");
}

.tbm-lease { font-family: "Sarabun", "Noto Sans Thai", "Inter", ui-sans-serif, system-ui, sans-serif; font-size: 15px; color: var(--tbm-slate-900); }
.tbm-lease-title {
    margin: 0 0 20px; text-align: center; font-size: 18px; font-weight: 700;
    color: var(--tbm-slate-900); border-bottom: 2px solid var(--tbm-brand-600); padding-bottom: 12px;
}

/* Thai is the binding half, so it leads; English follows in a lighter tone. */
.tbm-th { margin: 0 0 4px; line-height: 1.7; }
.tbm-en { margin: 0 0 4px; line-height: 1.6; color: var(--tbm-slate-500); font-size: 14px; }
.tbm-parties { margin-bottom: 16px; }
.tbm-clause { margin-bottom: 14px; }
.tbm-clause:last-of-type { margin-bottom: 0; }

/* A filled-in answer stands out from the lease's own words; an empty one is a
   dotted line somebody can write on. */
.tbm-filled { font-weight: 700; color: var(--tbm-brand-700); }
.tbm-blank { color: var(--tbm-slate-400); letter-spacing: 1px; }

.tbm-bank-line {
    margin: 16px 0 0; padding: 12px 16px; border-radius: 12px;
    background: var(--tbm-slate-50); border: 1px solid var(--tbm-slate-200); font-size: 13px;
}

.tbm-blank-hint { margin-top: 10px; text-align: center; }

/* ---------- printing a multi-page lease ---------- */
@media print {
    .tbm-print-root .tbm-lease { font-size: 13px; }
    .tbm-print-root .tbm-en { color: #475569; }
    /* Never split a clause or the bank line across two pages (signatures: base.css). */
    .tbm-print-root .tbm-clause,
    .tbm-print-root .tbm-parties,
    .tbm-print-root .tbm-bank-line { break-inside: avoid; page-break-inside: avoid; }
    .tbm-print-root .tbm-lease-title { break-after: avoid; page-break-after: avoid; }
    .tbm-print-root .tbm-filled { color: #000; }
    .tbm-print-root .tbm-blank { color: #64748b; }
}

/* ---------- the owner's own terms (form) ---------- */
.tbm-clauses-hint { margin-bottom: 12px; }
.tbm-clause-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 12px; align-items: start; margin-bottom: 16px; }
.tbm-clause-boxes { display: grid; gap: 12px; }
.tbm-clause-row .tbm-remove { margin-top: 27px; }

/* ---------- every clause, folded to one line until it is opened (A3) ---------- */
.tbm-term { border: 1px solid var(--tbm-slate-200); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.tbm-term > summary {
    cursor: pointer; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--tbm-slate-700); overflow-wrap: anywhere;
}
.tbm-term > summary:focus-visible { outline: 2px solid var(--tbm-brand-500); outline-offset: 2px; }
.tbm-term[open] > summary { border-bottom: 1px solid var(--tbm-slate-200); font-weight: 600; }
.tbm-term .tbm-clause-row { padding: 12px 14px 4px; }
.tbm-term-changed {
    flex: none; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--tbm-brand-50); color: var(--tbm-brand-700);
}
.tbm-link {
    justify-self: start; padding: 6px 0; min-height: 36px; border: 0; background: none; cursor: pointer;
    color: var(--tbm-brand-700); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline;
}
.tbm-actions .tbm-btn { flex: 1 1 auto; }
/* A folded clause's boxes take the whole width; "Remove clause N" is a plain link under them (fresh eyes, 25 Nov). */
.tbm-term .tbm-clause-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.tbm-term .tbm-link-remove { justify-self: start; color: #b42318; }
