/* TriPad's website. The three mode colours are the bars in TriPad's icon. */

:root {
  --bg: #ffffff;
  --bg-soft: #f4f6fb;
  --surface: #ffffff;
  --text: #1a2132;
  --muted: #586274;
  --border: #e1e6ef;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --on-accent: #ffffff;
  --code-bg: #eef2f8;
  --simple: #0f9f78;
  --advanced: #3b7cf0;
  --expert: #8452f0;
  --mark: #fff1a8;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 6px 20px rgb(16 24 40 / 7%);
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b;
    --bg-soft: #141b26;
    --surface: #171f2b;
    --text: #e5e9f1;
    --muted: #9ba5b6;
    --border: #273142;
    --accent: #6b9bff;
    --accent-hover: #8db2ff;
    --on-accent: #0a1222;
    --code-bg: #1d2633;
    --simple: #34c99c;
    --advanced: #6b9bff;
    --expert: #a983ff;
    --mark: #5a4b12;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; overflow-wrap: normal; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 12px; border-radius: 6px; }

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.site-nav { display: flex; gap: 18px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--text); }
body.manual .site-nav a[href$="manual/index.html"] { color: var(--text); }

.search { position: relative; margin-left: auto; width: min(320px, 100%); }
.search input {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 34px 7px 12px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.search-key {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; font-size: 0.75rem; color: var(--muted);
}
.search input:focus + .search-key { display: none; }
.search-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(520px, calc(100vw - 32px));
  max-height: min(70vh, 560px); overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.search-results li a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.search-results li a .where { display: block; font-size: 0.78rem; color: var(--muted); }
.search-results li a .title { font-weight: 600; }
.search-results li a .snippet { display: block; font-size: 0.86rem; color: var(--muted); margin-top: 2px; }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--bg-soft); }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; }
.search-results .empty { padding: 10px; color: var(--muted); }

@media (max-width: 640px) {
  .header-row { padding-top: 8px; padding-bottom: 8px; gap: 10px 16px; }
  .search { width: 100%; margin-left: 0; }
  .search-key { display: none; }
}

/* Footer */

.site-footer { border-top: 1px solid var(--border); margin-top: 64px; color: var(--muted); font-size: 0.92rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; align-items: center; padding-top: 20px; padding-bottom: 28px; }
.footer-row p { margin: 0; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-row a { color: var(--muted); }

/* Home */

.hero { padding: 56px 0 40px; background:
  radial-gradient(1000px 400px at 85% 0%, color-mix(in srgb, var(--advanced) 14%, transparent), transparent 70%),
  radial-gradient(700px 300px at 10% 100%, color-mix(in srgb, var(--expert) 8%, transparent), transparent 70%); }
.hero-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 3.8rem); margin: 0 0 8px; letter-spacing: -0.03em; }
.lead { font-size: 1.3rem; font-weight: 500; margin: 0 0 14px; }
.hero-text > p { max-width: 38em; }
.hero-art { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.hero-art img { width: 200px; height: 200px; filter: drop-shadow(0 18px 30px rgb(37 99 235 / 28%)); }
.pill { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: 4px; box-shadow: var(--shadow); }
.pill span { padding: 4px 14px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; }
.pill .on-simple { color: var(--simple); }
.pill .on-advanced { background: var(--advanced); color: #fff; }
.pill .on-expert { color: var(--expert); }
@media (max-width: 800px) {
  .hero { padding-top: 36px; }
  .hero-row { grid-template-columns: 1fr; }
  .hero-art { order: -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 16px; }
  .hero-art img { width: 96px; height: 96px; }
  .pill span { padding: 4px 10px; font-size: 0.85rem; }
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 10px; }
.button {
  display: inline-flex; flex-direction: column; justify-content: center;
  padding: 10px 20px; border-radius: 9px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); line-height: 1.3;
}
.button small { font-weight: 400; font-size: 0.8rem; opacity: 0.85; }
.button:hover { border-color: var(--accent); color: var(--text); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.fine { font-size: 0.9rem; color: var(--muted); }

section { padding: 44px 0; }
section h2 { font-size: 1.8rem; margin: 0 0 12px; }
.band { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-lead { max-width: 48em; color: var(--muted); margin-bottom: 24px; }

.modes { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mode { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; border-top: 4px solid; }
.mode h3 { margin: 0 0 6px; font-size: 1.2rem; }
.mode p { margin: 0; }
.mode .mode-key { margin-top: 10px; font-size: 0.85rem; color: var(--muted); font-family: var(--mono); }
.mode-simple { border-top-color: var(--simple); } .mode-simple h3 { color: var(--simple); }
.mode-advanced { border-top-color: var(--advanced); } .mode-advanced h3 { color: var(--advanced); }
.mode-expert { border-top-color: var(--expert); } .mode-expert h3 { color: var(--expert); }

.features { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.features a { display: block; height: 100%; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.features a:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); }
.features h3 { margin: 0 0 6px; font-size: 1.08rem; }
.features p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.facts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.facts li { display: flex; flex-direction: column; }
.facts strong { font-size: 2rem; letter-spacing: -0.02em; }
.facts span { color: var(--muted); }

.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 20px 0; }
.download { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.download h3 { margin: 0 0 6px; }
.download .button { margin-top: 4px; }
.hash { font-size: 0.8rem; color: var(--muted); margin-bottom: 0; }
.hash code { font-size: 0.95em; word-break: break-all; }

/* Manual */

.manual-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; max-width: 1160px; margin: 0 auto; padding: 32px 28px 0; }
.manual-layout .doc { grid-column: 2; grid-row: 1; min-width: 0; max-width: 820px; }
.manual-layout .sidebar { grid-column: 1; grid-row: 1; }
.sidebar { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 0.93rem; padding-bottom: 20px; }
.sidebar-title { font-weight: 650; margin: 0 0 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.sidebar li a:hover { color: var(--text); background: var(--bg-soft); }
.sidebar li.current > a { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
.sidebar li ul { margin: 2px 0 6px 12px; border-left: 1px solid var(--border); }
.sidebar li ul a { padding: 2px 10px; font-size: 0.88rem; }
.skip-contents { display: none; }

@media (max-width: 860px) {
  .manual-layout { display: block; padding: 20px 16px 0; }
  .skip-contents { display: inline-block; margin-bottom: 8px; font-size: 0.92rem; }
  .sidebar { position: static; max-height: none; border-top: 1px solid var(--border); margin-top: 40px; padding-top: 20px; }
}

.doc h1 { font-size: 2.2rem; margin: 0 0 18px; }
.doc h2 { font-size: 1.5rem; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 1.18rem; margin: 28px 0 10px; }
.doc h1 + h2 { border-top: 0; }
.anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
:is(h2, h3):hover .anchor, .anchor:focus { opacity: 1; }
.doc li { margin: 4px 0; }
.doc li > p { margin: 4px 0; }
.doc ul, .doc ol { padding-left: 1.4em; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.doc th { background: var(--bg-soft); font-weight: 600; }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }
.doc :target { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--mark); } to { background: transparent; } }

.page-list { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.page-list a { display: block; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.page-list a:hover { border-color: var(--accent); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager a { display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; }
.pager a span { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; grid-column: 2; }

.narrow { max-width: 860px; margin: 0 auto; padding: 32px 16px 0; }
.crumbs { margin: 0 0 6px; font-size: 0.92rem; }
.licence { white-space: pre-wrap; font-size: 0.85rem; }

@media print {
  .site-header, .sidebar, .pager, .skip-contents, .site-footer nav { display: none; }
  .manual-layout { display: block; padding: 0; }
}
