/*
 * The free tools (tools.ts): one look for all of them, over the articles' page (guides.css). The working part of a
 * tool is a pane of the home page's glass; its buttons are the app's orange capsule; what a person is heading for wears
 * the amber glow of the thing the magpie holds; every move a tool rewards bursts with the site's stars (sparkle.js) and
 * a count that pops. Each tool adds its own stylesheet (public/tools/<slug>.css). Under Reduce Motion nothing moves.
 */

.tool-page {
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --lit: #ffb071;
  --lit-glow: rgb(255 154 77 / 0.55);
  --glass-top: rgb(70 50 42 / 0.62);
  --glass-bottom: rgb(44 30 26 / 0.74);
  --glass-edge: rgb(255 226 200 / 0.16);
  --glass-shine: rgb(255 240 228 / 0.1);
  --private: #5fd0c2;
}

/* What a tool hides stays hidden, whatever display its class gives it. */
.tool-page [hidden] {
  display: none !important;
}

/* Words for a screen reader alone: a field's label the placeholder already shows. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The heading: centred over the tool, the articles' type. */

.tool-head {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 88px) 0 0;
  text-align: center;
}

.tool-head .kicker a {
  color: inherit;
  text-decoration: none;
}

@media (hover: hover) {
  .tool-head .kicker a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
  }
}

