/* ==========================================================================
   Minimal Theme for Felipe Antolinez's Blog
   Fonts: DM Sans (body), STIX Two Text (headlines), JetBrains Mono (code)
   ========================================================================== */

/* CSS Custom Properties - Light Theme (default) */
:root {
  /* Colors */
  --color-bg: #fafaf9;
  --color-bg-secondary: #f5f5f4;
  --color-text: #1a1a1a;
  --color-text-muted: #666;
  --color-text-faint: #999;
  --color-link: #4A7AC9;
  --color-link-visited: #3A6AB9;
  --color-link-hover: #2A5A99;
  --color-border: #e0e0e0;
  --color-border-dark: #ccc;

  /* Code */
  --color-code-bg: #f5f5f4;
  --color-code-text: #1a1a1a;

  /* Syntax highlighting */
  --color-code-comment: #6a737d;
  --color-code-keyword: #d73a49;
  --color-code-string: #032f62;
  --color-code-constant: #005cc5;
  --color-code-entity: #6f42c1;
  --color-code-tag: #22863a;
  --color-code-value: #e36209;

  /* Tags */
  --color-tag-bg: #f0f0ef;
  --color-tag-border: #d4d4d4;
  --color-tag-hover: #e5e5e4;

  /* Accent (for quotes - coral pink) */
  --color-accent: #FF6B80;

  /* Fonts */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'STIX Two Text', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Layout */
  --wrapper-width: 940px;
  --wrapper-padding: 10px;
}

/* Dark Theme */
[data-theme="dark"] {
  --color-bg: #000000;
  --color-bg-secondary: #111111;
  --color-text: #ffffff;
  --color-text-muted: #a0a0a0;
  --color-text-faint: #707070;
  --color-link: #8AB7F9;
  --color-link-visited: #6A97D9;
  --color-link-hover: #AAD7FF;
  --color-border: #333;
  --color-border-dark: #444;

  --color-code-bg: #242424;
  --color-code-text: #e8e8e8;

  --color-code-comment: #8b949e;
  --color-code-keyword: #ff7b72;
  --color-code-string: #a5d6ff;
  --color-code-constant: #79c0ff;
  --color-code-entity: #d2a8ff;
  --color-code-tag: #7ee787;
  --color-code-value: #ffa657;

  --color-tag-bg: #2a2a2a;
  --color-tag-border: #404040;
  --color-tag-hover: #333;

  --color-accent: #FF6B80;
}

/* Auto dark theme based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #000000;
    --color-bg-secondary: #111111;
    --color-text: #ffffff;
    --color-text-muted: #a0a0a0;
    --color-text-faint: #707070;
    --color-link: #8AB7F9;
    --color-link-visited: #6A97D9;
    --color-link-hover: #AAD7FF;
    --color-border: #333;
    --color-border-dark: #444;

    --color-code-bg: #242424;
    --color-code-text: #e8e8e8;

    --color-code-comment: #8b949e;
    --color-code-keyword: #ff7b72;
    --color-code-string: #a5d6ff;
    --color-code-constant: #79c0ff;
    --color-code-entity: #d2a8ff;
    --color-code-tag: #7ee787;
    --color-code-value: #ffa657;

    --color-tag-bg: #2a2a2a;
    --color-tag-border: #404040;
    --color-tag-hover: #333;

    --color-accent: #FF6B80;
  }
}

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

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

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,
pre, form, fieldset, input, p, blockquote, th, td {
  margin: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset, img {
  border: 0;
}

ol, ul {
  list-style: none;
}

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

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: break-word;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent layout shift from scrollbar appearing/disappearing */
html {
  overflow-x: hidden;
  overflow-y: scroll;
}

/* Headings - Serif */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

p {
  margin-bottom: 0.8em;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

sup {
  vertical-align: baseline;
  position: relative;
  top: -0.4em;
  font-size: 0.75em;
  line-height: 0;
}

sup a {
  text-decoration: none;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: var(--color-border-dark);
  text-underline-offset: 2px;
}

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

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

/* Code */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--color-code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  background-color: var(--color-code-bg);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1em;
  white-space: pre-wrap;
  width: 98%;
}

pre code {
  background: none;
  padding: 0;
}

/* ==========================================================================
   Layout - Match original 940px centered layout
   ========================================================================== */

#wrapper {
  flex: 1;
}

#wrapper:not(.three-col-layout) {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--wrapper-padding);
  overflow: hidden;
}

#primary {
  /* Handled by grid in three-col-layout */
}

#secondary {
  font-size: 0.9em;
}

#secondary h3 {
  font-family: var(--font-serif);
  font-size: 1em;
  margin: 0.5em 0;
}

#secondary ul {
  margin-top: 0.5em;
}

#secondary ul li {
  margin-bottom: 0.5em;
  list-style: none;
}

