@import url("https://fonts.googleapis.com/css2?family=lora:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=inconsolata&display=swap");

:root {
  /* material dark theme colors */
  --md-sys-color-primary: #80cbc4; /* teal 200 */
  --md-sys-color-on-primary: #000000;
  --md-sys-color-primary-container: #00504b;
  --md-sys-color-on-primary-container: #a7f2ec;
  --md-sys-color-secondary: #ffb74d; /* amber 300 */
  --md-sys-color-on-secondary: #000000;
  --md-sys-color-tertiary: #9575cd; /* deep purple 300 */
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-error: #ef9a9a; /* red 200 */
  --md-sys-color-on-error: #6b0000;
  --md-sys-color-background: #121212;
  --md-sys-color-on-background: #e0e0e0;
  --md-sys-color-surface: #1e1e1e; /* slight elevation from background */
  --md-sys-color-on-surface: #e0e0e0;
  --md-sys-color-surface-variant: #333333;
  --md-sys-color-on-surface-variant: #c0c0c0;
  --md-sys-color-outline: #555555;
  --md-sys-color-shadow: #000000;

  /* status colors */
  --md-sys-color-info: #90caf9; /* blue 200 */
  --md-sys-color-success: #a5d6a7; /* green 200 */
  --md-sys-color-warning: #ffee58; /* amber 400 */
  --md-sys-color-error-status: #ef9a9a; /* red 200 */

  /* shadows (material elevation) */
  --md-elevation-1: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
  --md-elevation-2: 0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12);
  --md-elevation-4: 0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12);
  --md-elevation-8: 0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12);
}

body {
  margin: 40px auto;
  width: 610px;
  max-width: 100%;
  line-height: 1.6;
  font-size: 18px; /* slightly larger base font */
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  padding: 0 16px; /* slightly more padding */
  font-family: "lora", serif; /* specify serif fallback */
  font-weight: 400; /* lora default */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility; /* better text rendering */
}

h1, h2, h3 {
  line-height: 1.2;
  font-family: "lora", serif;
  color: var(--md-sys-color-on-surface);
  margin-top: 1.5em; /* add some top margin */
  margin-bottom: 0.8em;
  font-weight: 700; /* bolder headings */
}

/* input form with rounded corners and hover animations for dark theme */
input {
  padding: 12px 16px; /* increased padding */
  margin: 8px 0; /* more vertical margin */
  box-sizing: border-box;
  border: none; /* no explicit border */
  border-radius: 8px; /* slightly more rounded */
  background: var(--md-sys-color-surface-variant); /* surface variant for inputs */
  color: var(--md-sys-color-on-surface-variant);
  font-size: 16px;
  transition: all 0.3s ease-in-out; /* smoother transitions */
  outline: none;
  box-shadow: var(--md-elevation-1); /* subtle elevation */
}
input:focus {
  background-color: var(--md-sys-color-surface); /* slightly lighter on focus */
  box-shadow: 0 0 0 2px var(--md-sys-color-primary), var(--md-elevation-2); /* primary accent ring on focus */
}
input:hover {
  box-shadow: var(--md-elevation-2); /* increased elevation on hover */
}

/* dark theme button styling */
.button {
  background-color: var(--md-sys-color-primary); /* primary accent color */
  border: none;
  color: var(--md-sys-color-on-primary); /* black or dark for contrast */
  padding: 10px 20px; /* more padding for a bolder button */
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 8px 4px; /* more margin */
  transition: all 0.3s ease-in-out;
  cursor: pointer;
  border-radius: 8px; /* slightly more rounded */
  box-shadow: var(--md-elevation-1); /* subtle elevation */
  font-weight: 500; /* slightly bolder text */
  letter-spacing: 0.5px; /* subtle letter spacing */
}
.button:hover {
  background-color: var(--md-sys-color-primary-container); /* darker primary on hover */
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-elevation-2); /* increased elevation on hover */
}
.button:active {
  box-shadow: var(--md-elevation-1); /* slight press effect */
}

/* message boxes in dark theme */
.isa_info, .isa_success, .isa_warning, .isa_error {
  padding: 16px;
  margin: 16px 0;
  border-radius: 8px;
  box-shadow: var(--md-elevation-1); /* elevation for cards */
  font-weight: 500;
  line-height: 1.4;
  display: flex; /* for potential icon alignment */
  align-items: center;
}
.isa_info {
  color: var(--md-sys-color-info);
  background-color: color-mix(in srgb, var(--md-sys-color-info) 15%, var(--md-sys-color-surface) 85%); /* blended background */
}
.isa_success {
  color: var(--md-sys-color-success);
  background-color: color-mix(in srgb, var(--md-sys-color-success) 15%, var(--md-sys-color-surface) 85%);
}
.isa_warning {
  color: var(--md-sys-color-warning);
  background-color: color-mix(in srgb, var(--md-sys-color-warning) 15%, var(--md-sys-color-surface) 85%);
}
.isa_error {
  color: var(--md-sys-color-error-status);
  background-color: color-mix(in srgb, var(--md-sys-color-error-status) 15%, var(--md-sys-color-surface) 85%);
}

img {
  width: 500px;
  max-width: 100%;
  border-radius: 12px; /* more rounded images */
  display: block; /* center block images */
  margin: 24px auto; /* center images */
  box-shadow: var(--md-elevation-2); /* subtle shadow for images */
}

