/* ===== Theme tokens ===== */
:root {
  --bg: #ffffff;
  --text: #000000;
  --heading: #000000;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --border: #cccccc;
  --border-light: #e5e5e5;
  --code-bg: #eeeeee;
  --code-hover-bg: #cccccc;
  --muted-bg: #f9f9f9;
  --muted-border: #dddddd;
  --tooltip-bg: #333333;
  --tooltip-text: #ffffff;
  color-scheme: light;
}

/* Dark values, shared by system preference and manual override. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --text: #e6e6e6;
    --heading: #f0f0f0;
    --link: #6ea8fe;
    --link-hover: #93bbff;
    --border: #444444;
    --border-light: #333333;
    --code-bg: #2a2a2a;
    --code-hover-bg: #3a3a3a;
    --muted-bg: #1e1e1e;
    --muted-border: #444444;
    --tooltip-bg: #e6e6e6;
    --tooltip-text: #111111;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121212;
  --text: #e6e6e6;
  --heading: #f0f0f0;
  --link: #6ea8fe;
  --link-hover: #93bbff;
  --border: #444444;
  --border-light: #333333;
  --code-bg: #2a2a2a;
  --code-hover-bg: #3a3a3a;
  --muted-bg: #1e1e1e;
  --muted-border: #444444;
  --tooltip-bg: #e6e6e6;
  --tooltip-text: #111111;
  color-scheme: dark;
}

body {
	color: var(--text);
	background-color: var(--bg);
	font-size: 0.95em;
	line-height: 1.5;
	margin: 40px auto;
	max-width: 770px;
	padding: 0 10px;
  font-family: Arial
}

table, th, td, tr {
	border: 1px solid var(--border);
	border-collapse: collapse;
	padding: 10px;
	margin-left: auto;
	margin-right: auto;
}

.center {
		margin-left: auto;
		margin-right: auto;
		width: 75%;
}

img {
	display: block;
	margin-left: auto;
	margin-right: auto;
	image-orientation: from-image;
	max-width: 75%;
	height: auto;
  border-radius: 6px; /* Subtle rounding */
}

.spoiler{
  color: var(--text);
  background-color: var(--text);
}

.spoiler:hover{
  background-color: var(--bg);
  }

blockquote {
	border-left: 2px solid var(--border);
	padding: 0.25em 10px;
}

/* Better list styling */
ul, ol {
  margin-bottom: 1.2em;
}

ul ul {
  list-style-type: circle;
}

ol ul {
  list-style-type: disc;
}

code {
    background-color: var(--code-bg);
    border-radius: 3px;
    font-family: courier, monospace;
    padding: 0 3px;
}

.tex sub, .latex sub, .latex sup {
      text-transform: uppercase;
    }

    .tex sub, .latex sub {
      vertical-align: -0.5ex;
      margin-left: -0.1667em;
      margin-right: -0.125em;
    }

    .tex, .latex, .tex sub, .latex sub {
      font-size: 1em;
    }

    .latex sup {
      font-size: 0.85em;
      vertical-align: 0.15em;
      margin-left: -0.36em;
      margin-right: -0.15em;
    }

iframe {
		   display: block;
		   margin: 0 auto;
		}

video {
		   display: block;
		   margin: 0 auto;
		}

figcaption {
		   text-align: center;
		}

pre {
		    display: inline;
		    margin: 0;
		}

.collapsible {
  background-color: var(--code-bg);
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
	font-weight: bold;
}

.active, .collapsible:hover {
  background-color: var(--code-hover-bg);
}

.content {
  padding: 0 18px;
  display: none;
  overflow: hidden;
  background-color: var(--bg);
}

.collapsible:after {
  content: '\02795'; /* Unicode character for "plus" sign (+) */
  color: white;
  float: right;
  margin-left: 5px;
}

.active:after {
  content: "\2796"; /* Unicode character for "minus" sign (-) */
  color: white;
  float: right;
  margin-left: 5px;
}

