/* site.css - the stylesheet shared by every page of tatara.tools.
 *
 * Colours are named once, as variables, in two sets: light and dark.
 * The browser picks the set from the reader's system setting.
 * Page-specific rules (the home page, the manual) are added by the
 * steps that write those pages.
 */

/* ===== Colours ===== */

:root {
  --bg: #ffffff;          /* page background */
  --band: #f5f3ee;        /* background of alternate bands */
  --surface: #ffffff;     /* cards and buttons */
  --line: #e1ddd3;        /* borders and rules */
  --text: #1c2230;        /* headings and strong text */
  --body: #2a3140;        /* running text */
  --muted: #5a6476;       /* secondary text */
  --accent: #e0601c;      /* ember orange: buttons, the ring of the mark */
  --accent-text: #b3460f; /* orange that is dark enough for text */
  --on-accent: #1a0d05;   /* text on an orange button */
  --tanren: #33658f;      /* steel blue, for TANREN */
  --seal: #c7381c;        /* vermilion of the 鍛 seal */
  --code-bg: #efece4;     /* names set in code within the text */
  /* MSX-DOS screens: the MSX's own white on blue, in both themes */
  --term-bg: #2528f5;     /* the blue of an MSX screen */
  --term-text: #ffffff;
  --term-faded: #d9dcff;  /* prompts and labels: 5.8:1 on the blue */
  --term-hi: #ffe066;     /* a program's output, picked out: 6:1 */
  --term-line: #1a1cb8;   /* the frame and the rules inside it */
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* The dark set. It follows the system setting, unless the reader has
   chosen with the header's light/dark button: the button's script puts
   data-theme="light" or "dark" on <html>. The values are the same in
   both rules. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424;
    --band: #111a2e;
    --surface: #16203a;
    --line: #25314c;
    --text: #e6e9ef;
    --body: #d3d9e3;
    --muted: #9ca8ba;
    --accent: #f2661b;
    --accent-text: #ff8a47;
    --tanren: #7fb2d9;
    --code-bg: #1b2642;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424;
  --band: #111a2e;
  --surface: #16203a;
  --line: #25314c;
  --text: #e6e9ef;
  --body: #d3d9e3;
  --muted: #9ca8ba;
  --accent: #f2661b;
  --accent-text: #ff8a47;
  --tanren: #7fb2d9;
  --code-bg: #1b2642;
  color-scheme: dark;
}

/* ===== Base ===== */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--body);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
[lang="ja"] body { line-height: 1.85; }
h1, h2, h3, h4 { color: var(--text); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
}
/* The width of the page's content, with a 16-pixel margin on a phone */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* "Skip to the content": hidden until it is reached with the Tab key */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 10;
  background: var(--accent); color: var(--on-accent); font-weight: 700;
  padding: 6px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ===== The marks ===== */

.mark .ring { stroke: var(--accent); }
.mark .glyph { fill: var(--text); }
.mark .seal { fill: var(--seal); }

/* ===== Header ===== */

.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.topin { display: flex; align-items: center; gap: 24px; min-height: 64px;
  flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text);
  font-weight: 700; font-size: 20px; letter-spacing: .3px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 32px; height: 32px; }
.mainnav { display: flex; gap: 20px; flex-wrap: wrap; flex: 1; }
.mainnav a { color: var(--muted); font-weight: 600; font-size: 15px; }
.mainnav a:hover, .mainnav a.cur { color: var(--text); text-decoration: none; }
.tools { display: flex; gap: 8px; }
.langsw, .themesw { font-size: 14px; color: var(--muted);
  border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; }
.langsw:hover, .themesw:hover { color: var(--text); border-color: var(--muted);
  text-decoration: none; }
/* The light/dark button: shown only when its script can run */
.themesw { display: none; background: none; cursor: pointer;
  padding: 0 8px; }
.js .themesw { display: flex; align-items: center; }

/* ===== Footer ===== */

footer { border-top: 1px solid var(--line); padding: 28px 0 40px;
  font-size: 14px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 10px; }
