/* Principia Softwarica - progressive enhancement CSS.
 * The page is fully readable without this stylesheet.
 */

/* Base typography */
body {
  max-width: 40em;
  margin: 2em auto;
  padding: 0 1em;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
  color: #222;
  background: #fff;
}

h1, h2, h3 {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.2;
}

h1 {
  font-size: 2em;
  margin-bottom: 0.2em;
}

h1 + p {
  margin-top: 0;
  font-size: 1.1em;
  color: #555;
}

h2 {
  font-size: 1.4em;
  margin-top: 1.5em;
}

h3 {
  font-size: 1.1em;
  margin-top: 1.2em;
}

/* Links */
a {
  color: #0055aa;
}
a:visited {
  color: #553388;
}

/* Lists */
ul {
  padding-left: 1.5em;
}
li {
  margin-bottom: 0.3em;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2em 0;
}

/* ASCII art diagrams */
pre {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85em;
  line-height: 1.3;
  overflow-x: auto;
  background: #f8f8f8;
  padding: 1em;
  border: 1px solid #ddd;
}

/* Tables */
table {
  border-collapse: collapse;
  font-size: 0.95em;
  margin: 1em 0;
}
th, td {
  padding: 0.3em 0.6em;
  border: 1px solid #ccc;
  text-align: left;
}
th {
  background: #f0f0f0;
}
td:nth-child(n+4) {
  text-align: right;
  font-family: "Courier New", Courier, monospace;
}

/* GitHub ribbon (top-right corner) */
.github-ribbon {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  width: 150px;
  height: 150px;
  overflow: hidden;
  pointer-events: none;
}
.github-ribbon a {
  display: block;
  width: 200px;
  padding: 6px 0;
  background: #2e7d32;
  color: #fff;
  text-align: center;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  line-height: 20px;
  position: absolute;
  top: 38px;
  right: -48px;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  pointer-events: auto;
}
.github-ribbon a:hover {
  background: #388e3c;
}
.github-ribbon a:visited {
  color: #fff;
}

/* Wikipedia link icon */
a[href*="wikipedia.org"]::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  vertical-align: baseline;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ctext x='0' y='13' font-family='serif' font-size='15' font-weight='bold' fill='%23666'%3EW%3C/text%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

/* Footer */
body > p:last-child {
  color: #777;
}
