/* =============================================================
   Percentage Decrease Calculator - "Percentify" family, rose/pink.
   EVERYTHING IS SCOPED UNDER .pctdec - see sql-formatter.css for why.
   THEME follows the site's data-theme attribute on <html>.
   ============================================================= */

.pctdec {
  --ink: #191517; --ink-2: #564C50; --ink-3: #8A7F83;
  --paper: #EFEBEC; --surface: #FFFFFF; --surface-2: #F8F4F5; --surface-3: #F1ECEE;
  --line: #E0D8DB; --line-2: #CBC0C4;
  --brand: #A83A5F; --brand-2: #C9527B; --brand-soft: #FAE7EE; --brand-ink: #7A2543;
  --pos: #137A5C; --pos-soft: #E0F2EB;
  --gold: #A9700F; --gold-soft: #FAF0DA;
  --radius: 16px; --radius-sm: 10px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow-sm: 0 1px 2px rgba(25,21,23,.05);
  --shadow: 0 2px 4px rgba(25,21,23,.04), 0 18px 44px -24px rgba(25,21,23,.30);
  --shadow-lg: 0 2px 6px rgba(25,21,23,.05), 0 40px 80px -40px rgba(168,58,95,.45);
  --acc: var(--brand); --acc-soft: var(--brand-soft);

  background: var(--paper); color: var(--ink); font-family: var(--body);
  font-size: 16px; line-height: 1.62; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .pctdec {
  --ink: #F0EAEC; --ink-2: #ADA1A6; --ink-3: #7D7175;
  --paper: #100C0E; --surface: #1A1517; --surface-2: #221B1E; --surface-3: #292125;
  --line: #2E2529; --line-2: #40353A;
  --brand: #F284A9; --brand-2: #F9A6C2; --brand-soft: #33121F; --brand-ink: #FBBDD1;
  --pos: #46CBA3; --pos-soft: #0E2A23;
  --gold: #E0AE5A; --gold-soft: #2C2211;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 2px 4px rgba(0,0,0,.35), 0 18px 44px -24px rgba(0,0,0,.9);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 40px 80px -40px rgba(0,0,0,1);
}
/* per-card accent palette */
.pctdec [data-acc="rose"]  { --acc: #A83A5F; --acc-soft: #FAE7EE }
.pctdec [data-acc="amber"] { --acc: #A9700F; --acc-soft: #FAF0DA }
.pctdec [data-acc="violet"]{ --acc: #6746C4; --acc-soft: #EDE9FB }
.pctdec [data-acc="teal"]  { --acc: #0E7B72; --acc-soft: #DDF1EF }
.pctdec [data-acc="blue"]  { --acc: #2A5DB0; --acc-soft: #E5EDFA }
.pctdec [data-acc="green"] { --acc: #137A5C; --acc-soft: #E0F2EB }
[data-theme="dark"] .pctdec [data-acc="rose"]  { --acc: #F284A9; --acc-soft: #33121F }
[data-theme="dark"] .pctdec [data-acc="amber"] { --acc: #E5B25E; --acc-soft: #2E2412 }
[data-theme="dark"] .pctdec [data-acc="violet"]{ --acc: #A791F0; --acc-soft: #201A3A }
[data-theme="dark"] .pctdec [data-acc="teal"]  { --acc: #4CC9BE; --acc-soft: #0C2B29 }
[data-theme="dark"] .pctdec [data-acc="blue"]  { --acc: #7BA5EE; --acc-soft: #131F38 }
[data-theme="dark"] .pctdec [data-acc="green"] { --acc: #46CBA3; --acc-soft: #0E2A23 }

.pctdec *, .pctdec *::before, .pctdec *::after { box-sizing: border-box }
.pctdec h1, .pctdec h2, .pctdec h3, .pctdec h4 { font-family: var(--display); margin: 0; line-height: 1.12; letter-spacing: -.025em; font-weight: 600 }
.pctdec p { margin: 0 }
.pctdec button, .pctdec input, .pctdec select { font: inherit; color: inherit }
.pctdec button { cursor: pointer; background: none; border: 0 }
.pctdec a { color: var(--brand); text-underline-offset: 3px }
.pctdec :focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px }
.pctdec .wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px }
.pctdec .eyebrow { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3) }
.pctdec .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.pctdec .ico { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.12em }

/* ---------- in-page section nav ---------- */
.pctdec .section-nav { border-bottom: 1px solid var(--line); background: var(--surface); margin-bottom: 4px }
.pctdec .section-nav__in { display: flex; align-items: center; gap: 18px; min-height: 50px; flex-wrap: wrap }
.pctdec .section-nav a { text-decoration: none; color: var(--ink-2); font-size: 13.5px; font-weight: 500; padding-bottom: 2px; border-bottom: 2px solid transparent }
.pctdec .section-nav a:hover { color: var(--ink); border-bottom-color: var(--line-2) }
.pctdec .section-nav a.here { color: var(--brand-ink); border-bottom-color: var(--brand) }

/* ---------- hero ---------- */
.pctdec .hero { padding: 26px 0 30px; text-align: center; position: relative; overflow: hidden }
.pctdec .hero::before { content: ""; position: absolute; z-index: 0; left: 50%; top: -400px; transform: translateX(-50%); width: 900px; height: 640px; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 16%, transparent), transparent 72%) }
.pctdec .hero > * { position: relative; z-index: 1 }
.pctdec .hero h1 { font-size: clamp(33px,5vw,52px); margin: 16px auto 14px; max-width: 17ch }
.pctdec .hero h1 .dn { color: var(--brand); display: inline-flex; align-items: center; gap: .1em }
.pctdec .hero h1 .dn svg { width: .6em; height: .6em }
.pctdec .hero .lede { color: var(--ink-2); max-width: 58ch; margin: 0 auto; font-size: 17px }

/* ---------- calculator ---------- */
.pctdec .calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; margin-top: 32px }
.pctdec .tabrail { display: flex; gap: 5px; padding: 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: var(--surface-2) }
.pctdec .tabrail::-webkit-scrollbar { display: none }
.pctdec .tab { flex: none; padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; transition: background .2s, color .2s }
.pctdec .tab .ico { color: var(--acc); transition: color .2s }
.pctdec .tab:hover { color: var(--ink); background: var(--surface-3) }
.pctdec .tab[aria-selected="true"] { background: var(--acc); color: #fff }
.pctdec .tab[aria-selected="true"] .ico { color: #fff }
[data-theme="dark"] .pctdec .tab[aria-selected="true"] { color: #1A1517 }
[data-theme="dark"] .pctdec .tab[aria-selected="true"] .ico { color: #1A1517 }

.pctdec .stage { padding: 34px 30px 30px }
.pctdec .sentence { font-family: var(--display); font-size: clamp(20px,2.8vw,29px); font-weight: 500; letter-spacing: -.02em; line-height: 1.9; color: var(--ink) }
.pctdec .slot { font-family: var(--mono); font-size: .82em; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 5px 10px; min-width: 3.4ch; text-align: center; transition: border-color .18s, background .18s, box-shadow .18s }
.pctdec .slot:hover { border-color: var(--line-2) }
.pctdec .slot:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent) }
.pctdec .panel[hidden] { display: none }

.pctdec .quickrow { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 20px }
.pctdec .quickrow .qlab { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px }
.pctdec .qchip { font-family: var(--mono); font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); transition: all .18s }
.pctdec .qchip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft) }
.pctdec .qchip:active { transform: scale(.95) }
.pctdec .qchip.on { background: var(--brand); border-color: var(--brand); color: #fff }
[data-theme="dark"] .pctdec .qchip.on { color: #25101A }
.pctdec .quickrow[hidden] { display: none }

/* ---------- result ---------- */
.pctdec .result { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 36px; align-items: center; margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line) }
.pctdec .res-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3) }
.pctdec .res-value { font-family: var(--display); font-weight: 700; letter-spacing: -.045em; font-size: clamp(44px,7.6vw,72px); line-height: 1; margin: 10px 0 0; color: var(--brand); word-break: break-word; transition: color .3s }
.pctdec .res-value.pos { color: var(--pos) }
.pctdec .res-value.dim { color: var(--ink-3) }
.pctdec .res-value .suf { font-size: .44em; margin-left: .08em; color: var(--ink-3); font-weight: 600 }
.pctdec .res-steps { margin-top: 16px; font-family: var(--mono); font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; overflow-x: auto; white-space: nowrap }
.pctdec .res-note { margin-top: 12px; font-size: 14px; color: var(--ink-2) }
.pctdec .res-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap }
.pctdec .mini-btn { border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; transition: all .18s }
.pctdec .mini-btn:hover { border-color: var(--line-2); color: var(--ink); background: var(--surface-2) }

/* ---------- waterfall ---------- */
.pctdec .fall { width: 306px; flex: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px 14px }
.pctdec .scols { display: flex; align-items: flex-end; gap: 10px }
.pctdec .scol { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center }
.pctdec .scol[hidden] { display: none }
.pctdec .sval { font-family: var(--display); font-size: 14.5px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100% }
.pctdec .sbadge { font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); margin: 5px 0 7px; white-space: nowrap }
.pctdec .sbadge.blank { visibility: hidden }
.pctdec .strack { height: 162px; width: 100%; display: flex; align-items: flex-end; justify-content: center }
.pctdec .sbar { width: 100%; max-width: 72px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 7px 7px 3px 3px; overflow: hidden }
.pctdec .sbar > span { display: block; width: 100%; transition: height .5s cubic-bezier(.22,.9,.28,1), background-color .3s }
.pctdec .sbar .cut { border: 1.5px dashed var(--brand); border-bottom: 0; border-radius: 7px 7px 0 0; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--brand) 15%, transparent) 0 5px, transparent 5px 10px) }
.pctdec .sbar .keep { background: var(--brand); border-radius: 3px 3px 3px 3px }
.pctdec .scol:first-child .sbar .keep { background: var(--ink-3); opacity: .34; border-radius: 7px 7px 3px 3px }
.pctdec .slab { margin-top: 9px; font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); text-align: center; line-height: 1.4 }
.pctdec .fall-foot { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3) }
.pctdec .fall-foot div { display: flex; justify-content: space-between; gap: 10px }
.pctdec .fall-foot b { color: var(--ink); font-weight: 500 }
.pctdec .fall-foot b.save { color: var(--pos) }
.pctdec .chartbox { margin-top: 13px; display: none }
.pctdec .chartbox.show { display: block }
.pctdec .chartbox svg { width: 100%; height: auto; display: block }
.pctdec .chartbox .cap { margin-top: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); text-align: center }

