/* ============================================================
   Protocol Explorer — design system
   ------------------------------------------------------------
   Tokens on :root, then Bootstrap 5.1 component overrides, then
   reusable components for the homepage. This is a GLOBAL (non
   CSS-isolated) stylesheet, so its rules reach every page and
   re-theme Browse / Details / My Protocols automatically.
   Layout-scoped rules (navbar, footer chrome) live in
   _Layout.cshtml.css.
   ============================================================ */

:root {
  /* Brand */
  --pe-primary: #0B6BCB;
  --pe-primary-hover: #0855A6;
  --pe-navy: #0B2440;
  --pe-navy-2: #123A63;
  --pe-accent: #12B0C3;
  --pe-accent-hover: #0E94A4;

  /* Neutrals */
  --pe-ink: #15212E;
  --pe-body: #3C4A59;
  --pe-muted: #6A7A8C;
  --pe-border: #E2E9F1;
  --pe-surface: #F4F8FC;
  --pe-surface-2: #E9F2FA;

  /* Semantic */
  --pe-success: #1E9E6A;
  --pe-warning: #E08A1E;
  --pe-danger: #D6473B;

  /* Shape & elevation */
  --pe-radius-sm: 10px;
  --pe-radius: 14px;
  --pe-radius-lg: 22px;
  --pe-shadow-sm: 0 1px 2px rgba(11, 36, 64, .06), 0 1px 3px rgba(11, 36, 64, .08);
  --pe-shadow: 0 6px 18px rgba(11, 36, 64, .08), 0 2px 5px rgba(11, 36, 64, .05);
  --pe-shadow-lg: 0 20px 45px -14px rgba(11, 36, 64, .32);

  /* Type */
  --pe-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ---------- Base ---------- */
html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: var(--pe-font-sans);
  color: var(--pe-body);
  background-color: #fff;
  /* Sticky footer: body is a flex column, <main> grows. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--pe-ink);
  font-weight: 700;
  letter-spacing: -.01em;
}

a {
  color: var(--pe-primary);
  text-decoration: none;
}

a:hover {
  color: var(--pe-primary-hover);
  text-decoration: underline;
}

/* Consistent focus ring in brand colour. */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .1rem #fff, 0 0 0 .25rem rgba(11, 107, 203, .55);
  border-color: var(--pe-primary);
}

/* ---------- Buttons ---------- */
.btn {
  font-weight: 600;
  border-radius: var(--pe-radius-sm);
  padding: .5rem 1.1rem;
}

.btn-lg {
  padding: .8rem 1.65rem;
  font-size: 1.05rem;
}

.btn-primary {
  color: #fff;
  background-color: var(--pe-primary);
  border-color: var(--pe-primary);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-primary:active:focus, .btn-primary.active {
  color: #fff !important;
  background-color: var(--pe-primary-hover) !important;
  border-color: var(--pe-primary-hover) !important;
}

.btn-outline-primary {
  color: var(--pe-primary);
  border-color: var(--pe-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary:focus {
  color: #fff;
  background-color: var(--pe-primary);
  border-color: var(--pe-primary);
}

/* Accent (teal) button for the brand mark / secondary emphasis. */
.btn-accent {
  color: #fff;
  background-color: var(--pe-accent);
  border-color: var(--pe-accent);
}

.btn-accent:hover, .btn-accent:focus, .btn-accent:active {
  color: #fff;
  background-color: var(--pe-accent-hover);
  border-color: var(--pe-accent-hover);
}

/* Light button that reads well on the dark hero / CTA bands. */
.btn-on-dark {
  color: var(--pe-navy);
  background-color: #fff;
  border-color: #fff;
}

.btn-on-dark:hover, .btn-on-dark:focus {
  color: var(--pe-navy);
  background-color: var(--pe-surface-2);
  border-color: var(--pe-surface-2);
}

.btn-outline-on-dark {
  color: #fff;
  border-color: rgba(255, 255, 255, .65);
}

.btn-outline-on-dark:hover, .btn-outline-on-dark:focus {
  color: var(--pe-navy);
  background-color: #fff;
  border-color: #fff;
}

/* ---------- Links / text / backgrounds ---------- */
.text-primary {
  color: var(--pe-primary) !important;
}

.text-accent {
  color: var(--pe-accent) !important;
}

.bg-primary {
  background-color: var(--pe-primary) !important;
}

.bg-info {
  background-color: var(--pe-accent) !important;
  color: #fff !important;
}

.bg-success {
  background-color: var(--pe-success) !important;
}

.bg-warning {
  background-color: var(--pe-warning) !important;
}

.bg-danger {
  background-color: var(--pe-danger) !important;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
  background-color: var(--pe-primary);
}

/* ---------- Cards ---------- */
.card {
  border-radius: var(--pe-radius);
  border-color: var(--pe-border);
}

.card.shadow-sm {
  box-shadow: var(--pe-shadow-sm) !important;
}

.shadow-sm {
  box-shadow: var(--pe-shadow-sm) !important;
}

/* ---------- Badges ---------- */
.badge {
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: .01em;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-color: var(--pe-border);
  border-radius: var(--pe-radius-sm);
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--pe-radius);
  border: 1px solid transparent;
}

/* Headings on dark/coloured surfaces must stay light — overrides the global
   ink heading colour (which would otherwise render them dark-on-dark). */
.text-white h1, .text-white h2, .text-white h3,
.text-white h4, .text-white h5, .text-white h6 {
  color: #fff;
}

/* ---------- Browse / My Protocols cards ---------- */
.pe-protocol-card .card-title {
  font-size: 1.05rem;
  line-height: 1.3;
}

.pe-protocol-card .badge {
  font-size: .72rem;
}

/* ---------- Details page ---------- */
.pe-card-header {
  background-color: var(--pe-navy);
  color: #fff;
}

.pe-detail-heading {
  color: var(--pe-ink);
  font-weight: 700;
  border-bottom: 2px solid var(--pe-surface-2);
  padding-bottom: .5rem;
  margin-bottom: 1.1rem;
}

.pe-metric {
  background: var(--pe-surface);
  border: 1px solid var(--pe-border);
  border-radius: var(--pe-radius);
  padding: 1rem 1.1rem;
  height: 100%;
}

.pe-metric__label {
  color: var(--pe-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

.pe-metric__value {
  color: var(--pe-ink);
  font-size: 1.25rem;
  font-weight: 700;
}

/* ---------- Reusable bits kept from the original site.css ---------- */
.transition-hover {
  transition: transform .25s ease-in-out, box-shadow .25s ease-in-out;
}

.transition-hover:hover {
  transform: translateY(-5px);
  box-shadow: var(--pe-shadow-lg) !important;
}

.feature-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--pe-radius);
}

/* ============================================================
   Homepage components
   ============================================================ */

/* Full-bleed section band with comfortable vertical rhythm. */
.pe-band {
  padding: clamp(3rem, 6vw, 5.5rem) 0;
}

.pe-band--tint {
  background-color: var(--pe-surface);
  border-top: 1px solid var(--pe-border);
  border-bottom: 1px solid var(--pe-border);
}

.pe-eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
  font-size: .8rem;
  color: var(--pe-accent);
}

.pe-section-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

.pe-lead {
  font-size: 1.125rem;
  color: var(--pe-muted);
  max-width: 42rem;
}

/* ---------- Hero ---------- */
.pe-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--pe-navy) 0%, var(--pe-navy-2) 100%);
  padding: clamp(3.5rem, 7vw, 6.5rem) 0;
}

