/* =====================================================================
   AI Cost Calculator
   Ask an AI a question, then see the electricity, water and carbon
   behind it. One humanist face (Atkinson Hyperlegible Next), its mono
   for tokens and sums, Mukta for Nepali.
   Low vision: 20px text at the smallest, strong contrast, a larger-text
   switch (A+), a thick focus ring.
   Sections: fonts · tokens · base · top bar · title · question ·
   answer · cost card · receipt · estimates · disclaimer · closing band ·
   references page · kiosk overlay · small screens · more contrast ·
   reduced motion
   ===================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: 'Exhibit Text';
  src: url(fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2) format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exhibit Text';
  src: url(fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2) format('woff2-variations');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Exhibit Mono';
  src: url(fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2) format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
}
/* Nepali: Mukta, a humanist Devanagari face, next in every font stack */
@font-face {
  font-family: 'Exhibit Deva';
  src: url(fonts/mukta-devanagari-400-normal.woff2) format('woff2');
  font-weight: 100 500;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF;
}
@font-face {
  font-family: 'Exhibit Deva';
  src: url(fonts/mukta-devanagari-600-normal.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF;
}
@font-face {
  font-family: 'Exhibit Deva';
  src: url(fonts/mukta-devanagari-700-normal.woff2) format('woff2');
  font-weight: 700 900;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF;
}

/* ---------- Design tokens ---------- */
:root {
  --bg: #fffbf7; /* warm paper */
  /* the page: warm paper with soft lavender, peach and butter glows */
  --page-bg:
    radial-gradient(45% 50% at 30% 32%, rgba(175, 158, 215, 0.3), transparent 72%) fixed,
    radial-gradient(45% 50% at 72% 68%, rgba(253, 201, 180, 0.45), transparent 72%) fixed,
    radial-gradient(70% 70% at 50% 50%, rgba(253, 230, 136, 0.2), transparent 80%) fixed,
    #fffbf7;
  --ink: #2c1210;
  --ink-soft: #5b4a4e; /* 8.6:1 on --bg */
  --rule: #e6dcdd;
  --hair: rgba(44, 18, 16, 0.14); /* fine outlines */
  --tint: rgba(44, 18, 16, 0.06); /* the grey of the top-bar buttons */
  --panel: #f4ece8;
  --field: #ffffff;
  --field-edge: #9e8c90;

  --plum: #5c0a26; /* text on the coloured bands; white on it 13:1 */
  --coral: #ef473a; /* the send button */
  --coral-deep: #cc3326;
  --lavender: #5e46b0; /* focus ring on the question box */

  --bill-bg: #faf6c4;

  --electricity: #b36a00;
  --water: #1c6fa8;
  --carbon: #3f7d2c;

  --pill-a: #efe6c8;
  --pill-b: #d8eadf;
  --pill-edge: #a59f8c;

  --font: 'Exhibit Text', 'Exhibit Deva', Verdana, sans-serif;
  --mono: 'Exhibit Mono', 'Exhibit Deva', 'Courier New', monospace;
  --step--1: 0.9rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: 2.8rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --column: 52rem;
  --focus: #2c1210;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 125%; /* 20px */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (min-width: 1600px) {
  html { font-size: 137.5%; }
}
/* The A+ switch: everything is in rem, so the whole page grows */
html[data-text-size='large'] { font-size: 150%; }
@media (min-width: 1600px) {
  html[data-text-size='large'] { font-size: 165%; }
}
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.7;
  letter-spacing: 0.01em;
}
:lang(ne) body,
body:lang(ne) {
  line-height: 1.85;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}
h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}
:lang(ne) h1,
:lang(ne) h2,
:lang(ne) h3 {
  line-height: 1.4;
}
a {
  color: inherit;
  text-underline-offset: 0.18em;
}
button {
  font: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--bg);
}
.skip-link:focus {
  top: 1rem;
}
.small {
  font-size: var(--step--1);
  color: var(--ink-soft);
}

/* ---------- Top bar: logo, new chat, language and text size ---------- */
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--page-bg);
}
/* On wider screens the bar stays at the top all the way down.
   (On phones it scrolls away: there it can take two lines.) */