/* ==========================================================================
   Header - New Republik-inspired centered design
   ========================================================================== */

#site-header {
  max-width: calc(234px + 600px + 234px + 2em); /* Match three-col-layout width */
  margin: 0 auto;
  padding: 20px 20px 0;
}

.header-row {
  display: flex;
  justify-content: center;
}

.header-title {
  margin-bottom: 12px;
}

.header-title h1 {
  font-family: var(--font-serif);
  font-size: 2em;
  font-weight: 700;
  line-height: 1;
  margin: 0;
}

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

.header-guillemet {
  color: var(--color-accent);
  font-family: Georgia, serif;
  font-weight: 400;
}

.header-name {
  font-weight: 700;
}

.header-nav {
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.header-nav ul {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.header-nav li {
  display: inline;
}

.header-nav a, .nav-search-trigger {
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  border-bottom: none;
}

.header-nav a:hover, .nav-search-trigger:hover,
.header-nav a.active {
  color: var(--color-accent);
}

/* Admin bar (staff only) */
.admin-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 8px 20px;
  font-size: 0.85em;
  background: linear-gradient(135deg, #1a7a6d 0%, #3a8f6e 50%, #6b9f2a 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1001;
}

.admin-bar a {
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

.admin-bar a:hover,
.admin-bar a.active {
  color: white;
}

/* Inline search form (search page, tags page) */
.inline-search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1em;
}

.inline-search-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 8px 0;
  font-size: 1.1em;
  font-family: var(--font-sans);
  color: var(--color-text);
  flex: 1;
  max-width: 400px;
  outline: none;
}

.inline-search-input:focus {
  border-bottom-color: var(--color-accent);
}

.inline-search-input::placeholder {
  color: var(--color-text-faint);
}

.inline-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") center/contain no-repeat;
  cursor: pointer;
  opacity: 0.7;
}

.inline-search-input::-webkit-search-cancel-button:hover {
  opacity: 1;
}

.inline-search-btn {
  background: transparent;
  border: none;
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 1em;
  color: var(--color-text-faint);
  cursor: not-allowed;
  padding: 8px 0;
}

.inline-search-btn:not([disabled]) {
  color: var(--color-accent);
  cursor: pointer;
}

/* Wide search bar for Tags and Search pages */
.inline-search-wide .inline-search-input {
  max-width: none;
}

/* Tag hint (shown below tag cloud) */
.tag-hint {
  font-size: 0.85em;
  color: var(--color-text-muted);
  margin-top: 1.5em;
}

/* Feed link styling */
.feed-link {
  text-decoration: none;
  border-bottom: none;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feed-link:visited {
  color: var(--color-text-muted);
}

.feed-link:hover {
  color: var(--color-accent);
}

/* Current tags in sidebar (desktop) */
.sidebar-current-tags .more {
  display: block;
  margin-top: 0.5em;
  font-size: 0.85em;
}

.sidebar-current-tags {
  padding-top: 0.5em;
  margin-bottom: 1em;
}

.col-right > .sidebar-current-tags:first-child {
  border-top: 1px solid var(--color-text);
}

/* Mobile highlights (shown in header on mobile only) */
.mobile-highlights {
  display: none;
  margin-top: 0.5em;
  padding-bottom: 0.6em;
  font-size: 0.85em;
}

.mobile-highlights .sidebar-highlights-list li {
  margin-bottom: 0.3em;
}

.mobile-highlights .sidebar-highlights-list a {
  display: inline;
}

.mobile-highlights .sidebar-highlights-date {
  display: inline;
}

@media (max-width: 1000px) {
  .mobile-highlights {
    display: block;
  }
}

/* RSS feed icon (in footer) */
a#atomfeedlink {
  border-bottom: none;
  text-decoration: none;
  display: flex;
  align-items: center;
}

a#atomfeedlink svg {
  height: 16px;
  width: 16px;
}

/* Smallhead uses same header as bighead now */
body.smallhead #ft {
  margin-top: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

#ft {
  text-align: center;
  margin: 15px 0 0.4em 0;
  padding: 10px 0;
  clear: both;
  font-size: 0.85em;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

#ft ul {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em 1em;
  list-style: none;
  margin: 0;
  padding: 0;
}

#ft li {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

#ft a {
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: none;
}

#ft a:hover {
  color: var(--color-accent);
}

/* Theme toggle */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-text-muted);
  opacity: 0.8;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
}

#theme-toggle:hover {
  opacity: 1;
}

#theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ==========================================================================
   Three-Column Layout (Republik-inspired)
   Left: dates | Center: content | Right: sidebar
   ========================================================================== */

