/* ============================================================
   aaronrkaufman.com — main stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Inter+Tight:wght@600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #ffffff;
  --bg-subtle:    #f7f7f5;
  --text:         #1a1a1a;
  --muted:        #6b6b6b;
  --accent:       #1d4e89;
  --accent-hover: #163b6b;
  --accent-light: #e8f0f8;
  --border:       #e2e2e2;
  --radius:       6px;
  --max-w:        900px;
  --nav-h:        60px;
  --shadow:       0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --transition:   0.18s ease;

  /* Status colors */
  --pub:          #1d7a3a;
  --pub-bg:       #edf7f0;
  --forthcoming:  #7a5a1d;
  --forthcoming-bg: #fdf4e3;
  --wip:          #1d4e89;
  --wip-bg:       #e8f0f8;
  --rr:           #8b2252;
  --rr-bg:        #faedf4;
  --prep:         #555;
  --prep-bg:      #f0f0f0;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Navigation ─────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.nav-name:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  transition: color var(--transition);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); text-decoration: none; }

/* ── Page layout ─────────────────────────────────────────────── */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}

.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.page-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Home page ───────────────────────────────────────────────── */
.home-hero {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 3rem;
  align-items: start;
  padding: 3.5rem 0 3rem;
}

.hero-text h1 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.hero-text .title {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}
.hero-text p {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 600px;
  margin-bottom: 1rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  transition: all var(--transition);
}
.hero-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}
.hero-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.hero-photo {
  display: flex;
  justify-content: flex-end;
}
.photo-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}
.photo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.home-section h2 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.home-section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 1.25rem;
}

/* News/recent items */
.news-list { list-style: none; }
.news-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
}
.news-list li:last-child { border-bottom: none; }
.news-date { color: var(--muted); font-size: 0.8rem; padding-top: 0.1rem; }

/* ── Papers page ─────────────────────────────────────────────── */

/* Filter bar */
.filter-bar {
  margin-bottom: 2rem;
}
.filter-bar h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Status sections */
.papers-section { margin-bottom: 2.5rem; }
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Paper cards grid */
.papers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.paper-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.paper-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.paper-card.hidden { display: none; }

.card-thumb {
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.3s ease;
}
.paper-card:hover .card-thumb img { transform: scale(1.03); }

/* Placeholder thumbnails (for papers without figures) */
.card-thumb-placeholder {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,0.6);
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.card-authors {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}
.card-journal {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.75rem;
  flex: 1;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
}
.tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Award badge */
.card-award {
  font-size: 0.7rem;
  color: #7a5a1d;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Status pill colors */
.status-published { color: var(--pub); }
.status-forthcoming { color: var(--forthcoming); }
.status-rr { color: var(--rr); }
.status-under-review { color: var(--wip); }
.status-in-prep { color: var(--prep); }

/* Placeholder thumb gradients by tag */
.thumb-grad-methodology  { background: linear-gradient(135deg, #2c5282, #4a7fc1); }
.thumb-grad-american     { background: linear-gradient(135deg, #7b2d8b, #b46dca); }
.thumb-grad-text         { background: linear-gradient(135deg, #276749, #4a9e7a); }
.thumb-grad-redistricting { background: linear-gradient(135deg, #c05621, #e8924a); }
.thumb-grad-executive    { background: linear-gradient(135deg, #1a365d, #2a6496); }
.thumb-grad-social-media { background: linear-gradient(135deg, #553c9a, #9168d6); }
.thumb-grad-ai           { background: linear-gradient(135deg, #234e52, #38a89d); }
.thumb-grad-health       { background: linear-gradient(135deg, #742a2a, #c53030); }
.thumb-grad-causal       { background: linear-gradient(135deg, #1d4e89, #3a7ac4); }
.thumb-grad-data         { background: linear-gradient(135deg, #2d3748, #4a5568); }
.thumb-grad-default      { background: linear-gradient(135deg, #2d3748, #718096); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg);
  border-radius: 10px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-thumb {
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  background: var(--bg-subtle);
}
.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.modal-thumb-placeholder {
  width: 100%;
  height: 220px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
}

.modal-body { padding: 1.75rem 2rem 2rem; }
.modal-status {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.modal-title {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.modal-authors {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.modal-journal {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.modal-award {
  font-size: 0.8rem;
  color: #7a5a1d;
  background: #fdf4e3;
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}
.modal-abstract-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.modal-abstract {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.modal-link {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.modal-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.modal-link.primary {
  background: var(--accent);
  color: #fff;
}
.modal-link.primary:hover { background: var(--accent-hover); }
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 1.25rem;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--muted);
  padding: 0.5rem;
  margin: 0.5rem 0.5rem 0 0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition);
  z-index: 1;
}
.modal-close:hover { color: var(--text); background: var(--bg-subtle); }

/* No-results message */
.no-results {
  grid-column: 1/-1;
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Software page ───────────────────────────────────────────── */
.software-list { display: flex; flex-direction: column; gap: 1.25rem; }
.software-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}
.software-item:hover { box-shadow: var(--shadow); }
.software-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  color: var(--accent);
}
.software-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.software-info p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.6rem;
}
.software-links { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.software-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.software-link:hover { text-decoration: underline; }
.software-tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--border);
  margin-left: 0.5rem;
}

/* ── Puzzles page ────────────────────────────────────────────── */
.puzzles-intro {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 600px;
}
.puzzle-group { margin-bottom: 2rem; }
.puzzle-group h2 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.puzzle-list { display: flex; flex-direction: column; gap: 0.75rem; }
.puzzle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  gap: 1rem;
}
.puzzle-item:hover { box-shadow: var(--shadow); text-decoration: none; }
.puzzle-item-left h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.puzzle-item-left p {
  font-size: 0.8rem;
  color: var(--muted);
}
.puzzle-arrow {
  color: var(--muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Art page ─────────────────────────────────────────────────── */
.art-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  gap: 1rem;
}
.art-lock h2 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
}
.art-lock p { font-size: 0.9rem; color: var(--muted); }
.art-lock form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.art-lock input {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}
.art-lock input:focus { border-color: var(--accent); }
.art-lock button {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.art-lock button:hover { background: var(--accent-hover); }
.art-lock .error { font-size: 0.8rem; color: #c53030; }

.art-content { display: none; }
.art-content.visible { display: block; }

.art-note {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  max-width: 620px;
}
.art-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.art-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.art-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.art-thumb {
  width: 100%;
  height: 200px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.art-thumb img { width: 100%; height: 100%; object-fit: cover; }
.art-thumb-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.art-info { padding: 1rem; }
.art-info h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.art-info p { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.art-category {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-text { font-size: 0.8rem; color: var(--muted); }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { font-size: 0.8rem; color: var(--muted); }
.footer-links a:hover { color: var(--text); text-decoration: none; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
  .home-hero { grid-template-columns: 1fr; }
  .hero-photo { order: -1; justify-content: flex-start; }
  .photo-circle { width: 120px; height: 120px; }
  .papers-grid { grid-template-columns: 1fr; }
  .art-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 1.25rem; }
  .page { padding: 2rem 1.25rem 3rem; }
  .modal-body { padding: 1.25rem 1.25rem 1.5rem; }
  .modal-overlay { padding: 1rem; }
}
@media (max-width: 450px) {
  .nav-links { display: none; } /* mobile nav simplified */
  .hero-text h1 { font-size: 1.75rem; }
}