@media (min-width: 30rem) {
  .topbar {
    position: sticky;
    top: 0;
  }
  /* jumps (to the bill, a step) land below the bar, not under it */
  html {
    scroll-padding-top: 4.5rem;
  }
}
.logo-placeholder {
  display: grid;
  place-items: center;
  flex: none;
  width: 8rem;
  height: 2.6rem;
  border: 2px dashed var(--field-edge);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap; /* very large text on a phone: a second line, not off screen */
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.3rem 1rem;
  background: var(--tint);
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
}
.pill-btn:hover {
  background: rgba(44, 18, 16, 0.1);
}
.pill-btn svg {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* "New chat" only once a chat has started */
body:has(.chat-app[data-state='start']) #new-chat {
  display: none;
}
/* Language and text size: one segmented control; the chosen one is white */
.page-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--tint);
  border-radius: 999px;
}
.lang-switch {
  display: flex;
  gap: 0.15rem;
}
.lang-switch button,
.text-size {
  min-height: 2.1rem;
  min-width: 2.4rem;
  padding: 0.2rem 0.8rem;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.lang-switch button:hover,
.text-size:hover {
  color: var(--ink);
}
.lang-switch button[aria-pressed='true'],
.text-size[aria-pressed='true'] {
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(44, 18, 16, 0.14);
}
.text-size {
  font-size: var(--step-0);
  font-weight: 700;
  line-height: 1;
}
/* phones: a smaller logo, tighter buttons, and "New chat" shows just its + */
@media (max-width: 30rem) {
  .topbar { padding-inline: 0.5rem; }
  .topbar-right { gap: 0.3rem; }
  .logo-placeholder { width: 3.5rem; }
  .pill-btn { padding-inline: 0.7rem; }
  .pill-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .lang-switch button,
  .text-size { min-width: 2.2rem; padding-inline: 0.5rem; }
}

/* ---------- The page: one centred column ---------- */
.page {
  max-width: var(--column);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 7rem;
}

/* ---------- Title ---------- */
.masthead {
  text-align: center;
}
.masthead h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  margin-top: 0.6rem;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}
/* Before the first question the title and box sit in the middle of the screen */
body:has(.chat-app[data-state='start']) .page {
  padding-top: max(1.5rem, 16vh);
}
/* the title gets out of the way once the chat has started */
body:has(.chat-app[data-state='chat']) .masthead h1 {
  font-size: var(--step-2);
}
body:has(.chat-app[data-state='chat']) .subtitle {
  display: none;
}

/* ---------- Question ---------- */
.chat-app {
  margin-top: 2.2rem;
}
/* After the first question: the answers on top, the box at the bottom */
.chat-app[data-state='chat'] {
  display: flex;
  flex-direction: column;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 1.4rem;
  background: var(--field);
  border-radius: 1.6rem;
  box-shadow:
    0 0 0 1px var(--hair),
    0 2px 6px rgba(44, 18, 16, 0.04),
    0 14px 36px -14px rgba(60, 70, 140, 0.22);
}
.composer:focus-within {
  box-shadow:
    0 0 0 2px var(--lavender),
    0 2px 6px rgba(44, 18, 16, 0.04),
    0 18px 42px -14px rgba(60, 70, 140, 0.28);
}
/* In a chat the box stays at the bottom of the screen while the answers
   scroll under it, but only within the chat. */
.chat-app[data-state='chat'] .composer {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  background: transparent;
  box-shadow: none;
}
/* Around the box: the page's own colours, fading in at the top, so text
   going under it disappears. The box's white and border are drawn on top. */
.chat-app[data-state='chat'] .composer::before {
  content: '';
  position: absolute;
  top: -2.5rem;
  bottom: -1rem;
  left: -1rem;
  right: -1rem;
  z-index: -2;
  background: var(--page-bg);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 2.5rem);
  mask-image: linear-gradient(to bottom, transparent, #000 2.5rem);
  pointer-events: none;
}
.chat-app[data-state='chat'] .composer::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--field);
  box-shadow: 0 0 0 1px var(--hair);
  pointer-events: none;
}
.chat-app[data-state='chat'] .composer:focus-within::after {
  box-shadow: 0 0 0 2px var(--lavender);
}
.prompt-input {
  flex: 1;
  align-self: center;
  min-height: 2.6rem;
  max-height: 10rem;
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--step-1);
  line-height: 1.4;
  resize: none;
  outline: none;
}
.prompt-input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}
.char-count {
  align-self: center;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.char-count:empty {
  display: none;
}
.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
}
.icon-button svg {
  width: 1.3rem;
  height: 1.3rem;
}
.send-button {
  background: var(--coral);
  color: #ffffff;
}
.send-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.send-button:hover {
  background: var(--coral-deep);
}
/* grey until there is something to send */
.composer:has(.prompt-input:placeholder-shown) .send-button {
  background: transparent;
  color: var(--ink-soft);
}
.send-button:disabled {
  background: var(--panel);
  color: var(--ink-soft);
  cursor: not-allowed;
}
.stop-button {
  background: var(--ink);
  color: var(--bg);
}
.stop-button svg {
  fill: currentColor;
}