.three-col-layout {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  justify-content: center;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

.col-left {
  /* Empty by default, used by feed-row for dates */
}

.col-center {
  min-width: 0;
  border-top: 1px solid var(--color-text);
  padding-top: 1em;
  padding-bottom: 2em;
}

.col-right {
  /* Right column aligned with content */
}

/* Feed rows span the grid and create their own 3-col structure */
.feed-row {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  grid-column: 1 / -1;
  justify-content: center;
}

/* Space between date groups */
.feed-row + .feed-row {
  margin-top: 1em;
}

/* Date markers in left column */
.feed-date-marker {
  text-align: left;
  padding-top: 0.5em;
  font-size: 0.9em;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-text);
}

.feed-date-weekday {
  display: block;
}

.feed-date-full {
  display: block;
  font-weight: 500;
}

/* Content sections with top borders */
.feed-section {
  border-top: 1px solid var(--color-text);
  padding-top: 1em;
  padding-bottom: 0;
}

/* Divider between posts on same day */
.feed-section .segment {
  margin-bottom: 0;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--color-text);
}

/* Add top padding to segments that follow another segment (after the divider line) */
.feed-section .segment + .segment {
  padding-top: 1em;
}

.feed-section .segment:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Extra space after the last feed row before footer */
.feed-row:last-child .feed-section {
  padding-bottom: 2em;
}

.feed-spacer {
  /* Empty right column spacer - no lines */
}

/* Sidebar sections (right column) */
.sidebar-section {
  padding-top: 0;
}

.sidebar-section:first-child {
  border-top: 1px solid var(--color-text);
  padding-top: 0.5em;
  margin-top: 0;
}

/* Tags wrapper in sidebar with spacing */
.sidebar-tags-wrapper {
  margin-bottom: 1em;
}

/* Sidebar breadcrumb navigation */
.sidebar-breadcrumb {
  font-size: 0.9em;
  margin: 0.3em 0 0.5em 0;
}

/* Sidebar dates list */
.sidebar-dates {
  font-size: 0.9em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-dates li {
  margin-bottom: 0.3em;
}

.sidebar-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5em;
  font-size: 1em;
}

.sidebar-heading {
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.5em;
  font-size: 0.9em;
}

.sidebar-filter-section {
  margin-bottom: 1em;
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
}

.sidebar-tags .item-tag {
  font-size: 0.85em;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9em;
}

.sidebar-list li {
  margin-bottom: 0.3em;
}

/* Highlights sidebar */
.sidebar-highlights-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-highlights-list li {
  margin-bottom: 0.5em;
  line-height: 1.4;
}

.sidebar-highlights-list a {
  display: block;
}

.sidebar-highlights-date {
  display: block;
  color: var(--color-text-muted);
}

/* Pages with feed: feed rows span the full grid */
body.homepage .col-center,
body.has-feed .col-center {
  border-top: none;
  padding-top: 0;
}

body.has-feed .col-center .entry {
  overflow: visible;
}

body.homepage #primary .feed-row,
body.has-feed #primary .feed-row {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  margin-left: calc(-234px - 1em);
  margin-right: calc(-234px - 1em);
}

/* Non-feed pages: keep content in center column */
body:not(.homepage):not(.has-feed) #primary .feed-row {
  display: block;
  margin: 0;
}

body:not(.homepage):not(.has-feed) #primary .feed-date-marker {
  position: static;
  margin-bottom: 0.5em;
}

body:not(.homepage):not(.has-feed) #primary .feed-spacer {
  display: none;
}

/* Mobile: stack columns */
@media (max-width: 1000px) {
  .three-col-layout {
    display: block;
    padding: 0 15px;
  }

  .col-center {
    border-top: 1px solid var(--color-text);
    padding-top: 1em;
    max-width: 600px;
    margin: 0 auto;
  }

  .col-right {
    max-width: 600px;
    margin: 2em auto 0;
  }

  body.homepage .col-center,
  body.has-feed .col-center {
    border-top: none;
    padding-top: 0;
  }

  .feed-row,
  #primary .feed-row,
  body.homepage #primary .feed-row,
  body.has-feed #primary .feed-row {
    display: block;
    margin-left: 0;
    margin-right: 0;
  }

  .feed-date-marker {
    text-align: left;
    padding-top: 0;
    border-top: 1px solid var(--color-text);
    padding: 8px 0;
    margin-bottom: 0.5em;
  }

  .feed-section {
    border-top: none;
    padding-top: 0;
  }

  .feed-spacer {
    display: none;
  }

  .feed-date-weekday,
  .feed-date-full {
    display: inline;
  }

  .feed-date-weekday::after {
    content: ' ';
  }

  .sidebar-section {
    border-top: 1px solid var(--color-text);
    padding-top: 0.5em;
  }
}

/* ==========================================================================
   Content Segments
   ========================================================================== */

.segment {
  clear: both;
  padding: 0 0 0.75em 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.75em;
}

