/* ==========================================================================
   tool.css — tool page chrome (templates/tool.php, children of page 218).
   Theme 1.0.21: the tool on the first screen.

   THE PAGE
     .tcx-stage   the intro (left) beside the tool (right); stacked under
                  1100px, where a bar takes phones to the tool. The
                  featured image, when set, is the stage's dim backdrop.
     .tcx-guide   the corpus guide in the Journal's dress and rail — it is
                  an .art-shell holding .art-main/#art-body and #art-toc,
                  styled by article.css (enqueued before this file). Only
                  the guide's own differences live here.
     .tcx-next    three more tools.

   THE LOCK — how no rule can reach the tool DOM:
   The [tNN] output (div.ydp-tool-wrapper with its own <style>/<script>
   beside it) renders as direct children of .tcx-tool. Every selector in
   this file either names a theme element by its own tcx- class, or
   leaves .tcx-tool through a direct-child (>) hop onto .tcx-paper,
   the one theme element inside it. No selector names .ydp-tool-wrapper
   or anything inside it, and none is a bare descendant of .tcx-tool or
   .tcx-stage. article.css is scoped to .art-* classes and the tool sits
   outside .art-body, so its descendant rules never meet the tool either.

   THE GROUND — what the tool's ancestors must NOT do:
     · no overflow other than visible: 32 tools pin a sticky stepper
       (position: sticky), which an overflow ancestor would break;
     · no z-index, transform, filter, opacity or isolation: each makes a
       stacking context that would trap the tools' fixed modals and
       toasts under the site dock;
     · stay inside main#art-main: the shared layer's zero-specificity
       :where(#art-main) reset is part of the ground every tool was
       built and tested on.
   Hence the backdrop is a background image on .tcx-stage, not an
   element layered behind the content.
   ========================================================================== */

/* ---------------- THE STAGE ---------------- */
.tcx-stage {
  --tcx-glow: radial-gradient(760px 420px at 76% 6%, rgba(255, 107, 43, 0.13), transparent 70%);
  background-color: var(--ydp-bg);
  background-image:
    var(--tcx-glow),
    linear-gradient(180deg, rgba(10, 10, 26, 0) 0, rgba(10, 10, 26, 0.35) 25vw, var(--ydp-bg) 60vw),
    var(--tcx-veil, linear-gradient(90deg, rgba(10, 10, 26, 0.95) 0%, rgba(10, 10, 26, 0.88) 34%, rgba(10, 10, 26, 0.7) 62%, rgba(10, 10, 26, 0.82) 100%)),
    var(--tcx-bg, linear-gradient(135deg, #08080f 0%, #1a0a2e 45%, #08080f 100%));
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% auto;
  background-position: top center;
  /* 1.0.33: paint inside the padding box only. The layers are sized and
     placed on the padding box (background-origin), but painted under the
     border too (background-clip: border-box by default). Where the stage
     is shorter than its picture (66.7vw), the picture's next row showed
     through the 15% hairline as a bright line along the stage's foot. */
  background-clip: padding-box;
  border-bottom: 1px solid var(--ydp-border);
}
/* the fade reaches the page ground at 60vw, inside the picture's own
   height (a 3:2 picture at 100% width is 66.7vw tall), so no width ever
   shows the picture's bottom edge */
.tcx-stage-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(1.1rem, 2.4vw, 1.6rem) var(--ff-gutter) clamp(2.6rem, 6vw, 4rem);
}
.tcx-stage-inner > .art-crumbs { margin-bottom: 0; }
.tcx-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2.1fr);
  gap: clamp(2rem, 3.4vw, 3rem);
  align-items: start;
  margin-top: clamp(1.2rem, 2.6vw, 1.9rem);
}
.tcx-intro { min-width: 0; padding-top: 0.6rem; }
.tcx-tool { min-width: 0; }

/* the intro column */
.tcx-name { display: none; }
/* 1.0.50 (queue job 13, Claude's review 2.2): "Jump to the tool", the house pill (.art-chip), only while the intro
   and the tool are one column (templates/tool.php) */