.tool-head h1 {
  margin: 0;
  font-size: clamp(2.375rem, 1.6rem + 3.4vw, 4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.tool-head h1 .accent {
  display: block;
}

.tool-head .dek {
  max-width: 38rem;
  margin-right: auto;
  margin-left: auto;
  text-wrap: pretty;
}

/* The promise every tool keeps: it is free, and what you type stays on the page (tools.test.ts holds the scripts to
   it). Teal, My Life's colour for the people side of things, read here as "safe". */
/* On a phone its two sentences break between them, never inside one. */
.tool-promise {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  text-align: left;
  margin: 20px 0 0;
  padding: 7px 15px;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tool-promise .dot {
  width: 8px;
  height: 8px;
  background: var(--private);
  border-radius: 50%;
  box-shadow: 0 0 10px rgb(95 208 194 / 0.7);
}

/* The stage: the tool's working part, a pane of glass like the home page's windows onto the app. Its lines of words
   never end on one word alone. */

.tool-stage {
  position: relative;
  max-width: 56rem;
  margin: clamp(28px, 5vw, 44px) auto 0;
  padding: clamp(20px, 4vw, 36px);
  color: var(--ink);
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  border: 1px solid var(--glass-edge);
  border-radius: 30px;
  box-shadow:
    0 1px 0 var(--glass-shine) inset,
    0 40px 80px -36px rgb(0 0 0 / 0.75),
    0 0 0 8px rgb(255 226 200 / 0.035);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  backdrop-filter: blur(22px) saturate(1.35);
}

.tool-stage p {
  text-wrap: pretty;
}

/* A tool's stages (dump, sort, one step): numbered, the one you are on lit, the ones behind you ticked. */

.tool-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: 0;
  list-style: none;
  counter-reset: tool-step;
}

/* The count steps on the item, not its number: Safari stops counting a ::before whose content is the tick. */
.tool-steps li {
  display: flex;
  gap: 9px;
  align-items: center;
  counter-increment: tool-step;
  color: var(--ink-4);
  font-size: 0.9375rem;
  font-weight: 750;
  transition: color 300ms ease;
}

.tool-steps li::before {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 0.8125rem;
  font-weight: 800;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: counter(tool-step);
  transition:
    background-color 300ms ease,
    box-shadow 300ms ease;
}

.tool-steps li.is-now {
  color: var(--ink);
}

.tool-steps li.is-now::before {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgb(255 138 51 / 0.55);
}

.tool-steps li.is-done {
  color: var(--ink-3);
}

.tool-steps li.is-done::before {
  color: var(--on-accent);
  background: var(--lit);
  border-color: var(--lit);
  content: "✓";
}

/* Buttons: the app's orange capsule, and a quiet one of glass. The kit weighs one class, so a tool's own rule can
   always shape it; for the same reason a tool's markup carries no type="submit" and no type="text" (a form's button
   and an input are those already): site.css's waitlist rules key on those two attributes and would outweigh the kit
   (tools.test.ts holds every tool to it). */

.tool-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  color: var(--on-accent);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 26px -10px rgb(255 138 51 / 0.85);
  cursor: pointer;
  transition:
    transform 180ms var(--spring),
    background-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

/* A hover lifts only where a pointer can hover: a phone keeps the last tap's hover, and the lift would stick. */
@media (hover: hover) {
  .tool-button:hover {
    background: #ff9a4d;
    transform: translateY(-1px);
  }
}

.tool-button:active {
  transform: scale(0.97);
}

.tool-button:focus-visible,
.tool-chip:focus-visible,
.tool-field:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.4;
  box-shadow: none;
  transform: none;
}

.tool-button.is-quiet {
  color: var(--ink);
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (hover: hover) {
  .tool-button.is-quiet:hover {
    background: var(--well-hover);
  }
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
}

/* A field to type into: dark like the app's composer, warm at its edge, amber when it has you. */

.tool-field {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  background: rgb(20 13 15 / 0.55);
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  outline: none;
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.tool-field::placeholder {
  color: var(--ink-4);
}

.tool-field:focus {
  background: rgb(20 13 15 / 0.55);
  border-color: var(--lit);
  box-shadow: 0 0 0 4px rgb(255 176 113 / 0.16);
}

textarea.tool-field {
  min-height: 8rem;
  line-height: 1.5;
  resize: vertical;
}

/* A chip: one choice among a few. */

.tool-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 40px;
  padding: 8px 15px;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms var(--spring);
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .tool-chip:hover {
    color: var(--ink);
    border-color: rgb(255 176 113 / 0.5);
  }
}

.tool-chip:active {
  transform: scale(0.96);
}

.tool-chip[aria-pressed="true"],
.tool-chip.is-on {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 8px 18px -10px rgb(255 138 51 / 0.9);
}

/* A count that pops when it goes up. */

.tool-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.tool-count.pop {
  animation: tool-pop 460ms var(--spring);
}

@keyframes tool-pop {
  40% {
    color: var(--lit);
    transform: scale(1.35);
  }
}

/* What the person is heading for: the amber glow, as every diagram's lit step and the tree's next step wear it. */

.tool-lit {
  border: 1px solid var(--lit);
  box-shadow:
    0 0 0 1px var(--lit),
    0 0 40px -6px var(--lit-glow);
}

/* A ring that empties as time runs: tools set its dash offset from script (CSSOM, so the CSP holds). No drop-shadow
   filter on it: over the stage's frosted glass Chrome draws the filter's box as a faint square. */

.tool-ring {
  display: block;
  width: 120px;
  height: 120px;
}

.tool-ring circle {
  fill: none;
  stroke-width: 9;
}

.tool-ring .tool-ring-track {
  stroke: rgb(255 236 220 / 0.09);
}

.tool-ring .tool-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s linear;
}

/* Something arriving: a block that rises into place. */

.tool-arrive {
  animation: tool-arrive 520ms var(--spring) both;
}

@keyframes tool-arrive {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

/* The words around a tool, at the articles' measure. */

.tool-words {
  max-width: var(--measure);
  margin: clamp(48px, 8vw, 88px) auto 0;
}

.tool-words .prose {
  padding-top: 0;
}

/* The soft door to the app: last, once the tool has done its job. */

.tool-cta {
  max-width: 44rem;
  margin: clamp(40px, 7vw, 64px) auto 0;
  padding: clamp(24px, 4vw, 34px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgb(255 154 77 / 0.16), transparent 60%),
    linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line);
  border-radius: 26px;
}

.tool-cta h2 {
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
}

.tool-cta p {
  margin: 10px auto 0;
  max-width: 34rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.tool-cta .tool-button {
  margin-top: 18px;
  text-decoration: none;
}

/* The cards: the hub's, and the other tools under each one. */

.tool-more {
  max-width: 64rem;
  margin: clamp(56px, 9vw, 96px) auto 0;
}

.tool-more h2 {
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 800;
  text-align: center;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.tool-cards-hub {
  max-width: 64rem;
  margin: clamp(32px, 6vw, 56px) auto 0;
}

.tool-card {
  margin: 0;
}

.tool-card a {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  height: 100%;
  padding: 22px;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 50px -32px rgb(0 0 0 / 0.8);
  transition:
    transform 260ms var(--spring),
    border-color 260ms ease,
    box-shadow 260ms ease;
}

.tool-card a:focus-visible {
  border-color: rgb(255 176 113 / 0.45);
  box-shadow:
    0 0 0 1px rgb(255 176 113 / 0.2),
    0 30px 60px -30px rgb(255 138 51 / 0.45);
  transform: translateY(-4px);
}

@media (hover: hover) {
  .tool-card a:hover {
    border-color: rgb(255 176 113 / 0.45);
    box-shadow:
      0 0 0 1px rgb(255 176 113 / 0.2),
      0 30px 60px -30px rgb(255 138 51 / 0.45);
    transform: translateY(-4px);
  }
}

.tool-mark svg {
  display: block;
  width: 48px;
  height: 48px;
  transition: transform 320ms var(--spring);
}

@media (hover: hover) {
  .tool-card a:hover .tool-mark svg {
    transform: rotate(-6deg) scale(1.1);
  }
}

.tool-card h2,
.tool-card h3 {
  margin: 4px 0 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.tool-line {
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.tool-go {
  margin-top: auto;
  padding-top: 6px;
  color: var(--accent-text);
  font-size: 0.9375rem;
  font-weight: 800;
}

.tool-go::after {
  display: inline-block;
  margin-left: 6px;
  content: "→";
  transition: transform 220ms var(--spring);
}

@media (hover: hover) {
  .tool-card a:hover .tool-go::after {
    transform: translateX(4px);
  }
}

/* A tool not written yet says so plainly. */
.tool-soon {
  margin: 0;
  color: var(--ink-3);
  text-align: center;
}

/* Paper: a tool prints only what it was for, dark words on the page, no sky (each tool's stylesheet says what that
   is, with .tool-no-print on the rest). */
@media print {
  .tool-page .top,
  .tool-page .foot,
  .tool-more,
  .tool-cta,
  .tool-promise,
  .tool-steps,
  .tool-actions,
  .tool-no-print {
    display: none !important;
  }

  .tool-stage {
    margin-top: 12px;
    padding: 0;
    color: #1e1418;
    background: none;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-count.pop,
  .tool-arrive {
    animation: none;
  }

  .tool-card a,
  .tool-button,
  .tool-chip,
  .tool-mark svg,
  .tool-ring .tool-ring-fill {
    transition: none;
  }
}