/* Entry (blog post) */
div.entry h2, div.entry h3 {
  font-family: var(--font-serif);
  font-size: 1.4em;
  line-height: 1.4;
  margin: 0 0 0.5em 0;
}

/* Entry title (first h3) */
div.entry > h3:first-child {
  margin-top: 0;
}

/* Entry page title — larger than in-body headings */
div.entryPage [data-permalink-context] > h2:first-child {
  font-size: 1.9em;
}

div.entry h2 a, div.entry h3 a {
  text-decoration: none;
  color: var(--color-link);
}

div.entry h2 a:hover, div.entry h3 a:hover {
  text-decoration: underline;
  color: var(--color-link-hover);
}

div.entry h3, div.entry h4 {
  font-family: var(--font-serif);
  line-height: 1.4;
  font-size: 1.2em;
  margin: 1.2em 0 0.5em 0;
}

div.entry h4 {
  font-size: 1.1em;
}

div.entry p {
  margin: 0 0 0.8em 0;
}

div.entry ul, div.entry ol,
div.blogmark ul, div.blogmark ol,
div.quote ul, div.quote ol,
div.note ul, div.note ol {
  margin-bottom: 0.8em;
}

div.entry li, div.blogmark li, div.quote li, div.note li {
  margin-left: 1em;
  list-style-type: square;
}

div.entry ol li, div.blogmark ol li, div.note ol li, div.quote ol li {
  list-style-type: decimal;
  margin-left: 2em;
}

div.entry img, div.entry video,
div.blogmark img, div.blogmark video,
div.note img, div.note video {
  max-width: 100%;
}

div.entry table, div.blogmark table {
  margin: 1em 0;
}

div.entry table th, div.entry table td,
div.blogmark table th, div.blogmark table td,
div.note table th, div.note table td {
  font-size: 0.9em;
  padding-right: 0.5em;
  padding-bottom: 0.3em;
  padding-top: 0.3em;
  vertical-align: top;
}

div.entry table th, div.blogmark table th, div.note table th {
  font-weight: bold;
  border-bottom: 1px solid var(--color-border-dark);
}

div.entryFooter {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.8em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Share button */
.share-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: auto;
}
.share-btn:hover { opacity: 1; }

/* Share popover */
.share-popover {
  position: absolute;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 6px;
  z-index: 1000;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.share-popover[hidden] { display: none; }
.share-popover-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 0.9em;
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.share-popover-option:hover {
  background: var(--color-tag-hover);
}

div.entry p.mobile-date {
  color: var(--color-text-muted);
  margin-bottom: 0.5em;
  margin-top: -0.5em;
  display: none;
  font-size: 0.85em;
}

/* Blogmark (link) */
div.blogmark {
  font-size: 0.9em;
}

div.blogmark p, div.quote p,
#primary .elsewhere-in-primary p:not(:last-child) {
  margin-bottom: 0.8em;
}

/* Quotation - Swiss guillemets « » using font characters */
div.quote > blockquote,
.item-quote > blockquote {
  font-family: var(--font-sans);
  font-style: normal;
  clear: both;
  margin-top: 0.5em;
  margin-bottom: 0.2em;
  border-left: none;
  word-break: break-word;
}

/* Opening guillemet */
div.quote > blockquote > p:first-child::before,
.item-quote > blockquote > p:first-child::before {
  content: '«\00a0';
  font-family: var(--font-serif);
  font-size: 1.4em;
  font-style: normal;
  color: #FF6B80;
  line-height: 1;
}

/* Closing guillemet */
div.quote > blockquote > p:last-child::after,
.item-quote > blockquote > p:last-child::after {
  content: '\00a0»';
  font-family: var(--font-serif);
  font-size: 1.4em;
  font-style: normal;
  color: #FF6B80;
  line-height: 0;
  vertical-align: baseline;
}

div.quote > blockquote p,
.item-quote > blockquote p {
  margin: 0;
  display: inline;
}
div.quote > blockquote p + p,
.item-quote > blockquote p + p {
  display: block;
  margin-top: 0.75em;
}

/* No guillemets on nested blockquotes */
div.quote blockquote blockquote p:first-child::before,
.item-quote blockquote blockquote p:first-child::before,
div.quote blockquote blockquote p:last-child::after,
.item-quote blockquote blockquote p:last-child::after {
  content: none;
}

/* Citation styling */
div.quote p.cite {
  font-family: var(--font-sans);
  font-size: 0.9em;
  font-style: normal;
  font-weight: bold;
  padding: 0 1em;
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 0;
}

div.quote .context {
  font-weight: normal;
}

/* Sidebar quote - slightly smaller */
.item-quote > blockquote {
  font-size: 0.95em;
}

p.cite {
  text-indent: 16px;
  font-weight: bold;
}

