/* First Distinction - Minimal K₄ Design */

:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #2563eb;
  --border: #e5e5e5;
  --code-bg: #f5f5f5;
  --tetra-color: #1a1a1a;
  --tetra-opacity: 1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --text: #e5e5e5;
    --muted: #999;
    --accent: #60a5fa;
    --border: #333;
    --code-bg: #1a1a1a;
    --tetra-color: #e5e5e5;
    --tetra-opacity: 0.8;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Typography */
h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { font-size: 1.1rem; }

p {
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.k4-symbol {
  margin-bottom: 1.5rem;
}

.tetrahedron {
  width: 120px;
  height: 120px;
  color: var(--tetra-color);
  opacity: var(--tetra-opacity);
}

.tagline {
  font-size: 1.1rem;
  color: var(--muted);
  font-style: italic;
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

/* Code */
code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

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

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

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

th {
  font-weight: 600;
  background: var(--code-bg);
}

/* Lists */
ul, ol {
  margin: 1rem 0 1rem 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Footer links */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent);
}

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

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.site-title {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.header-badges a {
  display: inline-flex;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.header-badges a:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.header-badges img {
  height: 22px;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav a:hover {
  color: var(--text);
}

/* CI Badge */
img[alt="CI"] {
  height: 20px;
}

/* MathJax adjustments */
mjx-container {
  overflow-x: auto;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    font-size: 15px;
    padding: 1.5rem 1rem 3rem;
  }
  
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-badges {
    width: 100%;
    justify-content: flex-start;
  }
  
  .header-badges img {
    height: 18px;
  }
  
  .hero {
    padding: 2rem 0 1.5rem;
  }
  
  .tetrahedron {
    width: 100px;
    height: 100px;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 0.4rem 0.5rem;
  }

  main img {
    width: 100%;
  }
}

/* Images - clickable, responsive */
main img {
  max-width: 100%;
  width: 600px;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

main img:hover {
  box-shadow: 0 4px 12px rgba(128, 128, 128, 0.3);
}

/* Badges - don't apply figure styling */
main a > img[src*="badge"],
main a > img[src*="shields"],
main a > img[src*="zenodo"] {
  width: auto;
  max-width: none;
  display: inline;
  margin: 0;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

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

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Consent Banner */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  color: white;
  padding: 1.5rem;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
  z-index: 9999;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.consent-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.consent-content p {
  margin: 0;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.consent-content strong {
  font-size: 1.1rem;
}

.consent-content a {
  color: #4a9eff;
  text-decoration: underline;
}

.consent-buttons {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.consent-buttons button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-accept {
  background: #28a745;
  color: white;
}

.btn-accept:hover {
  background: #218838;
  transform: translateY(-1px);
}

.btn-decline {
  background: #6c757d;
  color: white;
}

.btn-decline:hover {
  background: #545b62;
}

@media (max-width: 768px) {
  .consent-content {
    flex-direction: column;
    text-align: center;
  }
  
  .consent-buttons {
    width: 100%;
    justify-content: center;
  }
}

.site-footer p {
  margin: 0.5rem 0;
}
