/* ===================================================================
   PolicyFlux – Institutional Theme
   =================================================================== */

/* ---------- CSS custom properties ---------- */
:root {
  --pfx-primary: #1e3a5f;
  --pfx-primary-light: #2c5282;
  --pfx-accent: #4a6fa5;
  --pfx-accent-muted: #718bab;
  --pfx-border: rgba(0, 0, 0, 0.1);
  --pfx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --pfx-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --pfx-radius: 6px;
  --pfx-radius-lg: 8px;
  --pfx-transition: 0.2s ease;
}

[data-md-color-scheme="slate"] {
  --pfx-border: rgba(255, 255, 255, 0.08);
}

/* ---------- Smooth scroll ---------- */
html {
  scroll-behavior: smooth;
}

/* ---------- Typography (scaled down) ---------- */
.md-typeset {
  font-size: 0.82rem;
  line-height: 1.65;
}

.md-typeset h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.md-typeset h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2.2rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--pfx-border);
}

.md-typeset h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-top: 1.6rem;
}

.md-typeset h4 {
  font-size: 0.92rem;
  font-weight: 600;
}

/* ---------- Header / Navbar ---------- */
.md-header {
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--pfx-border);
}

.md-tabs {
  border-bottom: 1px solid var(--pfx-border);
}

/* ---------- Main content spacing ---------- */
.md-main__inner {
  margin-top: 0.8rem;
}

.md-content {
  padding-bottom: 2.5rem;
}

/* ===================================================================
   HERO SECTION
   =================================================================== */
.hero {
  position: relative;
  margin: 0 -0.8rem 2rem;
  padding: 2.5rem 2.2rem 2.2rem;
  border-radius: var(--pfx-radius-lg);
  background: var(--pfx-primary);
  color: #fff;
}

.hero h2 {
  color: #fff;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

.hero p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 580px;
  margin-bottom: 1.2rem;
}

/* Hero buttons */
.hero .md-button {
  border-radius: 4px;
  padding: 0.5em 1.3em;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all var(--pfx-transition);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  margin-right: 0.5rem;
  margin-bottom: 0.4rem;
}

.hero .md-button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.hero .md-button--primary {
  background-color: #fff;
  border-color: #fff;
  color: var(--pfx-primary);
}

.hero .md-button--primary:hover {
  background-color: rgba(255, 255, 255, 0.9);
}

/* ===================================================================
   FEATURE CARDS
   =================================================================== */
.grid.cards > ul {
  gap: 0.65rem;
}

.grid.cards > ul > li {
  border: 1px solid var(--pfx-border);
  border-radius: var(--pfx-radius);
  padding: 1.1rem 1.1rem 1rem;
  box-shadow: none;
  transition: box-shadow var(--pfx-transition),
              border-color var(--pfx-transition);
}

.grid.cards > ul > li:hover {
  box-shadow: var(--pfx-shadow-md);
  border-color: rgba(30, 58, 95, 0.2);
}

