/* Shared golden-master layout for quantity-based habit landing pages. */

.topic-principles .topic-step-marker,
.topic-steps .topic-step-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin-bottom: 24px;
  color: var(--mint);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.14em;
}

.topic-step-marker .topic-chevron-run {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin: 0;
}

.topic-step-marker .topic-chevron-run i {
  display: block;
  width: 7px;
  height: 11px;
  margin: 0;
  border-radius: 0;
  background: var(--mint);
  -webkit-mask: url("/assets/chevron-right-heavy.png") center / contain no-repeat;
  mask: url("/assets/chevron-right-heavy.png") center / contain no-repeat;
}

.topic-calculator-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.topic-calculator-field {
  display: grid;
  gap: 8px;
}

.topic-calculator-field > span,
.topic-calculator-result span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topic-calculator-field input,
.topic-calculator-field select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

.topic-date-field {
  position: relative;
  display: block;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.topic-date-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 12px 44px 12px 14px;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
  pointer-events: none;
}

.topic-date-field input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.topic-date-field:focus-within {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.topic-date-field::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  pointer-events: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h2v2h6V2h2v2h1a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h1V2Zm11 7H6v9a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V9Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h2v2h6V2h2v2h1a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h1V2Zm11 7H6v9a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V9Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.topic-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.topic-calculator-field input:focus,
.topic-calculator-field select:focus {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.topic-date-field input[type="date"]:focus {
  outline: 0;
}

/* Topic pages use navy, never the old gray panel. */
.topic-page .topic-fit {
  background: var(--navy);
  color: #f4faf8;
  --muted: #a1b4bd;
  --line: #2a3c47;
}

.topic-page .topic-fit h2,
.topic-page .topic-fit h3 {
  color: #f4faf8;
}

.topic-fit-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(64px, 8vw, 120px);
  align-items: stretch;
}

.topic-fit-copy {
  display: flex;
  flex-direction: column;
}

.topic-steps--compact {
  margin: 46px 0 0;
  padding: 0;
  list-style: none;
  gap: 0;
}

/* Explicit compact-step structure overrides the legacy topic-page selector. */
.topic-fit .topic-steps--compact > .habit-step {
  grid-template-columns: 62px minmax(0, 1fr);
}

.topic-fit .topic-steps--compact > .habit-step {
  align-items: start;
  padding: 19px 0 20px;
}

.topic-fit .topic-steps--compact > .habit-step:last-child {
  border-bottom: 1px solid var(--line);
}

.topic-steps--compact .topic-step-marker {
  width: 62px;
  margin-top: 2px;
  justify-self: start;
  align-self: start;
}

.topic-steps--compact li > div {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}

.topic-steps--compact li h3,
.topic-steps--compact li p {
  text-align: left;
}

.topic-rhythm {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 4px;
}

.topic-rhythm-copy h3 {
  max-width: 520px;
  font-size: clamp(31px, 3.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.topic-rhythm-copy p {
  max-width: 540px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.topic-rhythm-visual {
  margin-top: 56px;
}

.topic-rhythm-bars {
  height: 210px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: clamp(10px, 1.6vw, 20px);
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
}

.topic-rhythm-bars span {
  display: block;
  height: var(--rhythm-height);
  min-height: 10px;
  border-radius: 9px 9px 3px 3px;
  background: var(--mint);
  box-shadow: 0 0 28px rgba(1, 228, 178, 0.06);
}

.topic-rhythm-bars span.is-quiet,
.topic-rhythm-bars span.is-off {
  background: #ff3048;
  box-shadow: none;
}

.topic-rhythm-range {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 14px;
  margin-top: 18px;
}

.topic-rhythm-range > span {
  display: grid;
  gap: 2px;
}

.topic-rhythm-range > span:last-child {
  text-align: right;
}

.topic-rhythm-range strong {
  color: #f4faf8;
  font-size: 16px;
  font-weight: 550;
  line-height: 1.2;
}

.topic-rhythm-range small {
  color: var(--muted);
  font-size: 11px;
}

.topic-rhythm-range i {
  width: 100%;
  height: 2px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--mint);
}

.topic-page .topic-calculator-shell {
  border-block: 0;
}

.topic-calculator-results {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.topic-calculator-result {
  padding-top: 20px;
}

.topic-calculator-result + .topic-calculator-result {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.topic-calculator-result strong {
  display: block;
  margin-top: 8px;
  color: var(--mint);
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 600;
}

.topic-calculator-safety {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding-top: 0;
  border-top: 0;
}

.topic-calculator-safety p {
  max-width: 620px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.topic-calculator-safety .text-link {
  flex: 0 0 auto;
  font-size: 12px;
}

.topic-calculator-section {
  padding-bottom: 42px;
}

.topic-calculator-section + .topic-nav {
  margin-top: 0;
}


@media (max-width: 900px) {
  .topic-rhythm {
    padding-top: 8px;
  }

  .topic-rhythm-visual {
    margin-top: 42px;
  }
}

@media (max-width: 699px) {
  .topic-fit-grid {
    grid-template-columns: 1fr;
    gap: 46px;
  }

  .topic-calculator-form,
  .topic-calculator-results {
    grid-template-columns: 1fr;
  }

  .topic-steps--compact {
    display: grid;
    grid-template-columns: 1fr;
    margin: 32px 0 0;
    padding: 0;
    gap: 0;
  }

  .topic-fit .topic-steps--compact > .habit-step {
    display: grid;
    grid-column: auto;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    gap: 0 16px;
    padding: 18px 0 20px;
  }

  .topic-steps--compact .topic-step-marker {
    width: 34px;
    margin-top: 2px;
  }

  .topic-steps--compact li > div {
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: left;
  }

  .topic-steps--compact li h3 {
    margin: 0;
    text-align: left;
  }

  .topic-steps--compact li p {
    max-width: none;
    margin-top: 8px;
    text-align: left;
  }

  .topic-fit .topic-steps--compact > .habit-step:last-child {
    border-bottom: 0;
  }

  .topic-rhythm {
    padding-top: 0;
  }

  .topic-rhythm-copy h3 {
    font-size: 32px;
  }

  .topic-rhythm-copy p {
    margin-top: 16px;
  }

  .topic-rhythm-visual {
    margin-top: 30px;
  }

  .topic-rhythm-bars {
    height: 165px;
    gap: 9px;
  }

  .topic-calculator-result + .topic-calculator-result {
    padding-left: 0;
    padding-top: 20px;
    margin-top: 20px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topic-calculator-safety {
    flex-direction: column;
    gap: 10px;
  }

  .topic-calculator-section {
    padding-bottom: 32px;
  }
}
