/*
  Screen Time Reduction Planner. Scoped to .stp-page and built only on the
  shared tokens in styles.css (:root). No gradients, no decorative shadows;
  elevation comes from tonal surfaces, matching the iOS app.
*/

.stp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Hero and tool share one surface so the tool owns the first screen. */
.stp-page.seo-design-template .how-hero.stp-hero {
  display: block;
  min-height: 0;
  padding: 72px 0 56px;
}

.stp-page.seo-design-template .stp-hero .text-card h1 {
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.1;
}

.stp-h1-payoff {
  display: block;
}

.stp-page.seo-design-template .stp-hero .lead {
  max-width: 640px;
  margin: 0 auto;
}

/* Tool: an inline sentence of inputs, then the results panel — matches vs-compare width for exact horizontal alignment */
.stp-tool {
  max-width: none;
  margin: 40px auto 0;
  text-align: left;
}

.stp-sentence {
  max-width: 800px;
  margin: 0 auto;
  color: var(--fella-primary-text);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 400;
  line-height: 2.15;
  text-align: center;
}

/* Each clause wraps as a unit, so a line never ends on a stray word. */
.stp-clause {
  display: inline-block;
}

.stp-nowrap {
  white-space: nowrap;
}

.stp-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.stp-select {
  -webkit-appearance: none;
  appearance: none;
  height: 44px;
  margin: 0;
  padding: 0 34px 0 14px;
  border: 1px solid var(--fella-separator);
  border-radius: var(--radius-md);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%231d1d1f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 12px;
  color: var(--fella-primary-text);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  cursor: pointer;
  transition: filter 150ms ease;
}

.stp-select:hover {
  filter: var(--hover-brighten);
}

.stp-select:focus-visible,
.stp-tab:focus-visible,
.stp-table-scroll:focus-visible {
  outline: 2px solid var(--fella-accent);
  outline-offset: 2px;
}