/* Note */
div.note p:not(.date-and-tags) {
  margin-bottom: 0.8em;
}

/* ==========================================================================
   Date and Tags
   ========================================================================== */

p.date-and-tags,
div.entry p.date-and-tags,
div.blogmark p.date-and-tags,
div.quote p.date-and-tags,
div.note p.date-and-tags {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.8em;
  margin-bottom: 0;
  display: flex;
  align-items: center;
}

/* Tags */
a.item-tag {
  display: inline-block;
  background-color: var(--color-tag-bg);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--color-tag-border);
  text-decoration: none;
  color: var(--color-text);
  margin-right: 0.3em;
  margin-bottom: 0.3em;
  font-size: 0.9em;
}

a.item-tag:hover {
  background-color: var(--color-tag-hover);
  color: var(--color-accent);
}

a.item-tag span {
  color: var(--color-text-faint);
  font-size: 0.8em;
  vertical-align: middle;
}

/* Tag cloud */
p#tagcloud {
  font-size: 1.2em;
  line-height: 1.9em;
  text-align: center;
  margin-top: 1.5em;
}

p#tagcloud .not-popular-at-all { font-size: 0.7em; }
p#tagcloud .not-very-popular { font-size: 0.89em; }
p#tagcloud .somewhat-popular { font-size: 1.07em; }
p#tagcloud .somewhat-more-popular { font-size: 1.26em; }
p#tagcloud .popular { font-size: 1.44em; }
p#tagcloud .more-than-just-popular { font-size: 1.63em; }
p#tagcloud .very-popular { font-size: 1.81em; }
p#tagcloud .ultra-popular { font-size: 2em; }

/* ==========================================================================
   Search
   ========================================================================== */

.search-input, .search-submit {
  border: 1px solid var(--color-border-dark);
  padding: 4px 8px;
  box-sizing: border-box;
  font-size: 17px;
  font-family: var(--font-sans);
  border-radius: 3px;
}

.search-input {
  width: 80%;
  max-width: 400px;
  background-color: var(--color-bg);
  color: var(--color-text);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-text-muted);
}

.search-submit {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-muted);
  cursor: pointer;
  border: 1px solid var(--color-border-dark);
}

.search-submit:hover {
  background-color: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

div.search-selections {
  margin-top: 0.5em;
  font-size: 0.9em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
}

.search-selections .filters {
  flex: 1;
}

a.selected-tag {
  border: 1px solid var(--color-border-dark);
  text-decoration: none;
  padding: 2px 5px;
  background-color: var(--color-tag-bg);
  color: var(--color-text);
  border-radius: 3px;
}

/* Search results header - results count + sort dropdown on same line */
.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.search-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-sort label {
  font-size: 0.9em;
  color: var(--color-text-muted);
}

.search-sort select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.9em;
}

/* ==========================================================================
   Archive pages
   ========================================================================== */

/* Archive header row - matches feed-row structure */
.archive-header-row {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  margin-bottom: 1em;
}

body.has-feed #primary .archive-header-row {
  margin-left: calc(-234px - 1em);
  margin-right: calc(-234px - 1em);
}

.archive-header-left {
  /* No border - left column is for dates only */
}

.archive-header-content {
  border-top: 1px solid var(--color-text);
  padding-top: 1em;
}

.archive-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.archive-header-content h2 {
  display: inline;
}

.archive-header-right {
  /* No border - right column has sidebar */
}

.archive-h2 {
  font-family: var(--font-serif);
  font-size: 1.4em;
  margin: 0;
}

.archive-feed-link {
  margin-left: 0.5em;
}

@media (max-width: 1000px) {
  .archive-header-row {
    display: block;
  }

  body.has-feed #primary .archive-header-row {
    margin-left: 0;
    margin-right: 0;
  }

  .archive-header-left,
  .archive-header-right {
    display: none;
  }

  .archive-header-content {
    border-top: 1px solid var(--color-text);
    padding-top: 1em;
  }
}

/* Search header row - matches feed-row structure */
.search-header-row {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  margin-bottom: 1em;
}

body.has-feed #primary .search-header-row {
  margin-left: calc(-234px - 1em);
  margin-right: calc(-234px - 1em);
}

.search-header-left {
  /* No border - left column is empty on search page */
}

.search-header-content {
  border-top: 1px solid var(--color-text);
  padding-top: 1em;
}

.search-header-right {
  /* No border - right column spacer */
}

@media (max-width: 1000px) {
  .search-header-row {
    display: block;
  }

  body.has-feed #primary .search-header-row {
    margin-left: 0;
    margin-right: 0;
  }

  .search-header-left,
  .search-header-right {
    display: none;
  }

  .search-header-content {
    border-top: none;
    padding-top: 0;
  }
}

h2.overband {
  font-family: var(--font-serif);
  font-size: 1.15em;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 1em 0 0.5em 0;
  padding: 0;
  background: none;
}