@media (max-width: 880px) { .pctdec .result { grid-template-columns: 1fr; gap: 26px } .pctdec .fall { width: 100%; max-width: 340px } .pctdec .stage { padding: 26px 20px 24px } .pctdec .sentence { line-height: 2.1 } }

/* ---------- sections ---------- */
.pctdec section.block { padding: 56px 0 0 }
.pctdec .block-head { margin-bottom: 22px }
.pctdec .block-head h2 { font-size: clamp(24px,3.4vw,32px); margin: 10px 0 8px }
.pctdec .block-head p { color: var(--ink-2); max-width: 62ch }
.pctdec .tools { display: grid; grid-template-columns: repeat(auto-fit,minmax(258px,1fr)); gap: 16px }
.pctdec .tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; position: relative; overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s }
.pctdec .tool::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--acc) }
.pctdec .tool:hover { border-color: var(--acc); box-shadow: var(--shadow); transform: translateY(-2px) }
.pctdec .tool h3 { font-size: 16.5px; display: flex; align-items: center; gap: 9px; margin-bottom: 4px }
.pctdec .tool h3 .emo { font-size: 17px; line-height: 1 }
.pctdec .tool .sub { font-size: 13px; color: var(--ink-3); margin-bottom: 16px }
.pctdec .rowin { display: flex; align-items: center; gap: 10px; margin-bottom: 9px }
.pctdec .rowin label { font-size: 13.5px; color: var(--ink-2); flex: 1; min-width: 0 }
.pctdec .rowin input { width: 104px; flex: none; text-align: right; font-family: var(--mono); font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; transition: border-color .18s, box-shadow .18s }
.pctdec .rowin input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 16%, transparent) }
.pctdec .tool-out { margin-top: auto; padding-top: 15px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 7px }
.pctdec .oline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px }
.pctdec .oline span { color: var(--ink-3) }
.pctdec .oline b { font-family: var(--mono); font-weight: 500; color: var(--ink); font-size: 14px }
.pctdec .oline.hero-out b { font-family: var(--display); font-size: 23px; font-weight: 700; letter-spacing: -.03em; color: var(--acc) }
.pctdec .oline b.save { color: var(--pos) }

