/* THC Potency Calculator / page-specific premium interface */
body:has([data-tool="thc-potency"].tws-thc-tool) .hero{background:radial-gradient(ellipse at 76% 0%,rgba(153,206,142,.13),transparent 55%),linear-gradient(135deg,#0b2822,#0c191e)!important}
.tws-thc-tool{--thc-line:rgba(179,216,176,.22);max-width:960px!important;margin:0 auto 36px!important;padding:clamp(19px,4vw,39px)!important;border:1px solid var(--thc-line);border-radius:19px;background:radial-gradient(circle at 98% 2%,rgba(199,164,86,.13),transparent 42%),linear-gradient(147deg,#112a22,#101d22);color:#e3f0e0;box-shadow:0 22px 70px rgba(3,10,9,.23);min-width:0}
.tws-thc-tool *{box-sizing:border-box}
.tws-thc-tool .tws-thc-kicker{display:block;font:800 .7rem/1.4 system-ui,sans-serif;letter-spacing:.15em;color:#bbdfb4;margin:0 0 9px}
.tws-thc-tool .tws-thc-banner h2{font-size:clamp(1.5rem,3vw,2.35rem)!important;line-height:1.18!important;color:#f8fff1!important;letter-spacing:-.025em;margin:0 0 11px!important}
.tws-thc-tool .tws-thc-banner p{font-size:clamp(.96rem,1.2vw,1.07rem);line-height:1.65;color:#d7e9d7;max-width:67ch;margin:0 0 23px}
.tws-thc-tool .calc-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:16px!important;margin:0 0 20px!important}
.tws-thc-tool .calc-grid label,.tws-thc-tool .tws-thc-source label{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:8px!important;font:750 .88rem/1.35 system-ui,sans-serif!important;color:#eaf7e5!important;min-width:0}
.tws-thc-tool .calc-grid input,.tws-thc-tool .tws-thc-source :is(input,select){width:100%!important;max-width:100%!important;min-height:49px!important;box-sizing:border-box!important;padding:10px 13px!important;font-size:1.05rem!important;line-height:1.4!important;color:#fafff4!important;background:#0b1919!important;border:1px solid rgba(207,238,202,.3)!important;border-radius:9px!important;box-shadow:none!important}
.tws-thc-tool :is(input,select):focus-visible{outline:3px solid #cae8a2!important;outline-offset:2px!important}
.tws-thc-tool .tws-thc-source{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:4px 0 12px;align-items:end}
.tws-thc-tool #tws-thc-delta9-wrap[hidden]{display:none!important}
.tws-thc-tool #tws-thc-method-note{color:#d4e2d0;font:.85rem/1.65 system-ui,sans-serif;margin:0 0 23px;max-width:76ch}
.tws-thc-tool #r{display:block!important;min-height:120px!important;padding:0!important;margin:0 0 20px!important;background:none!important;border:0!important;box-shadow:none!important;color:#f1f9e9!important}
.tws-thc-tool .tws-thc-results-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tws-thc-tool .tws-thc-result-tile{min-width:0;border:1px solid var(--thc-line);border-radius:13px;padding:clamp(14px,2.4vw,23px);background:#102d25}
.tws-thc-tool .tws-thc-per-serving{background:linear-gradient(135deg,#284023,#1a3028);border-color:rgba(212,229,155,.38)}
.tws-thc-tool .tws-thc-result-label{display:block;font:800 .78rem/1.5 system-ui,sans-serif;letter-spacing:.03em;color:#d7edd5;margin:0 0 9px}
.tws-thc-tool .tws-thc-result-number{display:block;font:800 clamp(1.7rem,3.5vw,2.8rem)/1.18 system-ui,sans-serif;color:#fff8db;overflow-wrap:anywhere}
.tws-thc-tool .tws-thc-result-equation{font:.82rem/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;color:#d9ebc9;overflow-wrap:anywhere;margin:14px 0 7px}
.tws-thc-tool .tws-thc-result-uncertainty{font:.82rem/1.6 system-ui,sans-serif;color:#d7e7d8;margin:0}
.tws-thc-tool .tws-thc-has-error{padding:15px 17px!important;border:1px solid #e8ac8d!important;background:#331c1a!important;border-radius:10px!important;min-height:0!important}
.tws-thc-tool .tws-thc-error{font-weight:700;color:#ffe1cf!important;margin:0}
.tws-thc-tool .tool-calc-btn{min-height:49px!important;padding:12px 20px!important;border-radius:11px!important;font-size:1.04rem!important;font-weight:800!important}
.tws-thc-guide{max-width:960px;margin:0 auto 42px;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:14px;color:#e5f0e4}
.tws-thc-guide>*{min-width:0;border:1px solid rgba(183,214,185,.25);border-radius:12px;padding:clamp(17px,2.8vw,27px);background:linear-gradient(140deg,#11251f,#0c1d20)}
.tws-thc-guide h2{color:#f4ffef!important;font-size:clamp(1.18rem,1.9vw,1.55rem)!important;line-height:1.24!important;margin:0 0 13px!important}
.tws-thc-guide p,.tws-thc-guide li{color:#d9e8dc;font-size:.94rem;line-height:1.68}
.tws-thc-guide a{color:#d7f0be!important;text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
.tws-thc-guide a:focus-visible{outline:3px solid #d3edb6;outline-offset:3px}
.tws-thc-guide ul{margin:0;padding-left:1.15rem}
.tws-thc-guide li{margin:0 0 9px}
.tws-thc-guide .tws-thc-safety{border-left:3px solid #dfcb98;padding-left:15px;margin:12px 0 0}
@media(max-width:700px){.tws-thc-tool{border-radius:14px!important;padding:21px!important}.tws-thc-tool .calc-grid,.tws-thc-tool .tws-thc-source,.tws-thc-tool .tws-thc-results-grid,.tws-thc-guide{grid-template-columns:minmax(0,1fr)!important}.tws-thc-tool .tool-calc-btn{width:100%!important}}

/* Keep related-tool navigation accessible without delaying the tool itself. */
body:has(.tws-thc-tool) #tws-tool-link-parity-v1{max-width:960px;margin:16px auto 38px;justify-content:center}

/* Second-pass layout: make the working instrument the clearest content block. */
body:has(.tws-thc-tool) .tws-thc-tool{
  position:relative;
  border-color:rgba(192,224,173,.36);
  box-shadow:0 24px 70px rgba(0,0,0,.28),inset 0 1px rgba(228,255,215,.08);
}
.tws-thc-tool .tws-thc-banner{
  padding-bottom:18px;
  margin-bottom:20px;
  border-bottom:1px solid rgba(192,224,173,.2);
}
.tws-thc-tool .tws-thc-banner p{margin-bottom:0}
.tws-thc-tool .tws-thc-results-grid{gap:16px}
.tws-thc-tool .tws-thc-result-tile{display:flex;flex-direction:column;justify-content:center;min-height:126px}
.tws-thc-tool .tws-thc-per-serving{
  border-color:rgba(207,245,139,.6);
  background:linear-gradient(140deg,#29472c,#16372e);
}
.tws-thc-tool .tws-thc-result-number{font-variant-numeric:tabular-nums}
.tws-thc-tool .tool-calc-btn{min-width:170px;cursor:pointer;transition:filter .15s ease,transform .15s ease}
.tws-thc-tool .tool-calc-btn:hover{filter:brightness(1.08)}
.tws-thc-tool .tool-calc-btn:active{transform:translateY(1px)}
.tws-thc-tool .tool-calc-btn:focus-visible{outline:3px solid #fff;outline-offset:3px}
.tws-thc-guide>*{box-shadow:inset 0 1px rgba(242,255,231,.04)}
@media(max-width:700px){
  .tws-thc-tool .tws-thc-banner{margin-bottom:16px;padding-bottom:14px}
  .tws-thc-tool .tws-thc-result-tile{min-height:110px}
  .tws-thc-tool .tws-thc-results-grid{gap:10px}
  .tws-thc-tool .tws-thc-result-number{font-size:clamp(1.75rem,8vw,2.5rem)}
}

/* Desktop presentation matches the calculators directory's graphic language.
   Reuses its published first-party art; the existing ad slots are untouched. */
@media (min-width:960px){
  body:has(.tws-thc-tool) main .hero{
    box-sizing:border-box!important;
    min-height:355px!important;
    overflow:hidden!important;
    padding:clamp(32px,3.5vw,56px)!important;
    margin-block:10px 24px!important;
    border:1px solid rgba(105,228,185,.28)!important;
    border-radius:20px!important;
    background-color:#07151d!important;
    background-image:linear-gradient(90deg,rgba(3,13,20,.99) 0%,rgba(3,13,20,.94) 36%,rgba(3,13,20,.66) 62%,rgba(3,13,20,.23) 100%),url('/assets/tws-editorial/calculators-neon-hero-v1.webp')!important;
    background-position:center,right center!important;
    background-size:cover!important;
    background-repeat:no-repeat!important;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.025);
  }
  body:has(.tws-thc-tool) main .hero h1{
    max-width:11ch!important;
    font-size:clamp(3.4rem,5.5vw,6.1rem)!important;
    line-height:.96!important;
    letter-spacing:-.045em!important;
    text-wrap:balance;
    color:#fffaf0!important;
    text-shadow:0 3px 20px rgba(0,0,0,.72);
  }
  body:has(.tws-thc-tool) main .hero p{
    max-width:53ch!important;
    color:#e4f2e9!important;
    line-height:1.6!important;
    text-shadow:0 2px 12px rgba(0,0,0,.84);
  }
}
@media (min-width:1200px){
  body:has(.tws-thc-tool) .tws-thc-tool{
    display:grid!important;
    grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);
    column-gap:clamp(20px,2.5vw,38px);
    align-items:start;
    max-width:1060px!important;
  }
  .tws-thc-tool .tws-thc-banner{grid-column:1/-1;grid-row:1}
  .tws-thc-tool .calc-grid{grid-column:1;grid-row:2;gap:13px!important}
  .tws-thc-tool .tws-thc-source{grid-column:1;grid-row:3;grid-template-columns:minmax(0,1fr)}
  .tws-thc-tool #tws-thc-method-note{grid-column:1;grid-row:4;margin:0 0 15px!important}
  .tws-thc-tool #r{
    grid-column:2;grid-row:2/span 4;
    align-self:stretch;
    padding:20px!important;margin:0!important;
    background:linear-gradient(155deg,#0b2822,#0b1b1e)!important;
    border:1px solid rgba(190,228,177,.28)!important;
    border-radius:14px!important;
  }
  .tws-thc-tool #r .tws-thc-results-grid{grid-template-columns:minmax(0,1fr)!important;gap:13px}
  .tws-thc-tool #r .tws-thc-result-tile{min-height:110px}
  .tws-thc-tool #r .tws-thc-result-number{font-size:clamp(2.2rem,3vw,3rem)}
  .tws-thc-tool .tool-calc-btn{grid-column:1;grid-row:5;max-width:230px}
  body:has(.tws-thc-tool) .tws-thc-guide{max-width:1060px}
}

/* Ensure the hero illustration sits above the legacy hero's decorative layer. */
@media (min-width:960px){
  body:has(.tws-thc-tool) main .hero{
    position:relative!important;
    isolation:isolate!important;
  }
  body:has(.tws-thc-tool) main .hero::after{
    content:""!important;
    position:absolute!important;
    inset:0!important;
    z-index:0!important;
    pointer-events:none!important;
    background:linear-gradient(90deg,#06151d 0%,rgba(6,21,29,.92) 39%,rgba(6,21,29,.44) 69%,rgba(6,21,29,.08) 100%),url('/assets/tws-editorial/calculators-neon-hero-v1.webp') right center/cover no-repeat!important;
    opacity:1!important;
  }
  body:has(.tws-thc-tool) main .hero > *{
    position:relative!important;
    z-index:1!important;
  }
}
