/*
 * Free tools (/tools/). Plain CSS like service-themes.css, so animations and
 * states that are toggled from JavaScript never depend on the Tailwind build.
 *
 * Palette matches the rest of the site:
 *   pine #08291f, deep #06271f, cream #fbf8ef, sage #a8bf7a, moss #5f7f4f
 * Status colours are tuned for 4.5:1 text contrast on white and cream.
 */

.tl {
  --tl-pine: #08291f;
  --tl-deep: #06271f;
  --tl-cream: #fbf8ef;
  --tl-paper: #f7f3e8;
  --tl-line: #e7dfd3;
  --tl-sage: #a8bf7a;
  --tl-moss: #5f7f4f;
  --tl-ink: #34433d;
  --tl-pass: #2f7d4f;
  --tl-warn: #8a5d00;
  --tl-fail: #b3261e;
  --tl-info: #50625a;
}

/* ---- hero ------------------------------------------------------------ */
.tl-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #06271f 0%, #063126 55%, #041d17 100%);
}
.tl-hero::before {
  /* faint contour lines, a nod to Maine topo maps */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background:
    radial-gradient(ellipse at 88% 30%, transparent 0 18%, rgba(168,191,122,.10) 18.3% 18.8%, transparent 19.1% 26%, rgba(168,191,122,.08) 26.3% 26.8%, transparent 27.1% 34%, rgba(168,191,122,.06) 34.3% 34.8%, transparent 35.1%);
}
.tl-hero > * { position: relative; z-index: 1; }

