/* ================================================================
   AutoEmail — Modern Documentation Styles
   ================================================================ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  --ae-blue:       #2563eb;
  --ae-blue-light: #60a5fa;
  --ae-blue-dark:  #1d4ed8;
  --ae-cyan:       #06b6d4;
  --ae-sky:        #38bdf8;

  --ae-surface-1:    rgba(37, 99, 235, 0.05);
  --ae-surface-2:    rgba(37, 99, 235, 0.09);
  --ae-border:       rgba(37, 99, 235, 0.14);

  --md-primary-fg-color:        #2563eb;
  --md-primary-fg-color--light: #60a5fa;
  --md-primary-fg-color--dark:  #1d4ed8;
  --md-accent-fg-color:         #f59e0b;

  --md-text-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --md-code-font: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color:           #0a0d14;
  --md-default-bg-color--light:    #111520;
  --md-default-bg-color--lighter:  #161c2a;
  --md-default-fg-color--light:    #94a3b8;
  --md-code-bg-color:              #111520;

  --ae-surface-1: rgba(37, 99, 235, 0.08);
  --ae-surface-2: rgba(37, 99, 235, 0.14);
  --ae-border:    rgba(96, 165, 250, 0.16);
}

/* ── Global ─────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

.md-grid {
  max-width: 1440px;
}

/* ── Header ─────────────────────────────────────────────────────── */
.md-header {
  background: linear-gradient(135deg, var(--ae-blue-dark) 0%, var(--ae-blue) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 24px rgba(29, 78, 216, 0.35);
}

.md-header__title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Navigation Tabs ─────────────────────────────────────────────── */
.md-tabs {
  background: rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.md-tabs__link--active,
.md-tabs__link:hover {
  font-weight: 600;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.md-nav__title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ae-blue);
  padding-left: 0.6rem;
}

.md-nav__link {
  font-size: 0.78rem;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.md-nav__link--active {
  color: var(--ae-blue-light) !important;
  font-weight: 600;
}

/* ── Typography ──────────────────────────────────────────────────── */
.md-typeset h1 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.md-typeset h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--ae-border);
}

.md-typeset h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Inline Code ─────────────────────────────────────────────────── */
code:not(.highlight code) {
  background: var(--ae-surface-1);
  border: 1px solid var(--ae-border);
  border-radius: 5px;
  padding: 0.12em 0.42em;
  font-size: 0.87em;
  color: var(--ae-blue-light);
}

[data-md-color-scheme="slate"] code:not(.highlight code) {
  color: var(--ae-blue-light);
}

/* ── Code Blocks ─────────────────────────────────────────────────── */
.highlight {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ae-border);
}

.highlight code {
  font-size: 0.84em;
  line-height: 1.7;
}

/* ── Admonitions ─────────────────────────────────────────────────── */
.admonition {
  border-radius: 10px;
  border-width: 1px;
  border-style: solid;
  box-shadow: none;
}

.admonition-title {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 8px 8px 0 0;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.md-typeset table:not([class]) {
  display: table;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ae-border);
  box-shadow: none;
}

.md-typeset table:not([class]) th {
  background: var(--ae-surface-2);
  color: var(--md-default-fg-color);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--ae-border);
}

.md-typeset table:not([class]) td {
  font-size: 0.87rem;
  border-bottom: 1px solid var(--ae-border);
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tr:hover td {
  background: var(--ae-surface-1);
  transition: background 0.12s;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.md-button {
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  text-transform: none;
  padding: 0.6em 1.5em;
  transition: all 0.18s;
}

.md-button--primary {
  background: var(--ae-blue);
  border-color: var(--ae-blue);
}

.md-button--primary:hover {
  background: var(--ae-blue-dark);
  border-color: var(--ae-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.md-button:not(.md-button--primary):hover {
  border-color: var(--ae-blue);
  color: var(--ae-blue);
  transform: translateY(-1px);
}

/* ── Search ──────────────────────────────────────────────────────── */
.md-search__form {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

/* ── Tabs (pymdownx.tabbed) ──────────────────────────────────────── */
.md-typeset .tabbed-set {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ae-border);
}

.md-typeset .tabbed-labels {
  background: var(--ae-surface-1);
  border-bottom: 1px solid var(--ae-border);
  gap: 0;
  padding: 0;
}

.md-typeset .tabbed-labels > label {
  font-weight: 600;
  font-size: 0.83rem;
  padding: 0.65rem 1.2rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  margin: 0;
}

.md-typeset .tabbed-labels > label:hover {
  background: var(--ae-surface-2);
}

.md-typeset .tabbed-content {
  padding: 0;
}

.md-typeset .tabbed-content .highlight {
  border-radius: 0;
  border: none;
  margin: 0;
}

/* ── Copy Button ─────────────────────────────────────────────────── */
.md-clipboard {
  border-radius: 5px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.md-clipboard:hover {
  opacity: 1;
}

/* ── API Reference ───────────────────────────────────────────────── */
.doc-heading {
  border-bottom: 2px solid var(--ae-border);
  padding-bottom: 0.5rem;
}

.doc-signature {
  background: var(--ae-surface-1);
  border: 1px solid var(--ae-border);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.md-footer {
  border-top: 1px solid var(--ae-border);
}

/* ── Hero Section ────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 55% at 50% -5%,
    rgba(37, 99, 235, 0.16) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero img {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.2),
    0 12px 36px rgba(37, 99, 235, 0.32);
  margin-bottom: 1.75rem;
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.8rem;
  background: linear-gradient(
    135deg,
    var(--ae-blue-dark) 0%,
    var(--ae-blue) 35%,
    var(--ae-sky) 70%,
    var(--ae-cyan) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p,
.hero > strong {
  display: block;
  font-size: 1.15rem;
  color: var(--md-default-fg-color--light);
  max-width: 500px;
  margin: 0 auto 2.25rem;
  font-weight: 400;
  line-height: 1.65;
}

/* ── Feature Grid ────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0;
}

.feature-item {
  background: var(--ae-surface-1);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--ae-border);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

/* Animated top-border bar on hover */
.feature-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--ae-blue), var(--ae-cyan));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-item:hover {
  border-color: rgba(37, 99, 235, 0.32);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.13);
}

.feature-item:hover::before {
  transform: scaleX(1);
}

.feature-item strong:first-child,
.feature-item > p > strong:first-child {
  display: block;
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--ae-blue-light);
  margin-bottom: 0.45rem;
}

.feature-item p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--md-default-fg-color--light);
  line-height: 1.55;
}

/* ── Material Grid Cards (index quickstart) ──────────────────────── */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > ol > li {
  border: 1px solid var(--ae-border);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > ol > li:hover {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.6em;
  font-size: 0.7em;
  font-weight: 700;
  border-radius: 6px;
  background: var(--ae-surface-2);
  color: var(--ae-blue-light);
  border: 1px solid var(--ae-border);
  margin-right: 0.4em;
  vertical-align: middle;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge--new  { background: rgba(0, 200, 83, 0.1);  color: #00c853; border-color: rgba(0, 200, 83, 0.25); }
.badge--beta { background: rgba(255, 145, 0, 0.1); color: #ff9100; border-color: rgba(255, 145, 0, 0.25); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media screen and (max-width: 76.25em) {
  .hero h1     { font-size: 2.4rem; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

@media screen and (max-width: 44.9375em) {
  .hero         { padding: 3rem 1rem 2.5rem; }
  .hero h1      { font-size: 2rem; }
  .hero img     { width: 72px; height: 72px; }
  .feature-grid { grid-template-columns: 1fr; }
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  .md-header, .md-footer, .md-sidebar { display: none; }
}
