/* The free tool pages (/tools/*), from the design system's Tool Page
   template. Loaded after /blog/blog.css, whose tokens, crumbs, header,
   footer, FAQ and badge styles these pages share. Colors are --kf-* tokens
   (and blog.css's --blog-* where the token sheet has none). */

.tool-hero {
  margin-top: var(--kf-space-three);
  background: var(--kf-blueTint);
  border-top: 1px solid var(--kf-line);
  border-bottom: 1px solid var(--kf-line);
}

.tool-hero-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: flex-start;
  padding-top: 40px;
  padding-bottom: 44px;
}

.tool-pitch {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-three);
}

.tool-badge {
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--kf-manilaTint);
  color: var(--kf-manilaDeep);
  font-size: 13px;
  font-weight: 700;
}

.tool-pitch h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 800;
  letter-spacing: -0.9px;
  line-height: 1.08;
  color: var(--kf-ink);
  text-wrap: balance;
}

.tool-pitch .dek {
  max-width: 44ch;
  font-size: clamp(17px, 1.9vw, 20px);
  line-height: 1.55;
}

.tool-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tool-points li {
  position: relative;
  padding-left: 17px;
  font-size: var(--kf-font-size-body);
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-slate);
}

.tool-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--kf-accent);
}

.tool-panel {
  flex: 1 1 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-card {
  background: var(--kf-surface);
  border: 1px solid var(--kf-line);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-card[hidden],
.tool-card [hidden] {
  display: none !important;
}

/* The drop zone is a <label> for the file input, so it is keyboard- and
   screen-reader-reachable without any script. */
.tool-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--kf-space-two);
  padding: 30px 20px;
  border-radius: var(--kf-radius-card);
  border: 2px dashed var(--kf-mist);
  background: var(--kf-cloud);
  cursor: pointer;
  text-align: center;
}

.tool-drop:hover,
.tool-drop.is-over,
.tool-drop:focus-within {
  border-color: var(--kf-accent);
  background: var(--kf-blueTint);
}

.tool-drop svg {
  width: 42px;
  height: 42px;
  color: var(--kf-steel);
}

.tool-drop-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--kf-ink);
}

.tool-drop-hint {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-steel);
}

.tool-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tool-sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: var(--kf-font-size-small);
  font-weight: 700;
  color: var(--kf-steel);
}

.tool-card button {
  font-family: var(--kf-font);
  cursor: pointer;
}

.tool-sample,
.tool-toggle-all {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--kf-surface);
  border: 1px solid var(--kf-line);
  color: var(--kf-ink);
  font-size: var(--kf-font-size-small);
  font-weight: 700;
}

.tool-sample:hover,
.tool-toggle-all:hover {
  border-color: var(--kf-accent);
}

.tool-file {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--kf-cloud);
  border: 1px solid var(--kf-line);
  border-radius: var(--kf-radius-card);
}

.tool-file-name {
  flex: 1 1 140px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 700;
  color: var(--kf-ink);
}

/* Discard role: manila light, per the design system's button rules. */
.tool-remove {
  padding: 7px 13px;
  border-radius: var(--kf-radius);
  background: var(--kf-manilaLight);
  border: 1px solid var(--kf-manilaEdge);
  color: var(--kf-manilaDeep);
  font-size: var(--kf-font-size-small);
  font-weight: 700;
}

.tool-run,
.tool-download {
  padding: 15px 20px;
  border-radius: var(--kf-radius);
  border: none;
  background: var(--kf-ink);
  color: var(--kf-surface);
  font-size: 17px;
  font-weight: 700;
}

.tool-run:hover,
.tool-download:hover {
  background: var(--blog-navy-hover);
}

.tool-run:disabled,
.tool-download:disabled,
.tool-share:disabled {
  background: var(--kf-mist);
  color: var(--kf-surface);
  border-color: var(--kf-mist);
  cursor: default;
}

/* Extracting: the button keeps its navy and turns a small ring beside the
   word, so the wait reads as work, not as a dead button. */
.tool-run.is-busy,
.tool-run.is-busy:disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--kf-ink);
  color: var(--kf-surface);
  cursor: progress;
}

