/* ==========================================================================
   Geist Font Declarations
   ========================================================================== */

@font-face {
  font-family: 'Geist';
  src: url('/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/GeistMono-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
  /* Colors - Light Mode */
  --color-background: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #666666;
  --color-border: #e5e5e5;
  --color-code-bg: #f5f5f5;
  --color-accent: #0066cc;
  --color-accent-hover: #004499;

  /* Typography */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", Monaco, "Courier New", monospace;
  --font-size-base: 18px;
  --line-height-base: 1.7;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Layout */
  --content-max-width: 42rem;
  --border-radius: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Colors - Dark Mode */
    --color-background: #0f0f0f;
    --color-text: #e8e8e8;
    --color-text-secondary: #a0a0a0;
    --color-border: #2a2a2a;
    --color-code-bg: #1a1a1a;
    --color-accent: #4d9fff;
    --color-accent-hover: #80b3ff;
  }
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  margin: var(--spacing-xl) 0 var(--spacing-md);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

h1 {
  font-size: 2em;
  margin-top: 0;
}

h2 {
  font-size: 1.5em;
}

h3 {
  font-size: 1.25em;
}

h4, h5, h6 {
  font-size: 1em;
}

p {
  margin: 0 0 var(--spacing-md);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Remove underline from heading links */
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  color: var(--color-text);
  text-decoration: none;
}

h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
  text-decoration: none;
}

ul, ol {
  margin: 0 0 var(--spacing-md);
  padding-left: var(--spacing-lg);
}

li {
  margin-bottom: var(--spacing-xs);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

time {
  color: var(--color-text-secondary);
  font-size: 0.9em;
}

/* ==========================================================================
   Layout
   ========================================================================== */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  border-bottom: 1px solid var(--color-border);
}

header a {
  color: var(--color-text);
  font-weight: 500;
}

header a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

main {
  padding: 0 var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

@media (min-width: 600px) {
  main {
    padding: 0 var(--spacing-xl);
  }
}

.content {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

footer {
  margin-top: var(--spacing-2xl);
  padding: var(--spacing-xl) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9em;
}

footer a {
  color: var(--color-text-secondary);
}

footer a:hover {
  color: var(--color-text);
}

/* ==========================================================================
   Components
   ========================================================================== */

/* Blog Post Lists */
article {
  margin-bottom: var(--spacing-xl);
}

article h1 {
  margin-bottom: var(--spacing-sm);
}

article time {
  display: block;
  margin-bottom: var(--spacing-lg);
}

/* Simple blog list styling */
.blog-list ul {
  list-style: none;
  padding: 0;
}

.blog-list li {
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.blog-list li:last-child {
  border-bottom: none;
}

/* Code Blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-code-bg);
  padding: 0.15em 0.35em;
  border-radius: var(--border-radius);
}

pre {
  margin: var(--spacing-lg) 0;
  overflow-x: auto;
  background-color: var(--color-code-bg);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
}

pre code {
  display: block;
  line-height: 1.5;
  background: none;
}

/* Code blocks with line numbers using CSS counters */
pre.line-numbers code {
  padding: var(--spacing-md);
}

pre.line-numbers .line {
  counter-increment: line;
}

pre.line-numbers .line::before {
  content: counter(line);
  display: inline-block;
  min-width: 3em;
  text-align: right;
  margin-right: var(--spacing-md);
  padding-right: var(--spacing-md);
  border-right: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  user-select: none;
}

/* ==========================================================================
   Arborium Syntax Highlighting (Custom Elements)
   ========================================================================== */

/* Arborium color definitions - light mode */
:root {
  --arb-keyword: #0000ff;           /* Keywords (if, let, const, etc.) */
  --arb-function: #795e26;          /* Function names */
  --arb-string: #008000;            /* Strings */
  --arb-comment: #008000;           /* Comments */
  --arb-number: #098658;            /* Numbers */
  --arb-type: #267f99;              /* Types */
  --arb-variable: #001080;          /* Variables */
  --arb-property: #001080;          /* Properties */
  --arb-operator: #000000;          /* Operators */
  --arb-punctuation: #000000;       /* Punctuation */
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
  :root {
    --arb-keyword: #569cd6;         /* Keywords */
    --arb-function: #dcdcaa;        /* Function names */
    --arb-string: #ce9178;          /* Strings */
    --arb-comment: #6a9955;         /* Comments */
    --arb-number: #b5cea8;          /* Numbers */
    --arb-type: #4ec9b0;            /* Types */
    --arb-variable: #9cdcfe;        /* Variables */
    --arb-property: #9cdcfe;        /* Properties */
    --arb-operator: #d4d4d4;        /* Operators */
    --arb-punctuation: #d4d4d4;     /* Punctuation */
  }
}

/* Arborium custom element styles */
a-k { color: var(--arb-keyword); font-weight: 600; }      /* keyword */
a-f { color: var(--arb-function); }                        /* function */
a-s { color: var(--arb-string); }                          /* string */
a-c { color: var(--arb-comment); font-style: italic; }    /* comment */
a-n { color: var(--arb-number); }                          /* number */
a-t { color: var(--arb-type); }                            /* type */
a-v { color: var(--arb-variable); }                        /* variable */
a-pr { color: var(--arb-property); }                       /* property */
a-o { color: var(--arb-operator); }                        /* operator */
a-p { color: var(--arb-punctuation); }                     /* punctuation */
a-co { color: var(--arb-keyword); }                        /* constant */
a-l { color: var(--arb-string); }                          /* label */
a-m { color: var(--arb-function); }                        /* method */
a-ns { color: var(--arb-type); }                           /* namespace */
a-ma { color: var(--arb-keyword); }                        /* macro */

/* Tables */
table {
  width: 100%;
  margin: var(--spacing-lg) 0;
  border-collapse: collapse;
  border-radius: var(--border-radius);
  overflow: hidden;
}

th, td {
  padding: var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  background-color: var(--color-code-bg);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--color-code-bg);
}

/* Footnotes */
.footnote-definition p {
  display: inline;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* Responsive utilities */
.mobile {
  display: initial;
}

.not-mobile {
  display: none;
}

@media (min-width: 1025px) {
  .mobile {
    display: none;
  }

  .not-mobile {
    display: initial;
  }
}

/* ==========================================================================
   Login Form
   ========================================================================== */

.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 30px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: var(--color-background);
}

.login-container h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--color-text);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  background-color: var(--color-background);
  color: var(--color-text);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.login-container button[type="submit"] {
  width: 100%;
  padding: 12px;
  background-color: var(--color-accent);
  color: var(--color-text);
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
}

.login-container button[type="submit"]:hover {
  background-color: var(--color-accent-hover);
}