/* ---- focus & form controls ------------------------------------------ */
.tl :focus-visible {
  outline: 3px solid var(--tl-sage);
  outline-offset: 2px;
}
.tl-input {
  width: 100%;
  background: #fff;
  color: var(--tl-pine);
  border: 1px solid #cfc6b6;
  border-radius: 8px;
  padding: .85rem 1rem;
  font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tl-input:focus {
  outline: none;
  border-color: var(--tl-moss);
  box-shadow: 0 0 0 3px rgba(95,127,79,.25);
}
.tl-input[aria-invalid="true"] { border-color: var(--tl-fail); }
.tl-label { display: block; font-weight: 700; font-size: .9rem; color: var(--tl-pine); margin-bottom: .4rem; }
.tl-hint { font-size: .85rem; color: var(--tl-ink); margin-top: .35rem; }
.tl-error-text { color: var(--tl-fail); font-size: .875rem; font-weight: 600; margin-top: .35rem; }

.tl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: #0b3b2d;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .02em;
  border-radius: 8px;
  padding: .95rem 1.6rem;
  transition: background-color .15s ease;
  border: 0;
  cursor: pointer;
}
.tl-btn:hover { background: #14523f; }
.tl-btn:disabled { opacity: .6; cursor: wait; }
.tl-btn-sage { background: var(--tl-sage); color: var(--tl-deep); }
.tl-btn-sage:hover { background: #b9cd8f; }
.tl-btn-ghost { background: transparent; color: var(--tl-pine); border: 1px solid #cfc6b6; }
.tl-btn-ghost:hover { background: #fff; }

.tl-honeypot { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* The domain search bar in the hero */
.tl-search {
  display: flex;
  gap: .6rem;
  background: #fff;
  border-radius: 12px;
  padding: .5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.tl-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--tl-pine);
  font-size: 1.1rem;
  padding: .75rem .9rem;
}
.tl-search input:focus { outline: none; }
.tl-search:focus-within { box-shadow: 0 0 0 3px var(--tl-sage), 0 20px 50px rgba(0,0,0,.35); }
@media (max-width: 520px) {
  .tl-search { flex-direction: column; }
}

/* ---- loading: envelope inspection (email check) --------------------- */
.tl-scan {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (max-width: 720px) { .tl-scan { grid-template-columns: 1fr; justify-items: center; text-align: left; } }

.tl-envelope { width: 200px; height: 150px; }
.tl-envelope .env-body { fill: #fff; stroke: var(--tl-pine); stroke-width: 3; }
.tl-envelope .env-flap { fill: none; stroke: var(--tl-pine); stroke-width: 3; stroke-linejoin: round; }
.tl-envelope .env-lines rect { fill: #d9d0bf; }
.tl-envelope .env-beam {
  fill: url(#beamGradient);
  animation: tl-beam 1.6s ease-in-out infinite alternate;
}
.tl-envelope .env-lens { animation: tl-lens 3.2s ease-in-out infinite; transform-origin: 0 0; }
@keyframes tl-beam { from { transform: translateY(0); } to { transform: translateY(78px); } }
@keyframes tl-lens {
  0%   { transform: translate(40px, 40px); }
  25%  { transform: translate(120px, 50px); }
  50%  { transform: translate(140px, 95px); }
  75%  { transform: translate(60px, 100px); }
  100% { transform: translate(40px, 40px); }
}

.tl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.tl-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #8a958f;
  font-weight: 600;
  transition: color .3s ease;
}
.tl-step .dot {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  border-radius: 999px;
  border: 2px solid #cfc6b6;
  display: grid;
  place-items: center;
  font-size: .7rem;
  color: transparent;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.tl-step.is-active { color: var(--tl-pine); }
.tl-step.is-active .dot {
  border-color: var(--tl-moss);
  border-top-color: transparent;
  animation: tl-spin .8s linear infinite;
}
.tl-step.is-done { color: var(--tl-pine); }
.tl-step.is-done .dot { background: var(--tl-moss); border-color: var(--tl-moss); color: #fff; animation: none; }
@keyframes tl-spin { to { transform: rotate(360deg); } }

/* ---- result: postmark grade stamp ---------------------------------- */
.tl-stamp {
  width: 190px;
  height: 190px;
  flex: none;
  color: var(--stamp, var(--tl-pass));
}
.tl-stamp text { fill: currentColor; }
.tl-stamp .stamp-ring { fill: none; stroke: currentColor; }
.tl-stamp .stamp-wave { fill: none; stroke: currentColor; stroke-width: 2.5; opacity: .55; }
.tl-stamp-in { animation: tl-stamp 620ms cubic-bezier(.2,.9,.25,1.25) both; }
@keyframes tl-stamp {
  0%   { opacity: 0; transform: scale(1.7) rotate(-22deg); }
  60%  { opacity: 1; transform: scale(.94) rotate(-6deg); }
  100% { opacity: 1; transform: scale(1) rotate(-8deg); }
}
.tl-grade-A, .tl-grade-B { --stamp: var(--tl-pass); }
.tl-grade-C { --stamp: var(--tl-warn); }
.tl-grade-D, .tl-grade-F { --stamp: var(--tl-fail); }

.tl-tally { display: flex; flex-wrap: wrap; gap: .5rem; }
.tl-tally span {
  font-size: .85rem;
  font-weight: 700;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tl-line);
}

/* Finding cards */
.tl-finding {
  background: #fff;
  border: 1px solid var(--tl-line);
  border-left: 5px solid var(--tl-info);
  border-radius: 12px;
  padding: 1.35rem 1.5rem;
}
.tl-finding[data-status="pass"] { border-left-color: var(--tl-pass); }
.tl-finding[data-status="warn"] { border-left-color: #c8920c; }
.tl-finding[data-status="fail"] { border-left-color: var(--tl-fail); }
.tl-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 800;
  border-radius: 999px;
  padding: .2rem .65rem;
}
.tl-badge-pass { background: #e6f2ea; color: var(--tl-pass); }
.tl-badge-warn { background: #fbf0d6; color: var(--tl-warn); }
.tl-badge-fail { background: #fbe6e4; color: var(--tl-fail); }
.tl-badge-info { background: #edf0ee; color: var(--tl-info); }
.tl-record {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .8rem;
  background: var(--tl-paper);
  border-radius: 8px;
  padding: .6rem .75rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--tl-pine);
}
.tl-fix {
  background: var(--tl-cream);
  border-radius: 8px;
  padding: .75rem .9rem;
  color: var(--tl-pine);
}

/* ---- readiness questionnaire --------------------------------------- */
.tl-progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; }
.tl-progress > span { display: block; height: 100%; background: var(--tl-sage); border-radius: inherit; transition: width .35s ease; }
.tl-progress-light { background: #e2dacb; }
.tl-progress-light > span { background: var(--tl-moss); }

.tl-question {
  background: #fff;
  border: 1px solid var(--tl-line);
  border-radius: 14px;
  padding: 1.5rem;
}
.tl-question.is-missing { border-color: var(--tl-fail); box-shadow: 0 0 0 3px rgba(179,38,30,.12); }
/* Browsers draw <legend> on the fieldset's border by default. Floating it
   takes it out of that special rendering so it sits inside the card. */
.tl-question legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--tl-pine);
  line-height: 1.4;
}
.tl-question legend + * { clear: both; }
.tl-options { display: grid; gap: .5rem; margin-top: 1.1rem; }
@media (min-width: 640px) {
  .tl-options { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  /* Questions with long answer labels read better as a list. */
  .tl-options.is-stacked { grid-template-columns: 1fr; max-width: 34rem; }
}
.tl-option { position: relative; }
.tl-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tl-option span {
  display: flex;
  align-items: center;
  gap: .6rem;
  height: 100%;
  border: 1.5px solid #d8cfbf;
  border-radius: 10px;
  padding: .75rem .9rem;
  font-weight: 600;
  color: var(--tl-pine);
  background: var(--tl-cream);
  transition: border-color .15s ease, background-color .15s ease;
}
.tl-option span::before {
  content: "";
  width: 1rem;
  height: 1rem;
  flex: none;
  border-radius: 999px;
  border: 2px solid #a89f8f;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tl-option input:hover + span { border-color: var(--tl-moss); }
.tl-option input:checked + span { border-color: var(--tl-moss); background: #eef3e6; }
.tl-option input:checked + span::before { border-color: var(--tl-moss); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 10px var(--tl-moss); }
.tl-option input:focus-visible + span { outline: 3px solid var(--tl-sage); outline-offset: 2px; }

.tl-details summary { cursor: pointer; color: var(--tl-moss); font-weight: 700; font-size: .9rem; list-style: none; }
.tl-details summary::-webkit-details-marker { display: none; }

.tl-section-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.tl-section-tab {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .85rem; font-weight: 700;
  border-radius: 999px; padding: .4rem .85rem;
  background: rgba(255,255,255,.08); color: #c9d3ce;
  border: 1px solid rgba(255,255,255,.12);
}
.tl-section-tab.is-current { background: var(--tl-sage); color: var(--tl-deep); border-color: var(--tl-sage); }
.tl-section-tab.is-done { color: #fff; }

/* ---- loading: policy review overlay (readiness) -------------------- */
.tl-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(4,29,23,.88);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 1.5rem;
}
.tl-policy { width: 150px; height: 190px; }
.tl-policy .sheet { fill: var(--tl-cream); }
.tl-policy .policy-line { fill: #d9d0bf; }
.tl-policy .tick {
  fill: none; stroke: var(--tl-moss); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: tl-tick 2.4s ease-in-out infinite;
}
.tl-policy .tick:nth-of-type(2) { animation-delay: .4s; }
.tl-policy .tick:nth-of-type(3) { animation-delay: .8s; }
.tl-policy .tick:nth-of-type(4) { animation-delay: 1.2s; }
@keyframes tl-tick {
  0%, 10% { stroke-dashoffset: 30; }
  35%, 80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 30; }
}

/* ---- result: shield gauge (readiness) ------------------------------ */
.tl-shield { width: 210px; height: 240px; }
.tl-shield .shield-edge { fill: none; stroke: rgba(255,255,255,.25); stroke-width: 4; }
.tl-shield .fill-rect { transition: none; }
.tl-shield-fill { animation: tl-fill 1.4s cubic-bezier(.25,.8,.25,1) .2s both; }
@keyframes tl-fill { from { transform: translateY(var(--tl-fill-from, 230px)); } to { transform: translateY(var(--tl-fill-to, 0)); } }
.tl-band-strong   { --band: #a8d5a2; }
.tl-band-gaps     { --band: #e6c46b; }
.tl-band-struggle { --band: #eda46b; }
.tl-band-risk     { --band: #f08a80; }

/* Area scores: bars line up even when a title wraps to two lines. */
.tl-area { display: flex; flex-direction: column; height: 100%; }
.tl-area-title { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; font-size: .875rem; font-weight: 700; margin-bottom: .6rem; }
.tl-area .tl-meter { margin-top: auto; }
.tl-meter { height: 10px; border-radius: 999px; background: #e2dacb; overflow: hidden; }
.tl-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--tl-moss); }

.tl-gap {
  background: #fff;
  border: 1px solid var(--tl-line);
  border-radius: 12px;
  padding: 1.35rem 1.5rem;
}
.tl-gap[data-level="critical"] { border-left: 5px solid var(--tl-fail); }
.tl-gap[data-level="important"] { border-left: 5px solid #c8920c; }
.tl-gap[data-level="good"] { border-left: 5px solid var(--tl-info); }

/* ---- tools hub ----------------------------------------------------- */
.tl-tool-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  border: 1px solid var(--tl-line);
  border-radius: 16px;
  padding: 2rem;
  color: var(--tl-pine);
  transition: border-color .2s ease, box-shadow .2s ease;
}
a.tl-tool-card:hover { border-color: var(--tl-moss); box-shadow: 0 14px 30px rgba(8,41,31,.10); }
.tl-tool-card .tl-tool-icon {
  width: 3.25rem; height: 3.25rem;
  display: grid; place-items: center;
  border-radius: 12px;
  background: #eef3e6;
  color: var(--tl-moss);
  font-size: 1.4rem;
}
.tl-tool-card.is-soon { background: transparent; border-style: dashed; }

/* ---- callout used on service pages ---------------------------------- */
.tl-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--tl-line);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
}

@media (prefers-reduced-motion: reduce) {
  .tl *, .tl *::before, .tl *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .tl-envelope .env-beam, .tl-envelope .env-lens { animation: none; }
}

[x-cloak] { display: none !important; }

/* ---- security policy builder --------------------------------------- */
.tl-option-check span::before { border-radius: 4px; }
.tl-option-check input:checked + span::before {
  border-color: var(--tl-moss);
  background: var(--tl-moss);
  box-shadow: inset 0 0 0 3px #fff;
}
.tl-plan-num {
  flex: none;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 999px;
  background: #eef3e6;
  color: var(--tl-moss);
  font-weight: 800;
  font-size: .9rem;
}

/* The plan document itself (preview sample and the full printable plan) */
.wisp-doc { color: #1e2d28; font-family: Inter, sans-serif; line-height: 1.65; }
.wisp-doc h1, .wisp-doc h2 { font-family: 'Playfair Display', serif; color: #08291f; line-height: 1.2; }
.wisp-doc h2 { font-size: 1.6rem; font-weight: 800; margin: 0 0 1rem; }
.wisp-doc h2 span { color: #5f7f4f; }
.wisp-doc p { margin: 0 0 1rem; }
.wisp-doc ul, .wisp-doc ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.wisp-doc ul { list-style: disc; }
.wisp-doc ol { list-style: decimal; }
.wisp-doc li { margin: 0 0 .5rem; }
.wisp-doc em { color: #8a5d00; font-style: normal; font-weight: 600; }
.wisp-sign { margin-top: 1.5rem; border-collapse: collapse; }
.wisp-sign td { padding: .45rem 1.5rem .45rem 0; }

.wisp-sample { position: relative; max-height: 34rem; overflow: hidden; }
.wisp-fade { height: 5rem; margin-top: -5rem; position: relative; background: linear-gradient(to bottom, rgba(255,255,255,0), #fff); }

.wisp-page { margin: 0; background: #f7f3e8; }
.wisp-page .wisp-doc { max-width: 52rem; margin: 2rem auto; background: #fff; padding: 3.5rem 4rem; border: 1px solid #e7dfd3; border-radius: 12px; }
@media (max-width: 720px) { .wisp-page .wisp-doc { padding: 2rem 1.25rem; margin: 0; border-radius: 0; } }
.wisp-toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: #08291f; font-family: Inter, sans-serif; }
.wisp-toolbar a { color: #d9e2dc; font-weight: 600; text-decoration: none; }
.wisp-toolbar button { background: #a8bf7a; color: #06271f; font-weight: 700; border: 0; border-radius: 8px; padding: .6rem 1.1rem; cursor: pointer; }
.wisp-cover { border-bottom: 3px solid #08291f; padding-bottom: 2rem; margin-bottom: 2rem; }
.wisp-kicker { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; font-size: .8rem; color: #5f7f4f; }
.wisp-cover h1 { font-size: 2.6rem; font-weight: 800; margin: .3rem 0 1.5rem; }
.wisp-cover dl { display: grid; grid-template-columns: 11rem 1fr; gap: .35rem 1rem; margin: 0 0 1.25rem; }
.wisp-cover dt { font-weight: 700; }
.wisp-cover dd { margin: 0; }
.wisp-note { font-size: .85rem; color: #50625a; }
.wisp-toc { margin-bottom: 2.5rem; }
.wisp-toc a { color: #0b3b2d; }
.wisp-section { padding-top: 1.75rem; margin-top: 1.75rem; border-top: 1px solid #e7dfd3; break-inside: avoid-page; }
.wisp-actions { width: 100%; border-collapse: collapse; font-size: .9rem; }
.wisp-actions th, .wisp-actions td { border: 1px solid #d8cfbf; padding: .6rem .7rem; text-align: left; vertical-align: top; }
.wisp-actions th { background: #f7f3e8; }
.wisp-actions td span { color: #50625a; }
.wisp-actions td:nth-child(2) { width: 9rem; }
.wisp-actions td:nth-child(3) { width: 7rem; }
.wisp-actions td:nth-child(4) { width: 3.5rem; }

@media print {
  .wisp-toolbar { display: none; }
  .wisp-page { background: #fff; }
  .wisp-page .wisp-doc { margin: 0; padding: 0; border: 0; max-width: none; }
  .wisp-toc { break-after: page; }
  .wisp-doc a { color: inherit; text-decoration: none; }
  @page { margin: 2cm; }
}
