/* Custom CSS for Agda-generated HTML - Inspired by 1lab */
/* This file will override the default Agda.css */

:root {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-code: #f5f5f5;
  --text-primary: #2c3e50;
  --text-secondary: #546e7a;
  --link-color: #3498db;
  --link-hover: #2980b9;
  --border-color: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);

  /* Agda syntax highlighting */
  --agda-keyword: #8e44ad;
  --agda-function: #2980b9;
  --agda-constructor: #16a085;
  --agda-type: #c0392b;
  --agda-comment: #95a5a6;
  --agda-module: #e67e22;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-code: #252525;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --link-color: #64b5f6;
    --link-hover: #42a5f5;
    --border-color: #404040;
    --shadow: rgba(0, 0, 0, 0.3);

    --agda-keyword: #bb86fc;
    --agda-function: #64b5f6;
    --agda-constructor: #4db6ac;
    --agda-type: #ef5350;
    --agda-comment: #757575;
    --agda-module: #ff9800;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Headers */
h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Code blocks */
pre {
  background-color: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  box-shadow: 0 2px 4px var(--shadow);
  font-size: 0.9rem;
  line-height: 1.5;
}

code {
  font-family: "Fira Code", "SF Mono", Monaco, Inconsolata, "Roboto Mono", Consolas, monospace;
  font-variant-ligatures: common-ligatures;
}

/* Inline code */
:not(pre) > code {
  background-color: var(--bg-code);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  border: 1px solid var(--border-color);
}

/* Agda-specific styles */
.Agda {
  font-size: 1rem;
}

/* Make Agda code more readable */
.Agda a {
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}

.Agda a:hover {
  border-bottom-color: currentColor;
  text-decoration: none;
}

/* Syntax highlighting classes */
.Comment { color: var(--agda-comment); font-style: italic; }
.Keyword { color: var(--agda-keyword); font-weight: 600; }
.Function { color: var(--agda-function); }
.Datatype { color: var(--agda-type); font-weight: 500; }
.InductiveConstructor { color: var(--agda-constructor); }
.Module { color: var(--agda-module); font-weight: 500; }
.Primitive { color: var(--agda-type); }
.PrimitiveType { color: var(--agda-type); font-weight: 500; }
.Postulate { color: var(--agda-function); font-style: italic; }
.Record { color: var(--agda-type); font-weight: 500; }
.Field { color: var(--agda-function); }

/* Operators and symbols */
.Operator, .Symbol {
  color: var(--text-primary);
}

/* Background highlighting for clickable elements */
.Agda a.Function:hover,
.Agda a.InductiveConstructor:hover,
.Agda a.Datatype:hover,
.Agda a.Module:hover {
  background-color: rgba(52, 152, 219, 0.1);
  border-radius: 2px;
}

/* Line numbers (if enabled) */
.LineNumber {
  color: var(--text-secondary);
  opacity: 0.5;
  user-select: none;
  padding-right: 1em;
}

/* Module header */
.module-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

/* Navigation */
nav {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px var(--shadow);
}

nav ul {
  list-style: none;
}

nav li {
  margin: 0.5rem 0;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  pre {
    padding: 1rem;
    font-size: 0.85rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  pre {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}
