:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #555555;

  --outline: #111111;
  --track: #eeeeee;

  --red: #d32f2f;
  --yellow: #f9a825;
  --green: #2e7d32;

  /* Thermometer sizing (responsive) */
  --thermo-width: clamp(72px, 8vw, 96px);
  --tube-height: clamp(240px, 36vh, 360px);
  --tube-inner-pad: 6px;


  --bulb-size: clamp(66px, 7.5vw, 86px);

  /* NEW: tube width independent of bulb */
  --tube-width: calc(var(--bulb-size) * 0.60); /* ~2/3 of bulb width */
  --tube-height: clamp(240px, 36vh, 360px);


  --outline-w: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page-header {
  padding: 24px 16px 10px 16px;
  text-align: center;
}

.page-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(28px, 3.2vw, 44px);
  letter-spacing: 0.2px;
}

.last-updated {
  margin-top: 8px;
  font-size: clamp(14px, 1.6vw, 18px);
  color: var(--muted);
}

.page-body {
  padding: 18px 16px 36px 16px;
}

.projects-grid {
  display: grid;
  justify-content: center;         /* centers the grid itself */
  justify-items: center;           /* centers each item in its cell */
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 22px 18px;
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  width: min(220px, 100%);
  text-align: center;
}

.project-name {
  margin: 0 0 10px 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;

  /* Two lines max + ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thermometer {
    position: relative;
    /* Container width should accommodate the bulb, not the tube */
    width: var(--bulb-size);
    margin: 0 auto;
    padding-bottom: calc(var(--bulb-size) * 0.55);
}

/* Tube outline */
.tube {
    position: relative;
    z-index: 1;
    width: var(--tube-width); /* was 100% */
    height: var(--tube-height);
    margin: 0 auto; /* centers tube in container */
    border: var(--outline-w) solid var(--outline);
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
    --fill: 0%;
}


/* Full-height, fixed segmentation (NOT scaled to fill height) */
.tube-segments {
    position: absolute;
    inset: 0;
    background: linear-gradient( to top, var(--red) 0%, var(--red) 33.333%, var(--yellow) 33.333%, var(--yellow) 66.666%, var(--green) 66.666%, var(--green) 100% );
    /* Reveal only the bottom --fill percent */
    clip-path: inset(calc(100% - var(--fill)) 0 0 0);
}

/* Tick overlay aligned to the tube geometry */
.tube-ticks {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--tube-width);
    height: var(--tube-height);
    pointer-events: none;
    z-index: 4; /* above fill and tube highlight */
}

/* A tick is positioned by bottom:% */
.tick {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
}

/* Tick line anchored to the RIGHT edge (fundraiser-like) */
.tick-line {
    position: absolute;
    right: 0;
    top: 0;
    background: rgba(17, 17, 17, 0.7);
}

/* Major vs minor tick styling */
.tick.major .tick-line {
    height: 2px;
    width: 100%;
}

/* Keep the 100% label, but hide the 100% tick line */
.tick.major[style*="bottom: 100%"] .tick-line {
    display: none;
}

.tick.minor .tick-line {
    height: 1px;
    width: 60%;
    background: rgba(17, 17, 17, 0.5);
}

/* Major tick label to the right of the tube */
.tick-label {
    position: absolute;
    right: 0;
    top: 0;
    transform: translate(calc(100% + 10px), -50%);
    font-weight: 700;
    font-size: 13px;
    color: rgba(17, 17, 17, 0.85);
    white-space: nowrap;
}

.page-subtitle {
    margin: 6px 0 0 0;
    font-weight: 700;
    font-size: clamp(18px, 2.2vw, 26px);
    letter-spacing: 0.2px;
}


/* Inner highlight to make it feel more like a “glass tube”. */
.tube::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 10%;
  width: 18%;
  height: calc(100% - 12px);
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
  pointer-events: none;
}

/* Bulb outline */
.bulb {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 0;
    width: var(--bulb-size);
    height: var(--bulb-size);
    transform: translateX(-50%);
    border: var(--outline-w) solid var(--outline);
    border-radius: 50%;
    background: var(--track);
    overflow: hidden;
}

/* Bulb fill: red when percent > 0, else stays track */
.bulb-fill {
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0; /* set by JS */
}

.bulb::after {
  content: "";
  position: absolute;
  top: 14%;
  left: 18%;
  width: 22%;
  height: 48%;
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
  pointer-events: none;
}

.percent-label {
  margin: 12px 0 0 0;
  font-weight: 700;
  font-size: 16px;
}

/* Small devices: slightly tighter cards */
@media (max-width: 420px) {
  .project-card { width: min(200px, 100%); }
}
