/* Estimea — outils gratuits (/outils/). Même palette et typographie que styles.css. */

/* ---------- En-tête compact : l'outil reste au-dessus de la ligne de flottaison ---------- */
.tool-hero { background: var(--night); color: var(--ivory); padding: calc(var(--header-h) + 34px) 0 118px; position: relative; overflow: hidden; }
.tool-hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -220px; border-radius: 50%; border: 1px solid rgba(232,179,143,.16); pointer-events: none; }
.tool-hero .crumbs { margin-bottom: 18px; }
.tool-hero .eyebrow { color: var(--brass-light); }
.tool-hero h1 { margin: 14px 0 0; font-size: clamp(2.3rem, 5.2vw, 4.6rem); max-width: 18ch; color: var(--ivory); }
.tool-hero p { margin: 16px 0 0; max-width: 620px; color: rgba(250,248,243,.74); font-size: 1.04rem; }

.tool-zone { background: var(--ivory); padding: 0 0 34px; position: relative; z-index: 2; }
.tool-zone > .container { margin-top: -86px; position: relative; }

/* ---------- Carte outil ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); background: #fffefb; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 40px 90px -50px rgba(15,26,38,.45); }
.tool-form { padding: clamp(20px, 3vw, 36px); min-width: 0; }
.tool-form .form-grid { align-items: start; }
.tool-out { background: var(--forest); color: var(--ivory); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.tool-result { transition: opacity .25s ease; }
.tool-result.is-stale { opacity: .72; }

.field select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--brass) 50%), linear-gradient(135deg, var(--brass) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.tf-input { position: relative; }
.tf-input.has-suffix .input { padding-right: 76px; }
.tf-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: .8rem; font-weight: 700; color: var(--muted); pointer-events: none; white-space: nowrap; }
.tf-help { margin: 6px 0 0; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.tool-form .input { font-size: 1rem; }
.tool-form .field label { color: #3c4a56; }

/* Choix segmentés (boutons radio) */
.tf-seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.tf-seg legend { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .04em; color: #3c4a56; margin-bottom: 8px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { flex: 1 1 auto; text-align: center; padding: 11px 14px; border-radius: 12px; font-size: .88rem; font-weight: 700; color: var(--forest); cursor: pointer; transition: background-color .25s, color .25s, box-shadow .25s; margin: 0; letter-spacing: 0; }
.seg input:checked + label { background: var(--forest); color: var(--ivory); box-shadow: 0 8px 20px -12px rgba(15,26,38,.6); }
.seg input:focus-visible + label { outline: 2px solid var(--brass); outline-offset: 2px; }

/* Case à cocher */
.tf-check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.tf-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--forest); }
.tf-check label { margin: 0; font-size: .92rem; font-weight: 700; color: var(--forest); letter-spacing: 0; cursor: pointer; }
.tf-check label span { display: block; margin-top: 3px; font-size: .8rem; font-weight: 500; color: var(--muted); line-height: 1.45; }

/* Options repliables */
.form-grid > .full { grid-column: 1 / -1; }
.tool-more { border-top: 1px solid var(--line); padding-top: 12px; }
.tool-more summary { cursor: pointer; font-size: .86rem; font-weight: 700; color: var(--forest); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 10px; }
.tool-more summary::-webkit-details-marker { display: none; }
.tool-more summary::before { content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); font-size: .9rem; transition: transform .3s var(--ease); }
.tool-more[open] summary::before { content: "−"; }
.tool-more .form-grid { margin-top: 12px; }

/* Champ commune */
.tf-commune .ac-list { width: 100%; }
.ac-meta { display: block; font-size: .78rem; color: var(--muted); }
.ac-name { display: block; font-weight: 600; }

