/*
  Left — styles scoped to /tools/* and /support/* pages.
  Loaded in addition to the main style.css.
*/

/* ─────────── Tool widget card ─────────── */

.tool-page {
  padding-top: calc(var(--nav-h) + 48px);
  padding-bottom: 96px;
}
.tool-page h1 {
  font-size: clamp(36px, 5vw, 56px);
  margin-bottom: 12px;
}
.tool-page > .tool-lede {
  color: var(--text-secondary);
  font-size: 18px;
  margin-bottom: 28px;
  max-width: 720px;
}

.tool-widget {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: clamp(26px, 3.4vw, 38px);
  margin: 0 0 36px;
}
.tool-widget__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  align-items: end;
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .tool-widget__row { grid-template-columns: 1fr; }
}
.tool-widget__field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tool-widget__row > .tool-widget__field:only-child {
  grid-column: 1 / -1;
}
.tool-widget__field label,
.tool-widget__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.tool-widget input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]),
.tool-widget select,
.tool-input {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 18px;
  min-height: 60px;
  padding: 15px 18px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-surface) 84%, var(--bg) 16%);
  color: var(--text);
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.tool-widget input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):hover,
.tool-widget select:hover,
.tool-input:hover {
  border-color: color-mix(in srgb, var(--hairline) 55%, var(--accent) 45%);
  background: color-mix(in srgb, var(--bg-surface) 92%, var(--bg) 8%);
}
.tool-widget input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):focus,
.tool-widget select:focus,
.tool-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.tool-widget input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"])::placeholder,
.tool-input::placeholder {
  color: var(--text-secondary);
}
.tool-widget select {
  padding-right: 54px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 28px) calc(50% - 2px),
    calc(100% - 20px) calc(50% - 2px);
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
}
.tool-widget input[type="date"],
.tool-widget input[type="time"],
.tool-widget input[type="datetime-local"] {
  padding-right: 14px;
}
.tool-widget input[type="date"]::-webkit-calendar-picker-indicator,
.tool-widget input[type="time"]::-webkit-calendar-picker-indicator,
.tool-widget input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.72;
  cursor: pointer;
}

/* Result big area */
.tool-result {
  margin-top: 12px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}