.pctdec .ref-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(268px,1fr)); gap: 16px }
.pctdec .fcard { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 18px }
.pctdec .fcard h4 { font-size: 14.5px; font-family: var(--body); font-weight: 600; margin-bottom: 9px; display: flex; align-items: center; gap: 8px }
.pctdec .fcard h4 .ico { color: var(--acc); width: 15px; height: 15px }
.pctdec .fcard .fx { font-family: var(--mono); font-size: 12.6px; color: var(--acc); background: var(--acc-soft); border-radius: 7px; padding: 9px 12px; display: block; overflow-x: auto; white-space: nowrap }
.pctdec .fcard .ex { margin-top: 9px; font-size: 13px; color: var(--ink-2) }

.pctdec table.common { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden }
.pctdec table.common th, .pctdec table.common td { padding: 11px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line) }
.pctdec table.common th { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; background: var(--surface-2) }
.pctdec table.common td { font-family: var(--mono); font-size: 13.5px; color: var(--ink-2) }
.pctdec table.common td:first-child { color: var(--ink); font-weight: 500 }
.pctdec table.common td.hl { color: var(--brand); font-weight: 500 }
.pctdec table.common tr:last-child td { border-bottom: 0 }
.pctdec table.common tbody tr { transition: background .15s }
.pctdec table.common tbody tr:hover { background: var(--surface-2) }

