/* style/style.css — Harrer-structured stylesheet, Hugo Coder palette */

/* ---------- Tokens: Hugo Coder light ---------- */
:root {
  --background-color: #fafafa;
  --text-color: #212121;
  --highlight-color: #1565c0;
  --highlight-hover: #0d47a1;
  --border-color: #e0e0e0;
  --grey-color: #666666;
  --line-color: #eeeeee;
  --bg-box: #f5f5f5;
  --box-border-color: #e0e0e0;
  --code-bg: #f5f5f5;
  --code-chunk-bg: linear-gradient(160deg, #f8f8f8 0%, #f1f1f1 100%);
  --code-text-color: #212121;
  --hr-border-top: 1px solid rgba(0, 0, 0, 0.1);
  --table-text-color: #212121;
  --toc-active: #e0e0e0;
  --form-color: #4d4c4b;
  --form-background-color: #fafafa;
  --form-border: 1px solid #999896;
}

/* ---------- Tokens: dark mode (toggle attribute) ---------- */
[data-theme="dark"] {
  --background-color: #212121;
  --text-color: #dadada;
  --highlight-color: #42a5f5;
  --highlight-hover: #90caf9;
  --border-color: #424242;
  --grey-color: #cfcfcf;
  --line-color: #424242;
  --bg-box: #2a2a2a;
  --box-border-color: #424242;
  --code-bg: #2a2a2a;
  --code-chunk-bg: linear-gradient(160deg, #2a2a2a 0%, #1f1f1f 100%);
  --code-text-color: #dadada;
  --hr-border-top: 1px solid #424242;
  --table-text-color: #dadada;
  --toc-active: #424242;
  --form-color: #cfcfcf;
  --form-background-color: #2a2a2a;
  --form-border: 1px solid #424242;
}

/* ---------- Typography (Hugo Coder fonts) ---------- */
body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  font-size: 17px;
}

h1, h2, h3, h4, h5, h6,
.book-summary {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

code, pre, kbd, samp {
  font-family: 'JetBrains Mono', 'Fira Code', SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

code {
  background-color: var(--code-bg);
  color: var(--code-text-color);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}

pre {
  background-image: var(--code-chunk-bg);
  background-color: var(--code-bg);
  border-left: 3px solid var(--highlight-color);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
}

a {
  color: var(--highlight-color);
  text-decoration: none;
  border-bottom: 1px dotted var(--highlight-color);
}

a:hover {
  color: var(--highlight-hover);
  border-bottom-style: solid;
}

/* ---------- Header block on landing page ---------- */
#header .title {
  font-size: 3em;
  margin-bottom: -40px;
}

#header .subtitle em {
  font-style: normal;
  font-size: 1em;
  color: var(--grey-color);
  margin-bottom: -40px;
}

#header .author em,
#header .date em {
  font-size: 0.9em;
  font-style: normal;
}

/* ---------- Figures ---------- */
p.caption,
.caption {
  color: var(--grey-color);
  margin-top: 10px;
  font-size: 0.9em;
}

.figure {
  border-top: 2px solid var(--line-color);
  border-bottom: 2px solid var(--line-color);
  padding: 0.5em 0;
  margin: 1.5em 0;
}

.inline-figure {
  border: 0;
  box-shadow: none;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

img.cover {
  margin: 0 0 1em 1.5em;
  max-width: 250px;
}

/* ---------- Horizontal rules ---------- */
hr {
  border: 0;
  border-top: var(--hr-border-top);
  margin: 2em 0;
}

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  margin: 1.5em 0;
  color: var(--table-text-color);
}

th, td {
  border-bottom: 1px solid var(--border-color);
  padding: 0.5em 0.8em;
}

th {
  border-bottom: 2px solid var(--text-color);
  text-align: left;
}

/* ---------- Blockquotes ---------- */
blockquote {
  border-left: 3px solid var(--border-color);
  padding: 0.4em 1em;
  color: var(--text-color);
  background: var(--bg-box);
  border-radius: 0 4px 4px 0;
  position: relative;
}

/* ---------- Callout boxes (Harrer-style) ---------- */
.boxinfo, .boximportant, .boxreport, .boxdmetar, .boxquestion, .boxempty {
  padding: 1em 1em 1em 3em;
  margin-bottom: 10px;
  background: var(--bg-box);
  position: relative;
  border: 1px solid var(--box-border-color);
  border-left: 3px solid var(--highlight-color);
  border-radius: 0.25rem;
}

.boxempty {
  padding: 1em 1em 1em 1.1em;
  border-left-color: var(--border-color);
}

.boxinfo::before,
.boximportant::before,
.boxreport::before,
.boxdmetar::before,
.boxquestion::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 13px;
  font-size: 28px;
  color: var(--highlight-color);
  line-height: 1;
  top: 1rem;
}

.boxinfo::before      { content: "\f0eb"; }
.boximportant::before { content: "\f06a"; }
.boxreport::before    { content: "\f570"; }
.boxdmetar::before    { content: "\f4f7"; }
.boxquestion::before  { content: "\f059"; }

/* ---------- Drop cap ---------- */
.firstcharacter {
  color: var(--highlight-color);
  float: left;
  font-size: 40px;
  line-height: 50px;
  font-weight: 700;
  padding: 2px 8px 2px 2px;
}

/* ---------- Section-numbering color ---------- */
.header-section-number {
  color: var(--grey-color);
}

small.text-muted {
  color: var(--grey-color) !important;
}

/* ---------- Sidebar (gitbook) ---------- */
.book-summary {
  background: var(--background-color);
  border-right: 1px solid var(--border-color);
}

.book-summary ul.summary li.active > a {
  color: var(--highlight-color);
  background-color: var(--toc-active);
}

.book-summary ul.summary li a:hover {
  color: var(--highlight-color);
}

/* ---------- Citation entries ---------- */
.csl-entry {
  margin-bottom: 20px;
  padding-left: 1.5em;
  text-indent: -1.5em;
}

/* ---------- Floating mode-switch button ---------- */
.sticky-item {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
}

.btn-circle-mode {
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-box);
  color: var(--text-color);
  font-size: 22px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, color 120ms ease;
}

.btn-circle-mode:hover {
  background-color: var(--highlight-color);
  color: #ffffff;
}

.btn-circle-mode i {
  pointer-events: none;
}

/* ---------- Right-sidebar download list ---------- */
.sidebar-downloads-heading {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  color: var(--text-color);
}

.sidebar-downloads {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
}

.sidebar-downloads li {
  margin: 0.2rem 0;
}

.sidebar-downloads a {
  color: var(--highlight-color);
  border-bottom: none;
}

.sidebar-downloads a::before {
  content: "⬇ ";
  opacity: 0.7;
}

.sidebar-downloads a:hover {
  color: var(--highlight-hover);
  text-decoration: underline;
}

/* ---------- Footer attribution ---------- */
.bookdown-attribution {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.9em;
  color: var(--grey-color);
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

.bookdown-attribution a {
  border-bottom-style: solid;
}
