/* ============================================================
   Name Machine: three scroll wheels on a dark console, and a
   plain encyclopedia page underneath for the article.
   ============================================================ */

:root {
  --item: 48px; /* wheel row height, must match ITEM in app.js */

  --console: #16181b;
  --console-2: #202429;
  --console-line: #353b42;
  --amber: #e9b44c;
  --amber-dim: #8d6c2c;
  --ink-light: #ece6d8;
  --ink-light-dim: #9a937f;

  --page: #ffffff;
  --page-2: #f8f9fa;
  --page-3: #eaecf0;
  --border: #a2a9b1;
  --text: #202122;
  --text-dim: #54595d;
  --link: #3366cc;
  --link-new: #d73333;

  --wiki-serif: "Linux Libertine", "Georgia", "Times", serif;
  --wiki-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Lato, Helvetica, Arial, sans-serif;
  --display: "Oswald", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }
body { background: var(--page-2); color: var(--text); font-family: var(--wiki-sans); }

/* ------------------------------------------------------------ console */
.machine {
  background: radial-gradient(120% 140% at 50% -20%, #2a2f35 0%, var(--console) 60%);
  color: var(--ink-light);
  border-bottom: 4px solid var(--amber-dim);
  padding: 20px 16px 22px;
}
.machine-inner { max-width: 760px; margin: 0 auto; }
.machine-head { text-align: center; margin-bottom: 16px; }
.back {
  display: inline-block;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light-dim);
  text-decoration: none;
  margin-bottom: 8px;
}
.back:hover { color: var(--amber); }
.machine h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  color: var(--amber);
}
.hint { margin: 6px 0 0; color: var(--ink-light-dim); font-size: 14px; }

.wheels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.wheel { min-width: 0; }
.wheel-label {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-light-dim);
  margin-bottom: 6px;
}
.track {
  position: relative;
  height: calc(var(--item) * 5);
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  padding: calc(var(--item) * 2) 0;
  background: #0e1012;
  border: 1px solid var(--console-line);
  border-radius: 10px;
  scrollbar-width: none;
  outline: none;
  -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
          mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
}
.track::-webkit-scrollbar { display: none; }
.wheel { position: relative; }
.wheel::after {
  /* the centre "window" the selection sits in */
  content: "";
  position: absolute;
  left: 4px; right: 4px;
  bottom: calc(var(--item) * 2);
  height: var(--item);
  border-top: 1px solid var(--amber-dim);
  border-bottom: 1px solid var(--amber-dim);
  pointer-events: none;
}
.track:focus-visible { border-color: var(--amber); }
.item {
  height: var(--item);
  line-height: var(--item);
  scroll-snap-align: center;
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(13px, 3.6vw, 20px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
  cursor: pointer;
  user-select: none;
  color: var(--ink-light);
  transition: color 0.15s;
}
.item.on { color: var(--amber); }

.toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-light-dim);
  cursor: pointer;
}
.toggle input { accent-color: var(--amber); width: 16px; height: 16px; }

/* ------------------------------------------------------------ article */
.wiki {
  max-width: 1000px;
  margin: 24px auto 48px;
  padding: 20px 28px 32px;
  background: var(--page);
  border: 1px solid var(--page-3);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.wiki a { color: var(--link); text-decoration: none; cursor: pointer; }
.wiki a:hover { text-decoration: underline; }
.wiki a.new { color: var(--link-new); }

.empty { text-align: center; padding: 40px 0; color: var(--text-dim); }

.wiki-tabs {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--link);
  border-bottom: 1px solid var(--page-3);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.wiki-tabs .on { color: var(--text); border-bottom: 2px solid var(--text); }
.wiki-tabs .spacer { flex: 1; }

.wiki-title {
  font-family: var(--wiki-serif);
  font-weight: normal;
  font-size: 1.9em;
  line-height: 1.3;
  margin: 0 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.wiki-from { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

.hatnote { font-style: italic; padding-left: 1.6em; margin-bottom: 10px; font-size: 14px; }
.ambox {
  border: 1px solid var(--border);
  border-left: 10px solid #f28500;
  background: var(--page-2);
  padding: 8px 12px;
  margin: 0 0 14px;
  font-size: 14px;
}

.wiki h2 {
  font-family: var(--wiki-serif);
  font-weight: normal;
  font-size: 1.5em;
  margin: 1.1em 0 0.3em;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.wiki h3 { font-size: 1.15em; margin: 0.9em 0 0.2em; }
.wiki p { margin: 0.4em 0 0.6em; }

.infobox {
  float: right;
  clear: right;
  width: 22em;
  margin: 0 0 1em 1.4em;
  border: 1px solid var(--border);
  background: var(--page-2);
  font-size: 88%;
  line-height: 1.5;
  border-spacing: 3px;
}
.infobox caption { font-weight: bold; font-size: 125%; padding: 4px; }
.infobox th { text-align: left; vertical-align: top; padding: 2px 6px; width: 38%; }
.infobox td { vertical-align: top; padding: 2px 6px; }
.infobox .photo { text-align: center; padding: 6px; }
.infobox img { width: 220px; height: 220px; object-fit: cover; display: block; margin: 0 auto; }
.nophoto {
  width: 220px; height: 220px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--page-3); color: var(--text-dim); font-size: 13px;
}
.photo-caption { font-size: 92%; margin-top: 4px; }
.signature { font-family: "Homemade Apple", cursive; font-size: 120%; line-height: 1.8; }

.toc {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--page-2);
  padding: 8px 14px 10px;
  margin: 10px 0 6px;
  font-size: 14px;
}
.toc-title { font-weight: bold; text-align: center; margin-bottom: 4px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol ol { padding-left: 1.6em; }
.toc .num { color: var(--text); padding-right: 4px; }

sup { line-height: 1; font-size: 75%; }
sup.cn { white-space: nowrap; }

.wikitable {
  border-collapse: collapse;
  background: var(--page-2);
  margin: 0.6em 0 1em;
  font-size: 14px;
}
.wikitable th, .wikitable td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.wikitable th { background: var(--page-3); }
.wikitable .won { background: #9eff9e; }
.wikitable .nom { background: #ffdf9f; }

.references { font-size: 90%; padding-left: 2em; }
.references .caret { font-weight: bold; }

.catlinks {
  clear: both;
  margin-top: 24px;
  border: 1px solid var(--border);
  background: var(--page-2);
  padding: 6px 10px;
  font-size: 13px;
}
.wiki-footer { font-size: 12px; color: var(--text-dim); margin-top: 16px; }

@media (max-width: 640px) {
  .wiki { margin: 0; border: none; padding: 16px; }
  .infobox { float: none; width: 100%; margin: 0 0 1em; }
  .wikitable { display: block; overflow-x: auto; }
  .wiki-tabs { gap: 10px; overflow-x: auto; white-space: nowrap; }
}