/* Subtle grid texture, pure CSS (CSP blocks external images). */
.pe-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 38px 38px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at 70% 30%, #000 0%, transparent 75%);
  pointer-events: none;
}

.pe-hero > .container {
  position: relative;
  z-index: 1;
}

.pe-hero h1 {
  color: #fff;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.08;
}

.pe-hero .pe-lead {
  color: rgba(255, 255, 255, .82);
  font-size: 1.2rem;
}

.pe-hero .pe-eyebrow {
  color: var(--pe-accent);
}

.pe-trustline {
  color: rgba(255, 255, 255, .7);
  font-size: .9rem;
}

/* ---------- App-window product mock ---------- */
.pe-mock {
  border-radius: var(--pe-radius);
  background: #fff;
  box-shadow: var(--pe-shadow-lg);
  overflow: hidden;
  transform: perspective(1600px) rotateY(-7deg) rotateX(2deg);
  transform-origin: center left;
}

.pe-mock__bar {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .9rem;
  background: var(--pe-surface-2);
  border-bottom: 1px solid var(--pe-border);
}

.pe-mock__dots {
  display: flex;
  gap: .35rem;
}

.pe-mock__dot {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #c7d4e2;
}

.pe-mock__url {
  flex: 1;
  font-size: .72rem;
  color: var(--pe-muted);
  background: #fff;
  border: 1px solid var(--pe-border);
  border-radius: 999px;
  padding: .2rem .7rem;
  text-align: center;
}

.pe-mock__body {
  padding: 1rem;
  background: var(--pe-surface);
  display: grid;
  gap: .85rem;
}

@media (max-width: 991.98px) {
  .pe-mock {
    transform: none;
    margin-top: 2.5rem;
  }
}

/* ---------- Product behaviour steps ---------- */
.pe-step__num {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: var(--pe-accent);
  background: var(--pe-surface-2);
}

/* ---------- Standards / foundation chips ---------- */
.pe-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  color: var(--pe-navy);
  background: #fff;
  border: 1px solid var(--pe-border);
  border-radius: 999px;
  padding: .45rem 1rem;
  box-shadow: var(--pe-shadow-sm);
}

/* ---------- Conversion band ---------- */
.pe-cta-band {
  color: #fff;
  background: linear-gradient(120deg, var(--pe-primary) 0%, var(--pe-accent) 130%);
}

.pe-cta-band h2 {
  color: #fff;
}

/* ---------- Scroll reveal (progressive enhancement) ----------
   Only hide content once home.js has flagged JS support, so the
   page is fully visible if JS/IntersectionObserver is absent. */
.pe-js .pe-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}

.pe-js .pe-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .pe-js .pe-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* External links get a small "leaves the site" icon (added by markExternalLinks
   in site.js). Sized relative to the link/button text it follows. */
.pe-external-icon {
  font-size: .72em;
  margin-left: .3em;
  vertical-align: baseline;
}
