:root {
  --ui-ink: #17202a;
  --ui-muted: #607080;
  --ui-line: #dce4ea;
  --ui-paper: #ffffff;
  --ui-soft: #f5f8fa;
  --ui-green: #0f8b78;
  --ui-green-dark: #096455;
  --ui-blue: #1d5f78;
  --ui-gold: #f4bd50;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--ui-ink);
  background: var(--ui-soft);
}

a,
button,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(29, 95, 120, 0.3);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--ui-line);
  backdrop-filter: blur(10px);
}

.nav {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  padding: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: #fff;
  background: var(--ui-green);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: #263645;
  border-radius: 7px;
  font-size: 0.94rem;
  font-weight: 750;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-links a:hover {
  color: var(--ui-green-dark);
  background: #eef7f5;
}

.nav-links a[aria-current="page"],
body.home-simple .nav-links a:first-child {
  color: #fff;
  background: var(--ui-green);
}

.nav-links a[aria-current="page"]:hover,
body.home-simple .nav-links a:first-child:hover {
  background: var(--ui-green-dark);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ui-ink);
  background: #fff;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
}

.menu-toggle-lines {
  display: grid;
  gap: 5px;
}

.menu-toggle-lines span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 160ms ease, opacity 160ms ease;
}

.nav-open .menu-toggle-lines span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-open .menu-toggle-lines span:nth-child(2) {
  opacity: 0;
}

.nav-open .menu-toggle-lines span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

:where(.panel, .detail-card, .card, .paper-card, .tool-card, .result-card, .trust-card, .main-tool-card) {
  border-color: var(--ui-line);
  border-radius: 8px;
  box-shadow: none;
}

:where(a.card, a.paper-card, a.tool-card, a.trust-card, a.main-tool-card) {
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

:where(a.card, a.paper-card, a.tool-card, a.trust-card, a.main-tool-card):hover {
  transform: translateY(-2px);
  border-color: #b8cdc8;
  box-shadow: 0 8px 20px rgba(24, 43, 55, 0.07);
}

:where(.button, .primary-button, .finder-button, button[type="submit"]) {
  border-radius: 7px;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

:where(.button, .primary-button, .finder-button, button[type="submit"]):active {
  transform: translateY(1px);
}

.breadcrumbs {
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.footer {
  border-top: 1px solid var(--ui-line);
  background: #fff;
}

.footer-about,
.footer-support,
.footer-links {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

main > :where(section, nav) {
  animation: ui-enter 360ms ease both;
}

main > :where(section, nav):nth-child(2) { animation-delay: 45ms; }
main > :where(section, nav):nth-child(3) { animation-delay: 80ms; }

body.home-simple .home-intro {
  display: block;
  padding-top: 34px;
  padding-bottom: 20px;
}

body.home-simple .home-intro > div {
  width: min(760px, 100%);
}

body.home-simple .home-intro h1 {
  margin-bottom: 10px;
}

body.home-simple .home-intro p:not(.eyebrow) {
  max-width: 640px;
  margin: 0;
  color: var(--ui-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.tool-hero {
  grid-template-columns: 1fr !important;
}

.tool-hero > .panel {
  width: 100%;
}

@keyframes ui-enter {
  from { opacity: 0.86; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .nav {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
  }

  .menu-toggle {
    display: inline-flex !important;
  }

  .nav-links {
    display: none !important;
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
    gap: 4px;
    width: 100%;
    padding: 6px 0 2px;
  }

  .nav.nav-open .nav-links {
    display: grid !important;
  }

  .nav-links a {
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 12px;
    color: #263645;
    background: #f7fafb;
    border: 1px solid var(--ui-line);
  }

  .nav-links a[aria-current="page"],
  body.home-simple .nav-links a:first-child {
    color: #fff;
    background: var(--ui-green);
    border-color: var(--ui-green);
  }

  main {
    overflow: clip;
  }

  :where(.hero, .compact-hero) {
    padding-top: 16px !important;
  }

  :where(.hero, .hero > div, .hero .panel, .detail-card) {
    min-width: 0;
  }

  h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
    line-height: 1.12 !important;
  }

  h2 {
    overflow-wrap: anywhere;
    font-size: clamp(1.3rem, 6vw, 1.65rem) !important;
    line-height: 1.2 !important;
  }

  .actions {
    gap: 8px;
  }

  .actions :where(.button, button) {
    min-height: 46px;
  }

  body.home-simple .main-tools-grid,
  body.home-simple .trust-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.home-simple .main-tool-card,
  body.home-simple .trust-card {
    min-height: 150px !important;
    padding: 12px !important;
  }

  body.home-simple .main-tool-card {
    grid-template-columns: 1fr !important;
    align-content: start;
    gap: 8px !important;
  }

  body.home-simple .main-tool-card > * {
    grid-column: 1 !important;
  }

  body.home-simple .main-tool-card strong {
    align-self: start;
  }

  body.home-simple .main-tool-action {
    min-height: 28px !important;
    padding: 4px 7px !important;
    white-space: normal;
  }

  body.home-simple .home-intro {
    padding-top: 20px !important;
    padding-bottom: 10px !important;
  }

  body.home-simple .main-tool-graphic,
  body.home-simple .home-card-icon {
    width: 58px !important;
    height: 58px !important;
  }

  body.home-simple .main-tool-card strong,
  body.home-simple .trust-card strong {
    font-size: 0.92rem !important;
    line-height: 1.22 !important;
  }

  body.home-simple .main-tool-action {
    font-size: 0.72rem;
  }

  body.home-simple .trust-card span {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .footer-about,
  .footer-support,
  .footer-links {
    width: calc(100% - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .footer {
    display: none !important;
  }
  main > :where(section, nav) {
    animation: none !important;
  }
}
