/* site.css: the look of ozkr.ac, taken from the logo: an engraving of a bird in
   ink on paper, in a gold rim. Paper and ink by day, night and paper by dark;
   gold for the rules, the links and the labels; one serif for everything.

   luccet.css (loaded by luccet.js) is functional only, so this sheet is the
   theme: it sets the --t-* properties luccet.css reads, the column and the
   type, then the site's chrome (site.js) and the vocabulary (math.js). Every
   colour is a light-dark() pair; site.js sets color-scheme through
   data-theme when the reader chooses. */

@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..700;1,400..700&display=swap");

/* ------------------------------------------------------------ tokens */

:root {
  color-scheme: light dark;

  --t-bg: light-dark(#f6ecd8, #1b1815);
  --t-fg: light-dark(#262320, #eadfc8);
  --t-muted: light-dark(#6b6153, #a89d88);
  --t-line: light-dark(#d9c7a0, #3b3429);
  --t-line-strong: light-dark(#a47432, #c9a452);
  --t-soft: light-dark(#efe3ca, #231e19);
  --t-link: light-dark(#85591a, #d6b062);
  --t-mark: light-dark(#f1d990, #5a4a1a);
  --t-error: light-dark(#9a2f1e, #ff9b8f);
  --t-error-bg: light-dark(#f6ddd4, #3b1714);
  --t-warn: light-dark(#8a5300, #e3b341);

  --t-gold: var(--t-line-strong);
  --t-font: "EB Garamond", "Iowan Old Style", Charter, Georgia, serif;
  --t-sans: var(--t-font);
  --t-mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --t-width: 40rem;
  --t-size: 1.2rem; /* Garamond sets small: 19px at the browser's default */
  --t-leading: 1.55;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}
@media (prefers-contrast: more) {
  :root {
    --t-muted: var(--t-fg);
    --t-line: var(--t-line-strong);
  }
}

/* ------------------------------------------------------------ the page */

html {
  background: var(--t-bg);
  color: var(--t-fg);
  font: var(--t-size) / var(--t-leading) var(--t-font);
  -webkit-text-size-adjust: 100%;
  min-block-size: 100%;
}
body {
  margin: 0;
  padding: 2rem 1rem 3rem;
  min-block-size: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
body > main.luccet {
  flex: 1 0 auto;
  inline-size: 100%;
}
.luccet {
  max-inline-size: var(--t-width);
  margin-inline: auto;
  hanging-punctuation: first last;
}
.luccet > :first-child {
  margin-block-start: 0;
}
.luccet :is(p, li, dd, blockquote, figcaption, caption, .t-title) {
  text-wrap: pretty;
}
.luccet :is(p, ul, ol, dl, pre, table, blockquote, figure, details),
.t-block,
.t-eq {
  margin-block: 0 1rem;
  margin-inline: 0;
}
::selection {
  background: var(--t-mark);
}

/* ------------------------------------------------------------ headings */

.luccet :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--t-font);
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
  color: var(--t-fg);
}
.luccet h1 {
  font-size: 2.2rem;
  margin-block: 0 2rem;
}
.luccet h2 {
  font-size: 1.45rem;
  margin-block: 2.75rem 0.9rem;
  padding-block-end: 0.25rem;
  border-block-end: 1px solid var(--t-line);
}
.luccet h3 {
  font-size: 1.15rem;
  margin-block: 2rem 0.6rem;
}
.luccet :is(h4, h5, h6) {
  font-size: 1rem;
  font-style: italic;
  margin-block: 1.5rem 0.5rem;
}

/* {.kicker}: the small line above or under a title. */
.luccet .kicker {
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--t-muted);
}

/* ------------------------------------------------------------ text */

.luccet a {
  color: var(--t-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
.luccet a:hover {
  text-decoration-color: currentColor;
}
.luccet a.t-ref {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: var(--t-muted);
}
.luccet a.t-ref:hover {
  color: var(--t-link);
}
.luccet :is(ul, ol) {
  padding-inline-start: 1.5rem;
}
.luccet li > :is(ul, ol) {
  margin-block-end: 0;
}
.luccet li > p {
  margin-block-end: 0.5rem;
}
.luccet hr {
  border: 0;
  border-block-start: 1px solid var(--t-line);
  margin-block: 2.5rem;
}
.luccet blockquote {
  margin-inline-start: 0;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--t-line);
  color: var(--t-muted);
}
.luccet mark,
.luccet mark a {
  color: var(--t-fg);
}
.luccet mark {
  background: var(--t-mark);
  padding-inline: 0.15em;
}
.luccet dfn {
  font-style: italic;
  font-weight: 500;
}
.luccet .term > a {
  color: inherit;
}

/* Code: small, on a soft panel, with a hairline. */
.luccet :is(code, kbd, samp, pre) {
  font-family: var(--t-mono);
  font-size: 0.82em;
}
.luccet pre code {
  font-size: 1em;
}
.luccet :not(pre) > code {
  background: var(--t-soft);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
.luccet kbd {
  border: 1px solid var(--t-line-strong);
  border-block-end-width: 2px;
  border-radius: 3px;
  padding: 0.05em 0.4em;
}
.luccet pre {
  background: var(--t-soft);
  border: 1px solid var(--t-line);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  line-height: 1.45;
}

/* Tables: rules, no grid. */
.luccet table {
  border-collapse: collapse;
  font-size: 0.95em;
}
.luccet :is(th, td) {
  padding: 0.35em 0.8em;
  border-block-end: 1px solid var(--t-line);
  text-align: start;
}
.luccet th {
  font-weight: 500;
  border-block-end-color: var(--t-line-strong);
}
.luccet caption {
  caption-side: top;
  text-align: start;
  padding-block-end: 0.4em;
}

/* Blocks, figures, footnotes. */
.t-title {
  font-weight: 500;
  margin-block-end: 0.4rem;
}
.t-block > :last-child,
.t-cell > :last-child,
.luccet blockquote > :last-child {
  margin-block-end: 0;
}
.luccet figure.t-block {
  text-align: center;
}
.luccet figure > img {
  display: block;
  margin-inline: auto;
}
.luccet :is(figcaption, caption).t-title {
  font-weight: normal;
  font-size: 0.95em;
  color: var(--t-muted);
  margin-block: 0.4rem 0;
}
.t-eqno {
  color: var(--t-muted);
  font-size: 0.9em;
}
.t-fnref {
  line-height: 0;
  font-size: 0.75em;
}
.t-fnref a,
.t-fnback {
  text-decoration: none;
}
.t-footnotes {
  border-block-start: 1px solid var(--t-line);
  margin-block-start: 3rem;
  padding-block-start: 1rem;
  font-size: 0.9em;
}
.luccet .t-error {
  font-size: 0.85em;
}

/* ------------------------------------------------------------ the chrome */

/* The masthead: the mark and the name at the start, the sections at the end,
   the section this page is in marked in gold. site.js adds it to every page
   but the home page, which is its own. */
.site-head {
  inline-size: 100%;
  max-inline-size: var(--t-width);
  margin: 0 auto 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--t-fg);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.site-brand:hover {
  color: var(--t-link);
}
.site-mark {
  inline-size: 36px;
  block-size: 36px;
  border-radius: 50%;
}
.site-nav a {
  color: var(--t-muted);
  text-decoration: none;
  margin-inline-start: 1.25rem;
}
.site-nav a:hover {
  color: var(--t-link);
}
.site-nav a[aria-current] {
  color: var(--t-fg);
  text-decoration: underline;
  text-decoration-color: var(--t-gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.4em;
}

/* The footer: a gold hairline, a line of small print, the scheme switch. */
.site-foot {
  inline-size: 100%;
  max-inline-size: var(--t-width);
  margin: 5rem auto 0;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--t-line);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--t-muted);
}
.site-foot p {
  margin: 0;
}
.site-foot a {
  color: inherit;
  text-decoration: none;
}
.site-foot a:hover {
  color: var(--t-link);
  text-decoration: underline;
}
.site-theme {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}
.site-theme:hover {
  color: var(--t-link);
}

/* The home page: the emblem, the name, a line, the sections; all centred. */
.luccet .home {
  text-align: center;
  margin-block-start: 3rem;
}
.luccet .home img {
  display: inline-block;
  border-radius: 50%;
}
.luccet .home + h1 {
  text-align: center;
  font-size: 2.6rem;
  letter-spacing: 0.06em;
  margin-block: 1.5rem 0.25rem;
}
.luccet .home + h1 + .kicker {
  text-align: center;
  margin-block-end: 2.5rem;
}
.luccet .sections {
  text-align: center;
  font-size: 1.05rem;
}
.luccet .sections a {
  margin-inline: 0.6rem;
  text-decoration: none;
}
.luccet .sections a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------ the wiki add-ons */

.luccet .t-notes a {
  text-decoration: none;
}
.luccet .t-notes-title {
  font-weight: 500;
}
/* The list's first rule would double the heading's. */
.luccet .t-notes-list > li:first-child {
  border-block-start: 0;
}
.luccet .t-notes a:hover {
  text-decoration: underline;
}
.luccet :is(.t-notes, .t-glossary) time,
.luccet :is(.t-notes, .t-glossary) .t-notes-desc {
  color: var(--t-muted);
}
.luccet .t-search input {
  font: inherit;
  color: inherit;
  background: var(--t-soft);
  border: 1px solid var(--t-line-strong);
  border-radius: 4px;
  padding: 0.4em 0.7em;
  inline-size: 100%;
  box-sizing: border-box;
}
.luccet .t-search input:focus {
  outline: 2px solid var(--t-gold);
  outline-offset: 1px;
}

/* ------------------------------------------------------------ the vocabulary (math.js) */

/* A label: small tracked capitals in gold; a title after it in italic. */
.luccet :is(.defn, .thm, .eg, .callout, .rmk) > .t-title > .t-label {
  font-style: normal;
  font-weight: 500;
  font-size: 0.74em;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--n-accent, var(--t-gold));
  margin-inline-end: 0.6em;
}
.luccet :is(.defn, .thm, .eg, .callout, .rmk) > .t-title {
  font-weight: normal;
  font-style: italic;
  color: var(--t-muted);
  margin-block-end: 0.35rem;
}
.luccet :is(.defn, .thm, .eg) {
  margin-block: 1.5rem;
}
/* A statement is set in italic; emphasis inside it turns upright. */
.luccet .stmt > :not(.t-title) {
  font-style: italic;
}
.luccet .stmt :is(em, i) {
  font-style: normal;
}
/* Proof: "Proof." run in with the first line, ∎ at the end of the last. */
.luccet .pf {
  margin-block: 0 1.25rem;
}
.luccet .pf > .t-title {
  float: inline-start;
  font-weight: normal;
  font-style: italic;
  color: var(--t-fg);
  margin-block: 0;
  margin-inline-end: 0.5em;
}
.luccet .pf > .t-title > .t-label {
  font-weight: normal;
}
.luccet .pf > .t-title::after {
  content: ".";
}
.luccet .pf > :is(.t-eq, pre, table, figure, ul, ol) {
  clear: both;
}
.luccet .pf > :nth-last-child(2) {
  margin-block-end: 0;
}
.luccet .pf > .t-end {
  clear: both;
  color: var(--t-muted);
  font-size: 0.8em;
}
.luccet .rmk {
  --n-accent: var(--t-muted);
}

/* Callouts: a soft panel with a gold rule at the side; caution's is red. */
.luccet .callout {
  background: var(--t-soft);
  border-inline-start: 2px solid var(--n-accent, var(--t-gold));
  border-radius: 0 4px 4px 0;
  padding: 0.75rem 1.1rem 0.8rem;
  margin-block: 1.5rem;
}
.luccet .callout > :last-child {
  margin-block-end: 0;
}
.luccet .caution {
  --n-accent: var(--t-error);
}

/* Folds: recall. A caret before the head turns when it opens. */
.luccet .fold > .t-title {
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-style: normal;
  color: var(--t-fg);
}
.luccet .fold > .t-title::-webkit-details-marker {
  display: none;
}
.luccet .fold > .t-title::before {
  content: "";
  display: inline-block;
  inline-size: 0.38em;
  block-size: 0.38em;
  margin-inline: 0.1em 0.65em;
  vertical-align: 0.12em;
  border-inline-end: 1.5px solid;
  border-block-end: 1.5px solid;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.luccet .fold[open] > .t-title::before {
  transform: rotate(45deg);
}
.luccet .callout.fold:not([open]) > .t-title {
  margin-block-end: 0;
}

/* A revision: a sentence as written, then as revised, under small heads. */
.luccet .revision {
  margin-block: 1.5rem;
  padding-inline-start: 1.25rem;
  border-inline-start: 1px solid var(--t-line);
}
.luccet .revision > :is(.before, .after) {
  margin-block: 0.5rem;
}
.luccet .revision > :is(.before, .after)::before {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-muted);
  margin-block-end: 0.2rem;
}
.luccet .revision > .before::before {
  content: "Before";
}
.luccet .revision > .after::before {
  content: "After";
  color: var(--t-gold);
}
.luccet .revision > .before {
  color: var(--t-muted);
}
.luccet .revision > .after ~ p {
  font-size: 0.92em;
  color: var(--t-muted);
}

/* Contents. */
.luccet .toc {
  font-size: 0.92rem;
  margin-block: 0 2.5rem;
}
.luccet .toc > .t-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--t-muted);
  margin-block-end: 0.5rem;
}
.luccet .toc a {
  text-decoration: none;
}

/* ------------------------------------------------------------ print */

@media print {
  :root {
    --t-size: 11pt;
  }
  body {
    padding: 0;
  }
  .luccet {
    max-inline-size: none;
  }
  .site-head,
  .site-foot {
    display: none;
  }
  .luccet :is(p, li, blockquote) {
    orphans: 3;
    widows: 3;
  }
  .luccet :is(h1, h2, h3, h4, h5, h6) {
    break-after: avoid;
  }
  .luccet :is(figure, figcaption, .t-eq, blockquote, tr, .defn, .thm, .eg, .callout) {
    break-inside: avoid;
  }
}
