/* ============================================================================
   Toolkit Template Styles
   --------------------------------------------------------------------------
   Tailored styling for long-form instructional toolkits. Combines a sticky
   navigation rail with glassmorphism-inspired content panels to match the
   Poli Plot Labs aesthetic while still feeling distinct from other layouts.
   ========================================================================== */

/* Page backdrop & typography --------------------------------------------- */
body.toolkit-page {
  background:
    radial-gradient(120% 160% at 20% -40%, rgba(236, 244, 248, 0.95), transparent 65%),
    radial-gradient(110% 120% at 80% -50%, rgba(212, 226, 233, 0.75), transparent 55%),
    var(--navy-bg);
  color: #143240;
}

/* Align toolkit pages with other layouts */
body.toolkit-page #main-content {
  margin-top: -44px;
}

.toolkit-layout a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.25s ease;
}

.toolkit-layout a:hover,
.toolkit-layout a:focus-visible {
  color: var(--navy);
}

/* Layout shell ----------------------------------------------------------- */
.toolkit-layout {
  position: relative;
}

.toolkit-aurora {
  position: relative;
  padding: clamp(2.5rem, 5vw, 3.75rem) 0;
}

.toolkit-aurora::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  background-color: rgba(212, 232, 243, 0.82);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.85),
    inset 0 -6px 12px rgba(255, 255, 255, 0.35),
    0 40px 90px -65px rgba(37, 71, 92, 0.45);
  z-index: 0;
  pointer-events: none;
}

.toolkit-aurora > .container {
  position: relative;
  z-index: 1;
}

.toolkit-main {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 1.4vw, 1.1rem);
}

/* Table of contents ------------------------------------------------------ */
.toolkit-toc {
  margin: 0;
  padding: clamp(1.6rem, 3vw, 2.2rem);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(11, 59, 77, 0.08);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.9),
    inset 0 -4px 10px rgba(227, 240, 247, 0.6),
    0 26px 68px -52px rgba(11, 59, 77, 0.32);
}

.toolkit-toc__heading {
  margin: 0 0 clamp(1rem, 2vw, 1.4rem);
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: none;
  color: rgba(20, 50, 64, 0.72);
}

.toolkit-toc__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.5vw, 0.9rem);
}

.toolkit-toc__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: rgba(233, 243, 248, 0.9);
  color: rgba(20, 50, 64, 0.85);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: clamp(0.82rem, 1.6vw, 0.95rem);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -6px 10px rgba(188, 214, 228, 0.6),
    0 12px 32px -18px rgba(11, 59, 77, 0.28);
}

.toolkit-toc__link:hover,
.toolkit-toc__link:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -4px 10px rgba(188, 214, 228, 0.75),
    0 18px 44px -24px rgba(11, 59, 77, 0.35);
  color: var(--navy);
}

@media (max-width: 992px) {
  .toolkit-toc__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .toolkit-toc__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .toolkit-toc__grid {
    grid-template-columns: 1fr;
  }
}

/* Hero block ------------------------------------------------------------- */
.toolkit-hero {
  position: relative;
  margin-bottom: clamp(0.55rem, 1.4vw, 1rem);
  padding: clamp(2.4rem, 4.8vw, 3.6rem);
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(11, 59, 77, 0.08), rgba(249, 132, 0, 0.2));
  border: 1px solid rgba(11, 59, 77, 0.12);
  box-shadow: 0 36px 110px -70px rgba(11, 59, 77, 0.58);
  overflow: hidden;
}

.toolkit-hero::before,
.toolkit-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  opacity: 0.42;
  transition: transform 0.6s ease;
}

.toolkit-hero::before {
  width: clamp(220px, 36vw, 420px);
  height: clamp(220px, 36vw, 420px);
  top: clamp(-160px, -18vw, -120px);
  right: clamp(-140px, -16vw, -100px);
  background: radial-gradient(circle at 40% 40%, rgba(249, 132, 0, 0.38), rgba(11, 59, 77, 0.04));
}

.toolkit-hero::after {
  width: clamp(280px, 44vw, 520px);
  height: clamp(280px, 44vw, 520px);
  bottom: clamp(-220px, -20vw, -160px);
  left: clamp(-180px, -18vw, -120px);
  background: radial-gradient(circle at 60% 60%, rgba(11, 59, 77, 0.18), rgba(77, 107, 122, 0.08));
}

.toolkit-hero:hover::before {
  transform: translate(-10px, 10px);
}

.toolkit-hero:hover::after {
  transform: translate(12px, -12px);
}

.toolkit-hero__content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  z-index: 1;
}

