/* ═══════════════════════════════════════════════════════════
   Jäntra AI — shared stylesheet for every page
   Loaded by index.html, jobs.html, and all article-*.html files.

   Sections:
     1. Tokens (palette, spacing, type scale)
     2. Base elements (reset, links, headings, media)
     3. Site header
     4. Main / footer
     5. Bottom nav
     6. Fixed chrome (page size + back to top)
     7. Responsive (shared)
     8. Home page  — .article-list grid          (index.html)
     9. Jobs page  — intro, contents, positions   (jobs.html)
    10. Article page — header, hero, body, quotes  (article-*.html)
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. Tokens — palette from solar.lowtechmagazine.com
───────────────────────────────────────────── */
:root {
  --color-bg:      #fff5d1;
  --color-primary: #000;
  --color-sub:     rgba(0, 0, 0, 0.49); /* warm grey: cream bg shows through */
  --monospace:     "Courier", "Courier New", monospace;

  --pad-small:  0.25rem;
  --pad:        0.5rem;
  --pad-large:  1rem;
  --pad-xlarge: 2rem;

  --font-xlarge: 2.5rem;
  --font-large:  2rem;
  --font-medium: 1.4rem;
  --font-body:   1rem;
  --font-small:  0.7rem;
}

/* ─────────────────────────────────────────────
   2. Base elements
───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; padding: 0; margin: 0; }

html { font-size: 20px; scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-primary);
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.4;
  padding: var(--pad-large);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  padding-bottom: 0.05em;
  border-bottom: 1px solid;
}
a:hover { color: var(--color-sub); }

/* Headings */
h1, h2, h3, h4 { font-weight: normal; }

h1 {
  font-size: var(--font-xlarge);
  line-height: 1;
  text-transform: uppercase;
  text-indent: -0.15rem;
}

img { width: 100%; display: block; }

/* ═══════════════════════════════════════════
   3. HEADER
═══════════════════════════════════════════ */
.site-header {
  position: relative;
  padding: var(--pad) 0;
  margin-bottom: var(--pad-large);
}

.site-header h1 a {
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: var(--pad);
}

.site-header h1 a .site-name {
  font-size: var(--font-xlarge);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: normal;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: none;
  color: var(--color-primary);
  white-space: nowrap;
}

.header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--pad-small);
  margin-bottom: var(--pad);
}

.site-logo {
  height: var(--font-xlarge);
  width: auto;
  display: block;
}

.subtitle {
  font-size: var(--font-body);
  line-height: 1.2;
  margin: 0;
}
.subtitle a { border-bottom: none; }

/* Pipe-separated nav */
nav#menu {
  font-family: var(--monospace);
  font-size: var(--font-small);
}
nav#menu a { border-bottom: none; }
nav#menu ul { list-style: none; }
nav#menu ul li { display: inline-block; }
nav#menu ul li + li::before { content: " | "; color: var(--color-sub); }

/* Status bar top-right */
#battery-bar {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--monospace);
  font-size: var(--font-small);
  text-align: right;
  color: var(--color-sub);
  line-height: 1.4;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   4. MAIN / FOOTER
═══════════════════════════════════════════ */
main, footer {
  border-top: 2px solid var(--color-primary);
}

main { padding: var(--pad) 0; }

footer {
  padding: var(--pad) 0;
  font-family: var(--monospace);
  font-size: var(--font-small);
  color: var(--color-sub);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pad-small);
}

footer a {
  color: var(--color-sub);
  border-bottom: 1px solid var(--color-sub);
}

footer a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ═══════════════════════════════════════════
   5. BOTTOM NAV
═══════════════════════════════════════════ */
.bottom-nav {
  border-top: 1px solid var(--color-primary);
  padding-top: var(--pad);
  margin-top: var(--pad-xlarge);
  font-family: var(--monospace);
  font-size: var(--font-small);
}
.bottom-nav ul { list-style: none; }
.bottom-nav ul li { display: inline-block; }
.bottom-nav ul li + li::before { content: " | "; color: var(--color-sub); }
.bottom-nav a { border-bottom: none; }

