/* 
ThreadOS Stylesheet
Author: Paige Spry 

Palette
- App Background (Midnight): #0B0F14 - Updated to #FFF
- Card Surface (Slate):      #141A22
- Primary (Electric Cyan):   #00BBE8
- Hover/Active (Light Cyan): #87D3E6
- Focus/Tint (Ice):          #DFF2F5
*/

/* Base */
body {
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  color: #dff2f5;
  background: #fff;
  margin: 0;
}

/* Optional alt font helpers */
.nunito {
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 500;
}
.light {
  font-weight: 200;
}

/* Layout */
.wrap {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 16px;
}
.row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin: 10px 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Card */
.card {
  background: #141a22;
  border: 1px solid #1f2933;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.table th,
.table td {
  border-bottom: 1px solid #1f2933;
  padding: 6px;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.table th:first-child {
  width: 70%;
} /* host column wider */

/* Header */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap; /* allow wrapping when narrow */
}

/* Beta Tag */
.badge-beta {
  display: inline-block;
  padding: 2px 6px;
  font: 600 10px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.5px;
  border-radius: 999px;
  background: #00bbe8;
  color: #0b0f14;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* Brand lockup */
.brand {
  display: flex;
  align-items: center;
  gap: 0;
}
.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}
.brand-name {
  margin: 0;
  font-size: 30px;
}
a.branding,
a.piper {
  color: #dff2f5;
  text-decoration: none;
}

/* Text bits */
.header {
  margin: 15px 0 10px;
}
.subheader {
  margin: 5px 0 10px;
}
.label {
  font-weight: 600;
}
small {
  color: #00bbe8;
  font-size: 12px;
}
pre {
  background: #ecebe1;
  color: #0f1115;
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  vertical-align: middle;
  margin-right: 8px;
}
.tag--urgent {
  background: #c62828;
  color: #dff2f5;
}
.tag--medium {
  background: #ef6c00;
  color: #dff2f5;
}
.tag--low {
  background: #fdd835;
  color: #111;
}

/* Buttons */
button {
  background: #00bbe8;
  color: #0b0f14;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* Report CTA */
.share-cta {
  text-align: center;
  margin: 5% 0 32px;
}
.btn-lg {
  padding: 16px 24px;
  font-size: 1.125rem;
  border-radius: 16px;
}
.helper {
  margin: 10px 0 5%;
  font-size: 12px;
  color: #dff2f5;
}

/* Icons */
.icon {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  margin-right: 6px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.loading__text {
  font-weight: 200;
  font-size: 12px;
  font-family: "Fira Code" !important;
  opacity: 0.5;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: #00bbe8;
  animation: spin 0.8s linear infinite;
}
.dots {
  display: inline-block;
  margin-left: 2px;
}
.dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 3px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.4;
  transform: scale(0.4);
  animation: bounce 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.4);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .dots span {
    animation: none;
  }
}

/* Circular score ring */
.tech__center .score-ring__value {
  font-size: 32px; /* big and bold */
  font-weight: 800;
  line-height: 1;
  color: inherit;
}

/* let glows show past the content box */
.card.tech {
  overflow: visible;
}

/* add a bit of inner room around the big ring only */
.tech__center {
  padding: 8px;
}
.tech__center .score-ring {
  margin: 10px;
}

/* tuck the aura slightly so it stays inside the card radius */
.tech__center .score-ring.is-excellent::after {
  inset: -10px;
} /* was -14px */

/* Ensure mini/side rings stay normal size */
.tech__score--mini .score-ring__value {
  font-size: 22px;
}
.score-ring {
  position: relative;
  display: inline-block;
  overflow: visible;
  width: 84px !important;
  height: 84px !important;
}
.score-ring svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}
.score-ring__bg {
  opacity: 0.16;
}
.score-ring__track {
  opacity: 0.25;
}
/* faint ring */
.score-ring__progress {
  transition: stroke-dasharray 0.8s ease;
}
.score-ring__value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Score Ring: Blue (Excellent) glow & pulse --- */
:root {
  --score-blue-primary: #00bbe8; /* Electric Cyan */
  --score-blue-hover: #87d3e6; /* Light Cyan */
}

/* 1) Failsafe pulse: throb the stroke width itself */
.score-ring.is-excellent .score-ring__progress {
  animation: ringThrob 1.6s ease-in-out infinite;
}

/* 2) Visible glow using SVG drop-shadow (sits on top of the stroke) */
.score-ring.is-excellent svg {
  filter: drop-shadow(0 0 6px rgba(0, 187, 232, 0.85))
    drop-shadow(0 0 18px rgba(135, 211, 230, 0.65));
  animation: glowBreathe 2.2s ease-in-out infinite;
}
/* inline animation relies on these keyframes */
@keyframes ringThrob {
  0%,
  100% {
    stroke-width: 6px;
    opacity: 1;
  }
  50% {
    stroke-width: 8px;
    opacity: 0.95;
  }
}