.tool-run.is-busy::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--kf-surface);
  animation: tool-spin 0.8s linear infinite;
}

@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tool-run.is-busy::before {
    animation-duration: 2.4s;
  }
}

.tool-share {
  padding: 15px 20px;
  border-radius: var(--kf-radius);
  background: var(--kf-surface);
  border: 1px solid var(--kf-line);
  color: var(--kf-ink);
  font-size: var(--kf-font-size-body);
  font-weight: 700;
}

.tool-share:hover:not(:disabled) {
  border-color: var(--kf-accent);
}

.tool-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--kf-radius-card);
  background: var(--kf-errorLight);
  border: 1px solid var(--blog-error-edge);
  color: var(--blog-error-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.tool-fine {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-steel);
}

.tool-results-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.tool-results-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: var(--kf-ink);
}

.tool-truncated {
  margin: 0;
  font-size: var(--kf-font-size-small);
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-manilaWord);
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tool-event {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: var(--kf-radius-card);
  border: 1px solid var(--kf-line);
  background: var(--kf-surface);
  cursor: pointer;
}

.tool-event.is-kept {
  border-color: var(--kf-skyEdge);
  background: var(--kf-blueTint);
}

.tool-event input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--kf-accent);
}

.tool-event-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tool-event-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--kf-ink);
}

.tool-event-when {
  font-size: 15px;
  font-weight: 600;
  color: var(--kf-slate);
}

.tool-event-where {
  font-size: var(--kf-font-size-small);
  font-weight: 600;
  color: var(--kf-steel);
}

.tool-conf {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tool-conf-high { background: var(--kf-successLight); color: var(--blog-success-word); }
.tool-conf-medium { background: var(--kf-manilaTint); color: var(--kf-manilaDeep); }
.tool-conf-low { background: var(--kf-errorLight); color: var(--blog-error-word); }

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: var(--kf-space-one);
}

/* ---- Below the tool ---- */

.tool-body {
  display: flex;
  flex-direction: column;
  gap: 44px;
  padding-top: 44px;
  padding-bottom: 60px;
}

.tool-section {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-three);
}

.tool-section h2 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--kf-ink);
}

.tool-section h3 {
  margin: 8px 0 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--kf-ink);
}

.tool-section p,
.tool-section li {
  margin: 0;
  max-width: 66ch;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--kf-slate);
}

.tool-section ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-two);
}

.tool-section li {
  font-size: var(--kf-font-size-body);
  line-height: 1.6;
}

.tool-example {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
}

.tool-example figure {
  margin: 0;
  flex: 0 1 300px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-two);
}

.tool-example img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--kf-mist);
  border-radius: 8px;
}

.tool-example figcaption {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-steel);
}

