/* CSS Variables from Material for MkDocs */
:root {
  --md-default-fg-color: rgba(0, 0, 0, 0.87);
  --md-default-fg-color--light: rgba(0, 0, 0, 0.54);
  --md-default-fg-color--lighter: rgba(0, 0, 0, 0.32);
  --md-default-fg-color--lightest: rgba(0, 0, 0, 0.07);
  --md-code-fg-color: #36464e;
  --md-code-bg-color: #f5f5f5;
  --md-primary-fg-color: #4051b5;
  --md-accent-fg-color: #526cfe;
  --md-typeset-a-color: var(--md-primary-fg-color);
  --md-text-font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --md-code-font: "Roboto Mono", "SF Mono", Monaco, "Cascadia Code", Consolas, "Courier New", monospace;
  --hs-success: #059669;
  --hs-success-bg: #d1fae5;
  --hs-error: #dc2626;
  --hs-error-bg: #fee2e2;
  --hs-warning-text: #92400e;
  --hs-warning-bg: #fef3c7;
  --hs-warning-border: #f59e0b;
  --hs-border: #e5e7eb;
  --hs-bg: #ffffff;
  --hs-focus-ring: #4051b5;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --md-default-fg-color: rgba(255, 255, 255, 0.87);
    --md-default-fg-color--light: rgba(255, 255, 255, 0.6);
    --md-default-fg-color--lighter: rgba(255, 255, 255, 0.38);
    --md-default-fg-color--lightest: rgba(255, 255, 255, 0.07);
    --md-code-fg-color: #c9d1d9;
    --md-code-bg-color: #1e1e1e;
    --md-primary-fg-color: #7b8fdb;
    --md-accent-fg-color: #8fa4ff;
    --md-typeset-a-color: var(--md-primary-fg-color);
    --hs-success: #34d399;
    --hs-success-bg: #064e3b;
    --hs-error: #f87171;
    --hs-error-bg: #450a0a;
    --hs-warning-text: #fbbf24;
    --hs-warning-bg: #451a03;
    --hs-warning-border: #d97706;
    --hs-border: #374151;
    --hs-bg: #111827;
    --hs-focus-ring: #7b8fdb;
  }
}

/* Base Typography - 1rem (16px) avoids iOS auto-zoom on inputs */
.md-typeset {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--md-default-fg-color);
  font-family: var(--md-text-font);
  overflow-wrap: break-word;
  text-align: left;
}

/* Headings */
.md-typeset h1 {
  color: var(--md-default-fg-color--light);
  font-size: 2em;
  line-height: 1.3;
  margin: 0 0 1.25em;
  font-weight: 300;
  letter-spacing: -0.01em;
}

.md-typeset h1:not(:first-child) {
  margin-top: 2em;
}

.md-typeset h2 {
  font-size: 1.5625em;
  line-height: 1.4;
  margin: 2.4em 0 0.64em;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--md-default-fg-color--light);
}

.md-typeset h3 {
  font-size: 1.25em;
  line-height: 1.5;
  margin: 2em 0 0.8em;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--md-default-fg-color--light);
}

/* Paragraphs and block elements */
.md-typeset p {
  margin: 1em 0;
}

.md-typeset blockquote,
.md-typeset dl,
.md-typeset figure,
.md-typeset ol,
.md-typeset pre,
.md-typeset ul {
  margin-bottom: 1em;
  margin-top: 1em;
}

/* Lists */
.md-typeset ol,
.md-typeset ul {
  padding-left: 2em;
}

.md-typeset li {
  margin-bottom: 0.25em;
}

/* Links - underline for accessibility (don't rely on color alone) */
.md-typeset a {
  color: var(--md-typeset-a-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  word-break: break-word;
  cursor: pointer;
}

.md-typeset a:hover,
.md-typeset a:focus {
  color: var(--md-accent-fg-color);
  text-decoration-thickness: 2px;
}

/* Focus styles - visible ring for keyboard navigation */
.md-typeset a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--hs-focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Code (inline) */
.md-typeset code {
  background-color: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  border-radius: 0.1rem;
  font-size: 0.85em;
  font-family: var(--md-code-font);
  padding: 0 0.2941176471em;
  word-break: break-word;
}

/* Code blocks (pre) */
.md-typeset pre {
  display: block;
  line-height: 1.4;
  margin: 1em 0;
  overflow-x: auto;
}

.md-typeset pre > code {
  background-color: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  display: block;
  padding: 0.7720588235em 1.1764705882em;
  font-family: var(--md-code-font);
  font-size: 0.85em;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: pre-wrap;
  border-radius: 0.25rem;
}

/* Links in code */
.md-typeset a code {
  color: currentcolor;
}

/* Buttons - styled via CSS for hover/active/focus pseudo-classes */
.md-typeset button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--md-text-font);
  line-height: 1;
  color: #ffffff;
  background-color: var(--md-primary-fg-color);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  min-height: 44px;
  transition:
    background-color 150ms ease-out,
    box-shadow 150ms ease-out;
}

.md-typeset button:hover {
  background-color: var(--md-accent-fg-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.md-typeset button:active {
  transform: translateY(1px);
}

/* Logo */
.headscale-logo {
  display: block;
  width: 400px;
  max-width: 100%;
  height: auto;
  margin: 0 0 3rem 0;
  padding: 0;
}

@media (max-width: 768px) {
  .headscale-logo {
    width: 200px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