[data-md-color-scheme="slate"] .grid.cards > ul > li {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

[data-md-color-scheme="slate"] .grid.cards > ul > li:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.grid.cards > ul > li > p:first-child {
  font-size: 0.88rem;
}

/* ===================================================================
   CODE BLOCKS
   =================================================================== */
.md-typeset pre {
  border-radius: var(--pfx-radius);
  border: 1px solid var(--pfx-border);
  box-shadow: none;
}

.md-typeset pre > code {
  font-size: 0.76rem;
  line-height: 1.6;
}

.md-clipboard {
  border-radius: 4px;
}

/* Code preview section on index */
.code-preview {
  margin: 1.5rem 0 2rem;
  padding: 0;
  border-radius: var(--pfx-radius-lg);
  overflow: hidden;
  border: 1px solid var(--pfx-border);
}

.code-preview .code-preview__header {
  background: var(--pfx-primary);
  color: #fff;
  padding: 0.7rem 1.2rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.code-preview .code-preview__header::before {
  content: ">";
  font-family: var(--md-code-font-family);
  opacity: 0.5;
}

.code-preview pre {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* ===================================================================
   BUTTONS (general, outside hero)
   =================================================================== */
.md-typeset .md-button {
  border-radius: 4px;
  padding: 0.5em 1.2em;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all var(--pfx-transition);
}

.md-typeset .md-button--primary {
  background: var(--pfx-primary);
  border-color: var(--pfx-primary);
  color: #fff;
}

.md-typeset .md-button--primary:hover {
  background: var(--pfx-primary-light);
  border-color: var(--pfx-primary-light);
}

.md-typeset .md-button:not(.md-button--primary) {
  border: 1.5px solid var(--pfx-accent-muted);
  color: var(--pfx-primary);
}

.md-typeset .md-button:not(.md-button--primary):hover {
  background: rgba(30, 58, 95, 0.05);
  border-color: var(--pfx-primary);
}

[data-md-color-scheme="slate"] .md-typeset .md-button:not(.md-button--primary) {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
}

[data-md-color-scheme="slate"] .md-typeset .md-button:not(.md-button--primary):hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===================================================================
   ADMONITIONS
   =================================================================== */
.md-typeset .admonition,
.md-typeset details {
  border-radius: var(--pfx-radius);
  box-shadow: none;
  border-width: 0 0 0 3px;
}

.md-typeset .admonition > .admonition-title,
.md-typeset details > summary {
  font-weight: 600;
  font-size: 0.82rem;
}

/* ===================================================================
   TABLES
   =================================================================== */
.md-typeset table:not([class]) {
  border-radius: var(--pfx-radius);
  overflow: hidden;
  border: 1px solid var(--pfx-border);
  font-size: 0.82rem;
}

.md-typeset table:not([class]) th {
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===================================================================
   LINKS
   =================================================================== */
.md-typeset a {
  transition: color var(--pfx-transition);
}

.md-content a:not(.md-button):not(.headerlink) {
  text-decoration-color: rgba(30, 58, 95, 0.25);
  text-underline-offset: 2px;
}

.md-content a:not(.md-button):not(.headerlink):hover {
  text-decoration-color: var(--pfx-primary);
}

/* ===================================================================
   NAV CARDS (index page "Start here" section)
   =================================================================== */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 1.5rem;
}

.nav-cards a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: var(--pfx-radius);
  border: 1px solid var(--pfx-border);
  text-decoration: none !important;
  color: inherit;
  transition: all var(--pfx-transition);
}

.nav-cards a:hover {
  box-shadow: var(--pfx-shadow-sm);
  border-color: rgba(30, 58, 95, 0.2);
  background: rgba(30, 58, 95, 0.02);
}

.nav-cards a .twemoji {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.nav-cards a strong {
  display: block;
  font-size: 0.8rem;
}

.nav-cards a span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.55;
  margin-top: 0.1rem;
}

[data-md-color-scheme="slate"] .nav-cards a {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-md-color-scheme="slate"] .nav-cards a:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

/* ===================================================================
   FOOTER
   =================================================================== */
.md-footer {
  border-top: 2px solid var(--pfx-primary);
}

/* ===================================================================
   SEARCH
   =================================================================== */
.md-search__form {
  border-radius: 4px;
}

/* ===================================================================
   SECTION DIVIDERS
   =================================================================== */
.section-divider {
  border: none;
  height: 1px;
  background: var(--pfx-border);
  margin: 2rem 0;
}

/* ===================================================================
   SCOPE LIST
   =================================================================== */
.scope-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.4rem 1.2rem;
  margin: 0.8rem 0;
  padding: 0;
  list-style: none;
}

.scope-list li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0;
  font-size: 0.82rem;
}

.scope-list li::before {
  content: "\2014";
  color: var(--pfx-accent-muted);
  flex-shrink: 0;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.4rem 1.8rem;
    margin: 0 -0.4rem 1.5rem;
  }

  .hero h2 {
    font-size: 1.3rem;
  }

  .hero p {
    font-size: 0.84rem;
  }

  .md-typeset h1 {
    font-size: 1.4rem;
  }

  .nav-cards {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .nav-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===================================================================
   SCROLLBAR
   =================================================================== */
.md-sidebar__scrollwrap::-webkit-scrollbar {
  width: 3px;
}

.md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
  background: rgba(30, 58, 95, 0.15);
  border-radius: 3px;
}

.md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 58, 95, 0.3);
}