.tool-example-text {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-about {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 26px;
  align-items: flex-start;
}

.tool-about-text {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-others {
  flex: 0 1 250px;
  min-width: 210px;
  background: var(--kf-cloud);
  border: 1px solid var(--kf-line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-soon {
  font-size: var(--kf-font-size-body);
  font-weight: 700;
  color: var(--kf-slate);
}

.tool-other {
  font-size: var(--kf-font-size-body);
  font-weight: 700;
  color: var(--kf-ink);
  text-decoration: underline;
  text-decoration-color: var(--kf-accent);
  text-underline-offset: 3px;
}

.tool-soon em {
  display: block;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: var(--kf-steel);
}

.tool-section.faq details p {
  margin-top: 10px;
  font-size: var(--kf-font-size-body);
  line-height: 1.6;
}

.tool-section.faq {
  gap: 12px;
}

/* The end-of-page app card: after the tool, never before it. */
.tool-app {
  background: var(--kf-blueTint);
  border: 1px solid var(--kf-skyEdge);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  align-items: center;
}

.tool-app-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tool-app h2 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--kf-ink);
}

.tool-app p {
  margin: 0;
  font-size: var(--kf-font-size-body);
  font-weight: 600;
  line-height: 1.6;
  color: var(--kf-ink);
}

/* The app's one gradient (plan-gradient.tsx: 135deg, #163A73 0%, #2457A6
   60%, #2F8FEA 100%) with its blue glow under it (upgrade.tsx buttonGlow),
   as on the article end cards. */
.tool-app-button {
  align-self: flex-start;
  min-width: 220px;
  padding: 14px 18px;
  border-radius: var(--kf-radius);
  background: linear-gradient(135deg, #163A73 0%, #2457A6 60%, #2F8FEA 100%);
  box-shadow: 0 4px 12px rgba(88, 175, 255, 0.5);
  color: var(--kf-surface);
  font-size: var(--kf-font-size-body);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.tool-app-button:hover {
  background: linear-gradient(135deg, #163A73 0%, #2457A6 45%, #2F8FEA 100%);
  box-shadow: 0 6px 16px rgba(88, 175, 255, 0.6);
  color: var(--kf-surface);
}

.tool-app-button:focus-visible {
  outline: 3px solid var(--kf-accent);
  outline-offset: 3px;
}

.tool-app-art {
  width: 100%;
  max-width: 190px;
  height: auto;
  justify-self: center;
  /* The app's backpack glow (radial-glow.tsx): KidsFoldr Blue at the
     center, alpha 0.62 * (1 - d)^2.2, gone before the edge, in a box about
     twice the mark. The padding holds the glow; the negative margin keeps
     the layout the mark's own size. */
  padding: 50px;
  margin: -50px;
  box-sizing: content-box;
  background: radial-gradient(closest-side,
    rgba(88, 175, 255, 0.62) 0%,
    rgba(88, 175, 255, 0.33) 25%,
    rgba(88, 175, 255, 0.135) 50%,
    rgba(88, 175, 255, 0.03) 75%,
    rgba(88, 175, 255, 0) 100%);
}

/* On a phone the button spans the card, as on the article end cards. */
@media (max-width: 520px) {
  .tool-app-button {
    align-self: stretch;
  }
}

/* The human check (Cloudflare Turnstile) sits just above the run button. */
.tool-human:not(:empty) {
  margin: 12px 0 4px;
  min-height: 65px;
}

/* ---- .ics validator (/tools/ics-validator) ---- */

.tool-hero .pill {
  align-self: flex-start;
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ics-paste-label {
  font-size: var(--kf-font-size-small);
  font-weight: 700;
  color: var(--kf-steel);
}

.ics-paste {
  width: 100%;
  box-sizing: border-box;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: var(--kf-radius-card);
  border: 1px solid var(--kf-line);
  background: var(--kf-surface);
  color: var(--kf-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.ics-paste:focus {
  outline: 2px solid var(--kf-accent);
  outline-offset: 1px;
}

.ics-summary {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--kf-ink);
}

.ics-sub {
  margin: -8px 0 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-slate);
}

.ics-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ics-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ics-group h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--kf-ink);
}

.ics-finding {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px;
  border-radius: var(--kf-radius-card);
  border: 1px solid var(--kf-line);
  border-left-width: 4px;
  background: var(--kf-surface);
}

.ics-finding.ics-error { border-left-color: var(--blog-error-edge); }
.ics-finding.ics-warning { border-left-color: var(--kf-manilaEdge); }
.ics-finding.ics-info { border-left-color: var(--kf-skyEdge); }

.ics-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ics-chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ics-chip-error { background: var(--kf-errorLight); color: var(--blog-error-word); }
.ics-chip-warning { background: var(--kf-manilaTint); color: var(--kf-manilaDeep); }
.ics-chip-info { background: var(--kf-blueTint); color: var(--kf-ink); }
.ics-fix-fixed { background: var(--kf-successLight); color: var(--blog-success-word); }
.ics-fix-review { background: var(--kf-successLight); color: var(--blog-success-word); }
.ics-fix-no { background: var(--kf-ink); color: var(--kf-surface); }

.ics-line {
  font-size: 12px;
  font-weight: 700;
  color: var(--kf-steel);
}

.tool-card .ics-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--kf-ink);
}

.tool-card .ics-detail {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--kf-slate);
  overflow-wrap: anywhere;
}

.ics-apps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ics-apps li,
.tool-card .ics-rule {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-slate);
}

.ics-apps strong {
  color: var(--kf-ink);
}