/* Sample prompts: pills under the box; a choice fills the box */
.templates {
  margin-top: 1rem;
}
.chat-app[data-state='chat'] .templates {
  display: none;
}
.template-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}
.preset-btn {
  display: block;
  min-height: 2.5rem;
  padding: 0.5rem 1.1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--hair);
  color: var(--ink);
  font-size: var(--step--1);
  text-align: center;
}
.preset-btn:hover {
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--lavender);
}
.preset-text {
  display: block;
  max-width: min(22rem, 100vw - 6rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-kind {
  display: none;
}

.chat-notice {
  margin-top: 1rem;
  text-align: center;
  font-weight: 600;
}

/* ---------- Answer ---------- */
.answer-panel {
  order: -2;
  width: 100%;
  max-width: 44rem;
  align-self: center;
  margin-top: 2rem;
}
/* no empty answer area before the first question */
.chat-app[data-state='start'] .answer-panel {
  display: none;
}
.message-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 5rem;
}
.message {
  scroll-margin-bottom: 7rem; /* never hidden behind the question box */
}
.message--visitor {
  align-self: flex-end;
  max-width: 80%;
  padding: 0.6rem 1rem;
  background: rgba(175, 158, 215, 0.25);
  border-radius: 1.2rem 0.3rem 1.2rem 1.2rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message--ai {
  position: relative;
  align-self: stretch;
  padding-left: 2.6rem;
}
/* a small plum circle with a speech bubble beside each answer */
.message--ai::before {
  content: '';
  position: absolute;
  top: 0.1rem;
  left: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--plum) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fde688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / 0.9rem no-repeat;
}
.answer-from,
.thinking,
.stopped-note {
  font-size: var(--step--1);
  color: var(--ink-soft);
}
/* the model's name, quietly, beside the plum circle */
.answer-from {
  min-height: 1.7rem;
  margin-bottom: 0.3rem;
  line-height: 1.9rem;
}
.answer-body > * + * {
  margin-top: 1em;
}
.answer-body h3,
.answer-body h4,
.answer-body h5 {
  font-size: var(--step-1);
  margin-top: 1em;
}
.answer-body ul,
.answer-body ol {
  padding-left: 1.4em;
}
.answer-body em {
  font-style: normal;
  font-weight: 600;
}
.answer-body code,
.answer-body pre {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--field);
}
.answer-body pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
}
.answer-body blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
}
.answer-body hr {
  border: 0;
  border-top: 1px solid var(--rule);
}
.is-streaming .answer-body > :last-child::after {
  content: '';
  display: inline-block;
  width: 0.45em;
  height: 1em;
  margin-left: 0.15em;
  vertical-align: -0.12em;
  background: var(--ink);
}
.meter-line {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.meter-line strong {
  color: var(--ink);
}


/* ---------- The card under the answer: a small receipt, the way in ---------- */
.cost-card {
  order: -1;
  width: 100%;
  max-width: 44rem;
  align-self: center;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  margin-top: 2.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--plum), #8a1c34);
  color: #ffffff;
  border-radius: 14px;
}
.chat-app[data-state='chat'] .cost-card {
  margin-bottom: 2rem;
}
/* only once there is an answer (the button is shown then) */
.cost-card:has(#see-cost[hidden]) {
  display: none;
}
.mini-receipt {
  padding: 1.1rem 1.25rem 1.4rem;
  background: #fffefa;
  color: #1b1f1d;
  font-family: var(--mono);
  font-size: 0.9rem;
  transform: rotate(-2deg);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}
