/**
 * F-Gas Calculator by EgoLog — styles.
 *
 * One centred card: gas field on top, then three aligned tiles (mass in,
 * tCO2e out, GWP out), then the working. Every selector is prefixed
 * `egofgas-` and every custom property `--egofgas-`, so the file can sit next
 * to the existing EgoLog stylesheets without touching anything they own.
 *
 * Where the host page already defines the `--legal-*` tokens, they win; the
 * fallbacks keep the widget correct when it is used stand-alone.
 */

.egofgas {
  --egofgas-bg: var(--legal-bg, #030913);
  --egofgas-panel: var(--legal-panel, #071524);
  --egofgas-panel-soft: var(--legal-panel-soft, #0a1b2e);
  --egofgas-line: var(--legal-line, rgba(116, 153, 201, 0.22));
  --egofgas-line-soft: rgba(116, 153, 201, 0.14);
  --egofgas-line-strong: var(--legal-line-strong, rgba(102, 214, 191, 0.34));
  --egofgas-text: var(--legal-text, #edf5ff);
  --egofgas-muted: var(--legal-muted, #94a9c2);
  --egofgas-dim: #7e95b1;
  --egofgas-blue: var(--legal-blue, #6d91ff);
  --egofgas-mint: var(--legal-mint, #66d6bf);
  --egofgas-gold: var(--legal-gold, #e0c274);
  --egofgas-danger: #ff8f8f;

  display: block;
  width: min(1040px, 100%);
  margin: 0 auto;
  border: 1px solid var(--egofgas-line);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(12, 31, 52, 0.96), rgba(6, 18, 32, 0.98));
  color: var(--egofgas-text);
  padding: clamp(18px, 2.2vw, 28px);
  font-size: 15px;
  line-height: 1.55;
}

.egofgas *,
.egofgas *::before,
.egofgas *::after {
  box-sizing: border-box;
}

/* An author `display` rule outranks the user-agent rule for [hidden], so any
 * element this file gives a display value to would stay visible when the script
 * hides it. Keep hidden meaning hidden. */
.egofgas [hidden] {
  display: none !important;
}

.egofgas :focus-visible {
  outline: 2px solid var(--egofgas-mint);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ gas field */

.egofgas-combobox {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
}

.egofgas-comboboxInner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border: 1px solid var(--egofgas-line);
  border-radius: 11px;
  background: var(--egofgas-bg);
  padding: 0 6px 0 14px;
}

.egofgas-comboboxInner:focus-within {
  border-color: var(--egofgas-mint);
}

.egofgas-comboboxIcon {
  flex: 0 0 auto;
  color: var(--egofgas-mint);
  font-size: 17px;
  line-height: 1;
}

.egofgas-gasInput {
  flex: 1 1 auto;
  min-width: 0;
  height: 54px;
  border: 0;
  background: transparent;
  color: var(--egofgas-text);
  padding: 0;
  font: inherit;
  font-size: 17px;
}

.egofgas-gasInput::placeholder {
  color: rgba(148, 169, 194, 0.7);
  font-size: 15px;
}

.egofgas-gasInput:focus {
  outline: none;
}

.egofgas-gasInput.is-chosen {
  font-size: 19px;
  font-weight: 700;
}

.egofgas-change {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--egofgas-line);
  border-radius: 8px;
  background: transparent;
  color: var(--egofgas-mint);
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.egofgas-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 320px;
  border: 1px solid var(--egofgas-line);
  border-radius: 11px;
  background: var(--egofgas-panel-soft);
  overflow-y: auto;
}

.egofgas-option {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--egofgas-line-soft);
  padding: 10px 14px;
  cursor: pointer;
}

.egofgas-option:last-child {
  border-bottom: 0;
}

.egofgas-option.is-active,
.egofgas-option:hover {
  background: #122a44;
}

.egofgas-optionName {
  font-weight: 700;
  white-space: nowrap;
}

.egofgas-optionMeta {
  color: var(--egofgas-muted);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.egofgas-noMatch {
  margin: 8px auto 0;
  width: min(520px, 100%);
  color: var(--egofgas-gold);
  font-size: 12.5px;
}

/* ------------------------------------------------------------ tiles */

.egofgas-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  margin-top: 18px;
}

.egofgas-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 118px;
  border: 1px solid var(--egofgas-line);
  border-radius: 13px;
  background: rgba(3, 9, 19, 0.55);
  padding: 12px 16px;
}

.egofgas-tile--out {
  align-items: center;
  justify-content: center;
  border-color: var(--egofgas-line-strong);
  border-width: 1px;
  background:
    radial-gradient(circle at 50% 0%, rgba(102, 214, 191, 0.1), transparent 70%),
    rgba(10, 27, 46, 0.9);
  text-align: center;
}

.egofgas-tileLabel {
  display: block;
  margin-bottom: 2px;
  color: var(--egofgas-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.egofgas-tile--out .egofgas-tileLabel {
  color: var(--egofgas-mint);
}

.egofgas-tileValue {
  display: block;
  margin: 0;
  /* Digits of equal width, so the number does not shuffle as it updates. */
  font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* The tonnes of CO2 equivalent are what the page exists to produce. The site's
 * display face (Chakra Petch, via --font-display) is the same one its headings
 * use, so the number reads as EgoLog typography rather than as a widget. */
.egofgas-tile--out .egofgas-tileValue {
  font-family: var(--font-display), var(--font-geist-mono), "Segoe UI", sans-serif;
  font-size: clamp(40px, 6.4vw, 66px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.egofgas-tile--out .egofgas-tileLabel {
  margin-bottom: 6px;
  font-size: 11px;
}

.egofgas-tileSub {
  display: block;
  margin-top: 2px;
  color: var(--egofgas-muted);
  font-size: 11px;
}

/* The unit sits on the same baseline as the number, so the field reads "400 kg"
 * rather than putting the unit on a line of its own. */
.egofgas-massRow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid var(--egofgas-line);
}

.egofgas-massRow:focus-within {
  border-bottom-color: var(--egofgas-mint);
}

.egofgas-massInput {
  flex: 1 1 auto;
  font-variant-numeric: tabular-nums;
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--egofgas-text);
  padding: 0;
  font: inherit;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.egofgas-massInput::placeholder {
  color: #4c6076;
}

.egofgas-massInput:focus {
  outline: none;
}

.egofgas-unit {
  flex: 0 0 auto;
  color: var(--egofgas-mint);
  font-size: 14px;
  font-weight: 800;
}

/* ------------------------------------------------------------ strip */

.egofgas-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--egofgas-line);
  padding-top: 14px;
}

.egofgas-chip {
  min-height: 32px;
  border: 1px solid var(--egofgas-line);
  border-radius: 999px;
  background: transparent;
  color: var(--egofgas-muted);
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.egofgas-chip.is-on {
  border-color: var(--egofgas-mint);
  background: var(--egofgas-mint);
  color: #041019;
  font-weight: 800;
}

.egofgas-badge {
  margin-left: auto;
  border: 1px solid var(--egofgas-line-strong);
  border-radius: 999px;
  background: rgba(102, 214, 191, 0.08);
  color: var(--egofgas-mint);
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 800;
}

.egofgas-badge--quota_required_or_must_be_covered {
  border-color: rgba(224, 194, 116, 0.5);
  background: rgba(224, 194, 116, 0.1);
  color: var(--egofgas-gold);
}

.egofgas-badge--authorisation_context {
  border-color: rgba(109, 145, 255, 0.5);
  background: rgba(109, 145, 255, 0.1);
  color: var(--egofgas-blue);
}

.egofgas-badge--needs_case_review {
  border-color: rgba(255, 143, 143, 0.5);
  background: rgba(255, 143, 143, 0.1);
  color: var(--egofgas-danger);
}

/* One line under the strip that always answers the last chip pressed. Without
 * it, switching transaction before entering a gas changed nothing on screen and
 * the chips felt dead. */
.egofgas-txNote {
  margin: 10px 0 0;
  color: var(--egofgas-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ------------------------------------------------------------ detail */

.egofgas-details {
  margin-top: 12px;
  border: 1px solid var(--egofgas-line);
  border-radius: 11px;
  background: rgba(3, 9, 19, 0.4);
  padding: 0 14px;
}

.egofgas-details[open] {
  padding-bottom: 12px;
}

.egofgas-summary {
  color: var(--egofgas-mint);
  padding: 10px 0;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.egofgas-summary::marker {
  color: var(--egofgas-muted);
}

.egofgas-officialSource {
  width: min(1040px, 100%);
  margin: 14px auto 0;
  color: var(--egofgas-dim);
  font-size: 12.5px;
}

.egofgas-officialSource a {
  color: var(--egofgas-mint);
}

.egofgas-hint {
  margin: 10px 0 0;
  color: var(--egofgas-muted);
  font-size: 13px;
}

/* ------------------------------------------------------------ custom panel */

.egofgas-panelHead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.egofgas-panelHead .egofgas-fieldLabel {
  margin: 0;
}

.egofgas-back {
  min-height: 36px;
  border: 1px solid var(--egofgas-line);
  border-radius: 999px;
  background: transparent;
  color: var(--egofgas-mint);
  padding: 0 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.egofgas-back:hover {
  border-color: var(--egofgas-line-strong);
}

.egofgas-detail {
  font-size: 12.5px;
}

.egofgas-line {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  gap: 16px;
  border-bottom: 1px solid var(--egofgas-line-soft);
  padding: 6px 0;
  color: var(--egofgas-muted);
}

.egofgas-line span:first-child {
  color: var(--egofgas-text);
}

.egofgas-line.is-total {
  border-bottom: 0;
  font-weight: 800;
}

.egofgas-line.is-total span:last-child {
  color: var(--egofgas-mint);
}

.egofgas-line.is-default-zero span {
  color: var(--egofgas-gold);
}

.egofgas-line.is-note {
  border-bottom: 0;
}

.egofgas-line.is-note span:first-child {
  color: var(--egofgas-gold);
  font-weight: 400;
}

.egofgas-source {
  margin: 10px 0 0;
  color: var(--egofgas-dim);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.egofgas-source a {
  color: var(--egofgas-mint);
}

.egofgas-error {
  margin-top: 4px;
  border: 1px solid rgba(255, 143, 143, 0.45);
  border-radius: 10px;
  background: rgba(255, 143, 143, 0.07);
  padding: 10px 13px;
}

.egofgas-error p {
  margin: 0 0 4px;
  color: var(--egofgas-danger);
  font-size: 13px;
}

.egofgas-error p:last-child {
  margin-bottom: 0;
}

.egofgas-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  border-top: 1px solid var(--egofgas-line);
  padding-top: 12px;
}

.egofgas-link {
  /* A text button still needs a finger-sized hit area. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--egofgas-mint);
  padding: 0 2px;
  font: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
}

.egofgas-copy {
  margin-left: auto;
  min-height: 32px;
  border: 1px solid var(--egofgas-line);
  border-radius: 8px;
  background: transparent;
  color: var(--egofgas-text);
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.egofgas-disclaimer {
  margin: 10px 0 0;
  color: var(--egofgas-dim);
  font-size: 11.5px;
}

/* ------------------------------------------------------------ custom mixture */

.egofgas-customRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 40px;
  align-items: end;
  gap: 10px;
}

.egofgas-field {
  display: block;
  margin-bottom: 10px;
}

.egofgas-fieldLabel {
  display: block;
  margin-bottom: 5px;
  color: var(--egofgas-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.egofgas-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--egofgas-line);
  border-radius: 10px;
  background: var(--egofgas-bg);
  color: var(--egofgas-text);
  padding: 0 12px;
  font: inherit;
}

.egofgas-field input:focus {
  border-color: var(--egofgas-mint);
  outline: none;
}

.egofgas-rowRemove {
  width: 40px;
  height: 44px;
  margin-bottom: 10px;
  border: 1px solid var(--egofgas-line);
  border-radius: 10px;
  background: transparent;
  color: var(--egofgas-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.egofgas-customTotal {
  margin: 2px 0 12px;
  font-size: 12.5px;
  font-weight: 800;
}

.egofgas-customTotal[data-egofgas-ok='yes'] {
  color: var(--egofgas-mint);
}

.egofgas-customTotal[data-egofgas-ok='no'] {
  color: var(--egofgas-gold);
}

.egofgas-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 10px 0 14px;
  cursor: pointer;
}

.egofgas-check input {
  width: 18px;
  height: 18px;
  align-self: start;
  margin-top: 3px;
  accent-color: var(--egofgas-mint);
}

.egofgas-check small {
  grid-column: 2;
  color: var(--egofgas-muted);
  font-size: 12px;
}

.egofgas-noscript {
  border: 1px solid var(--egofgas-line-strong);
  border-radius: 10px;
  background: var(--egofgas-panel-soft);
  padding: 12px 14px;
  font-size: 13.5px;
}

.egofgas-srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------ page scale
 *
 * The host stylesheet sizes headings for full legal documents — a 70px h1 and
 * a 30px h2. On this page the heading is a label above a tool and the sections
 * are short supporting text, so both are brought down and the header is
 * tightened until the calculator itself is visible without scrolling.
 *
 * Every rule below is scoped to `.egofgasPage`, a class this module puts on its
 * own <article>. It exists on no other page of the site, so nothing else can be
 * affected by it.
 */

.egofgasPage .legalHero {
  padding: 2px 0 14px;
}

.egofgasPage .legalHero h1 {
  max-width: 34ch;
  margin: 0 0 8px;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.egofgasPage .legalHeroLead {
  max-width: 62ch;
  margin: 0;
  color: var(--egofgas-muted);
  font-size: 14px;
  line-height: 1.5;
}

.egofgasPage .legalHeroMeta {
  margin: 6px 0 0;
  color: var(--egofgas-dim);
  font-size: 11px;
}

.egofgasPage .legalSection {
  padding: clamp(16px, 2.4vw, 26px);
  scroll-margin-top: 84px;
}

.egofgasPage .legalSection h2 {
  margin: 0 0 8px;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.3;
  letter-spacing: 0;
}

.egofgasPage .legalSection h3 {
  margin: 16px 0 5px;
  font-size: 14.5px;
}

.egofgasPage .legalSection p,
.egofgasPage .legalSection li {
  font-size: 14px;
  line-height: 1.6;
}

.egofgasPage .legalBreadcrumb {
  min-height: 40px;
}

@media (max-width: 620px) {
  .egofgasPage .legalHero h1 {
    font-size: clamp(22px, 6.5vw, 28px);
  }

  .egofgasPage .legalHeroLead {
    font-size: 13.5px;
  }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 620px) {
  .egofgas-tiles {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  /* The result spans the full width above the two inputs it comes from. */
  .egofgas-tile--out {
    order: -1;
    grid-column: 1 / -1;
  }

  .egofgas-tile {
    min-height: 84px;
  }

  .egofgas-tile--out {
    min-height: 118px;
  }

  .egofgas-badge {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }

  .egofgas-customRow {
    grid-template-columns: minmax(0, 1fr) 88px 40px;
    gap: 8px;
  }

  .egofgas-line {
    flex-direction: column;
    gap: 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .egofgas * {
    transition: none !important;
    animation: none !important;
  }
}