.ics-apps a,
.ics-rule a {
  color: var(--kf-ink);
  text-decoration: underline;
  text-decoration-color: var(--kf-accent);
  text-underline-offset: 2px;
}

.ics-code {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: var(--kf-radius-card);
  border: 1px solid var(--kf-line);
  background: var(--kf-cloud);
  color: var(--kf-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

main[data-ics-validator] .tool-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

main[data-ics-validator] .tool-section ol {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-two);
}

main[data-ics-validator] .tool-section a {
  color: var(--kf-ink);
  text-decoration: underline;
  text-decoration-color: var(--kf-accent);
  text-underline-offset: 3px;
}

.ics-sources li {
  font-size: 15px;
}

/* Results scroll into view below the sticky header, not under it. */
.tool-results {
  scroll-margin-top: 96px;
}

/* On a phone the header wraps to two rows, so the results need more room. */
@media (max-width: 720px) {
  .tool-results {
    scroll-margin-top: 180px;
  }
}

/* A wide sample image (the .ics validator's annotated file) gets the full
   width, with the text below it, so its labels can be read. */
.tool-example-wide figure {
  flex: 1 1 100%;
}

/* ---- Handwritten list to digital list (/tools/handwritten-list-to-digital-list) ---- */

.list-title-label {
  font-size: var(--kf-font-size-small);
  font-weight: 700;
  color: var(--kf-steel);
  margin-bottom: -8px;
}

.list-title,
.list-item-text {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-family: var(--kf-font);
  color: var(--kf-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.list-title {
  padding: 8px 10px;
  font-size: 20px;
  font-weight: 800;
  background: var(--kf-cloud);
  border-color: var(--kf-line);
}

.list-title:focus,
.list-item-text:focus {
  outline: 2px solid var(--kf-accent);
  outline-offset: 1px;
  background: var(--kf-surface);
}

.list-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.list-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tool-card .list-group-name {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--kf-ink);
}

.list-group-count {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--kf-cloud);
  border: 1px solid var(--kf-line);
  font-size: 12px;
  font-weight: 700;
  color: var(--kf-steel);
}

.list-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 5px 8px 5px 12px;
  border-radius: var(--kf-radius-card);
  border: 1px solid var(--kf-line);
  background: var(--kf-surface);
}

.list-item.is-kept {
  border-color: var(--kf-skyEdge);
  background: var(--kf-blueTint);
}

.list-item input[type=checkbox] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin: 9px 0 0;
  accent-color: var(--kf-accent);
  cursor: pointer;
}

.list-item-text {
  flex: 1;
  display: block;
  padding: 7px 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
}

.list-item-text:hover {
  border-color: var(--kf-line);
}

.list-item:not(.is-kept) .list-item-text {
  color: var(--kf-steel);
  text-decoration: line-through;
}

.list-actions .tool-download,
.list-actions .tool-share {
  flex: 1 1 auto;
  padding: 12px 16px;
  font-size: var(--kf-font-size-body);
}

.list-actions .tool-download {
  flex-basis: 100%;
}

.list-status {
  margin: 0;
  min-height: 1.5em;
  font-size: 14px;
  font-weight: 700;
  color: var(--blog-success-word);
}

.list-howto {
  margin: 0;
  padding: 12px 14px 12px 32px;
  border-radius: var(--kf-radius-card);
  background: var(--kf-cloud);
  border: 1px solid var(--kf-line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-howto li {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--kf-slate);
}

.list-howto strong {
  color: var(--kf-ink);
}

main[data-kind="list"] .tool-section a {
  color: var(--kf-ink);
  text-decoration: underline;
  text-decoration-color: var(--kf-accent);
  text-underline-offset: 3px;
}

main[data-kind="list"] .tool-section ol {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-two);
}

/* "Try this list" under a worked example's photo. */
.tool-example figure .tool-try-sample {
  align-self: flex-start;
}

/* App screenshots on a tool page: phone-shaped, so capped and side by side. */
.tool-app-shots {
  margin: var(--kf-space-four, 24px) 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 250px));
  gap: 12px;
}

.tool-app-shots img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--kf-mist);
}

.tool-app-shots figcaption {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  color: var(--kf-steel);
}
