/* ==========================================================================
   Jim Collinsworth — Out of My Lane
   Pure HTML & Modern CSS Design System
   Inspired by Bear Blog (pinewind) and Mark Boulton (anewcanon)
   Zero JavaScript • 99.9% Pure HTML5 • Automatic Dark Mode
   ========================================================================== */

:root {
  /* Warm paper / editorial light palette */
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-subtle: #f2eee6;
  --text: #222324;
  --text-muted: #67696b;
  --border: #e4dfd5;
  --border-subtle: #eeeae1;
  --link: #9a431c;
  --link-hover: #5d250c;
  --tag-bg: #ece7dc;
  --tag-text: #4d4f4c;
  --code-bg: #ece8de;

  /* Typography */
  --font-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  
  --max-width: 1080px;
  --line-height-body: 1.7;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Deep slate & warm charcoal dark palette */
    --bg: #141617;
    --bg-card: #1c1e20;
    --bg-subtle: #232628;
    --text: #e6e4df;
    --text-muted: #95989b;
    --border: #2e3235;
    --border-subtle: #25282a;
    --link: #df9155;
    --link-hover: #f1b380;
    --tag-bg: #292d30;
    --tag-text: #cac8c1;
    --code-bg: #222527;
  }
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 2.5rem 2rem 4rem;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: var(--line-height-body);
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-wrap: break-word;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Supersize Desktop (> 1360px) */
@media (min-width: 1360px) {
  :root {
    --max-width: 1380px;
  }
  body {
    padding: 3rem 3rem 5rem;
  }
}

/* Tablets (640px - 1024px) */
@media (max-width: 1024px) {
  body {
    padding: 2rem 1.75rem 3.5rem;
  }
}

/* Mobile (< 640px) */
@media (max-width: 640px) {
  html {
    font-size: 15.5px;
  }
  body {
    padding: 1.25rem 1rem 2.5rem;
  }
  .site-branding {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    margin-bottom: 1rem;
  }
  .site-title {
    font-size: 1.25rem;
  }
  .site-tagline {
    font-size: 0.95rem;
    font-weight: 500;
  }
}

/* Header & Navigation */
header.site-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-branding {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.site-title,
.site-tagline {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-title a:hover {
  color: var(--link);
}

.site-tagline {
  color: var(--text-muted);
}

nav.site-nav {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}

nav.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}

nav.site-nav a:hover {
  color: var(--link);
  border-bottom-color: var(--link);
}

nav.site-nav a.active {
  color: var(--link);
  border-bottom-color: var(--link);
  font-weight: 600;
}

/* Typography Hierarchy */
h1, h2, h3, h4 {
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-top: 2.25rem;
}

h3 {
  font-size: 1.15rem;
  margin-top: 1.75rem;
}

p {
  margin-top: 0;
  margin-bottom: 1.4rem;
}

/* Links */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: 1.4rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.35rem;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--border);
  background-color: var(--bg-subtle);
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Code & Preformatted */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background-color: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Horizontal Rule */
hr {
  border: 0;
  height: 1px;
  background-color: var(--border);
  margin: 2.5rem 0;
}

/* Metadata & Details */
.meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* Lanes & Category Links (Simple Text Links, No Pills) */
.lane-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin: 1.5rem 0 2.25rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.lane-link, .post-lane {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.lane-link:hover, .post-lane:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.lane-link.active {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
}

/* Prose Reading Measure */
article p, .page-intro p, .post-desc, .book-notes {
  max-width: 76ch;
}

/* Multi-Column Magazine Layouts */
.desktop-two-col {
  display: block;
}

@media (min-width: 960px), (min-width: 720px) and (orientation: landscape) {
  .desktop-two-col {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 3rem;
    align-items: start;
  }
}

@media (min-width: 1360px) {
  .desktop-two-col {
    grid-template-columns: 1.3fr 1fr;
    gap: 4.5rem;
  }
}

/* Post Listings & Adaptive Density */
.post-list, .book-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-item, .book-item {
  margin-bottom: 2.25rem;
}

.post-item.featured {
  padding-bottom: 2rem;
  margin-bottom: 2.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.post-item.featured .post-title {
  font-size: 1.45rem;
  line-height: 1.25;
}

.post-item.featured .post-desc {
  font-size: 1rem;
}

.post-header, .book-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.post-title, .book-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.post-title a, .book-title {
  color: var(--link);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.post-meta, .book-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-meta time, .book-meta time {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-desc, .book-notes {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.post-teaser {
  display: block;
}

.post-detail {
  display: block;
  margin-top: 0.5rem;
}

/* Density Adaptations for Small Screens / Mobile */
@media (max-width: 640px) {
  .post-item {
    margin-bottom: 1.75rem;
  }
  .post-title, .book-title {
    font-size: 1.15rem;
  }
  .post-detail {
    display: none; /* Keep phone feeds concise and easily scannable */
  }
  .post-meta, .book-meta {
    font-size: 0.76rem;
    gap: 0.4rem;
  }
}

/* Page Intro Block */
.page-intro {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 2rem;
}

/* Lanes List & Cards */
.lanes-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (min-width: 1024px) {
  .lanes-list.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

.lane-entry {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.lane-entry:last-child {
  border-bottom: none;
}

.lane-entry h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 1.15rem;
}

/* MacWright-Style Photo Stream & Adaptive Grid */
.photo-stream {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
  margin: 2rem 0;
}

.photo-stream.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

@media (min-width: 1024px) {
  .photo-stream.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

.photo-stream figure {
  margin: 0;
}

.photo-stream img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  border: 1px solid var(--border-subtle);
}

@media (orientation: portrait) {
  .photo-stream img {
    max-height: 72vh;
    object-fit: cover;
  }
}

.photo-stream figcaption {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: left;
}

/* Callout / Aside */
.callout {
  background-color: var(--bg-subtle);
  border-left: 3px solid var(--link);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

th, td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

/* Footer */
footer.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--link);
  text-decoration: underline;
}

/* Back navigation */
.back-nav {
  margin-bottom: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
