/* ========================================================================
   Ertius Base CSS - Core styles shared across all ertius sites
   ======================================================================== */

/* ========================================================================
   CSS Custom Properties
   ======================================================================== */
:root {
  /* Colors */
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-text-muted: #666666;
  --color-text-subtle: #999999;
  --color-link: #0066cc;
  --color-link-hover: #0052a3;
  --color-border: #000000;
  --color-border-light: #cccccc;
  --color-bg-subtle: #f5f5f5;
  --color-bg-light: #f0f0f0;
  --color-bg-lightest: #f8f8f8;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;

  /* Font sizes */
  --font-size-small: 0.85em;
  --font-size-tiny: 0.75em;

  /* Layout */
  --max-width: 120ch;
}

/* ========================================================================
   Reset & Base
   ======================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* biome-ignore lint/suspicious/noDuplicateFontNames: Deliberate workaround for browser bug - https://github.com/necolas/normalize.css/issues/519 */
  font-family: monospace, monospace;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ========================================================================
   Typography
   ======================================================================== */
h1 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  font-size: 1.5em;
  font-weight: bold;
}

h2 {
  font-size: 1em;
  font-weight: normal;
  margin-top: 1.5em;
  margin-bottom: 0.8em;
}

h3 {
  font-size: 1em;
  font-weight: normal;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 0.8em;
}

strong {
  font-weight: bold;
}

/* ========================================================================
   Links
   ======================================================================== */
a {
  color: var(--color-link);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration: underline;
}

/* ========================================================================
   Header & Navigation
   ======================================================================== */
header {
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
  border: 5px solid var(--color-border);
  padding: 0.5em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

/* ========================================================================
   Skip to Content Link (Accessibility)
   ======================================================================== */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: -100%;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
  left: 0;
}

/* ========================================================================
   Blockquotes
   ======================================================================== */
blockquote {
  border-left: 4px solid #e0e0e0;
  padding-left: var(--space-md);
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: #555;
}

/* ========================================================================
   Lists
   ======================================================================== */
ul {
  margin-left: var(--space-lg);
  margin-bottom: 0.8em;
  list-style-type: none;
}

/* Opt-in multi-column layout for lists */
/* Can be applied directly: <ul class="multi-column"> */
/* Or via wrapper for markdown: <div class="multi-column">- item\n- item</div> */
ul.multi-column,
div.multi-column > ul {
  columns: 3;
  -webkit-columns: 3;
  -moz-columns: 3;
}

/* Two columns on medium screens */
@media only screen and (max-width: 1000px) {
  ul.multi-column,
  div.multi-column > ul {
    columns: 2;
    -webkit-columns: 2;
    -moz-columns: 2;
  }
}

/* One column on mobile */
@media only screen and (max-width: 600px) {
  ul.multi-column,
  div.multi-column > ul {
    columns: 1;
    -webkit-columns: 1;
    -moz-columns: 1;
  }
}

ul > li {
  margin-bottom: 0.3em;
  position: relative;
  padding-left: 1.5em;
}

ul > li:before {
  content: "→";
  position: absolute;
  left: 0;
}

/* Ordered lists - keep default numbering */
ol {
  margin-left: var(--space-lg);
  margin-bottom: 0.8em;
}

ol > li {
  margin-bottom: 0.3em;
}

/* ========================================================================
   Forms & Inputs
   ======================================================================== */
form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

form label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

input,
button {
  font-family: inherit;
  font-size: inherit;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
}

button {
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

button:hover {
  background: var(--color-border);
  color: var(--color-bg);
}

/* ========================================================================
   Code
   ======================================================================== */
code {
  font-family: "Courier New", Courier, monospace;
  background-color: var(--color-bg-lightest);
  padding: 0.1em 0.3em;
  font-size: 0.95em;
}

pre {
  font-family: "Courier New", Courier, monospace;
  background-color: var(--color-bg-lightest);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border-left: 3px solid var(--color-border-light);
}

/* ========================================================================
   Tables
   ======================================================================== */
table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: var(--space-md);
}

th,
td {
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.5rem;
  text-align: left;
}

th {
  background: var(--color-bg-light);
  font-weight: bold;
}

caption {
  text-align: left;
  font-weight: bold;
  padding: 0.5rem;
  background: var(--color-border);
  color: var(--color-bg);
}

/* ========================================================================
   Footer
   ======================================================================== */
footer {
  margin-top: 3em;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

footer p {
  margin: 0;
}

/* ========================================================================
   Responsive / Mobile
   ======================================================================== */
@media only screen and (max-width: 900px) {
  body {
    padding: 0 var(--space-sm);
  }
}

/* ========================================================================
   Print Styles
   ======================================================================== */
@media print {
  body {
    margin: var(--space-md);
    max-width: 100%;
  }

  a {
    text-decoration: none;
    font-weight: bold;
  }

  a[href]:after {
    content: " <" attr(href) ">";
  }
}
