/* ============================================================
   BareTools Frontend Refine — v1
   Overlay layer that refines existing frontend styles while
   preserving all functionality, i18n, routing, and theme logic.
   Loaded AFTER redesign.css / styles.css
   ============================================================ */

/* ===== Utility baseline overrides ===== */

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 16px;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Headings: display font, balanced, tight leading */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
h6 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

p {
  margin: 0;
  line-height: var(--lh-relaxed);
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
}

/* ===== Global focus-visible ring ===== */

:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove default outlines where misaligned, but only if we provide :focus-visible */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* ===== Skip link ===== */

.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-md);
  transition: top var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
  outline: none;
}

/* ===== Buttons: refine with explicit transitions + 8 states ===== */

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-signup,
.btn-nav-ghost {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-signup:active,
.btn-nav-ghost:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — solid accent */
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-on-accent);
}
.btn-primary:active {
  box-shadow: var(--shadow-xs);
}

/* Secondary — outline */
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--grey-400);
  color: var(--text);
}

/* Ghost — text-only / icon-only buttons */
.btn-ghost,
.btn-nav-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover,
.btn-nav-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Sign up CTA in nav */
.btn-signup {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--fs-sm);
}
.btn-signup:hover {
  background: var(--grey-700);
  border-color: var(--grey-700);
}
[data-theme="dark"] .btn-signup {
  background: var(--grey-100);
  color: var(--grey-900);
  border-color: var(--grey-100);
}
[data-theme="dark"] .btn-signup:hover {
  background: #ffffff;
  border-color: #ffffff;
}

/* Small buttons */
.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-6);
  font-size: var(--fs-base);
  border-radius: var(--radius);
}

/* ===== Icon buttons (nav, actions) ===== */

.nav-icon-btn,
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.nav-icon-btn svg,
.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

.nav-icon-btn:hover,
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-icon-btn:active,
.icon-btn:active {
  transform: scale(0.95);
}

/* ===== Navigation bar ===== */

.nav-bar {
  height: var(--nav-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.nav-bar.scrolled {
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}

/* Remove gradient text on brand — solid color */
.brand-text-ai,
.brand-text-depot {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: var(--text);
}

.brand-text-ai {
  font-weight: var(--fw-bold);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
}

.nav-link {
  height: 36px;
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--text);
  background: var(--bg-secondary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.auth-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

/* ===== Splash / Onboarding page ===== */

.splash-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--container-pad);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.splash-logo {
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-6);
  opacity: 0;
  transform: scale(0.96);
  animation: splash-in var(--duration-slow) var(--ease-out) 0.05s forwards;
}

.splash-title {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 var(--space-4);
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  animation: splash-in-up var(--duration-slow) var(--ease-out) 0.12s forwards;
}

.splash-title-ai,
.splash-title-depot {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: var(--text);
}

.splash-divider {
  width: 48px;
  height: 2px;
  background: var(--border-strong);
  border-radius: 1px;
  margin: var(--space-4) 0 var(--space-6);
  opacity: 0;
  animation: splash-in var(--duration-slow) var(--ease-out) 0.2s forwards;
}

.splash-lines {
  text-align: center;
  max-width: 420px;
  opacity: 0;
  transform: translateY(8px);
  animation: splash-in-up var(--duration-slow) var(--ease-out) 0.25s forwards;
}

.splash-line-1 {
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-2);
}

.splash-line-2 {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  line-height: var(--lh-relaxed);
}

.splash-enter-btn {
  margin-top: var(--space-10);
  opacity: 0;
  transform: translateY(8px);
  animation: splash-in-up var(--duration-slow) var(--ease-out) 0.35s forwards;
}

@keyframes splash-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes splash-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Tooltip ===== */

.tooltip,
[data-tooltip] {
  position: relative;
}

/* Clean, simple tooltip — no glassmorphism */
.tooltip::after,
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  padding: 6px 10px;
  background: var(--grey-800);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-tooltip);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .tooltip::after,
[data-theme="dark"] [data-tooltip]::after {
  background: var(--grey-700);
}