footer .sep { opacity: .5; }
/* The trademark and copyright notices, on a line of their own */
footer .legal { margin-top: 10px; font-size: 13px; gap: 4px 16px; }

/* ===== Buttons ===== */

.btn { display: inline-block; padding: 11px 18px; border-radius: 8px;
  font-weight: 700; font-size: 15px; border: 1px solid var(--line);
  color: var(--text); background: var(--surface); }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }

/* ===== Narrow screens ===== */

@media (max-width: 560px) {
  .topin { gap: 12px; padding-top: 10px; }
  .mainnav { order: 3; flex-basis: 100%; gap: 16px; padding-bottom: 10px; }
  .tools { margin-left: auto; }
}

/* ===================================================================
 * The home page
 * =================================================================== */

/* The hero: the background image, darkened and blurred, with the
 * terminal floating above it. It is dark in both themes, because the
 * image is, so it sets its own colours. */
.hero { position: relative; overflow: hidden; isolation: isolate;
  padding: 72px 0 64px; border-bottom: 1px solid var(--line);
  --text: #f1f4f8; --muted: #c3ccd9; --accent-text: #ff9a5c;
  --surface: #16203acc; --line: #ffffff26; color: var(--text); }
.hero::before { content: ""; position: absolute; inset: -30px; z-index: -2;
  background: url("/img/background.webp") center / cover no-repeat;
  filter: blur(6px) brightness(.6) saturate(.95); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(8,12,22,.82) 0%,
    rgba(8,12,22,.55) 55%, rgba(8,12,22,.15) 100%); }
.heroin { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px;
  align-items: center; }
/* The MSX logo, first in the hero, for MSX users to spot at once. The
   image is 400 pixels wide, for screens with twice the pixels. */
.msxlogo { display: block; width: 200px; height: auto; margin: 0 0 28px; }
.eyebrow { margin: 0 0 12px; color: var(--accent-text); font-weight: 600;
  font-size: 14px; letter-spacing: .4px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1.12;
  margin: 0 0 20px; letter-spacing: -.5px; font-weight: 800; }
[lang="ja"] .hero h1 { letter-spacing: 0; line-height: 1.3;
  font-size: clamp(28px, 4vw, 44px); }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 28px;
  max-width: 60ch; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.small { font-size: 14px; color: var(--muted); margin: 0; }

/* An MSX-DOS screen */
.term { margin: 0; position: relative; background: var(--term-bg);
  border: 1px solid var(--term-line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.55); }
.termbar { display: flex; align-items: center; gap: 6px; padding: 9px 12px;
  border-bottom: 1px solid var(--term-line); }
.termbar span { width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.35); }
.termbar b { margin-left: 8px; font-size: 12px; font-weight: 600;
  color: var(--term-faded); letter-spacing: .5px; }
.term pre { margin: 0; padding: 16px; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.55; color: var(--term-text);
  overflow-x: auto; }
.term .pr { color: var(--term-faded); }
.term .cmd { color: #ffffff; font-weight: 700; }
.term .out { color: var(--term-hi); }
.term figcaption { font-size: 13px; color: var(--term-faded);
  padding: 10px 16px 12px; border-top: 1px solid var(--term-line); }

/* The sections below the hero */
main section { padding: 64px 0; }
.band { background: var(--band); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); }
main section h2 { font-size: clamp(24px, 3vw, 32px); margin: 0 0 28px;
  letter-spacing: -.3px; }
[lang="ja"] main section h2 { letter-spacing: 0; }
[lang="ja"] h1, [lang="ja"] h2, [lang="ja"] h3 { word-break: keep-all;
  overflow-wrap: anywhere; }

/* The two programs */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.prog { display: flex; gap: 18px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px; }
.prog .mark { width: 52px; height: 52px; flex: none; }
.prog h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: .5px; }
.prog h3 span { font-weight: 500; color: var(--muted); letter-spacing: 0;
  margin-left: 6px; font-size: 15px; }