.stp-status {
  margin: 20px auto 0;
  color: var(--fella-primary-text);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.stp-status:empty {
  display: none;
}

/* Results */
.stp-results {
  margin-top: 28px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.stp-fallback {
  margin: 0;
  color: var(--fella-primary-text);
  text-align: center;
}

.stp-pace {
  margin: 0 0 24px;
  color: var(--fella-primary-text);
  font-size: 17px;
  line-height: 1.5;
}

.stp-pace strong {
  font-weight: 600;
}

.stp-suggest {
  display: flex;
  min-height: 44px;
  margin-top: 12px;
  font-size: 15px;
}

.stp-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0 0 28px;
}

.stp-figure {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
}

.stp-figure dt {
  color: var(--fella-secondary-text);
  font-size: 15px;
  line-height: 1.35;
}

.stp-figure dd {
  margin: 0;
  color: var(--fella-primary-text);
  font-size: clamp(28px, 3.2vw, 34px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* Chart: the plan's own step-down, drawn from the calculated limits. */
.stp-chart-figure {
  margin: 0;
}

.stp-chart {
  height: 220px;
}

.stp-chart svg {
  display: block;
  overflow: visible;
}

.stp-area {
  fill: var(--fella-secondary-fill);
}

.stp-step {
  fill: none;
  stroke: var(--fella-primary-text);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stp-area,
.stp-step {
  transition: d 320ms cubic-bezier(0.2, 0, 0, 1);
}

.stp-baseline {
  stroke: var(--fella-separator);
  stroke-width: 1;
  stroke-linecap: round;
}

.stp-goal {
  stroke: var(--fella-secondary-text);
  stroke-width: 1.5;
  stroke-dasharray: 1 6;
  stroke-linecap: round;
}

.stp-dot {
  fill: #ffffff;
  stroke: var(--fella-primary-text);
  stroke-width: 2;
}

.stp-dot-goal {
  fill: var(--fella-primary-text);
}

.stp-axis text {
  fill: var(--fella-secondary-text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stp-axis .stp-axis-goal {
  fill: var(--fella-primary-text);
  font-weight: 600;
}

.stp-caption {
  margin-top: 4px;
  color: var(--fella-secondary-text);
  font-size: 15px;
}

.stp-now {
  margin: 24px 0 0;
  color: var(--fella-primary-text);
  font-size: 20px;
  line-height: 1.4;
}

/* View switch + copy */
.stp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 28px 0 16px;
}

.stp-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--fella-secondary-fill);
}

.stp-tab {
  min-width: 108px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fella-primary-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 150ms ease, background-color 150ms ease;
}

.stp-tab:hover {
  filter: var(--hover-brighten);
}

.stp-tab[aria-selected="true"] {
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.12);
}

.stp-copy {
  min-width: 124px;
  font-size: 15px;
}

/* Tables reuse .vs-compare. The shared SEO template forces fixed layout and
   hidden overflow on mobile; results tables scroll sideways instead. */
.stp-page.seo-design-template .stp-results .vs-compare-wrap {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
}

.stp-page.seo-design-template .stp-results .vs-compare-wrap.stp-table-scroll {
  max-height: 440px;
  overflow: auto;
}

.stp-page.seo-design-template .stp-results .vs-compare {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.stp-page.seo-design-template .stp-results .vs-compare th,
.stp-page.seo-design-template .stp-results .vs-compare td {
  padding: 12px 16px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-wrap: normal;
}

.stp-page.seo-design-template .stp-results .vs-compare tbody th {
  background: #ffffff;
  color: var(--fella-primary-text);
  font-weight: 400;
}

.stp-page.seo-design-template .stp-results .vs-compare tbody tr:nth-child(even) th {
  background: #f7f7f8;
}

.stp-page.seo-design-template .stp-results .vs-compare tbody tr:last-child th {
  border-bottom: 0;
}

.stp-page.seo-design-template .stp-results .vs-compare thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.stp-page.seo-design-template .stp-results .stp-row-goal th,
.stp-page.seo-design-template .stp-results .stp-row-goal td {
  font-weight: 600;
}

/* Tables in the explanatory copy */
.stp-page.seo-design-template .stp-example {
  margin-top: 32px;
}

@media (max-width: 767px) {
  .stp-page.seo-design-template .how-hero.stp-hero {
    padding: 48px 0 32px;
  }

  .stp-page.seo-design-template .stp-hero .text-card h1 {
    font-size: 34px;
  }

  .stp-h1-payoff {
    margin-top: 6px;
    font-size: 24px;
  }

  .stp-tool {
    margin-top: 28px;
  }

  .stp-sentence {
    line-height: 2.3;
  }

  .stp-results {
    margin-top: 20px;
    padding: 20px 16px;
  }

  .stp-summary {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stp-chart {
    height: 180px;
  }

  .stp-now {
    font-size: 18px;
  }

  .stp-tabs {
    width: 100%;
  }

  .stp-tab {
    flex: 1;
    min-width: 0;
  }

  .stp-copy {
    width: 100%;
  }

  .stp-page.seo-design-template .stp-results .vs-compare th,
  .stp-page.seo-design-template .stp-results .vs-compare td {
    padding: 12px 10px;
    font-size: 15px;
  }
}

/* Narrow phones: drop the derived "Less than now" column, the limit is what matters. */
@media (max-width: 479px) {
  .stp-page.seo-design-template #stp-panel-weekly .vs-compare :is(th, td):nth-child(4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stp-area,
  .stp-step,
  .stp-select,
  .stp-tab {
    transition: none;
  }
}

/* Hold the tool's rendered height until its script replaces the no-JS note,
   so the sections below do not jump when the tool appears (layout shift). */
@media (scripting: enabled) {
  [data-stp]:has([data-stp-fallback]) {
    min-height: 1180px;
  }

  @media (min-width: 768px) {
    [data-stp]:has([data-stp-fallback]) {
      min-height: 1080px;
    }
  }
}