.mini-title {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1.5px dashed #6b6b62;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mini-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0;
}
.mini-line strong {
  white-space: nowrap;
}
.cost-card-text > * + * {
  margin-top: 1rem;
}
.cost-card-text h2 {
  font-size: var(--step-3);
  line-height: 1.15;
}
.card-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.6rem 1.5rem;
  background: #f7e07b;
  color: var(--plum);
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}
.card-button::after {
  content: '→';
}
.card-button[aria-expanded='true']::after {
  content: '↓';
}
.card-button:hover {
  background: #fbeba5;
}

/* ---------- The receipt band: words on the left, the receipt on the right ---------- */
.cost-content {
  margin-top: 3rem;
}
.bill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  justify-content: center;
  margin: 0 calc(50% - 50vw);
  padding: 4rem max(var(--gutter), calc(50vw - 34rem));
  background: #e9cba0;
  overflow-x: clip; /* the tilted receipt never makes the page scroll sideways */
}
.bill-text > * + * {
  margin-top: 1rem;
}
.kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--plum);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kicker::before {
  content: '';
  width: 1.4rem;
  height: 3px;
  background: var(--coral-deep);
}
.bill-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding-top: 0.75rem;
}
.bill-text h2 {
  color: var(--plum);
  font-size: var(--step-4);
  line-height: 1.05;
  text-transform: uppercase;
}

