/* Calorie Calculator — scoped styles (cal-) */

.cal-form {
  display: block;
  padding: 1.15rem 1rem 1.35rem;
}

.cal-intro {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-muted, #5a4a42);
}

/* Unit segmented control */
.cal-units {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
  flex-wrap: wrap;
}

.cal-unit {
  flex: 1 1 0;
  min-width: 140px;
}

.cal-unit input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cal-unit span {
  display: block;
  text-align: center;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--color-beige-border, #e0d4c4);
  border-radius: 10px;
  background: #fff;
  color: #4a0e1f;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cal-unit input:checked + span {
  background: var(--color-primary, #8b2942);
  border-color: var(--color-primary, #8b2942);
  color: #fff;
}

.cal-unit input:focus-visible + span {
  outline: 2px solid var(--color-primary, #8b2942);
  outline-offset: 2px;
}

/* Inputs grid */
.cal-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 0.9rem;
  margin: 0 0 0.9rem;
}

.cal-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* The class rule above otherwise overrides the [hidden] attribute, leaving the
   metric and imperial height fields both visible at once. */
.cal-field[hidden] {
  display: none;
}

.cal-field--wide {
  margin: 0 0 0.9rem;
}

.cal-field--name {
  margin: 0 0 1.5rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--color-beige-border, #e0d4c4);
}

.cal-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted, #6b5e58);
}

.cal-opt {
  font-weight: 400;
  color: var(--color-muted, #9a8470);
  font-size: 0.74rem;
}

.cal-field input,
.cal-field select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-beige-border, #e0d4c4);
  border-radius: 10px;
  background: #fff;
  color: #2a2220;
  font-size: 1rem;
}

.cal-ftin {
  display: flex;
  gap: 0.5rem;
}

.cal-ftin__cell {
  position: relative;
  flex: 1;
}

.cal-ftin__cell input {
  width: 100%;
  padding-right: 2.2rem;
  box-sizing: border-box;
}

.cal-ftin__unit {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--color-muted, #9a8470);
}

/* Result */
.cal-result[hidden],
.cal-empty[hidden] {
  display: none;
}

.cal-empty {
  margin: 0.6rem 0 0;
  padding: 0.9rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted, #6b5e58);
  background: var(--color-beige, #faf3e8);
  border: 1px dashed var(--color-beige-border, #e0d4c4);
  border-radius: 10px;
}

/* Gauge — matches the BMI / Kundli Milan dial (rim, ticks, polished needle,
   centre readout) with deficit / maintain / surplus zones. */
.cal-gauge {
  max-width: 300px;
  margin: 0.4rem auto 0.6rem;
}

.cal-gauge__svg {
  width: 100%;
  height: auto;
  display: block;
}

.cal-gauge__rim {
  filter: drop-shadow(0 1px 1px rgba(74, 14, 31, 0.06));
}

.cal-gauge__arc {
  filter: drop-shadow(0 1px 2px rgba(74, 14, 31, 0.12));
}

.cal-gauge__ticks line {
  stroke: #6b5e58;
  stroke-width: 1;
  opacity: 0.5;
}

.cal-gauge__needle {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.cal-gauge__needle-line {
  stroke: #3a2c26;
}

.cal-gauge__needle-hub-outer {
  fill: none;
  stroke: #d4a017;
  stroke-width: 2;
}

.cal-gauge__needle-hub {
  fill: #7a1834;
}

.cal-gauge__num {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-serif, Georgia, "Times New Roman", serif);
  fill: var(--color-primary, #8b2942);
}

.cal-gauge__unit {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font, system-ui, sans-serif);
  fill: #9a8470;
}

.cal-gauge__cat {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font, system-ui, sans-serif);
  fill: #6b5e58;
}

.cal-summary {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  color: #3a2c26;
}

/* Facts */
.cal-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
}

.cal-fact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-beige-border, #e7d9c3);
  border-radius: 10px;
  background: var(--color-beige, #faf3e8);
}

.cal-fact__k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted, #8a6b52);
}

.cal-fact__v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary, #8b2942);
}

/* Section title */
.cal-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary, #8b2942);
  border-bottom: 2px solid var(--color-beige-border, #eadfce);
  padding-bottom: 0.35rem;
  margin: 0 0 0.7rem;
}

/* Goal table — each row is a tappable button that selects that goal. */
.cal-goals {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
}

.cal-goal {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-beige-border, #e7d9c3);
  border-radius: 10px;
  background: #fff;
  color: #3a2c26;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cal-goal:hover {
  background: #fbf4ef;
}

.cal-goal.is-active {
  background: #fbf4ef;
  border-color: var(--color-primary, #8b2942);
  box-shadow: 0 0 0 1px var(--color-primary, #8b2942) inset;
}

.cal-goal__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.cal-goal__text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.cal-goal__label {
  font-size: 0.9rem;
  font-weight: 600;
}

.cal-goal__rate {
  font-size: 0.74rem;
  color: var(--color-muted, #8a7363);
}

.cal-goal__cal {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-primary, #8b2942);
  white-space: nowrap;
}

.cal-goal__cal small {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-muted, #9a8470);
  margin-left: 0.18rem;
  text-transform: uppercase;
}

/* Macros */
.cal-macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0 0 0.5rem;
}

.cal-macro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.7rem 0.5rem;
  border: 1px solid var(--color-beige-border, #e7d9c3);
  border-radius: 10px;
  background: var(--color-beige, #faf3e8);
  border-top: 3px solid #c9a227;
}

.cal-macro--p { border-top-color: #7a1834; }
.cal-macro--c { border-top-color: #2a8f6b; }
.cal-macro--f { border-top-color: #e0a52e; }

.cal-macro__k {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted, #8a6b52);
}

.cal-macro__v {
  font-size: 1.1rem;
  font-weight: 800;
  color: #3a2c26;
}

.cal-macros__note {
  margin: 0 0 1.1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--color-muted, #8a7363);
}

/* Advice */
.cal-advice__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary, #8b2942);
  border-bottom: 2px solid var(--color-beige-border, #eadfce);
  padding-bottom: 0.35rem;
  margin: 0 0 0.7rem;
}

.cal-advice__list {
  margin: 0;
  padding-left: 1.1rem;
}

.cal-advice__list li {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3a2c26;
}

@media (max-width: 480px) {
  .cal-facts {
    grid-template-columns: 1fr;
  }

  .cal-goal__label {
    font-size: 0.86rem;
  }
}
