/* Structure only. Every colour, font, border and radius comes from the variables
   below; themes (static/themes/<name>.css, chosen in etc/theme) override them. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #62666d;
  --border: #d8dbe0;
  --accent: #2f6fdb;
  --accent-bg: #e6f0fc;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fcebea;
  --warning: #7a4d00;
  --warning-bg: #fdf1dc;
  --ok: #2e7d32;
  --field-bg: var(--surface);
  --field-border: var(--border);
  --go-bg: var(--accent);
  --go-text: var(--on-accent);
  --editor-bg: var(--field-bg);
  --logo-color: var(--text);
  --logo-bg: transparent;
  --logo-border: 0 solid transparent;
  --logo-pad: 0;
  --logo-size: 40px;
  --logo-weight: 500;
  --logo-font: var(--mono);
  --logo-suffix: "";
  --octo: var(--accent);
  --octo-eye: #ffffff;
  --octo-pupil: #24123d;
  --octo-cheek: #f3a1c9;
  --sans: system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", monospace;
  --ui-font: var(--sans);
  --radius: 8px;
  --card-radius: 12px;
  --bw: 1px;
  --case: none;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--ui-font);
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1, h2 { font-weight: 600; margin: 0 0 12px; text-transform: var(--case); }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
input, select, textarea, button, .button {
  font: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: var(--bw) solid var(--field-border);
  border-radius: var(--radius);
}
input, select { padding: 7px 10px; width: 100%; }
input[type="radio"] { width: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
button, .button {
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  background: var(--surface);
  text-transform: var(--case);
}
button:hover, .button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--danger); }
form[data-confirm] button.danger { background: var(--danger-bg); }
textarea {
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 12px;
  width: 100%;
  resize: vertical;
  tab-size: 4;
  background: var(--editor-bg);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; margin-top: 10px; }
.row label { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.error { color: var(--danger); }
.notice { color: var(--ok); }
.bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: var(--bw) solid var(--border); background: var(--surface);
}
.brand {
  font-family: var(--logo-font); font-weight: var(--logo-weight); text-decoration: none;
  color: var(--logo-color); background: var(--logo-bg); border: var(--logo-border);
  padding: 0 calc(var(--logo-pad) / 2);
}
.sep { color: var(--muted); }
.code { font-family: var(--mono); }
.badge {
  font-size: 12px; padding: 1px 8px; border-radius: var(--radius);
  background: var(--accent-bg); color: var(--accent); text-transform: var(--case);
}
.badge-private, .badge-mode { background: var(--warning-bg); color: var(--warning); }
.status { font-size: 13px; color: var(--muted); text-transform: var(--case); }
.status.ok { color: var(--ok); }
.status.error { color: var(--danger); }
.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card {
  background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--card-radius);
  padding: 20px; width: 100%;
}
.narrow { max-width: 440px; }
.editor { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; min-height: 0; }
.editor textarea { flex: 1; resize: none; min-height: 50vh; }
.page { max-width: 820px; width: 100%; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.page textarea { min-height: 220px; }
.page textarea.short { min-height: 120px; }
.page .card button.primary { margin-top: 14px; }
.banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px;
}
.banner.warning { background: var(--warning-bg); color: var(--warning); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
[hidden] { display: none !important; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: var(--bw) solid var(--border); }
th { color: var(--muted); font-weight: 500; }

/* Entry page: nothing but the name, one field and a discreet "+". */
.home { position: relative; }
.home form { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.logo {
  font-family: var(--logo-font); font-size: var(--logo-size); font-weight: var(--logo-weight);
  line-height: 1.1; color: var(--logo-color); background: var(--logo-bg); border: var(--logo-border);
  padding: 0 var(--logo-pad);
}
.logo::after { content: var(--logo-suffix); }
.go {
  display: flex; width: 100%; background: var(--field-bg);
  border: var(--bw) solid var(--field-border); border-radius: var(--radius); overflow: hidden;
}
.go input { border: 0; border-radius: 0; background: transparent; font-family: var(--mono); flex: 1; min-width: 0; }
.go input:focus-visible { outline: 0; }
.go:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.go button { border: 0; border-radius: 0; background: var(--go-bg); color: var(--go-text); padding: 7px 14px; }
.newlink {
  position: absolute; top: 14px; right: 16px; color: var(--muted); text-decoration: none;
  font-family: var(--mono); font-size: 20px; line-height: 1; padding: 4px 8px;
}
.newlink:hover { color: var(--text); }

/* Octopus logo (views.php: octopus()). */
.octo { display: block; width: 72px; height: 72px; overflow: visible; }
.octo .head { fill: var(--octo); }
.octo .arms path { fill: none; stroke: var(--octo); stroke-width: 7; stroke-linecap: round; }
.octo .eye { fill: var(--octo-eye); }
.octo .pupil { fill: var(--octo-pupil); }
.octo .cheek { fill: var(--octo-cheek); }
.octo.small { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.28em; margin-right: 4px; }
.home form { gap: 10px; }
.home .go { margin-top: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .octo.live { animation: octo-bob 3s ease-in-out infinite; }
  .octo.live .arms path {
    transform-box: fill-box; transform-origin: 50% 0;
    animation: octo-wave 1.1s ease-in-out infinite alternate;
  }
  .octo.live .arms path:nth-child(2) { animation-delay: -0.3s; }
  .octo.live .arms path:nth-child(3) { animation-delay: -0.6s; }
  .octo.live .arms path:nth-child(4) { animation-delay: -0.9s; }
}
@keyframes octo-wave { from { transform: rotate(12deg); } to { transform: rotate(-12deg); } }
@keyframes octo-bob { 50% { transform: translateY(-4px); } }

.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
  padding: 10px 16px 12px; font-size: 12px; color: var(--muted); font-family: var(--ui-font);
}
.foot a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.foot a:hover, .foot a:focus-visible { color: var(--accent); }
.foot-name { font-weight: 600; color: var(--text) !important; }
.foot-name:hover { color: var(--accent) !important; }
.foot-links { display: inline-flex; gap: 10px; padding-left: 10px; border-left: var(--bw) solid var(--border); }
.foot-links a { display: inline-flex; align-items: center; gap: 4px; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) { .foot-links span { display: none; } }