/* ═══════════════════════════════════════════
   6. FIXED CHROME — page size + back to top
═══════════════════════════════════════════ */
#page-size {
  font-family: var(--monospace);
  position: fixed;
  bottom: 5px;
  left: var(--pad-large);
  background: var(--color-bg);
  padding: var(--pad-small) var(--pad);
  font-size: var(--font-small);
}
#back-to-top {
  font-family: var(--monospace);
  position: fixed;
  bottom: 5px;
  right: var(--pad-large);
  background: var(--color-bg);
  padding: var(--pad-small) var(--pad);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-size: var(--font-small);
}
#back-to-top a { border-bottom: none; }
body.scrolled #back-to-top { opacity: 1; pointer-events: auto; }

/* ═══════════════════════════════════════════
   7. RESPONSIVE (shared)
═══════════════════════════════════════════ */
@media only screen and (max-width: 550px) {
  .site-logo { height: var(--font-large); }
  #battery-bar {
    position: static;
    text-align: left;
    margin-bottom: var(--pad-large);
  }
  #page-size, #back-to-top { display: none; }
}

/* Date/meta — monospace small, like LTM's <time> (home + jobs) */
.card-meta {
  display: block;
  font-family: var(--monospace);
  font-size: var(--font-small);
  color: var(--color-sub);
  margin-bottom: var(--pad-small);
}

/* ═══════════════════════════════════════════
   8. HOME PAGE — article list grid (index.html)
   Matches LTM's .grid — 4 columns
═══════════════════════════════════════════ */
.article-list {
  list-style: none;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--pad-large);
  margin-top: var(--pad-large);
}

.article-list li a {
  border-bottom: none;
  display: block;
}

/* Cover card: full-width, image right 3 cols */
li.cover {
  grid-column: 1 / -1;
}

li.cover > a {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--pad-large);
}

li.cover .card-text {
  grid-column: 1 / 2;
}

li.cover .card-image {
  grid-column: 2 / -1;
  overflow: hidden;
  max-height: 500px;
}

li.cover .card-image img {
  height: 100%;
  object-fit: cover;
}

li.cover .entry-title {
  font-size: var(--font-large);
  line-height: 1.05;
  margin: 0 0 var(--pad);
}

li.cover .summary {
  font-size: var(--font-body);
  line-height: 1.3;
  color: var(--color-sub);
  margin-bottom: var(--pad);
}

/* Small cards */
li.article-card {
  grid-column: span 1;
}

li.article-card .card-image {
  overflow: hidden;
  height: 160px;
  margin-bottom: var(--pad-small);
}

li.article-card .card-image img {
  height: 100%;
  object-fit: cover;
}

li.article-card .entry-title {
  font-size: var(--font-body);
  line-height: 1.2;
  margin-bottom: var(--pad-small);
}

li.article-card .summary {
  font-size: var(--font-small);
  color: var(--color-sub);
  line-height: 1.3;
}

@media only screen and (max-width: 980px) {
  .article-list { grid-template-columns: repeat(2, 1fr); }
  li.cover > a { grid-template-columns: 1fr; }
  li.cover .card-text,
  li.cover .card-image { grid-column: span 1; }
  li.cover .card-image { max-height: 350px; }
}

@media only screen and (max-width: 550px) {
  .article-list { grid-template-columns: 1fr; }
  li.article-card { grid-column: span 1; }

  /* Single column: separate the cover from the stacked cards */
  li.cover {
    border-bottom: 1px solid var(--color-primary);
    padding-bottom: var(--pad-large);
  }
}

/* ═══════════════════════════════════════════
   9. JOBS PAGE (jobs.html)
═══════════════════════════════════════════ */
body.page-jobs main { padding: var(--pad-xlarge) 0; }

/* Intro + contents */
.page-intro {
  max-width: 40rem;
  margin-bottom: var(--pad-xlarge);
}

.page-intro .entry-title {
  font-size: var(--font-large);
  line-height: 1.05;
  margin-bottom: var(--pad-large);
}

.page-intro p {
  font-size: var(--font-body);
  color: var(--color-sub);
}