@media (hover: hover) and (pointer: fine) {
  .tooltip:hover::after,
  [data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

/* ===== Cards — remove ghost-card pattern ===== */

/* Base card: border only, no heavy shadow */
.card,
.tool-card,
.resource-card,
.article-card,
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  transition:
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    background-color var(--duration-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tool-card:hover,
  .resource-card:hover,
  .article-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

/* ===== Badges / tags ===== */

.badge,
.tag,
.tool-badge,
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.badge-primary,
.tag-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.badge-success {
  background: color-mix(in oklch, var(--success) 12%, transparent);
  color: var(--success);
  border-color: transparent;
}

.badge-warning {
  background: color-mix(in oklch, var(--warning) 15%, transparent);
  color: var(--warning);
  border-color: transparent;
}

.badge-danger {
  background: color-mix(in oklch, var(--danger) 12%, transparent);
  color: var(--danger);
  border-color: transparent;
}

/* ===== Alerts — remove side-stripe, use full border + subtle bg ===== */

.alert,
.callout,
.notice {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  border-left: none;
}

.alert-info {
  background: color-mix(in oklch, var(--info) 8%, var(--bg-card));
  border-color: color-mix(in oklch, var(--info) 30%, var(--border));
  color: var(--text);
}

.alert-success {
  background: color-mix(in oklch, var(--success) 8%, var(--bg-card));
  border-color: color-mix(in oklch, var(--success) 30%, var(--border));
  color: var(--text);
}

.alert-warning {
  background: color-mix(in oklch, var(--warning) 10%, var(--bg-card));
  border-color: color-mix(in oklch, var(--warning) 35%, var(--border));
  color: var(--text);
}

.alert-danger {
  background: color-mix(in oklch, var(--danger) 8%, var(--bg-card));
  border-color: color-mix(in oklch, var(--danger) 30%, var(--border));
  color: var(--text);
}

/* ===== Blockquote — no side-stripe ===== */

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-6);
  border-left: none;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-style: normal;
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  border: 1px solid var(--border);
}

blockquote p {
  margin: 0;
}

/* ===== Forms ===== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea,
select {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px var(--space-3);
  height: 40px;
  width: 100%;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
  line-height: var(--lh-relaxed);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--grey-400);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form labels above fields */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  line-height: 1.4;
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  line-height: 1.4;
}

/* ===== Footer ===== */

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: var(--section-gap);
}

.footer-content {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  display: grid;
  grid-template-columns: 1.5fr 2fr;
  gap: var(--space-12);
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-brand-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-brand-name {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--text);
  letter-spacing: -0.01em;
}

.footer-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  max-width: 320px;
}

.footer-copyright-mini {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.footer-col-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

.footer-col-group h4 {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: var(--space-4);
  letter-spacing: 0;
  text-transform: none;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
  line-height: 1.5;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: var(--container);
  margin: var(--space-12) auto 0;
  padding: var(--space-6) var(--container-pad) 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-bottom-left,
.footer-bottom-right {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.footer-bottom-right {
  display: flex;
  gap: var(--space-4);
}

.footer-bottom-right a {
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-bottom-right a:hover {
  color: var(--text-secondary);
}

/* ===== Toast ===== */

.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.4;
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-color: color-mix(in oklch, var(--success) 40%, var(--border));
}

.toast-error {
  border-color: color-mix(in oklch, var(--danger) 40%, var(--border));
}

.toast-info {
  border-color: color-mix(in oklch, var(--info) 40%, var(--border));
}

/* ===== Modal base ===== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.96) translateY(8px);
  opacity: 0;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ===== Remove eyebrow / uppercase abuse ===== */

/* Generic fix — be selective so we don't break legitimate uppercase */
.section-eyebrow,
.eyebrow,
.section-label,
.user-section-title,
.tool-panel-label {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  font-variant-numeric: normal;
}

/* ===== Gradient text cleanup — go monochrome ===== */

.gradient-text,
.hero h1,
.section-title,
.not-found-code,
.brand-text-bay {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: var(--text);
}

/* ===== Remove decorative dot-grid / glow backgrounds ===== */

.hero-grid,
.section-bg-dots,
.hero-glow,
.section-glow {
  background: none !important;
}

/* ===== Hero ===== */

.hero {
  position: relative;
  padding: var(--space-20) 0 var(--space-16);
  background: var(--bg);
  overflow: hidden;
}

.hero-bg-grid {
  display: none !important;  /* remove dot-grid decoration */
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: var(--space-5);
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  text-wrap: balance;
}

.hero-subtitle {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-8);
  text-wrap: pretty;
}

.hero-search {
  position: relative;
  max-width: 560px;
  margin: 0 auto var(--space-6);
  display: flex;
  align-items: center;
}

.hero-search-input {
  width: 100%;
  height: 52px;
  padding: 0 var(--space-6) 0 48px;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.hero-search-input::placeholder {
  color: var(--text-placeholder);
}

.hero-search-input:hover {
  border-color: var(--grey-400);
  box-shadow: var(--shadow-md);
}

.hero-search-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
  outline: none;
}

.hero-search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.hero-search-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

.hero-search-kbd {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 3px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  pointer-events: none;
}

.hero-hot-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.hero-hot-tags-label {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-right: var(--space-1);
}

.hero-hot-tag {
  height: 28px;
  padding: 0 var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.hero-hot-tag:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.hero-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-10);
}

.hero-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

.hero-trust-item strong {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.hero-trust-sep {
  color: var(--border-strong);
  line-height: 1;
}

/* ===== Section heads ===== */

.section {
  padding: var(--section-gap) 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 var(--space-2);
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  text-wrap: balance;
}

.section-desc {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  margin: 0;
  max-width: 480px;
}

/* ===== Category cards (hero section) — varied grid ===== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  transition:
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    background-color var(--duration-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .category-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.category-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.category-card-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

.category-card-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: 1.4;
}

.category-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  line-height: 1.5;
  flex: 1;
}

.category-card-count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.category-card-arrow {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition:
    transform var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out);
}

.category-card:hover .category-card-arrow {
  transform: translateX(2px);
  color: var(--accent);
}

/* ===== Scenario chips ===== */

.scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ===== Tool cards ===== */

.tool-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  gap: var(--space-3);
  min-height: 160px;
  position: relative;
  overflow: hidden;
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.tool-card-icon img,
.tool-card-icon svg {
  width: 24px;
  height: 24px;
}

.tool-card-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.tool-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.tool-card-badge {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ===== Value props — bento-style variation ===== */

.value-props-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.value-prop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  transition:
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .value-prop-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
  }
}

.value-prop-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.value-prop-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.value-prop-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin: 0 0 var(--space-2);
  line-height: 1.4;
}