/* 2) Softer glow using SVG drop-shadow (no hard neon) */
.score-ring.is-excellent svg {
  /* subtler base glow */
  filter: drop-shadow(0 0 6px rgba(0, 187, 232, 0.6))
    drop-shadow(0 0 16px rgba(135, 211, 230, 0.35));
  /* match the JS inline animation name */
  animation: glowBreatheSoft 2.2s ease-in-out infinite;
}

/* Gentle breathing glow */
@keyframes glowBreatheSoft {
  0%,
  100% {
    filter: drop-shadow(0 0 6px rgba(0, 187, 232, 0.6))
      drop-shadow(0 0 16px rgba(135, 211, 230, 0.35));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 9px rgba(0, 187, 232, 0.72))
      drop-shadow(0 0 22px rgba(135, 211, 230, 0.5));
    transform: scale(1.01);
  }
}

/* helpful so glow isn't clipped */
.score-ring {
  overflow: visible;
}
.score-ring svg {
  position: relative;
  z-index: 1;
}

/* Soft pulsing cyan aura only on large (center) score ring */
.tech__center .score-ring.is-excellent::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(0, 187, 232, 0.35),
    rgba(135, 211, 230, 0.1) 70%,
    rgba(0, 187, 232, 0) 90%
  );
  filter: blur(3px);
  animation: scorePulseCyan 1.8s ease-in-out infinite;
  pointer-events: none;
}

/* Reduce Motion preference */
@media (prefers-reduced-motion: reduce) {
  .tech__center .score-ring.is-excellent::after {
    animation: none;
  }
}

/* Keyframes for smooth pulsing cyan halo */
@keyframes scorePulseCyan {
  0% {
    transform: scale(0.97);
    opacity: 0.7;
    box-shadow: 0 0 12px 3px rgba(0, 187, 232, 0.8),
      0 0 30px 8px rgba(135, 211, 230, 0.6);
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
    box-shadow: 0 0 18px 5px rgba(0, 187, 232, 0.95),
      0 0 40px 12px rgba(135, 211, 230, 0.8);
  }
  100% {
    transform: scale(0.97);
    opacity: 0.7;
    box-shadow: 0 0 12px 3px rgba(0, 187, 232, 0.8),
      0 0 30px 8px rgba(135, 211, 230, 0.6);
  }
}

/* Optional: ensure the SVG stroke uses your cyan palette too */
.score-ring.is-excellent .score-ring__track,
.score-ring.is-excellent .score-ring__progress {
  stroke: var(--score-blue-primary) !important;
}
.score-ring.is-excellent .score-ring__value {
  color: var(--score-blue-hover) !important;
}