.prog.ta h3 { color: var(--accent-text); }
.prog.tn h3 { color: var(--tanren); }
.prog p { margin: 0; color: var(--muted); }

/* The features */
.feats { display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 28px 32px; }
.feat h3 { font-size: 16px; margin: 0 0 6px; }
.feat h3::before { content: ""; display: inline-block; width: 8px;
  height: 8px; border-radius: 2px; background: var(--accent);
  margin-right: 10px; vertical-align: 2px; }
.feat p { margin: 0; color: var(--muted); font-size: 15px; }

/* Requirements, and the names */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.reqs { margin: 0 0 16px; padding-left: 20px; }
.reqs li { margin-bottom: 8px; }
.more, .names { color: var(--muted); margin: 0; }
.names em { color: var(--text); font-style: normal; font-weight: 600; }

@media (max-width: 860px) {
  .heroin, .two, .cols { grid-template-columns: 1fr; }
  .feats { grid-template-columns: 1fr 1fr; }
  .hero { padding: 44px 0 40px; }
  .msxlogo { width: 150px; margin-bottom: 20px; }
  main section { padding: 44px 0; }
}
@media (max-width: 560px) {
  .feats { grid-template-columns: 1fr; }
  .term pre { font-size: 10.5px; padding: 12px; }
}

/* ===================================================================
 * Pages of text: Getting started, Download, Examples
 * =================================================================== */

.article { max-width: 772px; padding-top: 40px; padding-bottom: 64px;
  font-size: 17px; line-height: 1.75; }
[lang="ja"] .article { font-size: 16.5px; line-height: 1.95; }
.article h1 { font-size: clamp(30px, 4.2vw, 42px); line-height: 1.2;
  margin: 0 0 24px; letter-spacing: -.4px; }
.article h2 { font-size: 24px; line-height: 1.3; margin: 48px 0 14px;
  letter-spacing: -.2px; }
[lang="ja"] .article h1, [lang="ja"] .article h2 { letter-spacing: 0; }
.article p { margin: 0 0 1.1em; }
.article ul, .article ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.article li { margin-bottom: .4em; }
.article strong { color: var(--text); }

/* Listings and directory trees */
.article pre { font-family: var(--mono); font-size: 14px; line-height: 1.6;
  background: var(--band); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin: 0 0 1.4em; overflow-x: auto; }
.article pre code { background: none; padding: 0; font-size: inherit; }

/* MSX-DOS2 sessions: the same screen as on the home page */
.article pre.session { background: var(--term-bg); color: var(--term-text);
  border-color: var(--term-line); }
.article pre.session .pr { color: var(--term-faded); }
.article pre.session .cmd { color: #ffffff; font-weight: 700; }

/* Notes: a quotation block that starts with "Note." */
.article blockquote { margin: 1.4em 0; padding: 12px 18px;
  background: var(--band); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 6px; }
.article blockquote p:last-child { margin-bottom: 0; }

@media (max-width: 560px) {
  .article { font-size: 16px; padding-top: 28px; }
  .article pre { font-size: 12.5px; }
}

/* Tables and file sizes in pages of text */
.article table { border-collapse: collapse; margin: 0 0 1.4em; font-size: 15px;
  line-height: 1.5; }
.article th, .article td { text-align: left; padding: 7px 16px 7px 0;
  border-bottom: 1px solid var(--line); vertical-align: top; }
.article th { color: var(--text); border-bottom-width: 2px; }
.article .size { color: var(--muted); font-size: .9em; font-weight: 400; }

/* The Examples page */
.example { border-top: 1px solid var(--line); padding-top: 8px;
  margin-top: 36px; }
.example h2 { margin-top: 16px; letter-spacing: .5px; }
.example .chapter { font-size: 15px; margin-top: -.4em; }
.files { list-style: none; padding-left: 0; margin: 0 0 1em; }
.files li { margin-bottom: .3em; }
.files code { font-size: .95em; }

/* The root page: two links, seen only without JavaScript */
.choose { max-width: 1120px; margin: 0 auto; padding: 64px 16px;
  font-size: 20px; }