h3.blog-mixed-list-year {
  font-family: var(--font-serif);
  margin-top: 0.5em;
  margin-bottom: 1em;
  font-size: 1.2em;
}

/* ==========================================================================
   Calendar
   ========================================================================== */

table.monthcalendar {
  border: 1px solid var(--color-border);
  width: 241px;
  margin-left: 1px;
  margin-bottom: 25px;
}

table.monthcalendar caption {
  text-align: center;
  font-weight: bold;
  margin: 0 auto;
  padding-bottom: 4px;
}

table.monthcalendar caption a.nextprev {
  text-decoration: none;
  padding: 0 7px;
  border-bottom: none;
}

table.monthcalendar td, table.monthcalendar th {
  font-size: 0.9em;
  border: 1px solid var(--color-border);
  text-align: center;
  width: 14.28%;
}

table.monthcalendar td strong {
  font-size: 1.1em;
}

table.monthcalendar td.today {
  border: 2px solid #888;
}

table.monthcalendar td a {
  display: block;
  padding: 1px 4px 0px 4px;
  text-decoration: none;
  border-bottom: none;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

div.paginator {
  clear: both;
  padding: 0.5em 0;
  font-size: 0.9em;
}

.pagination {
  margin-bottom: 1em;
}

.paginate-pages, .paginate-first, .paginate-last,
.paginate-previous, .paginate-next, .paginate-link {
  padding: 2px 4px;
  border: 1px solid var(--color-border);
}

.paginate-current {
  padding: 2px 4px;
  border: 1px solid var(--color-border);
  font-weight: bold;
  background-color: var(--color-text);
  color: var(--color-bg);
}

/* ==========================================================================
   Sidebar (metabox)
   ========================================================================== */

div.metabox {
  font-size: 0.9em;
}

div.metabox p {
  margin-bottom: 0.8em;
}

div#secondary div.day {
  border-bottom: 1px solid var(--color-border);
  clear: both;
}

div#secondary div.photos {
  clear: both;
}

div#secondary a.photolink {
  position: relative;
  display: block;
  float: left;
  margin: 0 10px 10px 0;
  width: 40px;
  height: 40px;
}

div#secondary div.photos img {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border-dark);
  position: absolute;
  top: 0;
  left: 0;
}

/* ==========================================================================
   Comments
   ========================================================================== */

div#comment-wrapper {
  width: var(--wrapper-width);
  margin-left: 35px;
}

div#comments {
  float: left;
  width: 620px;
  padding-right: 35px;
  padding-top: 1em;
}

div#comments p {
  overflow: auto;
  margin-bottom: 0.6em;
}

div#comments ol {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

div#comments li {
  margin: 0 0 1em 0;
  font-size: 0.9em;
}

div#comments blockquote {
  margin: 1em 1.5em;
}

div#comments em {
  font-style: italic;
}

div#comments p.commentFooter {
  font-size: 0.85em;
  position: relative;
  top: 5px;
  margin: 10px 0 0 45px;
  color: var(--color-text-muted);
}

div#addcomment {
  float: left;
  padding: 1em 0;
  width: 280px;
}

div#addcomment p {
  font-size: 0.9em;
}

div#addcomment input.text, div#addcomment textarea {
  border: 1px solid var(--color-border-dark);
  background-color: var(--color-bg);
  color: var(--color-text);
}

/* ==========================================================================
   Series
   ========================================================================== */

div.series-info {
  margin: 2em 0;
}

div.series-info li {
  margin-left: 1.5em;
  list-style-type: decimal;
}

/* ==========================================================================
   Edit link (admin)
   ========================================================================== */

body div .edit-page-link {
  margin-top: 0.5em;
}

a.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8em;
  padding: 3px 8px;
  background-color: var(--color-tag-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
}

a.edit-link:hover {
  background-color: var(--color-tag-hover);
}