/* --- Tech Card (Option C + centered header) --- */
.card.tech {
  position: relative;
  border-radius: 16px;
  background: #0f141a;
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 26px rgba(0, 0, 0, 0.35);
}
/* subtle neon perimeter */
.card.tech::after {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: 17px;
  pointer-events: none;
  background: radial-gradient(
      60% 60% at 20% 0%,
      rgba(18, 188, 230, 0.25),
      transparent 60%
    ),
    radial-gradient(
      60% 60% at 100% 20%,
      rgba(18, 188, 230, 0.15),
      transparent 70%
    );
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask: linear-gradient(#000, #000) content-box,
    linear-gradient(#000, #000);
}

/* Header layout: spacer | centered score | URL */
.tech__head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 24px;
  margin-bottom: 12px;
}
.tech__center {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.tech__score-label {
  margin-top: 12px;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.tech__score-help {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.8;
  max-width: 400px;
}

.tech__right {
  justify-self: end;
  text-align: right;
}
.tech__url-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 0px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tech__url {
  color: #cfe6f5;
  font-weight: 500;
  word-break: break-word;
  text-decoration: none;
  font-size: 12px;
  opacity: 0.8;
}
.tech__url:hover {
  text-decoration: underline;
}

/* Full-width actions list */
.tech__list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 400;
}
.tech__list li {
  display: block;
  padding: 6px 0;
  margin-top: 10px;
  border-top: 1px solid rgba(207, 230, 245, 0.08);
}
.tech__list li:first-child {
  border-top: none;
}

/* Sub cards (pillars) */
.tech--sub .tech__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tech__score--mini {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Card header grid: title on left, ring on right */
.tech.tech--sub .tech__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

/* Mini score ring alignment */
.tech__score--mini .score-ring {
  width: 64px;
  height: 64px;
}

/* Findings list: full-width rows with steady rhythm */
.tech__list.tech__list--full {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.tech__list.tech__list--full .tech__li {
  display: flex;
  align-items: flex-start; /* good for multi-line */
  gap: 10px;
  padding: 6px 0px 0px 0;
  border-top: 1px solid rgba(207, 230, 245, 0.08);
  overflow-wrap: anywhere;
}
.tech__list.tech__list--full .tech__li:first-child {
  border-top: 0;
}
.tech__list.tech__list--full .tech__li:hover {
  background: rgba(207, 230, 245, 0.03); /* subtle interactive feel */
  border-radius: 8px;
}

/* Icon column: fixed width so multi-line text stays aligned */
.tech__li .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 2px; /* optically center vs text cap-height */
  vertical-align: middle;
}

/* Section divider (between findings/fixes) a bit softer */
.card.tech .section-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(207, 230, 245, 0.08),
    transparent
  );
  margin: 14px 0;
}

/* Title weight & spacing */
.tech.tech--sub .tech__title {
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
}

/* “Recommended fixes” block spacing */
.tech .fixes-block .label {
  display: block;
  margin: 8px 0 6px;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.tech .fixes-block .tech__list {
  margin-top: 2px;
}

/* Reduce divider contrast in dark */
.card.tech {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 10px 26px rgba(0, 0, 0, 0.35);
}

/* allow long URLs to wrap inside tables/blocks */
.break {
  overflow-wrap: anywhere; /* modern */
  word-break: break-word; /* Safari fallback */
}

/* Recommended Fixes Panel */
.fixes.label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "Fira Code";
}

/* Deep Scan panel */
.scan-panel {
  margin-top: 12px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(10, 18, 26, 0.55);
  border: 1px solid rgba(79, 208, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(79, 208, 255, 0.08) inset,
    0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}
.scan-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ed8f4;
  margin-bottom: 8px;
}
.scan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.input-wrap {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #8ec9f3;
  opacity: 0.9;
}
.scan-input {
  width: 96%;
  height: 48px;
  padding: 0 0 0 40px;
  border-radius: 12px;
  border: 1px solid rgba(143, 211, 252, 0.25);
  background: #fff;
  color: #23262d;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.scan-input::placeholder {
  color: rgba(35, 38, 45, 0.55);
}
.scan-input:focus {
  border-color: #19c2f0;
  box-shadow: 0 0 0 3px rgba(25, 194, 240, 0.2);
}

/* Toggle */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(143, 211, 252, 0.25);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e6f7ff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: left 0.18s ease;
}
.switch input:checked + .switch-ui {
  background: rgba(25, 194, 240, 0.25);
  border-color: rgba(25, 194, 240, 0.65);
}
.switch input:checked + .switch-ui::after {
  left: 20px;
}
.switch-text {
  color: #dff2f5;
  font-weight: 500;
}

/* Big CTA */
.btn-primary.btn-xl {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  color: #00121a;
  background: linear-gradient(90deg, #14bce5, #19c2f0 60%, #2ad7ff);
  border: 1px solid rgba(31, 217, 255, 0.45);
  box-shadow: 0 10px 24px rgba(26, 205, 255, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  font-weight: 800;
  font-size: 18px;
  transition: transform 0.06s ease, filter 0.2s ease;
  margin-top: 20px;
}
.btn-primary.btn-xl:hover {
  filter: brightness(1.08);
}
.btn-primary.btn-xl:active {
  transform: translateY(1px);
}
.btn-icon {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .tech__head {
    grid-template-columns: 1fr;
  }
  .tech__right {
    justify-self: start;
    text-align: left;
    margin-top: 12px;
  }
}
@media (max-width: 640px) {
  .header-bar {
    flex-direction: column; /* stack vertically */
    align-items: flex-start; /* left-align the column */
    gap: 12px;
  }
  .header-bar .brand {
    width: 100%; /* logo/title take full row */
  }
  .header-bar .piper {
    width: 100%; /* powered-by on its own row */
    text-align: right; /* or left/center as you prefer */
  }
  .piper-header {
    font-size: 10px;
  }
  .piper-img {
    width: 50px;
  }
  .scan-row {
    grid-template-columns: 1fr; /* one column */
  }
  .input-wrap {
    width: 100%;
  }
  .scan-input {
    width: 85%;
  }
  .switch {
    justify-self: start; /* left align under input */
    margin-top: 8px;
  }
  .btn-primary.btn-xl {
    margin-top: 16px; /* keep nice spacing before the button */
  }
  .tech__score-help {
    max-width: 260px;
  }
}
