:root {
  --paper: #F3F5F7;
  --surface: #FFFFFF;
  --ink: #17202B;
  --muted: #566170;
  --line: #D3DAE2;
  --tag: #FFD43B;
  --tag-deep: #F2B705;
  --stamp: #C8102E;
  --opt0: #2D5BE3;
  --opt1: #0E8C7F;
  --focus: #2D5BE3;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --text: 'Golos Text', 'Segoe UI', Arial, sans-serif;
  --radius: 10px;
  --measure: 68ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--opt0); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); margin-top: 1.8em; }
h3 { font-size: 1.15rem; font-weight: 500; margin-top: 1.4em; }
p { margin: 0 0 1em; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.05rem/1 var(--display); }
.logo-mark { width: 30px; height: 30px; }
.site-header nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.site-header nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { border-bottom-color: var(--tag-deep); }

/* Hero */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 64px); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero h1 { max-width: 15ch; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.button { display: inline-block; background: var(--ink); color: #fff; text-decoration: none; padding: 13px 20px; border-radius: 8px; font-weight: 600; }
.button:hover { background: #2a3646; }
.button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.button.ghost:hover { background: var(--surface); }

/* The price tag — the one memorable element */
.pricetag {
  position: relative;
  justify-self: center;
  width: min(360px, 100%);
  background: var(--tag);
  color: var(--ink);
  padding: 28px 28px 30px 64px;
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 14% 100%, 0 50%);
  filter: drop-shadow(0 2px 0 var(--tag-deep));
}
.pricetag::before {
  content: ""; position: absolute; left: 7.5%; top: 50%; width: 14px; height: 14px;
  margin-top: -7px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink);
}
.pricetag .item { font-weight: 600; margin: 0 0 6px; }
.pricetag .sticker { font: 700 2.4rem/1 var(--display); margin: 0; text-decoration: line-through; text-decoration-color: var(--stamp); text-decoration-thickness: 4px; }
.pricetag .terms { font-size: 0.92rem; margin: 10px 0 0; }
.stamp {
  position: absolute; right: -6px; bottom: -22px;
  transform: rotate(-6deg);
  border: 3px solid var(--stamp); color: var(--stamp); background: rgba(255,255,255,0.9);
  padding: 8px 12px 9px; border-radius: 6px; line-height: 1.15;
}
.stamp small { display: block; font-weight: 600; font-size: 0.8rem; }
.stamp b { font: 700 1.55rem/1.1 var(--display); }
.hero-tag-wrap { position: relative; padding-bottom: 28px; }

/* Sections */
.section { padding: clamp(32px, 5vw, 56px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.muted { color: var(--muted); }

.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.how div { padding: 20px; border-left: 1px solid var(--line); }
.how div:first-child { border-left: 0; }
.how b { display: block; font-family: var(--display); font-weight: 500; margin-bottom: 4px; }
.how p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.how .plus { color: var(--muted); }

/* Calculator list */
.calc-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.calc-list a { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: var(--ink); text-decoration: none; }
.calc-list a:hover { border-color: var(--ink); }
.calc-list h3 { margin: 0 0 8px; font-weight: 700; }
.calc-list p { margin: 0; color: var(--muted); }
.calc-list .vs { display: block; margin-top: 14px; font-weight: 600; color: var(--ink); }

/* Article list */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 20px 0; border-bottom: 1px solid var(--line); }
.article-list li:first-child { padding-top: 0; }
.article-list a { font: 500 1.25rem/1.3 var(--display); color: var(--ink); text-decoration: none; }
.article-list a:hover { text-decoration: underline; }
.article-list p { margin: 6px 0 0; color: var(--muted); max-width: var(--measure); }
.article-list time { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }

/* Prose */
.page-head { padding: clamp(32px, 5vw, 56px) 0 8px; }
.page-head .lead { font-size: 1.15rem; color: var(--muted); max-width: var(--measure); }
.prose { max-width: var(--measure); padding-bottom: 56px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }
.prose blockquote { margin: 1.4em 0; padding: 14px 18px; background: var(--surface); border-left: 4px solid var(--tag-deep); border-radius: 0 8px 8px 0; }
.prose blockquote p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: #EEF1F4; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meta { color: var(--muted); font-size: 0.95rem; }
.cta-box { margin: 2em 0; padding: 20px; background: var(--tag); border-radius: var(--radius); }
.cta-box p { margin: 0 0 10px; font-weight: 500; }

/* Calculator */
.calc { padding-bottom: 56px; }
.calc-form { display: grid; gap: 16px; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px 20px 8px; min-width: 0; }
legend { font: 600 1.02rem/1.3 var(--text); padding: 0 6px; margin-left: -6px; display: flex; align-items: center; gap: 8px; }
.calc-common { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.calc-common legend { grid-column: 1 / -1; }
.calc-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.opt-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block; }
.opt-0 .opt-dot { background: var(--opt0); }
.opt-1 .opt-dot { background: var(--opt1); }
.calc-option.opt-0 { border-top: 4px solid var(--opt0); }
.calc-option.opt-1 { border-top: 4px solid var(--opt1); }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field-label { font-weight: 500; font-size: 0.97rem; }
.field-label small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.field-input { display: flex; align-items: stretch; border: 1px solid #B9C2CD; border-radius: 8px; background: #fff; overflow: hidden; }
.field-input:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.field-input input { flex: 1; min-width: 0; border: 0; padding: 10px 12px; font: 500 1.05rem var(--text); color: var(--ink); background: transparent; font-variant-numeric: tabular-nums; }
.field-input input:focus { outline: none; }
.suffix { display: flex; align-items: center; padding: 0 12px; color: var(--muted); background: #F1F4F7; font-size: 0.92rem; white-space: nowrap; }

.calc-result { margin-top: 24px; }
.verdict { font: 500 clamp(1.15rem, 2.2vw, 1.45rem)/1.35 var(--display); margin-bottom: 6px; max-width: 40ch; }
.verdict .diff { background: var(--tag); padding: 0 6px; border-radius: 4px; }
.breakeven { color: var(--muted); }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.total { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.total.is-cheaper { box-shadow: inset 0 0 0 2px var(--ink); }
.total-name { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.total .sticker, .total .real { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; }
.total .sticker span, .total .real span { color: var(--muted); font-size: 0.95rem; }
.total .sticker s { text-decoration-color: var(--stamp); text-decoration-thickness: 2px; color: var(--muted); }
.total .real b { font: 700 1.6rem/1.2 var(--display); color: var(--stamp); }
.per-unit { margin: 4px 0 12px; text-align: right; font-weight: 600; }
.breakdown { margin: 0; border-top: 1px solid var(--line); padding-top: 8px; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 0.95rem; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn { margin: 12px 0 0; padding: 10px 12px; background: #FDECEE; border-radius: 8px; font-size: 0.93rem; }
.chart-wrap { margin: 20px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; }
.chart { width: 100%; max-height: 260px; display: block; }
.chart .line { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.chart .line.opt-0 { stroke: var(--opt0); }
.chart .line.opt-1 { stroke: var(--opt1); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { font: 11px var(--text); fill: var(--muted); }
.chart-wrap figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 6px; }
.calc-reset { margin-top: 12px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--opt0); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.price-note { font-size: 0.92rem; color: var(--muted); max-width: var(--measure); }

/* Footer */
.site-footer { background: var(--ink); color: #DCE2E9; padding: 40px 0 24px; margin-top: 24px; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; }
.footer-name { font: 700 1.05rem var(--display); color: #fff; margin-bottom: 8px; }
.footer-note { max-width: 56ch; font-size: 0.95rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.copy { font-size: 0.85rem; color: #9AA6B4; margin: 24px 0 0; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .calc-list { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr 1fr; }
  .how div:nth-child(3) { border-left: 0; }
  .how div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .calc-options, .totals, .footer-grid { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; }
  .how div { border-left: 0; border-top: 1px solid var(--line); }
  .how div:first-child { border-top: 0; }
  .pricetag { padding-left: 54px; }
  .pricetag .sticker { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Appliances calculator */
.appl-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; max-width: 900px; }
.appl-table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.appl-table { min-width: 960px; table-layout: auto; }
.appl-table th { font-size: 0.82rem; line-height: 1.25; vertical-align: bottom; padding: 8px; }
.appl-table td { padding: 6px 8px; vertical-align: middle; }
.appl-table td small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.appl-table input { width: 100%; min-width: 0; border: 1px solid #B9C2CD; border-radius: 6px; padding: 7px 8px; font: 500 0.97rem var(--text); color: var(--ink); background: #fff; font-variant-numeric: tabular-nums; }
.appl-table input[type="text"] { min-width: 150px; }
.appl-table input[type="number"] { width: 82px; }
.appl-table td.num { white-space: nowrap; }
.appl-table input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.appl-table td.num { font-weight: 600; font-variant-numeric: tabular-nums; }
.row-del { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.row-del:hover { background: #FDECEE; color: var(--stamp); }
.appl-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 14px 0 8px; }
.appl-add select { font: 500 1rem var(--text); padding: 11px 10px; border: 1px solid #B9C2CD; border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
.appl-add .button { border: 0; cursor: pointer; font: 600 1rem var(--text); }
.appl-result { margin-top: 20px; }
.appl-headline { max-width: 640px; }
.appl-headline .sticker-line, .appl-headline .real-line { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0; }
.appl-headline .sticker-line span, .appl-headline .real-line span { color: var(--muted); }
.appl-headline .sticker-line s { font: 500 1.2rem var(--display); color: var(--muted); text-decoration-color: var(--stamp); text-decoration-thickness: 2px; }
.appl-headline .real-line b { font: 700 clamp(1.8rem, 4vw, 2.5rem)/1.15 var(--display); color: var(--stamp); }
.appl-headline .muted { margin-top: 6px; }
.split { display: flex; height: 22px; max-width: 640px; border-radius: 6px; overflow: hidden; background: #E3E8EE; margin: 14px 0 10px; }
.seg { display: block; height: 100%; }
.seg-buy { background: var(--ink); }
.seg-energy { background: var(--tag-deep); }
.seg-service { background: var(--opt1); }
.split-legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 0.95rem; }
.split-legend li { display: flex; align-items: center; gap: 8px; }
.split-legend small { color: var(--muted); }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.bar.stacked { display: flex; background: transparent; }
.bar.stacked .seg { border-radius: 0; }
.bar-note { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); margin-top: -4px; }
.total-cell { color: var(--stamp); }
.appl-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 640px; }
.appl-sum p { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; }
.appl-sum p:first-child { background: var(--tag); border-color: var(--tag-deep); }
.appl-sum span { color: var(--ink); font-weight: 500; }
.appl-sum b { font: 700 1.8rem/1.15 var(--display); }
.appl-sum small { color: var(--muted); }
.appl-sum p:first-child small { color: var(--ink); }
.appl-result h3 { margin-top: 24px; }
.appl-bars { list-style: none; padding: 0; margin: 0 0 12px; max-width: 640px; display: grid; gap: 8px; }
.appl-bars li { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 110px; gap: 4px 10px; align-items: center; }
.appl-bars { gap: 12px; }
.bar-name { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 12px; background: #E3E8EE; border-radius: 6px; overflow: hidden; }
.bar > span:not(.seg) { display: block; height: 100%; background: var(--stamp); border-radius: 6px; }
.bar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .appl-table { min-width: 0; }
  .appl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .appl-table, .appl-table tbody, .appl-table tr, .appl-table td { display: block; width: 100%; }
  .appl-table tr { position: relative; padding: 12px 12px 8px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .appl-table td { padding: 0; border: 0; }
  .appl-table td:first-child { grid-column: 1 / -1; padding-right: 40px; }
  .appl-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 2px; }
  .appl-table input[type="number"] { width: 100%; max-width: none; }
  .appl-table input[type="text"] { min-width: 0; }
  .appl-table td:last-child { position: absolute; top: 10px; right: 8px; width: auto; }
  .appl-table td.num { text-align: left; }
  .appl-sum { grid-template-columns: 1fr; }
  .appl-bars li { grid-template-columns: 1fr 96px; }
  .appl-bars .bar { grid-column: 1 / -1; grid-row: 2; }
  .appl-headline .real-line, .appl-headline .sticker-line { flex-direction: column; gap: 0; }
}
