/* SPDX-License-Identifier: MIT
 * Copyright 2025 Jose E. Marchesi
 * Copyright 2025 C Standards Committee
 * Copyright 2024-2025 Jorenar
 */

:root {
  scrollbar-gutter: stable;
  color-scheme: light dark;

  --bg: #cededb;/*#cfdbd9;*/ /*#fff6ee; */
  --bg-item: #c3cdc5; /*#dc9cad;*//*#dcc5cb;*/
  --color: black; /*#81384b;*/ /* 3c4cc4; */
  --color-a: #af425e; /*#1473ad; */
  --color-nav-target: #e80b0b; /*#81384b;*/ /*#1e02dd; */
  --shadow-logo: grey; /* #596fc5;*/
  --h1-color: #81384b;
  --caption-color: #81384b;

  --font-serif: "Times New Roman", "Times", "Liberation Serif", "FreeSerif", serif;
  --font-mono: "Courier", "FreeMono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b22;
    --bg-item: #4a4a4a26;
    --color: #b0c4de;
  }
}

body {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: 0.02em;

  margin: 1em auto 3em;
  display: flex;
  max-width: 820px;

  background-color: var(--bg);
  color: var(--color);
  line-height: 1.25;
}

a {
  color: var(--color-a);
  letter-spacing: 0.03em;
  text-decoration: underline dotted 1px;
  text-underline-offset: 3px;
}

a:hover {
  filter: brightness(1.3);
}

caption {
  color: var(--caption-color);
  font-weight: bold;
}

code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  text-wrap: nowrap;
}

dd {
  margin-top: 0.1em;
  margin-bottom: 1em;
}

dt {
  border-radius: 10px;
  background-color: var(--bg-item);
  padding: 0.3em;
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.2em; }
h4 { font-size: 1.1em; }

h1, h2, h3, h4, h5 {
  color: var(--h1-color);
  margin-top: 0.8em;
  margin-bottom: 0.1em;
}

h1, h2 {
  margin-top: 0;
  text-decoration: underline;
  text-decoration: underline 2px;
  text-underline-offset: 4px;
}

hr {
  opacity: 0.4;
}

p {
  margin: 0;
}

p + p {
  margin-top: 0.5em;
}

details > p {
  margin: 0.5em 1.5em;
  margin-right: 0;
}

summary {
  cursor: pointer;
  width: max-content;
}

summary:hover {
  filter: brightness(1.3);
}

ul, ol {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}

x-cmt {
  opacity: 0.7;
  font-size: 0.8em;
  padding: 0.2em;
}

x-cmt::before {
  content: '# ';
}

x-cmt::after {
  content: ' #';
}

.anchor-no-color a {
  color: inherit;
}

.nobr {
  white-space: nowrap;
}

.yt-container {
  padding-bottom: 56.25%;
  position: relative;
  margin: 1em auto;
}

.yt-video {
  height: 100%;
  position: absolute;
  border: none;
  width: 100%;
}


.accordion-list > details {
  font-size: 0.9em;
  margin-left: 0.5em;
}

.accordion-list > details > details {
  margin-left: 1em;
}

.accordion-list > details > summary,
.accordion-list > details > details > summary {
  font-size: 1.2em;
}

.accordion-list > details li {
  margin-top: 0.1em;
}

.book {
  margin-bottom: 0.3em;
}

.book i {
  display: block;
}

.tools-grid {
  margin: 0.5em auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7em, auto));
  column-gap: 0.4em;
  row-gap: 0.15em;
  list-style: none;
  padding-left: 0;
  text-wrap: balance;
}

.tools-grid > li {
  display: grid;
  padding: 0.35em 0.1em;
  text-align: center;

  align-items: center;
  justify-content: center;
  width: 100%;

  background: var(--bg-item);
  border-radius: 10px;
}

.tools-grid > li > aside {
  font-size: 0.6em;
  padding-top: 0;
}


.copyleft {
  opacity: 0.7;
  margin-top: 1em;
}

.copyleft > a {
  display: block;
  font-size: 0.75em;
  margin-top: -0.3em;
}

.copyleft::before {
  content: "\00a9";
  display: inline-block;
  transform: scaleX(-1);
  line-height: 1;
}


nav {
  max-width: min-content;
  padding: 0.5em;
  margin-right: 1em;
  height: min-content;
  text-align: center;

  position: sticky;
  top: 1em;
}

nav > header {
  margin-bottom: 1em;
}

nav > header img {
  width: 70%;
  height: 100%;
  max-width: 3em;
  filter: drop-shadow(0 0 1px var(--shadow-logo));
}

nav > header span {
  display: block;
  font-size: 0.6em;
  margin-top: 0.5em;
}

nav > header img[alt] {
  font-family: "Helvetica Black", "Helvetica", "Arial", sans;
  font-weight: bolder;
  font-size: 2em;
  color: LightSteelBlue;
}

nav > #menu + label + div a {
  border-radius: 5px;
  border: 1px solid;
  display: block;
  font-size: 1.2em;
  margin: 0.5em auto;
  padding: 0.1em 0.15em;
  text-decoration: none;
}

nav a.current {
  color: var(--color-nav-target);
}


table.revisions {
  border-spacing: 0.2em;
  margin-top: 1.5em;
  //  width: max-content;
  text-wrap: balance;
}

table.revisions td {
  border-radius: 10px;
  padding: 0.3em;
}

table.revisions td:first-of-type {
  font-weight: bold;
  text-align: center;
}

table.revisions td:not(:empty) {
  background: var(--bg-item);
}

table.revisions td time {
  display: block;
  font-size: 0.7em;
}


#menu, #menu + label {
  display: none;
}

@media only screen and (max-width: 450px) {
  body {
    display: block;
    font-size: 0.95em;
    margin-top: 0;
  }

  body > * {
    margin: auto;
    max-width: 95%;
  }

  nav {
    background: var(--bg);
    border-bottom: 2px solid;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 0.5em;
    top: 0;
    z-index: 1;
  }

  nav > header {
    height: 2.5em;
    margin: 0;
  }

  nav > header span {
    display: none;
  }

  nav > div {
    display: none;
  }

  nav #menu + label {
    display: initial;
    font-size: 4em;
    line-height: 0;
    margin: auto 0;
  }

  nav #menu:checked ~ label {
    transform: scale(0.9);
  }

  nav #menu:checked ~ div {
    display: block;
    width: 100%;
    overflow-y: auto;
    max-height: 60vh;
  }

  .copyleft > a {
    font-size: 0.9em;
  }
}