.tcx-jumpto { display: none; }
.tcx-line {
  margin-top: 1rem;
  color: var(--ydp-text);
  font-size: clamp(1.8rem, 2.5vw, 2.45rem);
  font-weight: 800; line-height: 1.12; letter-spacing: -0.02em;
  text-wrap: balance;
}
.tcx-lede > p { margin-top: 0.95rem; color: rgba(240, 230, 211, 0.74); font-size: 0.95rem; line-height: 1.7; }
.tcx-lede > p:first-child { margin-top: 1.2rem; color: rgba(240, 230, 211, 0.94); font-size: 1.05rem; }
.tcx-lede > p a {
  color: var(--ydp-gold-light);
  border-bottom: 1px solid rgba(226, 176, 74, 0.4);
  transition: color 0.25s var(--ff-out), border-color 0.25s var(--ff-out);
}
.tcx-lede > p a:hover { color: #fff; border-bottom-color: var(--ydp-gold-light); }
/* Quick Stats, as a short list (inc/tool-page.php) */
.tcx-lede > .tcx-stats { display: grid; gap: 0.55rem; margin-top: 1.35rem; }
.tcx-stats > li { display: flex; align-items: flex-start; gap: 0.7rem; color: rgba(240, 230, 211, 0.92); font-size: 0.9rem; font-weight: 600; line-height: 1.45; }
.tcx-stats > li > svg {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 4px; margin-top: -1px;
  border-radius: 50%; background: rgba(226, 176, 74, 0.14);
  fill: none; stroke: var(--ydp-gold-light); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.tcx-stats > li > span > b { color: var(--ydp-gold-light); font-weight: 800; }
.tcx-guide-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin-top: 1.5rem;
  font-size: 0.84rem; font-weight: 700; color: var(--ydp-gold-light);
  border-bottom: 1px solid rgba(226, 176, 74, 0.35);
  transition: color 0.25s var(--ff-out), border-color 0.25s var(--ff-out);
}
.tcx-guide-link:hover, .tcx-guide-link:focus { color: #fff; border-bottom-color: var(--ydp-gold-light); }
.tcx-guide-link > svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* under the tool: the printable it sells (published records only) */
.tcx-tool > .tcx-paper {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 1rem;
  max-width: 560px; margin: 1.1rem auto 0; padding: 0.8rem 1.1rem 0.8rem 0.8rem;
  border: 1px solid var(--ydp-border); border-radius: 16px;
  background: rgba(18, 18, 42, 0.78);
  box-shadow: var(--ff-shadow-rest);
  transition: border-color 0.3s var(--ff-out), transform 0.45s var(--ff-spring);
}
.tcx-tool > .tcx-paper:hover, .tcx-tool > .tcx-paper:focus { color: inherit; border-color: var(--ydp-border-hover); transform: translateY(-3px); }
.tcx-paper-img { display: block; width: 64px; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden; background: var(--ff-paper); box-shadow: 0 6px 16px rgba(4, 4, 12, 0.45); }
.tcx-paper-img > img { width: 100%; height: 100%; object-fit: cover; }
.tcx-paper-copy { display: grid; gap: 0.2rem; min-width: 0; }
.tcx-paper-copy > small { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ydp-gold); }
.tcx-paper-copy > b { color: var(--ydp-text); font-size: 0.98rem; font-weight: 800; line-height: 1.3; }
.tcx-paper-go { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 700; color: var(--ydp-gold-light); }
.tcx-paper-go > em { font-style: normal; font-weight: 800; color: var(--ydp-text); padding: 0.05rem 0.55rem; border-radius: 999px; background: rgba(226, 176, 74, 0.14); }
.tcx-paper-go > svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--ff-spring); }
.tcx-paper:hover .tcx-paper-go > svg { transform: translateX(3px); }