a.random-post-link {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  padding: 4px 10px;
  margin-top: 0.3em;
  margin-right: 0.75em;
  background-color: var(--color-tag-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
}

a.random-post-link:hover {
  background-color: var(--color-tag-hover);
}

a.random-tag-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  padding: 4px 10px;
  margin-right: 1em;
  background-color: var(--color-tag-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
}

a.random-tag-nav:hover {
  background-color: var(--color-tag-hover);
}

/* ==========================================================================
   Code Syntax Highlighting
   ========================================================================== */

.pl-c { color: var(--color-code-comment); }
.pl-c1, .pl-s .pl-v { color: var(--color-code-constant); }
.pl-e, .pl-en { color: var(--color-code-entity); }
.pl-smi, .pl-s .pl-s1 { color: var(--color-code-text); }
.pl-ent { color: var(--color-code-tag); }
.pl-k { color: var(--color-code-keyword); }
.pl-s, .pl-pds, .pl-sr { color: var(--color-code-string); }
.pl-v { color: var(--color-code-value); }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Small screens (mobile) - consolidated at 1000px with three-col-layout */
@media (max-width: 1000px) {
  #site-header {
    width: 100%;
    box-sizing: border-box;
    padding: 20px var(--wrapper-padding) 0;
  }
  .header-nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
  .nav-search-input {
    width: 120px;
  }
  div.entry p.mobile-date {
    display: block;
  }
  #primary .elsewhere-in-primary {
    display: block;
  }
  .elsewhere-date {
    display: inline;
  }
  .hide-secondary-on-mobile {
    display: none;
  }
  #secondary {
    float: none;
    width: auto;
    padding-top: 15px;
    clear: both;
  }
  #primary {
    width: 100%;
  }
  #wrapper {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0 10px;
  }
  body.smallhead #wrapper {
    width: auto;
    margin: 0;
    padding-left: 15px;
    padding-right: 15px;
  }
  p.this-is {
    display: none;
  }
  object, img {
    max-width: 100%;
  }
  #secondary h2.overband {
    color: var(--color-text);
    font-weight: bold;
    font-size: 1.2em;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.elsewhere-date {
  display: none;
}

#primary .elsewhere-in-primary {
  display: none;
}

body.homepage .hide-on-homepage {
  display: none;
}

/* Homepage - show secondary column for tags */

body.homepage .col-center {
  border-top: none;
  padding-top: 0;
}

/* Wide entry layout */
.entry-wide div#primary {
  width: auto;
  margin: 0 1em;
  float: none;
  max-width: 98%;
}

.entry-wide div#wrapper {
  overflow: visible;
}

/* ==========================================================================
   Misc
   ========================================================================== */

.blogmark-image {
  display: block;
  margin: 1em auto;
  box-shadow: 0 0 6px 3px rgba(0,0,0,0.1);
}

.card-container img {
  display: block;
  max-width: 100%;
}

a:link.photoswipe-img,
a:visited.photoswipe-img,
a:hover.photoswipe-img {
  border: none;
}

.recent-articles {
  margin-top: 1em;
  font-size: 0.9rem;
}

.recent-articles li {
  list-style-type: square;
  margin-left: 1em;
  margin-bottom: 0.1em;
}

.tag-description {
  margin-bottom: 1em;
}

div.help {
  font-size: 0.9em;
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-secondary);
  padding: 0.5em 0.8em;
}

div.help p {
  margin: 0 0 1em 0;
}

/* Search order tabs */
ul#searchorder {
  border-bottom: 1px solid var(--color-text);
  margin: 0 0 0.5em 0;
  padding: 0;
  height: 1em;
}

ul#searchorder li {
  display: block;
  float: left;
  border: 1px solid var(--color-text);
  margin: 0 0 0 1em;
  line-height: 1em;
  position: relative;
  top: -2px;
  padding-top: 1px;
}

ul#searchorder li.selected {
  border-bottom: 1px solid var(--color-bg);
}

ul#searchorder a {
  line-height: 1em;
  padding: 0.2em 1em;
  text-decoration: none;
  font-size: 0.8em;
}

/* Blockquote in content areas (entries, blogmarks, notes - but not .quote divs) */
div#primary blockquote,
.item-link blockquote {
  margin: 1em 0;
  border-left: 3px solid rgba(255, 107, 128, 0.7);
  padding-left: 1em;
}

/* Quote divs use decorative marks instead of border */
div#primary div.quote > blockquote,
div.quote > blockquote {
  border-left: none;
  margin: 0;
  padding: 0 1em;
}

div#primary blockquote blockquote,
.item-link blockquote blockquote,
div#primary div.quote blockquote blockquote {
  border-left: none;
  padding-left: 1.5em;
}