/* Better link styling */
a {
  color: var(--link); /* Nice blue */
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

a:hover {
  border-bottom-color: var(--link);
}

/* Better spacing for content sections */
p {
  margin-bottom: 1.2em;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Theme toggle: a PowerPoint-style transition picked at random by theme.js,
   which tags <html> with [data-transition]. Only runs where the View
   Transitions API is supported. The new theme is the animated layer; the
   old one stays put underneath. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none; /* default: instant unless an effect below applies */
  }

  /* 1. Wipe: new theme sweeps in from top to bottom. */
  [data-transition="wipe"]::view-transition-new(root) {
    animation: theme-wipe 0.5s ease;
  }
  @keyframes theme-wipe {
    from { clip-path: inset(0 0 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
  }

  /* 2. Circle / iris: new theme grows from the toggle's click point. */
  [data-transition="circle"]::view-transition-new(root) {
    animation: theme-circle 0.5s ease;
  }
  @keyframes theme-circle {
    from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 50%)); }
    to   { clip-path: circle(150% at var(--vt-x, 50%) var(--vt-y, 50%)); }
  }

  /* 3. Split: new theme opens outward from the vertical center. */
  [data-transition="split"]::view-transition-new(root) {
    animation: theme-split 0.5s ease;
  }
  @keyframes theme-split {
    from { clip-path: inset(0 50% 0 50%); }
    to   { clip-path: inset(0 0 0 0); }
  }

  /* 4. Cover: new theme slides down over the old. */
  [data-transition="cover"]::view-transition-new(root) {
    animation: theme-cover 0.5s ease;
  }
  @keyframes theme-cover {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
  }

  /* 5. Dissolve: new theme fades in. */
  [data-transition="dissolve"]::view-transition-new(root) {
    animation: theme-dissolve 3.0s ease;
  }
  @keyframes theme-dissolve {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* 6. Corners: a disc blooms from each corner at once and they merge.
     Each radial gradient is pinned to a corner; growing mask-size expands
     all four discs together. */
  [data-transition="corners"]::view-transition-new(root) {
    mask-image:
      radial-gradient(circle at top left, #000 70%, transparent 72%),
      radial-gradient(circle at top right, #000 70%, transparent 72%),
      radial-gradient(circle at bottom left, #000 70%, transparent 72%),
      radial-gradient(circle at bottom right, #000 70%, transparent 72%);
    mask-repeat: no-repeat;
    mask-position: top left, top right, bottom left, bottom right;
    animation: theme-corners 3.0s ease;
  }
  @keyframes theme-corners {
    from { mask-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    to   { mask-size: 220% 220%, 220% 220%, 220% 220%, 220% 220%; }
  }
}

/* Remove margin from the last item in any list */
li:last-child {
    margin-bottom: 0;
}

/* Reset default list margins and set consistent spacing */
ul, ol {
    margin: 0 0 1.2em 0;
    padding-left: 2em; /* Consistent indentation */
}

/* Nested lists should have no bottom margin */
ul ul, ol ol, ul ol, ol ul {
    margin: 0; /* Remove bottom margin from nested lists */
    padding-left: 1.5em; /* Slightly less indentation for sub-items */
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Fit Adjustment Tracker */
#tracker-form-container {
  background-color: var(--muted-bg);
  border: 1px solid var(--muted-border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}

.tracker-row {
  margin-bottom: 10px;
}

.tracker-row label {
  display: block;
  font-weight: bold;
  margin-bottom: 3px;
}

.tracker-row input,
.tracker-row select,
.tracker-row textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Arial;
  font-size: 0.9em;
  box-sizing: border-box;
  background-color: var(--bg);
  color: var(--text);
}

.tracker-buttons {
  margin-top: 10px;
}

.tracker-buttons button,
#tracker-add {
  background-color: var(--link);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

.tracker-buttons button:hover,
#tracker-add:hover {
  background-color: var(--link-hover);
}

.tracker-delete {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: #888;
  padding: 2px 7px;
  font-size: 0.85em;
}

.tracker-delete:hover {
  background-color: #fee;
  color: #c00;
  border-color: #c00;
}

/* Scroll progress bar (top of page, fills left to right) */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  background-color: var(--link);
  z-index: 1200;
  transition: width 0.1s linear;
}

/* Dark-mode toggle button */
#theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background-color: var(--muted-bg);
  color: var(--text);
  font-size: 1.1em;
  line-height: 1;
  cursor: pointer;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#theme-toggle:hover {
  border-color: var(--link);
}

/*
a[href^="http"]:not([href*="yourdomain.com"])::after {
  content: " ↗";
  font-size: 0.75em;
  vertical-align: super;
  opacity: 0.6;
}
*/