.contents {
  font-family: var(--monospace);
  font-size: var(--font-small);
  margin-bottom: 3rem;
}
.contents .card-meta { margin-bottom: var(--pad); }
.contents ul { list-style: none; }
.contents ul li { display: inline-block; }
.contents ul li + li::before { content: " | "; color: var(--color-sub); }
.contents a { border-bottom: none; }

/* Positions */
.position {
  max-width: 40rem;
  margin-bottom: 3.5rem;
  padding-top: var(--pad-xlarge);
  border-top: 1px solid var(--color-sub);
}

.position h2.entry-title {
  font-size: var(--font-medium);
  line-height: 1.1;
  margin-bottom: var(--pad);
}

.position .location {
  font-family: var(--monospace);
  font-size: var(--font-small);
  color: var(--color-sub);
  margin-bottom: var(--pad-xlarge);
}

.position p {
  font-size: var(--font-body);
  line-height: 1.5;
  margin-bottom: var(--pad-large);
}

.position h3 {
  font-family: var(--monospace);
  font-size: var(--font-small);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-sub);
  margin-top: var(--pad-xlarge);
  margin-bottom: var(--pad-large);
}

.position ul {
  list-style: none;
  margin-bottom: var(--pad-large);
}

.position ul li {
  font-size: var(--font-body);
  line-height: 1.5;
  padding-left: 1.4rem;
  position: relative;
  margin-bottom: var(--pad);
}

.position ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--color-sub);
}

.apply {
  margin-top: var(--pad-xlarge);
  font-family: var(--monospace);
  font-size: var(--font-small);
}

/* General inquiry block */
.inquiry {
  max-width: 40rem;
  padding-top: var(--pad-xlarge);
  border-top: 1px solid var(--color-sub);
}
.inquiry p { font-size: var(--font-body); line-height: 1.5; margin-bottom: var(--pad); }
.inquiry .sub { color: var(--color-sub); }
.inquiry .apply { margin-top: var(--pad-large); }

/* ═══════════════════════════════════════════
   10. ARTICLE PAGE (article-*.html)
═══════════════════════════════════════════ */
.article-header {
  margin: var(--pad-large) 0 var(--pad-xlarge);
}

.article-header .article-meta {
  display: block;
  font-family: var(--monospace);
  font-size: var(--font-small);
  color: var(--color-sub);
  margin-bottom: var(--pad);
}

.article-header h2 {
  font-size: var(--font-large);
  line-height: 1.05;
  margin-bottom: var(--pad);
  text-transform: uppercase;
}

.article-header .lede {
  font-size: var(--font-medium);
  line-height: 1.3;
  color: var(--color-sub);
  max-width: 38rem;
  margin-bottom: var(--pad-large);
}

/* Hero image — full width with caption */
.article-hero {
  margin-bottom: var(--pad-large);
}

.article-hero img {
  max-height: 520px;
  object-fit: cover;
}

.article-hero figcaption {
  font-family: var(--monospace);
  font-size: var(--font-small);
  color: var(--color-sub);
  margin-top: var(--pad-small);
}

/* Body text — two columns on wide screens */
.article-body {
  columns: 2;
  column-gap: var(--pad-xlarge);
  max-width: 80rem;
  margin: var(--pad-xlarge) 0;
  contain: layout;
}

.article-body p {
  margin-bottom: var(--pad-large);
  break-inside: avoid;
}

.article-body h3 {
  font-size: var(--font-body);
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: var(--pad-xlarge) 0 var(--pad-small);
  break-after: avoid;
}

/* Lists + display math (KaTeX articles) */
.article-body ul, .article-body .katex-display {
  break-inside: avoid;
}
.article-body ul {
  margin-bottom: var(--pad-large);
  margin-left: var(--pad-xlarge);
}
.katex-display {
  margin: var(--pad-large) 0;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

/* Pull-quote */
.pull-quote {
  columns: 1;
  border-top: 1px solid var(--color-primary);
  border-bottom: 1px solid var(--color-primary);
  padding: var(--pad-large) 0;
  margin: var(--pad-xlarge) 0;
  font-size: var(--font-medium);
  line-height: 1.2;
  max-width: 38rem;
}

@media only screen and (max-width: 780px) {
  .article-body {
    columns: 1;
  }
}