/* Sponsor promo - hidden */
._sponsor_promo {
  display: none;
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-intro {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.about-name {
  font-family: var(--font-serif);
  font-size: 1.8em;
  font-weight: 700;
  line-height: 1.2;
}

.about-degree {
  font-size: 0.95em;
  color: var(--color-text-muted);
  margin-top: 0.2em;
}

.about-role {
  font-size: 1em;
  margin-top: 0.2em;
}

.about-role a {
  color: var(--color-link);
}

.about-avatar {
  width: 150px;
  min-width: 150px;
  height: 150px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 1000px) {
  .about-intro {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 600px) {
  .about-avatar {
    width: 100px;
    min-width: 100px;
    height: 100px;
  }
  .about-name {
    font-size: 1.4em;
  }
  .about-degree {
    font-size: 0.85em;
  }
  .about-role {
    font-size: 0.9em;
  }
  .about-intro {
    gap: 1rem;
  }
}

div[data-permalink-context="/about/"] {
  font-size: 1.05em;
}

div[data-permalink-context="/about/"] h2 {
  font-size: 1.5em;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

div[data-permalink-context="/about/"] h2:first-child {
  margin-top: 0;
}

div[data-permalink-context="/about/"] h3 {
  font-size: 1.2em;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

/* ==========================================================================
   Books
   ========================================================================== */

/* Book list page */
.books-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.book-card {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.book-card:last-child {
  border-bottom: none;
}

.book-cover img {
  width: 80px;
  height: auto;
  border-radius: 2px;
}

.book-info h3 {
  font-family: var(--font-serif);
  font-size: 1.2em;
  margin: 0 0 0.3em 0;
}

.book-info h3 a {
  text-decoration: none;
  color: var(--color-link);
}

.book-info h3 a:hover {
  text-decoration: underline;
}

.book-author {
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 0.3em;
}

.book-rating {
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 0.3em;
}

.book-dates {
  font-size: 0.9em;
  color: var(--color-text-muted);
  margin-bottom: 0.3em;
}

.book-excerpt {
  font-size: 0.9em;
  margin-bottom: 0.3em;
}

.book-tags {
  margin-top: 0.5em;
}

/* Book in feed */
.segment.book h3 {
  font-family: var(--font-serif);
  font-size: 1.2em;
  margin: 0 0 0.2em 0;
}

.segment.book h3 a {
  text-decoration: none;
  color: var(--color-link);
}

.segment.book h3 a:hover {
  text-decoration: underline;
}

.book-author-inline {
  display: block;
  font-family: var(--font-serif);
  font-weight: normal;
  font-style: italic;
  font-size: 0.95em;
  color: var(--color-text-muted);
  margin-bottom: 1.2em;
}

.book-cover-small img {
  width: 90px;
  float: right;
  margin: 0 0 0.5rem 1rem;
  border-radius: 2px;
}

.book-rating-inline {
  font-size: 0.9em;
  color: var(--color-accent);
  font-weight: 600;
}

/* Book detail page */
.book-cover-large {
  float: right;
  margin: 0 0 1rem 1rem;
}

.book-cover-large img {
  width: 150px;
  border-radius: 4px;
}

.book-title-row {
  display: flex;
  align-items: baseline;
}

.book-title-row .feed-link {
  margin-left: auto;
}

.book h2 {
  font-family: var(--font-serif);
  font-size: 1.6em;
  margin: 0;
}

.book .book-author {
  font-family: var(--font-serif);
  font-size: 1.1em;
  margin-top: -0.2em;
  margin-bottom: 0.5em;
}

.book .book-rating {
  font-family: var(--font-sans);
  margin-bottom: 1em;
}

.book .book-dates {
  font-family: var(--font-sans);
  margin-bottom: 1.5em;
}

.book-summary,
.book-thoughts {
  margin-bottom: 1.5em;
}

.book-summary h3,
.book-thoughts h3 {
  font-family: var(--font-serif);
  font-size: 1.1em;
  margin-bottom: 0.5em;
}

.book-related {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--color-border);
}

.book-related h3 {
  font-family: var(--font-serif);
  font-size: 1.2em;
  margin-bottom: 1em;
}

/* Book detail page - add border at top like other pages */
/* Only apply to pages with .book inside, not search page */
body.has-feed .entry.entryPage:has(.book) {
  border-top: 1px solid var(--color-text);
  padding-top: 1em;
}

/* Book related header - spans columns like archive header */
.book-related-header {
  display: grid;
  grid-template-columns: 234px minmax(0, 600px) 234px;
  gap: 0 1em;
  justify-content: center;
  margin-top: 2em;
  margin-left: calc(-234px - 1em);
  margin-right: calc(-234px - 1em);
}

.book-related-header h3 {
  grid-column: 2;
  font-family: var(--font-serif);
  font-size: 1.2em;
  margin-bottom: 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--color-text);
}

@media (max-width: 1020px) {
  .book-related-header {
    display: block;
    margin-left: 0;
    margin-right: 0;
    padding-top: 2em;
  }

  body.has-feed .entry.entryPage {
    border-top: 1px solid var(--color-text);
    padding-top: 1em;
  }
}

/* Book filters */
.book-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.book-filters form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.book-filters label {
  font-size: 0.9em;
  color: var(--color-text-muted);
}

.book-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.book-filter-group + .book-filter-group {
  margin-left: 1rem;
}

.book-filters select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.9em;
}

/* Book reference in quotes/entries/notes */
.from-book {
  font-size: 0.9em;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

.from-book a {
  font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
  .book-card {
    flex-direction: column;
  }

  .book-cover-large {
    float: none;
    margin: 0 0 1rem 0;
  }

  .book-cover-large img {
    width: 100px;
  }
}