.toolkit-hero__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(249, 132, 0, 0.92), rgba(255, 181, 77, 0.82));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toolkit-hero__title {
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 3.6rem);
  color: rgba(14, 46, 61, 0.95);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.toolkit-hero__subtitle {
  margin: 0;
  font-size: clamp(1.1rem, 2.1vw, 1.4rem);
  color: rgba(20, 50, 64, 0.78);
  max-width: 56ch;
}

.toolkit-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: clamp(0.2rem, 0.8vw, 0.4rem) 0 0;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  font-weight: 600;
  color: rgba(20, 50, 64, 0.68);
}

.toolkit-hero__author {
  color: var(--navy);
  letter-spacing: 0.015em;
}

.toolkit-hero__author:hover,
.toolkit-hero__author:focus-visible {
  color: var(--orange);
}

.toolkit-hero__divider {
  color: rgba(20, 50, 64, 0.35);
}

.toolkit-hero__date {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  color: rgba(20, 50, 64, 0.62);
}

.toolkit-hero__date .fa {
  color: rgba(20, 50, 64, 0.52);
  font-size: 0.95em;
}

.toolkit-hero__date {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(20, 50, 64, 0.65);
}

.toolkit-hero__date .fa {
  color: rgba(20, 50, 64, 0.55);
  font-size: 0.95em;
}

/* Content panel ---------------------------------------------------------- */
.toolkit-content {
  position: relative;
  counter-reset: toolkit-section;
  padding: clamp(2rem, 4vw, 3rem);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(11, 59, 77, 0.08);
  box-shadow: 0 28px 72px -44px rgba(11, 59, 77, 0.28);
  backdrop-filter: blur(18px);
}

.toolkit-content > *:first-child {
  margin-top: 0;
}

.toolkit-content h2,
.toolkit-content h3 {
  scroll-margin-top: 110px;
}

.toolkit-content h2 {
  counter-increment: toolkit-section;
  position: relative;
  margin: clamp(2.4rem, 4vw, 3rem) 0 clamp(1.2rem, 2vw, 1.6rem);
  padding-left: clamp(3.5rem, 5vw, 4.2rem);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  color: rgba(14, 46, 61, 0.95);
  line-height: 1.2;
}

.toolkit-content h2::before {
  content: counter(toolkit-section, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(2.6rem, 4vw, 3rem);
  height: clamp(2.6rem, 4vw, 3rem);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(249, 132, 0, 0.92), rgba(11, 59, 77, 0.85));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 18px 38px -24px rgba(249, 132, 0, 0.55);
}

.toolkit-content h3 {
  margin: clamp(1.6rem, 3vw, 2rem) 0 clamp(0.8rem, 1.6vw, 1.2rem);
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  color: rgba(20, 50, 64, 0.9);
}

.toolkit-content p,
.toolkit-content li {
  font-size: clamp(1.05rem, 1.9vw, 1.2rem);
  line-height: 1.7;
  color: rgba(20, 50, 64, 0.82);
}

.toolkit-content ul {
  padding-left: 1.4rem;
}

.toolkit-content ul li {
  margin-bottom: 0.4rem;
  position: relative;
}

.toolkit-content ul li::marker {
  color: var(--orange);
}

.toolkit-content blockquote {
  margin: 2rem 0;
  padding: 1.6rem 1.8rem;
  border-radius: 18px;
  background: rgba(11, 59, 77, 0.08);
  border-left: 4px solid var(--orange);
  font-style: italic;
  color: rgba(10, 35, 48, 0.82);
}

.toolkit-content code {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
  background: rgba(11, 59, 77, 0.12);
  color: rgba(11, 59, 77, 0.9);
  font-size: 0.95rem;
}

.toolkit-content pre {
  margin: 1.6rem 0;
  padding: 1.4rem 1.6rem;
  border-radius: 18px;
  background: rgba(14, 46, 61, 0.92);
  color: #e7f3f6;
  font-size: 0.95rem;
  overflow-x: auto;
}

.toolkit-content pre code {
  background: transparent;
  color: inherit;
  font-size: inherit;
  padding: 0;
}

.toolkit-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 40px -32px rgba(11, 59, 77, 0.3);
}

.toolkit-content th,
.toolkit-content td {
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid rgba(11, 59, 77, 0.08);
  text-align: left;
  font-size: 0.98rem;
}

.toolkit-content thead th {
  background: rgba(11, 59, 77, 0.85);
  color: #fff;
  font-weight: 700;
}

.toolkit-content tbody tr:nth-child(odd) {
  background: rgba(11, 59, 77, 0.05);
}

