/*
===============================================================================
PhyloGNN Documentation Theme
Custom CSS for Sphinx + sphinx_rtd_theme
===============================================================================
*/

:root {
  --phylognn-accent: #1f6f68;
  --phylognn-accent-dark: #15524d;
  --phylognn-border: #d8dee4;
  --phylognn-code-bg: #eef7f5;
  --phylognn-code-border: #b9d9d4;
  --phylognn-surface: #f7f9fb;
  --phylognn-radius: 8px;
  --phylognn-shadow: 0 8px 24px rgb(31 111 104 / 0.08);
}

/*
===============================================================================
Global typography
===============================================================================
*/

body {
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

/* Wider content area for better table rendering */
.wy-nav-content {
  max-width: 1100px;
}

.rst-content,
.rst-content p {
  overflow-wrap: break-word;
}

.rst-content a {
  color: #1c6387;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 0.08em;
}

.rst-content a:hover {
  color: #154a66;
  text-decoration-thickness: 0.12em;
}

/*
===============================================================================
Sidebar
===============================================================================
*/

.wy-side-nav-search {
  background: var(--phylognn-accent);
}

.wy-menu-vertical {
  font-size: 0.94rem;
}

.wy-menu-vertical a {
  overflow-wrap: anywhere;
}

.wy-menu-vertical li.current > a,
.wy-menu-vertical li.toctree-l1.current > a {
  font-weight: 700;
}

/*
===============================================================================
Headings
===============================================================================
*/

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin-bottom: 1rem;
}

h2 {
  margin-top: 2.1rem;
  padding-top: 0.2rem;
}

h3 {
  margin-top: 1.45rem;
}

/*
===============================================================================
Text blocks
===============================================================================
*/

p,
li,
dd,
.field-list p {
  line-height: 1.65;
}

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

.hero {
  border-bottom: 1px solid var(--phylognn-border);
  margin-bottom: 1.8rem;
  padding: 1rem 0 1.6rem;
}

.hero p {
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 760px;
}

.hero p:first-child {
  color: var(--phylognn-accent-dark);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.hero-actions a {
  align-items: center;
  border: 1px solid var(--phylognn-accent);
  border-radius: var(--phylognn-radius);
  display: inline-flex;
  font-weight: 700;
  min-height: 2.35rem;
  padding: 0.35rem 0.75rem;
  text-decoration: none;
}

.hero-actions a:first-child {
  background: var(--phylognn-accent);
  color: #ffffff;
}

.hero-actions a:hover {
  box-shadow: var(--phylognn-shadow);
}

/*
===============================================================================
Entry cards
===============================================================================
*/

.entry-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 1.2rem 0 1.6rem;
}

.entry-card {
  border: 1px solid var(--phylognn-border);
  border-radius: var(--phylognn-radius);
  padding: 1rem;
  background: var(--phylognn-surface);
  min-height: 9.5rem;
}

.entry-card p {
  margin-bottom: 0;
}

.entry-card strong {
  color: var(--phylognn-accent-dark);
  display: block;
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

.entry-card a {
  display: inline-block;
  font-weight: 700;
  margin-top: 0.45rem;
}

/*
===============================================================================
Workflow strip
===============================================================================
*/

.workflow-strip {
  border-left: 4px solid var(--phylognn-accent);
  background: var(--phylognn-surface);
  margin: 1.2rem 0 1.8rem;
  padding: 0.45rem 1rem;
}

/*
===============================================================================
Inline code and code blocks
===============================================================================
*/

code.literal {
  background: var(--phylognn-code-bg);
  border: 1px solid var(--phylognn-code-border);
  border-radius: 5px;
  color: #24313f;
  font-size: 0.91em;
  padding: 0.06rem 0.28rem;
  white-space: normal;
  word-break: break-word;
}

a code.literal {
  color: #1c6387;
}

pre,
div.highlight {
  border-radius: var(--phylognn-radius);
}

div.highlight pre {
  font-size: 0.91rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

/*
===============================================================================
Tables
===============================================================================
*/

/* Responsive wrapper provided by sphinx_rtd_theme */
.wy-table-responsive {
  overflow-x: auto;
}

/* Main table styling */
.wy-table-responsive table.docutils,
.rst-content table.docutils {
  display: table;
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  margin: 1rem 0 1.35rem;
}

/* Table headers */
.wy-table-responsive table.docutils th,
.rst-content table.docutils th {
  background: var(--phylognn-surface);
  font-weight: 700;
}

/* Table cells */
.wy-table-responsive table.docutils th,
.wy-table-responsive table.docutils td,
.rst-content table.docutils th,
.rst-content table.docutils td {
  padding: 0.58rem 0.7rem;
  vertical-align: top;

  /* Allow line wrapping */
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

/*
===============================================================================
Admonitions
===============================================================================
*/

.admonition,
.topic {
  margin: 1.25rem 0;
}

.admonition {
  border-radius: var(--phylognn-radius);
  box-shadow: none;
}

.admonition-title {
  overflow-wrap: anywhere;
}

/*
===============================================================================
Field lists and API docs
===============================================================================
*/

dl.field-list {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  row-gap: 0.35rem;
}

dl.py.class,
dl.py.function,
dl.py.method,
dl.py.exception {
  border-top: 1px solid var(--phylognn-border);
  margin-top: 1.35rem;
  padding-top: 1rem;
}

dl.py dt {
  border-radius: var(--phylognn-radius);
  overflow-wrap: anywhere;
}

dl.py sig,
dl.py .sig {
  line-height: 1.55;
}

dl.py .sig-name {
  font-weight: 800;
}

dl.py dd {
  margin-left: 1rem;
}

.field-list,
.option-list {
  overflow-wrap: anywhere;
}

/*
===============================================================================
Toctree
===============================================================================
*/

.toctree-wrapper ul {
  line-height: 1.55;
}

/*
===============================================================================
Mobile optimizations
===============================================================================
*/

@media (max-width: 720px) {
  .hero {
    padding-top: 0.7rem;
  }

  .hero p:first-child {
    font-size: 1.1rem;
  }

  .hero-actions a {
    width: 100%;
  }

  .entry-card {
    min-height: auto;
  }

  div.highlight pre {
    font-size: 0.84rem;
  }

  dl.field-list {
    display: block;
  }

  dl.py dd {
    margin-left: 0;
  }
}