/* The receipt hangs from a printer slot; the shadow follows the torn edge */
.receipt-slot {
  width: 100%;
  max-width: 26rem;
  margin: 0.5rem 0 1rem;
  transform: rotate(-0.6deg);
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.18)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.receipt-slot::before {
  content: '';
  display: block;
  height: 10px;
  margin: 0 -1rem;
  background: #2b2a26;
  border-radius: 3px;
}
.thermal-receipt {
  --zigzag: 14px;
  --ink: #1b1f1d;
  --ink-soft: #4f564f;
  --electricity: #8a5a00;
  --water: #1d5d70;
  --carbon: #3d6b2c;
  position: relative;
  padding: 1.75rem 1.6rem calc(2.25rem + var(--zigzag));
  background: #fffefa;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: left;
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zigzag)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zigzag) var(--zigzag) repeat-x;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zigzag)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zigzag) var(--zigzag) repeat-x;
}
/* Printing: the paper feeds out in steps, like a thermal printer */
.thermal-receipt.is-printing {
  animation: print-feed 1.3s steps(26, end) both;
}
@keyframes print-feed {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}
.receipt-header {
  text-align: center;
}
.receipt-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.receipt-header p {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.receipt-question {
  margin-top: 0.4rem;
  font-style: italic;
}
.receipt-divider {
  border: 0;
  border-top: 1.5px dashed var(--ink-soft);
  margin: 0.9rem 0;
}
.receipt-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 1rem;
  padding: 0.3rem 0;
  font-size: 1.1rem;
}
.receipt-line > strong {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.receipt-line .receipt-sub {
  grid-column: 1 / -1;
  margin-left: 1.05rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.receipt-resource {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.receipt-resource::before {
  content: '';
  width: 0.6rem;
  height: 0.6rem;
  background: var(--resource, var(--ink));
}
[data-resource='electricity'] { --resource: var(--electricity); }
[data-resource='water'] { --resource: var(--water); }
[data-resource='carbon'] { --resource: var(--carbon); }
.receipt-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- How do we estimate this? Four full-width colour bands ---------- */
.estimate {
  margin-top: 4.5rem;
}
.estimate-head {
  margin: 0 calc(50% - 50vw) 2.5rem;
  padding: 0 max(var(--gutter), calc(50vw - 34rem));
}
.estimate-head > * + * {
  margin-top: 0.8rem;
}
.estimate-head h2 {
  color: var(--plum);
  font-size: var(--step-4);
  line-height: 1.05;
  text-transform: uppercase;
}
.estimate-head > p:last-child {
  max-width: 40rem;
  font-size: var(--step-1);
  color: var(--ink-soft);
}
.est-block {
  margin: 0 calc(50% - 50vw);
  padding: 0 max(var(--gutter), calc(50vw - 34rem));
  color: var(--plum);
}
.est-block:nth-of-type(1) { background: #b39ddb; }
.est-block:nth-of-type(2) { background: #fbe38a; }
.est-block:nth-of-type(3) { background: #7cc0f5; }
.est-block:nth-of-type(4) { background: #93c8a8; }
/* The bar: number, title, the visitor's result, and the arrow box */
.est-block > .bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  min-height: 6.5rem;
  padding: 1rem 0;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.est-block > .bar::-webkit-details-marker {
  display: none;
}
:lang(ne) .est-block > .bar {
  text-transform: none;
}
.est-block > .bar > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.step-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.2rem;
  border: 2px solid currentColor;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.step-value {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  text-transform: none; /* exact units: mWh is not MWh */
}
/* the arrow in a white box; it lifts with a shadow on hover and when open */
.est-block > .bar::after {
  content: '';
  flex: none;
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--plum);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c0a26' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 1.3rem no-repeat;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.22s ease;
}
.est-block[open] > .bar::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c0a26' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E");
}
.est-block[open] > .bar::after,
.est-block > .bar:hover::after,
.est-block > .bar:focus-visible::after {
  transform: translate(-3px, -3px);
  box-shadow: 4px 4px 0 var(--plum);
}

/* An opened step: the words on the left, the visitor's numbers on the right */
.est-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  padding: 0.5rem 0 3rem;
  color: var(--ink);
}
.est-text > * + * {
  margin-top: 1.3rem;
}
.est-text .source {
  padding: 0.9rem 1.1rem;
  background: #fff6d8;
  border-radius: 4px;
}
.your-numbers {
  padding: 1.25rem 1.4rem;
  background: #ffffff;
  border-radius: 6px;
}
.your-numbers > * + * {
  margin-top: 0.8rem;
}
.working-label {
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.calc {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.calc-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  align-items: baseline;
  padding: 0.2rem 0;
}
.calc-value {
  text-align: right;
  white-space: nowrap;
}
.calc-total {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--ink);
  font-weight: 700;
}
.est-range {
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.est-compare {
  padding: 0.7rem 0.9rem;
  background: var(--panel);
  border-radius: 4px;
}
.source {
  font-size: var(--step--1);
  color: var(--ink-soft);
  line-height: 1.75;
}
.source strong {
  color: var(--ink);
}
.cite {
  font-size: 0.75em;
  vertical-align: 0.4em;
  line-height: 0;
  white-space: nowrap;
}
.cite a {
  display: inline-block;
  padding: 0.3em 0.1em;
}

/* The tokens step */
.token-body {
  gap: 3rem;
}
.token-body .est-text > * + * {
  margin-top: 1.1rem;
}
.token-examples {
  display: grid;
  gap: 0.9rem;
}
.token-sample {
  font-family: var(--mono);
  font-size: var(--step-1);
}
.token-count {
  margin-left: 0.5rem;
  color: var(--ink-soft);
}
.note-box {
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.5);
  font-size: var(--step--1);
}
.token-cards {
  display: grid;
  gap: 1.25rem;
}
.token-card {
  min-width: 0;
  padding: 1.1rem 1.25rem;
  background: #ffffff;
}
.token-card-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.token-card-title strong {
  font-family: var(--mono);
  white-space: nowrap;
}
.token-display-box {
  max-height: 14rem;
  overflow-y: auto;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.9;
}
.token-group + .token-group {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.token-group-label {
  display: block;
  font-family: var(--font);
  font-size: var(--step--1);
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.token-group--note .token-pill {
  color: var(--ink-soft);
}
/* Each token is a small printed unit. Inline, with no padding, so letters
   split across two tokens (Nepali vowel signs) still join up on screen. */
.token-pill {
  background: var(--pill-a);
  box-shadow: inset 0 -2px 0 var(--pill-edge), inset -2px 0 0 var(--bg);
  white-space: pre-wrap;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.token-pill:nth-of-type(even) {
  background: var(--pill-b);
}
.token-space {
  color: var(--pill-edge);
}

/* ---------- Disclaimer ---------- */
.disclaimer {
  max-width: 40rem;
  margin: 5rem auto 0;
  font-style: italic;
  text-align: center;
}
.disclaimer h2 {
  font-size: var(--step-2);
}
.disclaimer p {
  margin-top: 1rem;
  line-height: 1.75;
}
:lang(ne) .disclaimer {
  font-style: normal;
}

/* ---------- The closing band ---------- */
.closing-band {
  margin: 4rem calc(50% - 50vw) -7rem;
  padding: 5rem max(var(--gutter), calc(50vw - 30rem)) 6rem;
  background: #fbc8b2;
  color: var(--plum);
  text-align: center;
}
.closing-band h2 {
  font-size: var(--step-4);
  line-height: 1.1;
  text-transform: uppercase;
}
.closing-band > p {
  max-width: 34rem;
  margin: 1.5rem auto 0;
  font-size: var(--step-1);
}
.end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2rem;
}
/* Square band buttons: coral, or a plum outline; with a small icon */
.band-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.2rem;
  padding: 0.6rem 1.6rem;
  border: 2px solid var(--plum);
  border-radius: 0;
  background: transparent;
  color: var(--plum);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.band-btn svg {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.band-btn--outline:hover {
  background: rgba(255, 255, 255, 0.4);
}
.band-btn--coral {
  /* white text 4.6:1 */
  background: #e0392c;
  border-color: #e0392c;
  color: #ffffff;
}
.band-btn--coral:hover {
  background: var(--coral-deep);
  border-color: var(--coral-deep);
}
.button-text {
  margin-top: 1.5rem;
  min-height: 2.75rem;
  background: none;
  border: 0;
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Buttons elsewhere (the "Still there?" dialog) */
.button-primary {
  min-height: 3rem;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
}
.button-primary {
  background: var(--plum);
  color: #ffffff;
  border: 0;
}
.button-primary:hover {
  background: #44071c;
}

/* Spaced capitals suit English only: Devanagari letters must stay joined */
:lang(ne) .receipt-header h3,
:lang(ne) .kicker,
:lang(ne) .bill-text h2,
:lang(ne) .estimate-head h2,
:lang(ne) .token-card-title,
:lang(ne) .band-btn {
  letter-spacing: 0;
}
:lang(ne) .closing-band h2,
:lang(ne) .band-btn {
  text-transform: none;
}

/* ---------- References page ---------- */
main.references {
  padding: 1rem var(--gutter) 4rem;
}
.references .reader {
  max-width: 44rem;
  margin: 0 auto;
}
.references h1 {
  margin-top: 1.5rem;
  font-size: var(--step-3);
  text-align: center;
}
.references-intro {
  margin-top: 0.4rem;
  text-align: center;
  color: var(--ink-soft);
}
.back-link a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}
.back-link--end {
  margin-top: 3rem;
  text-align: center;
}
.reference-group {
  margin-top: 3rem;
}
.reference-group h2 {
  font-size: var(--step-1);
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
}
.reference-list {
  list-style: none;
  padding: 0;
}
.reference {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0 0.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 4rem;
  line-height: 1.65;
}
.reference:target,
.reference:focus {
  background: var(--bill-bg);
}
.reference-number {
  font-weight: 700;
  color: var(--plum);
}
.reference-used,
.reference-backlinks,
.reference-url {
  margin-top: 0.6rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.reference-url {
  display: inline-block;
  overflow-wrap: anywhere;
}

/* ---------- Kiosk: "Still there?" ---------- */
.idle-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(29, 29, 27, 0.6);
}
.idle-dialog {
  max-width: 30rem;
  padding: 2.25rem;
  background: var(--bg);
  border-radius: 1.2rem;
  text-align: center;
}
.idle-dialog h2 {
  font-size: var(--step-3);
}
.idle-dialog p {
  margin: 0.75rem 0 1.5rem;
  font-size: var(--step-1);
}

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
  :root {
    --step-3: 1.6rem;
    --step-4: 2.1rem;
  }
  .lang-switch button,
  .text-size {
    padding-inline: 0.5rem;
  }
  .cost-card {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
  .bill {
    grid-template-columns: 1fr;
    padding-block: 2.5rem;
  }
  .thermal-receipt {
    padding-inline: 1.1rem;
    font-size: 0.85rem;
  }
  .est-block > .bar {
    flex-wrap: wrap;
    gap: 0.9rem;
    font-size: 1.15rem;
  }
  .step-value {
    order: 3;
    flex-basis: 100%;
    margin-left: 3.4rem;
  }
  .est-body {
    grid-template-columns: 1fr;
  }
}

/* ---------- More contrast, when the visitor's system asks ---------- */
@media (prefers-contrast: more) {
  :root {
    --bg: #ffffff;
    --page-bg: #ffffff;
    --hair: #555555;
    --tint: #eeeeee;
    --ink: #000000;
    --ink-soft: #000000;
    --panel: #f0f0f0;
    --rule: #555555;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .thermal-receipt.is-printing {
    animation: none;
  }
}
.logo{
  width: 200px;  /* Changes the width to 300 pixels */
  height: auto; 
}