.toolkit-content h2:target,
.toolkit-content h3:target {
  background: linear-gradient(90deg, rgba(249, 132, 0, 0.16), rgba(236, 244, 248, 0));
  border-radius: 16px;
  padding-right: 1rem;
}

/* Ordered lists ---------------------------------------------------------- */
.toolkit-content ol {
  margin: 1.2rem 0;
  padding-left: clamp(1.6rem, 3vw, 2.2rem);
}

.toolkit-content ol > li {
  margin-bottom: 0.65rem;
  padding-left: 0.4rem;
  line-height: 1.65;
}

.toolkit-content ol > li:last-child {
  margin-bottom: 0;
}

/* References ------------------------------------------------------------- */
.toolkit-content h2#references {
  position: relative;
  margin-top: clamp(2.6rem, 5vw, 3.4rem);
  padding-top: clamp(1.4rem, 3vw, 1.8rem);
  border-top: 1px solid rgba(11, 59, 77, 0.12);
  padding-left: 0;
  counter-increment: none;
}

.toolkit-content h2#references::before {
  display: none;
}

.toolkit-reference-list {
  list-style: decimal;
  margin: clamp(1.4rem, 3vw, 1.8rem) 0 0;
  padding-left: clamp(1.6rem, 3vw, 2rem);
}

.toolkit-reference-list li {
  margin-bottom: 0.6rem;
  line-height: 1.55;
  color: rgba(20, 50, 64, 0.86);
  font-size: 0.96rem;
  scroll-margin-top: 5.4rem;
}

.toolkit-reference-list li:last-child {
  margin-bottom: 0;
}

.toolkit-reference-list a {
  word-break: break-word;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(249, 132, 0, 0.55);
}

.toolkit-reference-list a:hover,
.toolkit-reference-list a:focus-visible {
  color: var(--orange);
}

.toolkit-reference-list li:target {
  background: linear-gradient(90deg, rgba(249, 132, 0, 0.16), transparent);
  border-radius: 10px;
}

.toolkit-citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  padding: 0.1rem 0.4rem;
  margin: 0 0.12rem;
  border-radius: 999px;
  background: rgba(249, 132, 0, 0.16);
  color: rgba(11, 59, 77, 0.88);
  font-weight: 700;
  font-size: 0.92em;
  line-height: 1.1;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toolkit-citation:hover,
.toolkit-citation:focus-visible {
  background: rgba(249, 132, 0, 0.34);
  color: var(--navy);
  transform: translateY(-1px);
}

.toolkit-citation.is-highlighted {
  background: rgba(249, 132, 0, 0.34);
  color: var(--navy);
}

/* Tips grid -------------------------------------------------------------- */
.toolkit-tips {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.toolkit-tip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.6rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(11, 59, 77, 0.08);
  box-shadow: 0 24px 52px -40px rgba(11, 59, 77, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.toolkit-tip:hover,
.toolkit-tip:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 28px 70px -44px rgba(11, 59, 77, 0.35);
}

.toolkit-tip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(249, 132, 0, 0.65), rgba(11, 59, 77, 0.45));
  color: #fff;
  font-size: 1.3rem;
  flex: 0 0 auto;
}

.toolkit-tip__title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: rgba(14, 46, 61, 0.95);
}

.toolkit-tip__body {
  margin: 0;
  color: rgba(20, 50, 64, 0.82);
  line-height: 1.6;
  font-size: 1.02rem;
}

/* Utilities -------------------------------------------------------------- */
.toolkit-content h2:first-of-type {
  margin-top: 0;
}

.toolkit-content h2:first-of-type::before {
  margin-top: 0;
}

.toolkit-content > * + * {
  margin-top: clamp(1.1rem, 2vw, 1.6rem);
}

/* Responsive tweaks ------------------------------------------------------ */
@media (max-width: 768px) {
  .toolkit-hero,
  .toolkit-content,
  .toolkit-toc {
    padding: 1.6rem;
    border-radius: 22px;
  }

  .toolkit-hero__title {
    font-size: clamp(2rem, 8vw, 2.6rem);
  }
}

@media (max-width: 540px) {
  .toolkit-tip {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .toolkit-tip__icon {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
}

/* Motion preference ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .toolkit-toc__link,
  .toolkit-tip,
  .toolkit-hero,
  .toolkit-content {
    transition: none;
  }
}

/* Graceful fallback when blur unsupported */
@supports not (backdrop-filter: blur(1px)) {
  .toolkit-toc,
  .toolkit-content,
  .toolkit-hero {
    background: rgba(255, 255, 255, 0.95);
  }
}