/* dark theme for links */
a {
  cursor: pointer;
  color: var(--md-sys-color-primary); /* use primary accent for links */
  line-height: inherit;
  transition: all 0.2s ease-in-out;
  text-decoration: none; /* no underline by default */
  font-weight: 500; /* slightly bolder links */
}
a:hover {
  color: var(--md-sys-color-on-primary-container); /* lighter on hover */
  text-decoration: underline; /* underline on hover for clarity */
}
a:visited {
  color: var(--md-sys-color-tertiary); /* tertiary accent for visited */
}
a:visited:hover {
  color: var(--md-sys-color-on-tertiary); /* lighter on hover */
  text-decoration: underline;
}

/* code blocks and preformatted text */
pre, code {
  font-family: "inconsolata", monospace;
  background-color: var(--md-sys-color-surface-variant); /* use surface variant for code background */
  color: var(--md-sys-color-on-surface-variant);
  border-radius: 8px; /* consistent border-radius */
  overflow-x: auto;
  font-size: 15px; /* slightly adjusted font size */
}

/* preformatted blocks specifically */
pre {
  padding: 16px; /* more padding */
  margin: 16px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--md-elevation-1); /* elevation for code blocks */
}

/* inline code styling */
code {
  background-color: color-mix(in srgb, var(--md-sys-color-on-background) 10%, transparent); /* subtle inline code background */
  color: var(--md-sys-color-on-background);
  padding: 3px 6px; /* adjusted padding */
  border-radius: 6px;
  font-size: 90%;
  box-shadow: none; /* no shadow for inline */
}

/* selection styling for text */
::selection {
  color: var(--md-sys-color-on-primary);
  background: var(--md-sys-color-primary);
}

/* agenda buttons styling for dark mode */
.org-org-agenda-calendar-event,
.org-org-agenda-calendar-sexp {
  color:var(--md-sys-color-on-surface);
  background-color:var(--md-sys-color-surface);
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: var(--md-elevation-1);
  margin: 4px 0;
  display: inline-block;
  transition: background-color 0.3s ease;
}
.org-org-agenda-calendar-event:hover,
.org-org-agenda-calendar-sexp:hover {
  background-color: var(--md-sys-color-surface-variant);
  box-shadow: var(--md-elevation-2);
}

.org-org-agenda-clocking {
  background-color:color-mix(in srgb, var(--md-sys-color-warning) 20%, var(--md-sys-color-surface) 80%);
  color: var(--md-sys-color-warning);
  padding: 2px 6px;
  border-radius: 4px;
}

.org-org-agenda-column-dateline {
  background-color: var(--md-sys-color-surface-variant);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
}

.org-org-agenda-current-time {
  color: var(--md-sys-color-secondary); /* use amber accent for current time */
  font-weight: 700;
}

.org-org-agenda-date {
  color: var(--md-sys-color-primary); /* primary accent for dates */
  font-weight: 500;
}

.org-org-agenda-date-today {
  color: var(--md-sys-color-primary);
  font-weight: 700;
  font-style: italic;
  text-decoration: underline; /* highlight today's date more */
  text-underline-offset: 3px;
}

.org-org-agenda-date-weekend {
  color: var(--md-sys-color-tertiary); /* tertiary accent for weekends */
  font-weight: 700;
}

.org-org-agenda-diary {
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface);
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: var(--md-elevation-1);
  margin: 8px 0;
}

.org-org-agenda-dimmed-todo {
  color: var(--md-sys-color-on-surface-variant); /* dimmed text */
  opacity: 0.7;
}

.org-org-agenda-done {
  color: var(--md-sys-color-success);
  font-weight: 500;
}

.org-org-agenda-filter-category,
.org-org-agenda-filter-effort,
.org-org-agenda-filter-regexp,
.org-org-agenda-filter-tags {
  color: var(--md-sys-color-on-surface-variant);
  background-color: var(--md-sys-color-surface-variant);
  padding: 4px 8px;
  border-radius: 4px;
  margin: 2px;
  display: inline-block;
  font-size: 0.9em;
}

.org-org-agenda-restriction-lock {
  background-color: var(--md-sys-color-error-status);
  color: var(--md-sys-color-on-error);
  padding: 2px 6px;
  border-radius: 4px;
}

.org-org-agenda-structure {
  color: var(--md-sys-color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

/* --- Additions for Citations and References --- */

/* Blockquote styling for longer quotes */
blockquote {
  margin: 16px 0; /* consistent vertical margin */
  padding: 16px 24px; /* ample padding */
  border-left: 5px solid var(--md-sys-color-primary); /* primary color accent border */
  background-color: var(--md-sys-color-surface-variant); /* slightly distinct background */
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
  border-radius: 4px; /* subtle rounding */
  box-shadow: var(--md-elevation-1); /* subtle elevation */
  line-height: 1.5;
}
blockquote p {
  margin: 0; /* remove default paragraph margin inside blockquote */
}

/* Inline quote styling */
q {
  font-style: italic;
  color: var(--md-sys-color-on-surface); /* default text color */
}

/* Cite element styling for titles of works */
cite {
  font-style: normal; /* override default italic */
  color: var(--md-sys-color-tertiary); /* use tertiary accent for visual distinction */
  font-weight: 500;
}

/* General styling for reference lists (if using ol/ul) */
.references, .bibliography {
  list-style-type: none; /* remove default bullets/numbers */
  padding: 0;
  margin: 24px 0;
}
.references li, .bibliography li {
  margin-bottom: 12px; /* spacing between reference entries */
  line-height: 1.6;
  color: var(--md-sys-color-on-background);
}