.value-prop-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  margin: 0;
}

/* ===== Article cards ===== */

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .article-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.article-card-image {
  aspect-ratio: 16 / 9;
  background: var(--bg-secondary);
  overflow: hidden;
}

.article-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

.article-card-category {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.article-card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.article-card-excerpt {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: auto;
}

/* ===== Detail page ===== */

.detail-page {
  padding: var(--space-12) 0 var(--space-16);
}

.detail-header {
  max-width: var(--measure);
  margin: 0 auto var(--space-10);
  text-align: left;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb-sep {
  color: var(--border-strong);
  font-size: 0.8em;
}

.detail-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 var(--space-4);
}

.detail-subtitle {
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  margin: 0 0 var(--space-6);
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

.detail-cta-row {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.detail-section-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin: var(--space-10) 0 var(--space-5);
  line-height: 1.3;
}

/* Long-form content */
.prose,
.article-content,
.detail-content {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

.prose h2,
.article-content h2,
.detail-content h2 {
  font-size: var(--fs-2xl);
  margin: var(--space-10) 0 var(--space-4);
}

.prose h3,
.article-content h3,
.detail-content h3 {
  font-size: var(--fs-xl);
  margin: var(--space-8) 0 var(--space-3);
}

.prose p,
.article-content p,
.detail-content p {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
}

.prose ul,
.prose ol,
.article-content ul,
.article-content ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

.prose li,
.article-content li {
  margin-bottom: var(--space-2);
  line-height: var(--lh-relaxed);
}

.prose strong,
.article-content strong {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

/* ===== Auth modal ===== */

.auth-modal .modal {
  width: 100%;
  max-width: 420px;
  padding: var(--space-8);
}

.auth-modal-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-modal-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--text);
  margin: 0 0 var(--space-2);
  line-height: 1.2;
}

.auth-modal-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-form .form-field {
  gap: var(--space-2);
}

.auth-form .form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.auth-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: var(--space-2);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: var(--space-5);
}

.auth-footer a {
  color: var(--accent);
  cursor: pointer;
  font-weight: var(--fw-medium);
}

/* ===== Filter bar ===== */

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.filter-chip {
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  font-weight: var(--fw-semibold);
}

/* ===== Sort / select ===== */

.sort-select {
  margin-left: auto;
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--fs-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.sort-select:hover {
  border-color: var(--grey-400);
  color: var(--text);
}

.sort-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* ===== Empty state detail ===== */

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: var(--space-8) 0;
}

.empty-state-icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.25;
  color: var(--text-muted);
}

/* ===== Excessive radius reduction ===== */

/* Cap all non-pill radii at 16px */
.cta-banner,
.detail-icon,
.product-gallery-icon,
.product-gallery,
.success-card,
.hero-card,
.pricing-card {
  border-radius: var(--radius-lg) !important;
}

/* ===== Section spacing normalization ===== */

section,
.section,
[class*="section-"] {
  scroll-margin-top: calc(var(--nav-height) + var(--space-4));
}

/* ===== Code blocks ===== */

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  background: var(--grey-900);
  color: var(--grey-100);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.6;
  border: 1px solid var(--border);
}

:not(pre) > code {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  color: var(--text);
  border-radius: var(--radius-xs);
  font-size: 0.88em;
  border: 1px solid var(--border);
}

[data-theme="dark"] :not(pre) > code {
  background: var(--grey-800);
}

/* ===== Container ===== */

.container-x {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* ===== Empty state ===== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  max-width: 360px;
  margin-bottom: var(--space-6);
  line-height: var(--lh-relaxed);
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .footer-col-group {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --container-pad: var(--space-4);
    --nav-height: 56px;
  }

  .nav-links {
    display: none;
  }

  .footer-col-group {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }

  .toast-container {
    left: var(--space-3);
    right: var(--space-3);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .footer-col-group {
    grid-template-columns: 1fr;
  }
}
