/* Mπ4 website */


/* ---------- Colours ----------
   Light is the default. Dark follows the visitor's system setting,
   unless they pressed the theme button (that sets data-theme on <html>). */

:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg:         #efefec;
    --box:        #ffffff;
    --text:       #222222;
    --muted:      #666666;
    --border:     #cfcfca;
    --link:       #0b5fa5;
    --green:      #1e8449;
    --green-text: #1e8449;
    --orange:     #e67e22;
    --mono:       ui-monospace, 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg:         #181818;
        --box:        #222222;
        --text:       #dddddd;
        --muted:      #888888;
        --border:     #383838;
        --link:       #6db3f2;
        --green-text: #4cd07d;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:         #181818;
    --box:        #222222;
    --text:       #dddddd;
    --muted:      #888888;
    --border:     #383838;
    --link:       #6db3f2;
    --green-text: #4cd07d;
}


/* ---------- Basics ---------- */

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.05em;
    line-height: 1.6;
}

a {
    color: var(--link);
}

p, li {
    padding: 4px 0;
}

img {
    max-width: 100%;
}

summary {
    cursor: pointer;
}

.pi {
    font-family: 'Times New Roman', serif;
}

.small {
    font-size: 0.8em;
}

.hash {
    word-break: break-all;
}


/* ---------- Top bar ---------- */

#header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 16px;
    background: #151515;
}

#logo {
    display: block;
    height: 40px;
}

#menu {
    display: flex;
    align-items: center;
    gap: 20px;
    font-family: var(--mono);
}

#menu a {
    color: #dddddd;
    text-decoration: none;
}

#menu .button {
    margin: 0;
    padding: 6px 16px;
}

#menu .settings {
    color: #000000;
}

#theme {
    padding: 2px 10px;
    border: 1px solid #555555;
    border-radius: 4px;
    background: transparent;
    color: #dddddd;
    font-size: 16px;
    cursor: pointer;
}


/* ---------- Page and boxes ---------- */

#page {
    max-width: 60em;
    margin: 0 auto;
    padding: 16px;
}

.box {
    margin-bottom: 16px;
    padding: 20px 24px;
    background: var(--box);
    border: 1px solid var(--border);
    border-radius: 4px;
}

h2 {
    margin: 0 0 8px 0;
    font-size: 1.15em;
}

/* Boxes side by side */
.row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.row .box {
    margin-bottom: 0;
}

.half {
    flex: 1;
    min-width: 0;
}


/* ---------- Download box ---------- */

.hero {
    padding: 40px 24px;
    text-align: center;
}

.hero h2 {
    font-size: 1.8em;
}

#get {
    margin-top: 24px;
}

#version {
    font-size: 1.2em;
}


/* ---------- Buttons ---------- */

.button {
    display: inline-block;
    vertical-align: middle;
    margin: 4px 2px;
    padding: 12px 26px;
    border: 2px solid transparent;
    border-radius: 4px;
    color: #ffffff;
    font-family: var(--mono);
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.button small {
    display: block;
    font-size: 0.7em;
    opacity: 0.85;
}

#download {
    background: var(--green);
}

#download32 {
    background: transparent;
    border-color: var(--green-text);
    color: var(--green-text);
}

.settings {
    background: var(--orange);
    color: #000000;
}


/* ---------- Quick start ---------- */

.step {
    flex: 1;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.step b {
    display: block;
    width: 28px;
    margin-bottom: 8px;
    background: var(--green);
    border-radius: 2px;
    color: #ffffff;
    font-family: var(--mono);
    text-align: center;
}


/* ---------- Footer ---------- */

#footer {
    padding: 16px 0;
    color: var(--muted);
    font-size: 0.8em;
    text-align: center;
}

#footer a {
    color: var(--muted);
}


/* ---------- Settings page ---------- */

h1 {
    margin: 8px 0 16px 0;
    font-size: 1.6em;
}

.box label {
    margin-right: 24px;
}

.box i {
    color: var(--muted);
    font-size: 0.8em;
}

.box select,
.box input[type="text"],
.box input[type="number"] {
    padding: 3px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.85em;
}

.box input[type="number"] {
    width: 70px;
}

/* The little (i) icon in the headings. Hover it for help. */
.info {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    background: var(--muted);
    border-radius: 50%;
    color: #ffffff;
    font-family: system-ui, sans-serif;
    font-size: 11px;
    font-weight: normal;
    line-height: 16px;
    text-align: center;
    vertical-align: middle;
    cursor: help;
}


/* ---------- Triggers ---------- */

.trigrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}

.trigrow > * {
    flex: 1;
    min-width: 0;
}

.trigrow > :nth-child(3) {
    flex: 1.2;
}

.trigrow > :last-child {
    flex: 0 0 28px;
}

.trigrow select,
.trigrow input.file {
    width: 100%;
    font-size: 12px;
}

.addbtn,
.rmbtn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--mono);
    cursor: pointer;
}

.addbtn {
    margin-top: 10px;
    padding: 5px 16px;
}

.rmbtn {
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
}


/* ---------- GPIO map ---------- */

.pinmap {
    color: var(--muted);
}

.pinrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0;
    font-size: 11px;
}

.lbl {
    flex: 1;
}

.lbl.l {
    text-align: right;
}

.dot {
    display: flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 9px;
    font-weight: bold;
}

.p33    { background: #e74c3c; }
.p5     { background: #e67e22; }
.gnd    { background: #2c3e50; }
.gpio   { background: #27ae60; }
.spi    { background: #8e44ad; }
.i2c    { background: #2980b9; }
.uart   { background: #c0392b; }
.eeprom { background: #7f8c8d; }

.assignable {
    color: var(--text);
}

.assigned {
    padding: 0 10px;
    color: var(--text);
    font-weight: bold;
}


/* ---------- Documentation ---------- */

/* Narrower page, so lines of text stay easy to read */
#page.narrow {
    max-width: 46em;
}

h3 {
    margin: 20px 0 4px 0;
    font-size: 1em;
}

.step h3 {
    margin-top: 0;
}

code {
    padding: 1px 5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 0.9em;
}


.note {
    margin: 12px 0;
    padding: 10px 16px;
    background: rgba(230, 126, 34, 0.12);
    border-left: 5px solid var(--orange);
    border-radius: 0 4px 4px 0;
}

table {
    width: 100%;
    margin: 8px 0 12px 0;
    border: 1px solid var(--border);
    border-collapse: collapse;
}

th,
td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--bg);
    font-size: 0.85em;
}

/* Topics list on the docs page */
#tabs p {
    padding: 0;
}

#tabs a {
    display: block;
    padding: 6px 12px;
    border-left: 3px solid transparent;
    color: var(--text);
    text-decoration: none;
}

#tabs a.current {
    background: var(--box);
    border-left-color: var(--orange);
}


/* ---------- Small screens ---------- */

@media (max-width: 700px) {
    .row {
        flex-direction: column;
    }
}