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

/* ========================================================================
   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;

  /* Status colors */
  --color-success: #4caf50;

  /* Stem category backgrounds - subtle tints for type-based highlighting */
  --stem-base-bg: oklch(92% 0.08 220); /* soft blue */
  --stem-modified-bg: oklch(92% 0.1 70); /* soft amber */
  --stem-future-bg: oklch(92% 0.08 170); /* soft teal */

  /* 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: Intentional duplication fixes font-size rendering bug */
  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;
}

/* ========================================================================
   Visually Hidden (screen reader only)
   ======================================================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================================================
   Hidden (display none)
   ======================================================================== */
/* Note: !important is intentional for this utility class to override all other styles */
.hidden {
  display: none !important;
}

/* ========================================================================
   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);
}

/* Focus styles for text entry fields - no visible indicator except cursor */
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
}

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);
  }
}

/* ========================================================================
   Facts Page
   ======================================================================== */

.facts-section {
  margin-bottom: 3rem;
}

.facts-section h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border-light);
  font-size: 1.8rem;
}

.facts-section h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
  color: var(--color-text);
}

.facts-section h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

/* Stats cards */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.facts-card {
  padding: 1.5rem;
  background: var(--color-bg-lightest);
  border-radius: 8px;
  border: 1px solid var(--color-border-light);
  text-align: center;
}

.facts-stat-big {
  font-size: 3rem;
  font-weight: bold;
  color: var(--color-link);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.facts-stat-label {
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 500;
}

.facts-detail {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Tables */
.facts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.facts-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border-light);
  font-weight: 600;
  font-size: 0.95rem;
}

.facts-table td {
  padding: 0.75rem;
  border: 1px solid var(--color-border-light);
  vertical-align: top;
}

.facts-table tr:hover {
  background: var(--color-bg-lightest);
}

/* Lists */
.facts-list-two-column {
  columns: 2;
  column-gap: 2rem;
}

.facts-list-two-column ul {
  margin: 0.5rem 0;
}

.facts-list-two-column li {
  break-inside: avoid;
}

/* Verb families */
.facts-verb-family {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--color-bg-lightest);
  border-left: 4px solid var(--color-link);
}

.facts-verb-family h4 {
  margin-top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.facts-verb-family .count {
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--color-text-muted);
}

/* Callouts */
.facts-callout {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--color-bg-subtle);
  border-left: 4px solid var(--color-link);
  border-radius: 4px;
}

.facts-callout p {
  margin: 0;
}

/* Definition list */
.facts-definitions dt {
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: 1.5rem;
  color: var(--color-text);
}

.facts-definitions dd {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

/* Notes */
.facts-note {
  padding: 1rem;
  background: var(--color-bg-subtle);
  border-left: 3px solid var(--color-border-light);
  margin: 1rem 0;
  font-size: 0.95rem;
}

/* Example text */
.example {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .facts-list-two-column {
    columns: 1;
  }

  .facts-grid {
    grid-template-columns: 1fr;
  }

  .facts-stat-big {
    font-size: 2.5rem;
  }

  .facts-table {
    font-size: 0.9rem;
  }

  .facts-table th,
  .facts-table td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .facts-section h2 {
    font-size: 1.5rem;
  }

  .facts-section h3 {
    font-size: 1.2rem;
  }

  .facts-stat-big {
    font-size: 2rem;
  }
}

/* ========================================================================
   Regularity Indicators
   ======================================================================== */
.regularity-icon {
  font-size: 0.75em;
  margin-left: 0.3em;
  padding: 0.05em 0.2em;
  border-radius: 2px;
  font-weight: bold;
  vertical-align: middle;
}

.regularity-icon.regular {
  background: var(--color-success);
  color: white;
}

/* ========================================================================
   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) ">";
  }
}
