/* Yarisworld Archive.
   The feel is the contents page of a workshop manual: plain paper, ruled lines,
   numbered entries with dotted leaders, one red for what matters. No cards, no shadows. */

:root {
  --paper: #fbfaf7;         /* manual page */
  --ink: #17191c;           /* printed text */
  --ink-2: #4b5159;         /* supporting text */
  --ink-3: #7d848d;         /* figures, dates, labels */
  --rule: rgb(23 25 28 / 0.12);        /* ruled lines */
  --rule-strong: rgb(23 25 28 / 0.85); /* section rule */
  --well: rgb(23 25 28 / 0.045);       /* inset: search box, quotes */
  --toyota-red: #c1121f;    /* the one accent: manuals, the mark, focus */
  --diagram-blue: #1b5e9e;  /* links, like wiring-diagram ink */
  --highlighter: #ffe680;
  --measure: 760px;
  --step: 8px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --figures: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131517;
    --ink: #ecebe7;
    --ink-2: #b3b8bf;
    --ink-3: #848b94;
    --rule: rgb(236 235 231 / 0.13);
    --rule-strong: rgb(236 235 231 / 0.8);
    --well: rgb(236 235 231 / 0.06);
    --toyota-red: #f0616a;
    --diagram-blue: #86b9ee;
    --highlighter: #6a5a10;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--diagram-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--toyota-red); outline-offset: 2px; border-radius: 3px; }

.sheet { max-width: var(--measure); margin: 0 auto; padding: 0 16px; }
main.sheet { padding-top: 32px; padding-bottom: 72px; min-height: 72vh; }

/* Type: 13 / 16 / 20 / 28 / 40. Weight and colour carry the tiers. */
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.lede { margin: 8px 0 24px; color: var(--ink-2); }
.meta, .note, .figure, .crumbs, .colophon { font-size: 13px; color: var(--ink-3); }
.note { margin: -4px 0 8px; }
.meta a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.figure { font-family: var(--figures); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--ink-2); padding: 24px 0; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.wordmark { color: var(--ink); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.wordmark::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  background: var(--toyota-red); border-radius: 2px;
}
.wordmark span { color: var(--ink-3); font-weight: 500; }
.wordmark:hover { text-decoration: none; }
body.home .masthead { border-bottom-color: transparent; }

/* Search: an inset well, not a box with a border */
.search { display: flex; gap: 8px; flex: 0 1 280px; }
.search input {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--well);
  border: 1px solid transparent; border-radius: 8px; padding: 8px 12px;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--toyota-red); background: transparent; }
.search button {
  font: inherit; font-weight: 600; color: var(--paper); background: var(--ink); border: 0;
  border-radius: 8px; padding: 0 20px; cursor: pointer; transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.search button:active { transform: scale(0.97); }
.search-main { flex: none; max-width: 600px; }
.search-main input { padding: 12px 16px; }
.search-main button { min-height: 48px; }

/* Home */
.intro { padding: 40px 0 16px; }
.intro h1 { font-size: clamp(28px, 4vw + 12px, 40px); max-width: 16ch; }
section { margin-top: 48px; }

/* Section tab: a number, a name, a full rule. The manual's chapter heading. */
.tab {
  display: flex; align-items: baseline; gap: 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  padding-bottom: 8px; margin: 40px 0 0; border-bottom: 2px solid var(--rule-strong);
}
section > .tab:first-child { margin-top: 0; }
.tab span { font: 500 13px var(--figures); color: var(--toyota-red); letter-spacing: 0.04em; }
.tab + .note { margin: 12px 0 4px; font-size: 15px; color: var(--ink-2); max-width: 60ch; }

/* The index: numbered entries, dotted leader, a figure at the right edge */
.index { list-style: none; margin: 0; padding: 0; counter-reset: entry; }
.index li { border-bottom: 1px solid var(--rule); counter-increment: entry; }
.index a { display: flex; align-items: baseline; gap: 12px; padding: 12px 0; color: var(--ink); min-height: 44px; }
.index a::before {
  content: counter(entry, decimal-leading-zero); font: 13px var(--figures); color: var(--ink-3); width: 24px; flex: none;
}
.index.plain a::before { display: none; }
.index a:hover { text-decoration: none; }
.index a:hover .entry { color: var(--diagram-blue); }
.index a:hover .leader { border-bottom-color: var(--ink-3); }
.entry { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.entry strong { font-weight: 700; }
.kind {
  font: 600 11px var(--sans); font-style: normal; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--toyota-red); margin-left: 8px; white-space: nowrap;
}
.leader { flex: 1; min-width: 24px; border-bottom: 1px dotted var(--rule-strong); opacity: 0.35; transform: translateY(-4px); }
.more { margin: 16px 0 0; font-size: 14px; color: var(--ink-3); }

.group-name { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 32px 0 0; }
.group { margin-top: 0; }
.group[open] { margin-bottom: 16px; }
.group summary:hover { color: var(--diagram-blue); }
.group summary {
  cursor: pointer; font-weight: 600; padding: 12px 0; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline; list-style: none; min-height: 44px;
}
.group summary::-webkit-details-marker { display: none; }
.group summary::before { content: "+"; font-family: var(--figures); color: var(--toyota-red); width: 24px; }
.group[open] summary::before { content: "–"; }
.group summary .figure { margin-left: auto; }
.two-up { columns: 2; column-gap: 40px; }
.two-up li { break-inside: avoid; }

/* Lists on the inner pages share the ruled-line look */
.thread-list, .result-list, .file-list, .attached-files { list-style: none; margin: 0; padding: 0; }
.thread-list li, .result-list li, .file-list li { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; }
.thread-list li > a, .result-list li > a, .file-list a { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.thread-list li > a:hover, .result-list li > a:hover, .file-list a:hover { color: var(--diagram-blue); }
.file-list .meta a { font-weight: 400; color: inherit; }
.file-list li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-list p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; }
mark { background: var(--highlighter); color: inherit; padding: 0 2px; border-radius: 2px; }

.crumbs { margin-bottom: 8px; }
.crumbs a { color: inherit; }
.filters { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 8px; font-size: 14px; border-bottom: 2px solid var(--rule-strong); }
.filters a { color: var(--ink-3); padding: 8px 0; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.filters a:hover { color: var(--ink); text-decoration: none; }
.filters a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--toyota-red); }
.filters span { font-family: var(--figures); font-size: 12px; opacity: 0.7; }

.pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 24px 0; font: 13px var(--figures); }
.pager a, .pager .current { min-width: 32px; padding: 6px 10px; text-align: center; border-radius: 6px; color: var(--ink-2); }
.pager a:hover { background: var(--well); text-decoration: none; }
.pager .current { background: var(--ink); color: var(--paper); }
.pager .gap { color: var(--ink-3); padding: 0 4px; }

/* Posts. Each reply is its own block: a header strip that says who is speaking,
   then their words indented under it. The first post is set apart as the subject. */
.post { margin-top: 16px; border: 1px solid var(--rule); border-radius: 10px; scroll-margin-top: 16px; overflow: clip; }
.post:target { border-color: var(--toyota-red); }
.post-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--well); border-bottom: 1px solid var(--rule); }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font: 600 14px var(--sans); color: var(--paper); background: var(--ink-3);
}
.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; flex: 1; }
.author { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.where { font-size: 13px; color: var(--ink-3); flex-basis: 100%; }
.badge {
  font: 600 11px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--toyota-red);
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px;
}
.post-no { font: 13px var(--figures); color: var(--ink-3); align-self: flex-start; padding-top: 4px; }
.post-content { padding: 16px; }
.first-post { border-color: var(--rule-strong); border-width: 2px; }
.first-post .avatar, .by-starter .avatar { background: var(--toyota-red); }
.first-post .post-content { font-size: 17px; }
.replies-head {
  display: flex; align-items: baseline; gap: 10px; margin: 40px 0 0; padding-bottom: 8px;
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em; border-bottom: 2px solid var(--rule-strong);
}
.replies-head span { font: 500 13px var(--figures); color: var(--ink-3); }
.post-body { overflow-wrap: anywhere; }
.post-body img, .attached-pictures img {
  max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle;
  outline: 1px solid rgb(0 0 0 / 0.1); outline-offset: -1px;
}
@media (prefers-color-scheme: dark) { .post-body img, .attached-pictures img { outline-color: rgb(255 255 255 / 0.1); } }
.post-body table { max-width: 100%; }
.post-body pre { overflow-x: auto; background: var(--well); padding: 12px; border-radius: 6px; font: 13px/1.5 var(--figures); }
.quote {
  margin: 0 0 12px; padding: 10px 14px; background: var(--well); border-left: 3px solid var(--ink-3);
  border-radius: 0 6px 6px 0; color: var(--ink-2); font-size: 14px;
}
.quote > div:first-child { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); margin-bottom: 4px; }
.quote > div:first-child strong { color: var(--ink-2); }
.code { margin: 0 0 12px; }
.lost {
  display: inline-block; font-size: 12px; color: var(--ink-3); background: var(--well);
  border-radius: 4px; padding: 2px 8px; margin: 2px 0;
}
.saved-file::after { content: " (copy on this site)"; color: var(--ink-3); font-size: 0.85em; }
.attached-pictures { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 16px; }
.attached-pictures img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.attached-files { margin-top: 16px; font-size: 14px; }
.attached-files li { padding: 8px 12px; background: var(--well); border-radius: 6px; margin-top: 4px; }
.attached-files a { font-weight: 600; }