/* ---------- Résultat ---------- */
.tr-big { display: flex; flex-direction: column; gap: 6px; }
.tr-label { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--brass-light); }
.tr-big strong { font-family: var(--serif); font-weight: var(--serif-w); font-size: clamp(2.2rem, 4vw, 3.3rem); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tr-sub { font-size: .9rem; color: rgba(250,248,243,.72); }
.tr-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: .9rem; }
.tr-table th { text-align: left; font-weight: 500; color: rgba(250,248,243,.74); padding: 10px 12px 10px 0; border-top: 1px solid var(--line-light); vertical-align: top; }
.tr-table td { text-align: right; font-weight: 700; padding: 10px 0; border-top: 1px solid var(--line-light); white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: top; }
.tr-table .tr-total th, .tr-table .tr-total td { color: var(--brass-light); border-top-color: rgba(232,179,143,.4); }
.tr-note { margin: 14px 0 0; font-size: .82rem; line-height: 1.55; color: rgba(250,248,243,.72); }
.tr-note strong { color: var(--ivory); }
.tr-warn { color: var(--brass-light); }
.tr-place { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
.tr-place strong { font-family: var(--serif); font-weight: var(--serif-w); font-size: 1.9rem; letter-spacing: -.02em; line-height: 1.05; }
.tr-place span { font-size: .84rem; color: rgba(250,248,243,.66); }
.tr-duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tr-duo-item { border: 1px solid var(--line-light); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.tr-duo-item strong { font-family: var(--serif); font-weight: var(--serif-w); font-size: 2rem; line-height: 1; letter-spacing: -.02em; }
.tr-duo-item .tr-sub { font-size: .8rem; }
.tr-bars { height: 92px; margin-top: 10px; gap: 6px; }
.tr-bars .yb i { width: 100%; max-width: 30px; justify-self: center; }
.tool-out .yb b { color: var(--ivory); font-size: 10.5px; }
.tool-out .yb span { color: rgba(250,248,243,.6); font-size: 10.5px; }
.tr-links { margin: 14px 0 0; }
.tool-out .link-arrow { color: var(--brass-light); font-size: .88rem; }

/* Actions */
.tool-actions { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.tool-actions .btn { --bg: var(--ivory); --fg: var(--forest); --fill: var(--brass-light); justify-content: space-between; white-space: normal; text-align: left; }
.tool-mini { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tool-link { background: none; border: 0; padding: 6px 0; font-size: .84rem; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; min-height: 36px; }
.tool-out .tool-link { color: rgba(250,248,243,.86); }
.tool-link.is-done { color: var(--brass-light); text-decoration: none; }
.embed-panel[hidden] { display: none; }
.embed-panel { border: 1px solid var(--line-light); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.embed-panel label { font-size: .74rem; font-weight: 700; letter-spacing: .04em; color: var(--brass-light); }
.embed-panel textarea { width: 100%; min-height: 110px; resize: vertical; border-radius: 10px; border: 1px solid var(--line-light); background: rgba(0,0,0,.18); color: var(--ivory); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 10px; }
.embed-panel p { margin: 0; font-size: .78rem; color: rgba(250,248,243,.66); }
.tool-src { margin: 18px 4px 0; font-size: .78rem; line-height: 1.55; color: var(--muted); max-width: 980px; }

/* Bouton lien dans le résultat (loyer de marché) */
.tool-form [data-loyer-hint] .tr-note { color: var(--muted); margin: 0; }
.tool-form [data-loyer-hint] .tr-note strong { color: var(--forest); }
.tool-form [data-loyer-hint]:empty { display: none; }

/* ---------- Pièces (surface) ---------- */
.pc-list { display: grid; gap: 10px; }
.pc-row { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(4, minmax(0, .8fr)) minmax(0, 1.25fr) 36px; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.pc-row .field label { font-size: .66rem; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-row .input, .pc-row select { min-height: 44px; padding: 9px 10px; font-size: .92rem; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; }
.pc-del { width: 36px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; font-size: 1.2rem; color: var(--muted); }
.pc-del:hover { color: var(--forest); border-color: var(--forest); }
.pc-add { color: var(--forest); }

/* ---------- Documentation, cartes d'outils ---------- */
.tool-doc .article-body ol { padding-left: 1.2em; }
.tool-doc .article-body ol li { color: var(--muted); font-size: 1.04rem; line-height: 1.75; margin-bottom: 8px; }
.tool-doc .table-wrap { margin: 18px 0 8px; }
.tool-doc .compare-table small { color: var(--muted); font-size: .78rem; }
.tool-doc .link-cloud { margin-top: 14px; }
.tool-doc .link-cloud a { font-size: 13px; padding: 8px 13px; }
.tool-related { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: #fffefb; transition: border-color .3s, transform .5s var(--ease), box-shadow .5s var(--ease); min-height: 100%; }
.tool-card:hover { border-color: rgba(27,42,58,.35); transform: translateY(-3px); box-shadow: 0 24px 50px -34px rgba(15,26,38,.45); }
.tool-card strong { font-family: var(--serif); font-weight: var(--serif-w); font-size: 1.35rem; letter-spacing: -.02em; line-height: 1.12; color: var(--forest); }
.tool-card > span:last-child { font-size: .9rem; color: var(--muted); line-height: 1.5; }
.tc-ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(192,122,77,.12); color: var(--brass); }
.tc-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.section.paper .tool-card { background: var(--ivory); }
.tool-hub { margin-top: 0; }
.tool-hub .tool-card { box-shadow: 0 30px 70px -50px rgba(15,26,38,.5); }
.footer-title-2 { margin-top: 30px; }

/* ---------- Version intégrée (iframe) ---------- */
.embed-body { background: var(--ivory); }
.embed-body::after { display: none; }
.embed-main { padding: 10px; background: var(--ivory); }
.embed-main .tool { box-shadow: none; }
.embed-credit { margin: 10px 4px 0; font-size: .8rem; color: var(--muted); }
.embed-credit a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .tool { grid-template-columns: 1fr; }
  .tool-out { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
  .pc-row { grid-template-columns: repeat(4, minmax(0, 1fr)) 36px; }
  .pc-row .pc-name { grid-column: 1 / 3; }
  .pc-row .pc-type { grid-column: 3 / 5; }
}
@media (max-width: 640px) {
  .tool-hero { padding: calc(var(--header-h) + 18px) 0 92px; }
  .tool-hero .crumbs { margin-bottom: 12px; font-size: .7rem; }
  .tool-hero h1 { font-size: clamp(2rem, 9.4vw, 2.6rem); }
  .tool-hero p { font-size: .95rem; margin-top: 12px; }
  .tool-zone > .container { margin-top: -66px; width: calc(100% - 20px); }
  .tool-form { padding: 18px 16px; }
  .tool-out { padding: 22px 18px; }
  .tool-form .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .tool-sticky { display: flex; }
  .tool-sticky[hidden] { display: none; }
  .tool-form .field label { font-size: .7rem; }
  .tr-table { font-size: .84rem; }
  .tr-table td { white-space: normal; }
  .pc-row { position: relative; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .pc-row .pc-name { grid-column: 1 / -1; padding-right: 44px; }
  .pc-row .pc-type { grid-column: 1 / -1; }
  .pc-row .pc-del { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; }
  .tool-card { padding: 18px; }
  .tool-card strong { font-size: 1.2rem; }
}

/* Résultat résumé collé en bas de l'écran (mobile), quand le détail n'est pas visible */
.tool-sticky { display: none; position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 56; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 18px; background: var(--forest); color: var(--ivory); box-shadow: 0 18px 40px -14px rgba(15,26,38,.6); border: 1px solid var(--line-light); text-align: left; width: auto; }
.tool-sticky span { display: flex; flex-direction: column; min-width: 0; }
.tool-sticky small { font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--brass-light); }
.tool-sticky strong { font-family: var(--serif); font-weight: var(--serif-w); font-size: 1.35rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-sticky em { font-style: normal; font-size: .78rem; font-weight: 700; background: var(--ivory); color: var(--forest); border-radius: 999px; padding: 10px 14px; white-space: nowrap; }
body:has([data-tool-page]) .floating-cta { display: none; }
.tool-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: .8rem; color: var(--muted); }
.tool-picks a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--forest); font-weight: 600; transition: background-color .25s, color .25s; }
.tool-picks a:hover { background: var(--forest); color: var(--ivory); }
@media (max-width: 640px) { .tool-sticky:not([hidden]) { display: flex; } .tool-zone { padding-bottom: 90px; } }

/* Correctif mobile (tout le site) : le cercle décoratif de .aside-card débordait de l’écran quand la carte
   n’est plus « sticky » (≤ 900 px), ce qui élargissait la page à ~510 px sur les pages ville, guides et outils. */
@media (max-width: 900px) { .aside-card { position: relative; } }
@media (min-width: 1101px) { .tool-hub { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tool-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 14px; row-gap: 4px; align-items: start; } .tool-card .tc-ico { grid-row: span 2; } }
