/* ══════════════════════════════════════════════════════════════
   lazear.co
   ══════════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Light palette */
  --bg:                #f8f8f8;
  --surface:           #efefef;
  --border:            #e2e2e2;
  --border-strong:     #c4c4c4;
  --text:              #0d0d0d;
  --text-secondary:    #525252;
  --text-tertiary:     #979797;
  --accent:            #2563eb;
  --accent-hover:      #1d4ed8;
  --tag-bg:            #eeeeee;
  --tag-text:          #363636;
  --badge-bg:          #eff6ff;
  --badge-text:        #2563eb;
  --card-bg:           #ffffff;
  --card-border:       #e2e2e2;
  --shadow-sm:         0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:         0 2px 8px rgba(0, 0, 0, 0.07);

  /* Spacing */
  --radius:            7px;
  --radius-sm:         4px;
  --container:         760px;

  /* Motion */
  --duration:          140ms;
  --ease:              ease;
}

html.dark {
  /* Dark palette */
  --bg:                #111111;
  --surface:           #1a1a1a;
  --border:            #272727;
  --border-strong:     #404040;
  --text:              #e8e8e8;
  --text-secondary:    #888888;
  --text-tertiary:     #525252;
  --accent:            #60a5fa;
  --accent-hover:      #93c5fd;
  --tag-bg:            #222222;
  --tag-text:          #c0c0c0;
  --badge-bg:          #162040;
  --badge-text:        #7ab5fa;
  --card-bg:           #181818;
  --card-border:       #272727;
  --shadow-sm:         0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:         0 3px 10px rgba(0, 0, 0, 0.45);
}

/* ── Base ─────────────────────────────────────────────────── */
html {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; /* Inter optical variants */
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

body { min-height: 100vh; }

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

a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

/* ── Layout ───────────────────────────────────────────────── */
.site-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 56px 24px 96px;
}

/* ── Site header ──────────────────────────────────────────── */
.site-header {
  margin-bottom: 48px;
}

.header-top {
  align-items: baseline;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.site-name {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.header-intro {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 10px;
  max-width: 540px;
}

.header-contact {
  font-size: 0.875rem;
}

.header-contact a {
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
}

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

/* ── Dark mode toggle ─────────────────────────────────────── */
.dark-mode-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 4px 11px;
  transition: border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}

.dark-mode-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

/* ── Load error ───────────────────────────────────────────── */
.load-error {
  background: #fff4f4;
  border: 1px solid #fbbfbf;
  border-radius: var(--radius);
  color: #991111;
  font-size: 0.875rem;
  line-height: 1.55;
  margin-bottom: 24px;
  padding: 12px 16px;
}

html.dark .load-error {
  background: #2a1111;
  border-color: #5a2020;
  color: #ff9999;
}

/* ── Tag filter ───────────────────────────────────────────── */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.tag-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 4px 13px;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.tag-btn:hover {
  background: var(--border);
  color: var(--text);
}

.tag-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.tag-btn--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

/* ── Feed ─────────────────────────────────────────────────── */
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 120ms var(--ease);
}

.feed--fading { opacity: 0; }

.feed-empty {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  padding: 20px 0;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card-link {
  color: inherit;
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 144px;
  text-decoration: none;
}

.card-link:hover { text-decoration: none; }

/* Thumbnail */
.card-thumb {
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.card-thumb img {
  height: 100%;
  object-fit: cover;
  transition: opacity 200ms;
  width: 100%;
}

/* Card body */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
}

.card-meta-top {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 22px;
}

.update-badge {
  background: var(--badge-bg);
  border-radius: var(--radius-sm);
  color: var(--badge-text);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 2px 7px;
}

.launch-indicator {
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-left: auto;
}

.card-title {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-description {
  color: var(--text-secondary);
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.card-footer {
  align-items: flex-end;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  background: var(--tag-bg);
  border-radius: var(--radius-sm);
  color: var(--tag-text);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 2px 7px;
  text-transform: lowercase;
}

.card-date {
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Project page ─────────────────────────────────────────── */
.back-link {
  color: var(--text-tertiary);
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 32px;
  transition: color var(--duration) var(--ease);
}

.back-link:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.project-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
  padding-bottom: 24px;
}

.project-title {
  color: var(--text);
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.project-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 18px;
  max-width: 580px;
}

.project-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.project-date {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Project content ──────────────────────────────────────── */
.project-main {
  margin-bottom: 52px;
}

.project-image {
  margin-bottom: 36px;
}

.project-image img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}

.view-full-size {
  color: var(--text-tertiary);
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 9px;
  transition: color var(--duration) var(--ease);
}

.view-full-size:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Longform prose */
.project-content {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
  max-width: 640px;
}

.project-content p {
  margin-bottom: 1.3em;
}

.project-content h2 {
  color: var(--text);
  font-size: 1.1875rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 2.25em 0 0.65em;
}

.project-content h3 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2em 0 0.5em;
}

.project-content figure {
  margin: 2.25em 0;
}

.project-content figure img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}

.project-content figcaption {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-top: 9px;
}

.project-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color var(--duration) var(--ease);
}

.project-content a:hover {
  text-decoration-color: var(--accent);
}

.project-content em  { font-style: italic; }
.project-content strong { font-weight: 600; }

/* HTML project launch */
.project-launch {
  padding: 28px 0;
}

.launch-btn {
  background: var(--accent);
  border-radius: var(--radius);
  color: #ffffff;
  display: inline-block;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 11px 22px;
  transition: background-color var(--duration) var(--ease);
  text-decoration: none;
}

.launch-btn:hover {
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

/* Not found */
.not-found {
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 28px 0;
}

/* ── Revision log ─────────────────────────────────────────── */
.revision-log {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.revision-log summary {
  align-items: center;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 6px;
  letter-spacing: 0.03em;
  list-style: none;
  padding: 4px 0;
  text-transform: uppercase;
  transition: color var(--duration) var(--ease);
  user-select: none;
}

.revision-log summary::-webkit-details-marker { display: none; }

.revision-log summary::before {
  content: '▶';
  display: inline-block;
  font-size: 0.5rem;
  transition: transform var(--duration) var(--ease);
}

.revision-log[open] summary::before {
  transform: rotate(90deg);
}

.revision-log summary:hover { color: var(--text-secondary); }

.revision-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  list-style: none;
  margin-top: 20px;
}

.revision-entry {
  display: flex;
  font-size: 0.875rem;
  gap: 24px;
}

.revision-date {
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  min-width: 124px;
  white-space: nowrap;
}

.revision-note {
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Responsive ───────────────────────────────────────────── */

/* Tablet */
@media (max-width: 640px) {
  .site-container {
    padding: 36px 18px 72px;
  }

  .card-link {
    grid-template-columns: 1fr;
  }

  .card-thumb {
    height: 180px;
  }

  .project-title {
    font-size: 1.5rem;
  }

  .revision-entry {
    flex-direction: column;
    gap: 3px;
  }
}

/* Small mobile */
@media (max-width: 400px) {
  .site-container {
    padding: 28px 14px 64px;
  }

  .header-top {
    gap: 10px;
  }

  .dark-mode-toggle {
    font-size: 0.6875rem;
    padding: 3px 9px;
  }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