.tool-result-big {
  font-size: clamp(44px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tool-result-big .tool-result-unit {
  font-size: 0.45em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 8px;
  letter-spacing: 0;
  text-transform: lowercase;
}
.tool-result-sub {
  margin-top: 10px;
  font-size: 19px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.tool-result p {
  margin: 14px 0 0;
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.tool-result p[style] {
  margin-top: 14px !important;
  font-size: 17px !important;
  color: var(--text-secondary) !important;
  line-height: 1.55 !important;
}
.tool-result p + p {
  margin-top: 8px;
  font-size: 15px;
}
.tool-result p[style] + p[style] {
  margin-top: 8px !important;
  font-size: 15px !important;
}
.tool-result-card {
  padding: 18px 22px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg) 76%, var(--bg-surface) 24%);
}
.tool-result-card .tool-result-big {
  font-size: clamp(34px, 5vw, 54px);
}
.tool-result-meta,
.tool-meta,
.tool-widget > div[id$="-date"],
.tool-widget > div[id$="-date-display"],
.tool-widget > div[id$="-label"],
.tool-widget > div[id$="-status"],
.tool-widget > div[id$="-age"],
.tool-widget > p[id$="-range"],
.tool-widget > p[id$="-progress"],
.tool-widget > p[id$="-trimester"],
.tool-widget > p[id$="-next-bday"] {
  font-size: 17px !important;
  color: var(--text-secondary) !important;
  line-height: 1.5;
}
.tool-widget > div[id$="-date"],
.tool-widget > div[id$="-date-display"],
.tool-widget > div[id$="-label"],
.tool-widget > div[id$="-status"],
.tool-widget > div[id$="-age"] {
  margin-bottom: 18px !important;
}
.tool-widget > p[id$="-range"],
.tool-widget > p[id$="-progress"],
.tool-widget > p[id$="-trimester"],
.tool-widget > p[id$="-next-bday"] {
  margin-top: 16px !important;
}

/* Stat row (used when "all units" view) */
.tool-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
@media (max-width: 520px) {
  .tool-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
.tool-stat {
  background: color-mix(in srgb, var(--bg) 74%, var(--bg-surface) 26%);
  border-radius: var(--radius-cell);
  min-height: 158px;
  padding: 24px 14px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tool-stat-num {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.tool-stat-label {
  margin-top: 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* Unit pill selector */
.tool-units {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.tool-units button {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.tool-units button:hover { color: var(--text); }
.tool-units button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Secondary toggle (hemisphere, gender, fasting plan, etc.) */
.tool-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 6px;
  gap: 6px;
}
.tool-toggle button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  min-height: 48px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.tool-toggle button.is-active {
  background: var(--accent);
  color: #fff;
}

/* Tabs (calculation method) */
.tool-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 20px;
}
.tool-tabs button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tool-tabs button.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Submit button (life expectancy etc.) */
.tool-submit {
  appearance: none;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  min-height: 52px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
}
.tool-submit:hover { opacity: 0.92; }

.tool-fineprint {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.tool-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 28px;
  margin-bottom: 20px;
}
@media (max-width: 800px) {
  .tool-field-grid { grid-template-columns: 1fr; }
}
.tool-inline-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 4px;
}
.tool-inline-fields > select {
  flex: 1 1 280px;
  max-width: 420px;
}
.tool-inline-fields > .tool-meta {
  align-self: center;
}
.tool-inline-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.tool-compact-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tool-compact-group input {
  width: 92px;
  min-width: 92px;
  text-align: center;
}
.tool-compact-suffix {
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.tool-output-chip {
  min-height: 60px;
  display: inline-flex;
  align-items: center;
  padding: 15px 18px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 76%, var(--bg-surface) 24%);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.tool-quick-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tool-quick-btn {
  appearance: none;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--bg) 78%, var(--bg-surface) 22%);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.tool-quick-btn:hover {
  border-color: color-mix(in srgb, var(--hairline) 45%, var(--accent) 55%);
  color: var(--accent);
}

/* Prose around the widget */
.tool-prose {
  width: 100%;
  margin: 0 0 40px;
}
.tool-prose h2 { font-size: clamp(22px, 3vw, 28px); margin: 36px 0 12px; }
.tool-prose h3 { font-size: 18px; margin: 24px 0 8px; }
.tool-prose p, .tool-prose li { font-size: 16px; line-height: 1.7; color: var(--text); }
.tool-prose ul, .tool-prose ol {
  padding-inline-start: 2.25em;
  margin-left: 0;
  list-style-position: outside;
}
.tool-prose a {
  color: var(--accent);
  transition: opacity 120ms ease;
}
.tool-prose a:hover {
  opacity: 0.82;
  font-weight: inherit;
}

/* Related tools (link graph) */
.tool-related {
  width: 100%;
  margin: 24px 0 0;
  padding: 24px;
  background: var(--bg-muted);
  border-radius: var(--radius-card);
}
.tool-related h2 {
  font-size: 18px;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
}
.tool-related-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
}
@media (max-width: 640px) { .tool-related-items { grid-template-columns: 1fr; } }
.tool-related-item {
  display: block;
  position: relative;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
  color: var(--text);
  transition: color 160ms ease;
}
.tool-related-item::after {
  content: "→";
  position: absolute;
  top: 8px;
  right: 0;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.tool-related-item:hover {
  color: var(--accent);
}
.tool-related-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* ─────────── Shared "Start tracking what matters" download block ─────────── */

.download-block {
  width: 100%;
  margin: clamp(88px, 10vw, 128px) 0 0;
  padding-top: clamp(20px, 3vw, 36px);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.download-block .section-head {
  margin-bottom: clamp(28px, 4vw, 48px);
}
.download-block .section-head h2 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.download-block .section-head p {
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.45;
  color: var(--text-secondary);
  font-weight: 500;
}
.download-block .download-actions {
  margin-top: 0;
}

/* ─────────── Tools index page ─────────── */

.tools-index {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: calc(var(--nav-h) + 48px);
  padding-bottom: 96px;
}
.tools-index h1 { font-size: clamp(40px, 6vw, 64px); margin-bottom: 12px; }
.tools-index > .tools-intro {
  color: var(--text-secondary);
  font-size: 18px;
  max-width: 720px;
  margin-bottom: 48px;
}
.tools-group { margin-bottom: 48px; }
.tools-group h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .tools-grid { grid-template-columns: 1fr; } }
.tool-card {
  display: block;
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 20px 52px 20px 22px;
  transition: box-shadow 160ms ease;
}
.tool-card::after {
  content: "→";
  position: absolute;
  top: 20px;
  right: 22px;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
}
.tool-card:hover::after {
  opacity: 1;
  transform: translateX(0);
}
.tool-card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tool-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

/* ─────────── Tutorial article ─────────── */

.tutorial {
  width: 100%;
  padding-top: calc(var(--nav-h) + 48px);
  padding-bottom: 96px;
}
.tutorial > * { max-width: 920px; }
.tutorial h1 {
  font-size: clamp(32px, 4.5vw, 48px);
  margin-bottom: 12px;
  letter-spacing: -0.025em;
}
.tutorial .tutorial-lede {
  color: var(--text-secondary);
  font-size: 18px;
  margin-bottom: 32px;
}
.tutorial h2 {
  font-size: clamp(22px, 2.8vw, 28px);
  margin: 40px 0 14px;
  letter-spacing: -0.02em;
}
.tutorial h3 { font-size: 18px; margin: 24px 0 8px; }
.tutorial p, .tutorial li { font-size: 17px; line-height: 1.7; color: var(--text); }
.tutorial ol, .tutorial ul {
  padding-inline-start: 2.25em;
  margin-left: 0;
  list-style-position: outside;
}
.tutorial ol li, .tutorial ul li { margin-bottom: 6px; }
.tutorial a {
  color: var(--accent);
  transition: opacity 120ms ease;
}
.tutorial a:hover {
  opacity: 0.82;
  font-weight: inherit;
}
.tutorial figure { margin: 24px 0; }
.tutorial figure img {
  width: 100%;
  border-radius: var(--radius-cell);
  background: var(--bg-muted);
}
.tutorial figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.tutorial .step-block {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin: 32px 0 24px;
}
.tutorial .step-block .step-kicker {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.tutorial .step-block h2 { margin-top: 0; }