.colophon { border-top: 1px solid var(--rule); padding: 24px 0 40px; }

@media (max-width: 600px) {
  .index a { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 12px; }
  .index a::before { grid-row: 1 / span 2; }
  .index.plain a { grid-template-columns: minmax(0, 1fr); }
  .index .entry, .index .figure { grid-column: 2; }
  .index.plain .entry, .index.plain .figure { grid-column: 1; }
  .leader { display: none; }
  .kind { display: block; margin: 2px 0 0; }
  .two-up { columns: 1; }
  .search { flex-basis: 160px; }
  .search-main button { padding: 0 16px; }
  .intro { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Static site: posts use bare elements to keep 740,000 of them small ---- */
.posts article { margin-top: 16px; border: 1px solid var(--rule); border-radius: 10px; scroll-margin-top: 16px; overflow: clip; }
.posts article:target { border-color: var(--toyota-red); }
.posts article > header {
  position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 10px 16px 10px 60px; min-height: 52px; background: var(--well); border-bottom: 1px solid var(--rule);
}
.posts article > header::before {
  content: attr(data-i); position: absolute; left: 16px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font: 600 14px var(--sans); color: var(--paper); background: var(--ink-3);
}
.posts article.first > header::before, .posts article.starter > header::before { background: var(--toyota-red); }
.posts article > header b { font-weight: 700; overflow-wrap: anywhere; }
.posts article > header em {
  font: 600 11px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--toyota-red);
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px;
}
.posts article > header i { order: 3; flex-basis: 100%; font-style: normal; font-size: 13px; color: var(--ink-3); }
.posts article > header a { order: 2; margin-left: auto; font: 13px var(--figures); color: var(--ink-3); }
.posts article > div { padding: 16px; overflow-wrap: anywhere; }
.posts article.first { border: 2px solid var(--rule-strong); }
.posts article.first > div { font-size: 17px; }
.posts article > div img {
  max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle;
  outline: 1px solid rgb(0 0 0 / 0.1); outline-offset: -1px;
}
.posts article > div table { max-width: 100%; }
.posts article > div pre { overflow-x: auto; background: var(--well); padding: 12px; border-radius: 6px; font: 13px/1.5 var(--figures); }
.posts p.lost { display: block; margin: 12px 0 0; width: fit-content; }
.open-manual {
  display: inline-block; font-weight: 600; color: var(--paper); background: var(--ink);
  border-radius: 8px; padding: 10px 20px; margin-right: 12px;
}
.open-manual:hover { text-decoration: none; opacity: 0.9; }
.search-main + .note { margin: 12px 0 8px; }

.about { max-width: 62ch; color: var(--ink-2); }
.about p { margin: 12px 0 0; }

.more-rows summary {
  cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--diagram-blue);
  border-bottom: 1px solid var(--rule); list-style: none; min-height: 44px;
}
.more-rows summary::-webkit-details-marker { display: none; }
.more-rows summary::before { content: "+"; display: inline-block; width: 36px; font-family: var(--figures); color: var(--toyota-red); }
.more-rows[open] summary::before { content: "–"; }
.more-rows[open] summary { color: var(--ink-3); }
.shuffle {
  margin-top: 24px; font: inherit; font-weight: 600; color: var(--paper); background: var(--ink);
  border: 0; border-radius: 8px; padding: 10px 20px; cursor: pointer;
}
.shuffle:active { transform: scale(0.97); }
#sorts { margin-top: 8px; }

.toggle { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 44px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--toyota-red); margin: 0; }

/* Wordmark with the car icon in place of the red square */
.wordmark { display: inline-flex; align-items: center; gap: 8px; }
.wordmark::before { display: none; }
.wordmark img { width: 28px; height: 28px; border-radius: 6px; flex: none; }
.wordmark span { margin-left: -4px; }

/* Home page spacing: the headline sits close under the masthead */
section.intro { margin-top: 0; padding: 8px 0 0; }
body.home main.sheet { padding-top: 24px; }
body.home section { margin-top: 40px; }
body.home section.intro { margin-top: 0; }
.intro .lede { margin-bottom: 20px; }
