/* =====================================================================
   Converter — premium layer
   Scoped additions on top of style.css. Nothing here overrides global
   rules outside .cvt-* / #converter-* — safe to load only on this page.
   Reuses the site's existing tokens (--ink, --line, --line-2, --muted)
   and its Apple-style ease curve (cubic-bezier(0.16, 1, 0.3, 1)).
   ===================================================================== */

:root {
  --cvt-accent: #3b82f6;
  --cvt-accent-2: #8b5cf6;
  --cvt-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cvt-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Hero polish ---------- */
.tool-hero .docs-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tool-hero .docs-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cvt-accent), var(--cvt-accent-2));
}
.tool-hero h1 {
  background: linear-gradient(180deg, #18181b 0%, #3f3f46 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Card shell + ambient glow ---------- */
.cvt-card-wrap {
  position: relative;
  isolation: isolate;
  animation: cvtRise 0.8s var(--cvt-ease) both;
}
.cvt-card-wrap::before {
  content: "";
  position: absolute;
  inset: -60px -30px;
  z-index: -1;
  background: radial-gradient(
      60% 60% at 22% 0%,
      color-mix(in srgb, var(--cvt-accent) 22%, transparent),
      transparent 70%
    ),
    radial-gradient(
      50% 50% at 100% 30%,
      color-mix(in srgb, var(--cvt-accent-2) 16%, transparent),
      transparent 70%
    );
  filter: blur(50px);
  opacity: 0.6;
  transition: filter 0.6s var(--cvt-ease);
  pointer-events: none;
}

.tool-card.cvt-card {
  position: relative;
  border-radius: 24px;
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 1px rgba(9, 9, 11, 0.04),
    0 10px 24px -14px rgba(9, 9, 11, 0.14),
    0 32px 64px -32px color-mix(in srgb, var(--cvt-accent) 25%, transparent);
  transition: box-shadow 0.5s var(--cvt-ease), transform 0.5s var(--cvt-ease);
}

/* ---------- Input row → unified pill ---------- */
.cvt-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 16px;
  background: #fafafa;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: box-shadow 0.25s var(--cvt-ease), background 0.25s var(--cvt-ease);
}
.cvt-input-row:focus-within {
  background: #fff;
  box-shadow:
    inset 0 0 0 1.5px var(--ink),
    0 0 0 5px color-mix(in srgb, var(--cvt-accent) 14%, transparent);
}

#converter-picker.cvt-swatch-btn {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  box-shadow:
    0 0 0 1px var(--line-2),
    0 3px 8px -3px rgba(9, 9, 11, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.5) !important;
  transition: transform 0.2s var(--cvt-ease-spring);
}
#converter-picker.cvt-swatch-btn:hover {
  transform: scale(1.06) rotate(-2deg);
}
#converter-picker.cvt-swatch-btn::-webkit-color-swatch-wrapper {
  padding: 3px;
}
#converter-picker.cvt-swatch-btn::-webkit-color-swatch {
  border: none;
  border-radius: 9px;
}

#converter-input.cvt-input {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 10px 6px;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}
#converter-input.cvt-input:focus {
  box-shadow: none;
  background: transparent;
}
#converter-input.cvt-input.is-invalid {
  box-shadow: none;
  color: #ef4444;
}

#converter-error {
  padding-left: 4px;
}

/* ---------- Preview panel: glassy "product shot" ---------- */
.converter-preview.cvt-preview {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(9, 9, 11, 0.06),
    inset 0 1px 12px rgba(255, 255, 255, 0.25),
    0 20px 40px -24px rgba(9, 9, 11, 0.35);
  transition: background 0.5s var(--cvt-ease);
}
.converter-preview.cvt-preview::before {
  /* soft glossy sheen, top-left to bottom-right */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    rgba(255, 255, 255, 0) 55%
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}
.converter-preview.cvt-preview::after {
  /* grounded reflection fade at the base, like a product render */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.16),
    rgba(0, 0, 0, 0)
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
  pointer-events: none;
}

.cvt-preview-label {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(16, 16, 18, 0.4);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  color: #fff;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.cvt-preview-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

/* ---------- Format rows ---------- */
.format-grid.cvt-grid {
  gap: 10px;
}
.format-row.cvt-row {
  position: relative;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-2);
  padding: 13px 14px 13px 18px;
  overflow: hidden;
  transition:
    transform 0.25s var(--cvt-ease),
    box-shadow 0.25s var(--cvt-ease),
    background 0.25s var(--cvt-ease);
}
.format-row.cvt-row::before {
  /* accent rail on the left, revealed on hover */
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--cvt-accent), var(--cvt-accent-2));
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.3s var(--cvt-ease);
}
.format-row.cvt-row:hover {
  transform: translateY(-2px);
  background: #fdfdfd;
  box-shadow:
    0 0 0 1px var(--line-2),
    0 10px 20px -12px rgba(9, 9, 11, 0.16);
}
.format-row.cvt-row:hover::before {
  transform: scaleY(1);
}

.format-row-value.cvt-value {
  font-size: 14px;
  letter-spacing: 0.01em;
  font-weight: 500;
}

/* copy button → morphs into a check on success, no extra markup needed */
.format-copy.cvt-copy {
  position: relative;
  border-radius: 999px;
  transition:
    background 0.2s var(--cvt-ease),
    color 0.2s var(--cvt-ease),
    transform 0.15s var(--cvt-ease-spring);
}
.format-copy.cvt-copy:hover {
  background: var(--ink);
  color: #fff;
  transform: scale(1.06);
}
.format-copy.cvt-copy:active {
  transform: scale(0.92);
}
.format-copy.cvt-copy svg {
  transition: opacity 0.15s var(--cvt-ease), transform 0.2s var(--cvt-ease-spring);
}
.format-copy.cvt-copy.is-copied {
  background: #10b981;
  color: #fff;
}
.format-copy.cvt-copy.is-copied svg {
  opacity: 0;
  transform: scale(0.5);
}
.format-copy.cvt-copy.is-copied::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 7px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  animation: cvtCheckIn 0.35s var(--cvt-ease-spring) 0.05s forwards;
}
.format-copy.cvt-copy::before {
  /* soft success ripple */
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  background: #10b981;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}
.format-copy.cvt-copy.is-copied::before {
  animation: cvtRipple 0.6s var(--cvt-ease) forwards;
}

/* CMYK: quiet "detail" treatment since it spans full width */
#row-cmyk.cvt-row {
  background: #fafafa;
}
#row-cmyk.cvt-row:hover {
  background: #f5f5f6;
}

/* ---------- Keyframes ---------- */
@keyframes cvtRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes cvtCheckIn {
  to {
    transform: translateY(-1px) rotate(-45deg) scale(1);
  }
}
@keyframes cvtRipple {
  from {
    opacity: 0.35;
    transform: scale(0.6);
  }
  to {
    opacity: 0;
    transform: scale(1.4);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cvt-card-wrap,
  .format-row.cvt-row,
  .format-copy.cvt-copy,
  #converter-picker.cvt-swatch-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .cvt-card-wrap::before {
    filter: blur(30px);
    opacity: 0.4;
  }
  .converter-preview.cvt-preview {
    min-height: 160px;
  }
}