/* ---------------- THE GUIDE (article.css carries the dress) ---------------- */
.tcx-guide-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.1rem; margin-bottom: 0.4rem; }
/* the corpus opens on an md seam: no rule before the first section */
.tcx-guide .art-body > hr:first-child { display: none; }
.tcx-guide .art-body > hr:first-child + h2 { margin-top: 0.6rem; }
/* the FAQ accordion keeps its h3s in <summary> (inc/tool-page.php) —
   the summary's own type wins over the reading-column h3 */
.tcx-guide .art-body > .tcx-faq { margin-top: 1.4rem; }
.tcx-guide .art-body .tcx-faq summary h3 {
  margin: 0; padding: 0;
  font-size: inherit; font-weight: inherit; line-height: 1.45; color: inherit;
}
.tcx-guide .art-body .tcx-faq details > p + p { margin-top: -0.35rem; }
/* the way back to the tool, first in the rail */
.art-toc nav > .tcx-toc-back {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.45rem; padding-left: 0.6rem;
  border-left-color: transparent;
  color: var(--ydp-orange); font-weight: 700;
}
.art-toc nav > .tcx-toc-back:hover { color: #ff8c42; background: rgba(255, 107, 43, 0.08); }
.art-toc nav > .tcx-toc-back > svg { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* the stage without a split (no shortcode in the body) or a body that
   would not split: the whole body renders plain, as before 1.0.21 */
.tcx-raw { max-width: 1060px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.4rem) var(--ff-gutter) 0; }

/* ---------------- KEEP PLANNING ---------------- */
.tcx-next { max-width: 1240px; margin: 0 auto; padding: clamp(3rem, 7vw, 4.6rem) var(--ff-gutter) clamp(3rem, 7vw, 4.6rem); }
.tcx-next > h2 { margin-top: 0.75rem; color: var(--ydp-text); font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; max-width: 30ch; }
.tcx-next-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 1.4rem; }
.tcx-next-card { display: flex; flex-direction: column; gap: 0.55rem; padding: 1.3rem 1.3rem 1.25rem; }
.tcx-next-card:hover { transform: translateY(-5px) rotate(-0.4deg); border-color: var(--ydp-border-hover); box-shadow: var(--ff-shadow-lift); }
.tcx-next-card > b { margin-top: 0.4rem; color: var(--ydp-text); font-size: 1.02rem; font-weight: 800; line-height: 1.3; }
.tcx-next-card > small { color: var(--ydp-muted); font-size: 0.86rem; line-height: 1.5; }
.tcx-next-go { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: auto; padding-top: 0.5rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ydp-gold); }
.tcx-next-go > svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--ff-spring); }
.tcx-next-card:hover .tcx-next-go > svg { transform: translateX(3px); }
/* the hub's icon tile and its four ink classes (tools-hub.css .th-ico) */
.tcx-ico {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(226, 176, 74, 0.08); border: 1px solid var(--ydp-border);
  transition: transform 0.45s var(--ff-spring), border-color 0.3s var(--ff-out);
}
.tcx-next-card:hover .tcx-ico { transform: translateY(-2px) rotate(-4deg); border-color: var(--ydp-border-hover); }
.tcx-ico > svg { width: 28px; height: 28px; overflow: visible; display: block; }
.tcx-ico > svg * { fill: none; stroke: var(--ydp-gold); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tcx-ico > svg .d { fill: var(--ydp-gold); stroke: none; opacity: 0.9; }
.tcx-ico > svg .a { fill: var(--ydp-orange); stroke: none; }
.tcx-ico > svg .oc { stroke: var(--ydp-orange); }
.tcx-ico > svg .sf { fill: rgba(226, 176, 74, 0.14); }
.tcx-next-all { margin-top: 1.5rem; }

/* ---------------- THE PHONE BAR (assets/js/tool.js) ---------------- */
.tcx-jump {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 58;
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 52px; padding: 0 1.2rem;
  border-radius: 999px;
  background: var(--ydp-gradient-cta);
  color: #14060a; font-size: 0.92rem; font-weight: 800; text-decoration: none;
  box-shadow: 0 14px 34px rgba(255, 107, 43, 0.4), 0 4px 12px rgba(4, 4, 12, 0.5);
}
.tcx-jump[hidden] { display: none; }
.tcx-jump:hover, .tcx-jump:focus, .tcx-jump:active { color: #14060a; text-decoration: none; }
.tcx-jump > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcx-jump > svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; animation: tcx-nudge 1.8s var(--ff-out) infinite; }
@keyframes tcx-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1099px) {
  /* stacked: crumbs, intro and tool share one left edge, the width the
     tools were drawn at */
  .tcx-stage { --tcx-veil: linear-gradient(rgba(10, 10, 26, 0.9), rgba(10, 10, 26, 0.9)); }
  .tcx-stage-inner { max-width: calc(880px + 2 * var(--ff-gutter)); }
  .tcx-grid { grid-template-columns: minmax(0, 1fr); gap: clamp(1.6rem, 4vw, 2.2rem); }
  .tcx-intro { padding-top: 0; }
  .tcx-name {
    display: block; margin-top: 0.85rem;
    color: var(--ydp-text);
    font-size: clamp(1.9rem, 6.6vw, 2.6rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
    text-wrap: balance;
  }
  .tcx-line { margin-top: 0.55rem; font-size: clamp(1.02rem, 3.4vw, 1.2rem); font-weight: 600; line-height: 1.4; letter-spacing: 0; color: var(--ydp-gold-light); }
  .tcx-lede > p:first-child { margin-top: 1rem; }
  .tcx-guide-link { display: none; } /* stacked, the guide already follows the tool */
  .tcx-jumpto { display: inline-flex; margin-top: 0.9rem; }
}
/* the pill's landing: from 1025 to 1099 px the fixed dock is over the page and html's scroll-padding-top (the dock
   plus 12px) sets the card under it; at 1024 px and under nothing is fixed at the top and html's scroll padding is
   12px since 1.0.53 (site.css), so the card lands 12px from the top. 1.0.50 to 1.0.52 took the dock's share back
   here with #tcx-tool { scroll-margin-top: calc(-1 * var(--ydp-dock-h)) }, for this pill only. */
@media (max-width: 1000px) {
  /* the Contents pill waits for the guide (tool.js) */
  body:not(.tcx-in-guide):not(.art-drawer-open) .tcx .art-toc-toggle { opacity: 0; pointer-events: none; transform: translateY(80px); }
}
@media (max-width: 760px) {
  /* 1.0.43 (m15): no picture under the 90% veil on a phone, where it showed
     a tenth of a 1024px file. !important outranks the inline --tcx-bg, and a
     url() left unused in a custom property is never fetched. */
  .tcx-stage { --tcx-bg: linear-gradient(135deg, #08080f 0%, #1a0a2e 45%, #08080f 100%) !important; }
  .tcx-next-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tcx-next-card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1rem; row-gap: 0.2rem; align-items: center; padding: 1rem 1.1rem; }
  .tcx-next-card > .tcx-ico { grid-row: span 2; width: 46px; height: 46px; }
  .tcx-next-card > b { margin-top: 0; font-size: 0.96rem; }
  .tcx-next-card > small { font-size: 0.8rem; }
  .tcx-next-go { display: none; }
}
@media (max-width: 560px) {
  .tcx-tool > .tcx-paper { grid-template-columns: 56px minmax(0, 1fr); }
  .tcx-paper-img { width: 56px; }
}

/* ---------------- PRINT: the tool prints itself; the chrome steps back ---------------- */
@media print {
  .tcx-stage { background: none; border: 0; }
  .tcx-jump, .tcx-jumpto, .tcx-next, .tcx-guide-link, .tcx-paper { display: none !important; }
  /* 1.0.43 (m16): a tool page prints the tool and its intro only — the guide
     (with its rail, kit band and Contents pill) stays on screen — and the
     intro's light ink turns black (it printed near-white on white) */
  .tcx-guide { display: none !important; }
  .tcx-name, .tcx-line, .tcx-lede > p, .tcx-lede > p a, .tcx-stats > li, .tcx-stats > li > span > b { color: #000 !important; }
  .tcx-stats > li > svg { background: none; stroke: #000; }
}
