/* Brian C. Albrecht - Academic Website */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600&family=Source+Serif+4:wght@400;500;600&display=swap');

:root {
  --text-color: #2d2d2d;
  --text-muted: #5a5a5a;
  --heading-color: #1a1a1a;
  --link-color: #4a7c9b;
  --link-hover: #2d5a73;
  --accent-color: #6b8e7d;
  --bg-color: #fafaf8;
  --bg-header: rgba(244, 243, 240, 0.65);
  --border-color: #e0ddd8;
  --section-spacing: 2.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --heading-color: #f0f0f0;
    --link-color: #7eb5d6;
    --link-hover: #a8d0eb;
    --accent-color: #8ab89e;
    --bg-color: #1a1a1a;
    --bg-header: rgba(35, 35, 35, 0.65);
    --border-color: #3a3a3a;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.65;
  color: var(--text-color);
  background: var(--bg-color);
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* Typography */
h1, h2, h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading-color);
}

h1 {
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: var(--section-spacing);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Parallax supply/demand curves background */
.econ-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 400px;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.econ-curves {
  width: 100%;
  height: 100%;
  opacity: 0.08;
}

.demand-curve,
.supply-curve {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: draw-curve 2.5s ease forwards;
  transition: transform 0.1s ease-out;
}

.supply-curve {
  stroke: var(--link-color);
  animation-delay: 0.3s;
}

.equilibrium {
  fill: var(--accent-color);
  opacity: 0;
  animation: fade-in 0.5s ease forwards 1.5s;
}

@keyframes draw-curve {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

/* Header with photo */
.header {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: var(--section-spacing);
  padding: 2rem;
  background: var(--bg-header);
  border-radius: 8px;
}

.header-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.header-content h1 {
  margin-bottom: 0.3rem;
}

.header-content .role {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.header-content .role a {
  color: var(--text-muted);
}

.header-content .role a:hover {
  color: var(--link-color);
}

/* Icon links in header */
.icon-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.icon-links a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.icon-links a:hover {
  text-decoration: none;
  color: white;
  border-color: var(--link-color);
  background: var(--link-color);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(74, 124, 155, 0.3);
}

.icon-links a:active {
  transform: translateY(-1px);
}

/* CV button is special - pill shaped with text */
.icon-links .cv-btn {
  width: auto;
  padding: 0 1rem;
  border-radius: 22px;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.icon-links .cv-btn svg {
  width: 16px;
  height: 16px;
}

.icon-links .cv-btn:hover {
  background: var(--link-color);
  border-color: var(--link-color);
  box-shadow: 0 4px 12px rgba(107, 142, 125, 0.4);
}

/* Newsletter button - stands out more */
.icon-links .newsletter-btn {
  width: auto;
  padding: 0 1rem;
  border-radius: 22px;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--link-color);
  border-color: var(--link-color);
  color: white;
  white-space: nowrap;
  flex-direction: row;
  flex-wrap: nowrap;
}

.icon-links .newsletter-btn svg {
  width: 16px;
  height: 16px;
}

.icon-links .newsletter-btn span {
  white-space: nowrap;
}

.icon-links .newsletter-btn:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  box-shadow: 0 4px 12px rgba(74, 124, 155, 0.4);
}

/* Section styling */
.section {
  margin-bottom: var(--section-spacing);
}

/* Publication list */
.pub-list {
  list-style: none;
}

.pub-item {
  margin-bottom: 1.5rem;
  padding-left: 0;
}

.pub-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.4;
}

.pub-authors {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.pub-venue {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.pub-status {
  color: var(--accent-color);
  font-size: 0.9rem;
  font-weight: 500;
}

.pub-links {
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

.pub-links a {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-header);
  border-radius: 3px;
  font-size: 0.85rem;
}

.pub-links a:hover {
  text-decoration: none;
  background: var(--border-color);
}

/* Abstract toggle */
.pub-abstract-toggle {
  margin-top: 0.4rem;
}

.pub-abstract-toggle summary {
  font-size: 0.9rem;
  color: var(--link-color);
  cursor: pointer;
  list-style: none;
}

.pub-abstract-toggle summary::-webkit-details-marker {
  display: none;
}

.pub-abstract-toggle summary::before {
  content: "+ ";
  font-weight: 600;
}

.pub-abstract-toggle[open] summary::before {
  content: "- ";
}

.pub-abstract-toggle summary:hover {
  color: var(--link-hover);
}

.pub-abstract {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding: 1rem;
  background: var(--bg-header);
  border-radius: 4px;
  border-left: 3px solid var(--accent-color);
}

/* Popular writing */
.popular-list {
  list-style: none;
}

.popular-item {
  margin-bottom: 0.85rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
}

.popular-item a {
  font-weight: 500;
}

.popular-venue {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.popular-authors {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.popular-authors a {
  color: var(--link-color);
  font-weight: normal;
}

/* Interests list */
.interests-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.interests-list li {
  padding: 0.3rem 0.75rem;
  background: var(--bg-header);
  border-radius: 4px;
  font-size: 0.95rem;
}

/* Education list */
.edu-list {
  list-style: none;
}

.edu-item {
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--accent-color);
}

.edu-degree {
  font-weight: 500;
}

.edu-institution {
  color: var(--text-muted);
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1rem 1rem;
  }

  .header {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1rem;
    gap: 0.75rem;
  }

  .header-photo {
    width: 100px;
    height: 100px;
    margin: 0 auto;
  }

  .header-content h1 {
    margin-bottom: 0.2rem;
  }

  .header-content .role {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }

  .icon-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 280px;
    margin: 0 auto;
  }

  .icon-links a {
    width: 38px;
    height: 38px;
  }

  /* Force CV and Newsletter buttons to their own rows */
  .icon-links .cv-btn,
  .icon-links .newsletter-btn {
    flex: 0 0 100%;
    width: 100%;
    justify-content: center;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    height: 38px;
    white-space: nowrap;
    margin-top: 0.5rem;
    order: 10;
  }

  .icon-links .newsletter-btn {
    order: 11;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.2rem;
  }
}

/* Individual Paper Page */
.paper-page {
  max-width: 720px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

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

.paper-detail header {
  margin-bottom: 2rem;
}

.paper-detail h1 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.paper-authors {
  font-size: 1.1rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.paper-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.paper-meta .venue {
  font-style: italic;
}

.paper-meta .status {
  color: var(--accent-color);
  font-weight: 500;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  border-color: var(--link-color);
  color: var(--link-color);
  text-decoration: none;
}

.btn-primary {
  background: var(--link-color);
  border-color: var(--link-color);
  color: white;
}

.btn-primary:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: white;
}

.paper-abstract,
.paper-insight,
.paper-keywords,
.paper-citation {
  margin-bottom: 2rem;
}

.paper-abstract h2,
.paper-insight h2,
.paper-keywords h2,
.paper-citation h2 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.paper-abstract p {
  line-height: 1.7;
  text-align: justify;
}

.paper-insight .insight {
  font-style: italic;
  padding: 1rem;
  background: var(--bg-header);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 4px 4px 0;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.keyword-list li {
  padding: 0.25rem 0.6rem;
  background: var(--bg-header);
  border-radius: 3px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.citation-text {
  font-size: 0.9rem;
  padding: 1rem;
  background: var(--bg-header);
  border-radius: 4px;
  font-family: monospace;
}

/* BibTeX section */
.paper-bibtex {
  margin-bottom: 2rem;
}

.paper-bibtex h2 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.bibtex-container {
  position: relative;
}

.bibtex-code {
  font-size: 0.85rem;
  padding: 1rem;
  background: var(--bg-header);
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 0.75rem 0;
}

.btn-copy {
  cursor: pointer;
  background: var(--accent-color);
  color: white;
  border: none;
}

.btn-copy:hover {
  background: var(--link-color);
}

/* Cite button - styled exactly like pub-links a */
.pub-links .cite-btn {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-header);
  border: none;
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: normal;
  line-height: inherit;
  color: var(--link-color);
  cursor: pointer;
  text-decoration: none;
  vertical-align: baseline;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.pub-links .cite-btn:hover {
  text-decoration: none;
  background: var(--border-color);
  color: var(--link-hover);
}

/* Citation Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
  margin: 0 0 1.25rem 0;
  font-size: 1.2rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--text-color);
}

.cite-format {
  margin-bottom: 1.25rem;
}

.cite-format:last-child {
  margin-bottom: 0;
}

.cite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cite-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-color);
}

.copy-btn {
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.cite-code {
  font-size: 0.8rem;
  background: var(--bg-header);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.cite-text {
  font-size: 0.9rem;
  background: var(--bg-header);
  padding: 0.75rem;
  border-radius: 4px;
  margin: 0;
  line-height: 1.5;
}

.cite-text em {
  font-style: italic;
}

/* Make pub titles clickable links */
.pub-title a {
  color: inherit;
}

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

/* 404 Error Page */
.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  text-align: center;
}

.error-content h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--link-color);
  margin: 0;
  line-height: 1;
}

.error-subtitle {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0.5rem 0 1rem;
}

.error-message {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

.error-curves {
  max-width: 350px;
  margin: 0 auto 1.5rem;
}

.error-curves svg {
  width: 100%;
  height: auto;
}

.error-quote {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.error-content .btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--link-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.error-content .btn-primary:hover {
  opacity: 0.9;
}

/* Newsletter Section - Homepage */
.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -0.75rem;
  margin-bottom: 1rem;
}

.newsletter-list {
  list-style: none;
}

.newsletter-item {
  margin-bottom: 0.6rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
}

.newsletter-item a {
  font-weight: 500;
}

.newsletter-date {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.newsletter-subscribe {
  margin-top: 1.5rem;
}

/* Newsletter Individual Page */
.newsletter-page {
  max-width: 720px;
  margin: 0 auto;
}

.newsletter-post header {
  margin-bottom: 2rem;
}

.newsletter-post h1 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.newsletter-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.newsletter-meta .date {
  margin-right: 1rem;
}

.newsletter-meta .source a {
  color: var(--link-color);
}

.newsletter-content {
  line-height: 1.75;
}

.newsletter-content p {
  margin-bottom: 1.25rem;
}

.newsletter-content h1,
.newsletter-content h2,
.newsletter-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.newsletter-content h2 {
  font-size: 1.4rem;
  border-bottom: none;
  padding-bottom: 0;
}

.newsletter-content h3 {
  font-size: 1.2rem;
}

.newsletter-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.newsletter-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--accent-color);
  background: var(--bg-header);
  font-style: italic;
}

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

.newsletter-content ul,
.newsletter-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.newsletter-content li {
  margin-bottom: 0.5rem;
}

.newsletter-content a {
  color: var(--link-color);
}

.newsletter-content pre {
  background: var(--bg-header);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.newsletter-content code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-size: 0.9rem;
}

.newsletter-preview {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.newsletter-read-more {
  padding: 1.5rem;
  background: var(--bg-header);
  border-radius: 6px;
  text-align: center;
}

.newsletter-read-more a {
  font-weight: 500;
}

.newsletter-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.newsletter-cta {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.newsletter-footer .btn {
  margin: 0 0.5rem;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

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

/* Print styles */
@media print {
  body {
    max-width: none;
    padding: 0;
    background: white;
    color: black;
  }

  .header {
    background: none;
    padding: 0;
  }

  a {
    color: inherit;
  }

  .pub-links a::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
  }
}