.pctdec .faq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 22px }
.pctdec details { border-top: 1px solid var(--line) }
.pctdec details:first-of-type { border-top: 0 }
.pctdec summary { cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 12px }
.pctdec summary::-webkit-details-marker { display: none }
.pctdec summary::before { content: ""; width: 9px; height: 9px; flex: none; border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg) translate(1px,-1px); transition: transform .25s }
.pctdec details[open] summary::before { transform: rotate(45deg) }
.pctdec details .ans { padding: 0 0 18px 21px; color: var(--ink-2); font-size: 14.8px }
.pctdec details .ans code { font-family: var(--mono); font-size: 12.8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px }

.pctdec .related { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 14px }
.pctdec .rel { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 17px 19px; text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s }
.pctdec .rel:hover { border-color: var(--acc); transform: translateY(-2px); box-shadow: var(--shadow) }
.pctdec .rel b { display: block; font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.02em }
.pctdec .rel span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-3) }
.pctdec .rel .emo { font-size: 18px }

.pctdec .toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%,20px); background: var(--ink); color: var(--paper); font-size: 13.5px; font-weight: 500; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60 }
.pctdec .toast.show { opacity: 1; transform: translate(-50%,0) }

@media print { .pctdec .res-actions, .pctdec .quickrow, .pctdec .toast, .pctdec .tabrail .tab:not([aria-selected="true"]), .pctdec .related { display: none !important } }
@media (prefers-reduced-motion: reduce) { .pctdec * { animation-duration: .001ms !important; transition-duration: .001ms !important } }
