/* The word list. A reference page rather than an exercise: set as a
   document, in one column, with the Thai given the size it needs to be read
   by somebody still learning the letters.

   Hand-kept, unlike index.html next to it, which scripts/generate-words-page.mjs
   writes out of the syllabus. */

body {
  margin: 0;
  padding: 0 18px 64px;
  background-color: var(--paper);
  background-image: var(--lattice);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.65;
}

.w-nav {
  max-width: 828px;
  margin: 0 auto;
  padding: 16px 34px 0;
  box-sizing: border-box;
}
.w-nav a {
  font-family: var(--sans, Arial, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
}
.w-nav a:hover { color: var(--silk); }

/* The lattice is the page's ground, not its writing surface: a column of
   Thai, romanisation and English read against the diamonds is hard work.
   The reading column therefore sits on a flat sheet laid over the pattern,
   the way .exercise does inside a lesson. Nav and footer keep the sheet's
   width so their text lines up with the text on it. */
.wordlist {
  max-width: 828px;
  margin: 10px auto 0;
  padding: 30px 34px 36px;
  box-sizing: border-box;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(22, 33, 28, 0.06);
}

h1 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: clamp(30px, 5.5vw, 44px);
  font-weight: 600;
  line-height: 1.2;
}
.lede {
  margin: 0 0 34px;
  font-size: 17px;
  color: var(--ink-2);
  max-width: 44em;
}
.lede a { color: var(--silk); text-underline-offset: 0.2em; }

/* The contents: ten lines, so a list rather than a wall of links. */
.toc {
  margin: 0 0 40px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
}
.toc h2 {
  margin: 0 0 10px;
  font-family: var(--sans, Arial, sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin: 3px 0; font-size: 15px; }
.toc a { color: var(--ink); text-underline-offset: 0.2em; }
.toc span { color: var(--ink-3); font-size: 14px; }

.unit { margin: 0 0 46px; }
.unit h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  border-top: 2px solid var(--silk);
  padding-top: 14px;
}
.u-sub {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-3);
}
.place { margin: 0 0 22px; font-size: 15px; color: var(--ink-2); }
.place span[lang="th"] { font-size: 19px; font-weight: 600; }
.p-rom { color: var(--ink-3); font-size: 14px; }

.unit h3 {
  margin: 26px 0 10px;
  font-family: var(--sans, Arial, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* The table. Three columns, no rules between them: the Thai is the column
   the eye travels down, and vertical lines would cut that column into
   cells. */
.words {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 6px;
}
/* The column headings are labels on the table, not entries in it. */
.words thead th {
  font-family: var(--sans, Arial, sans-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 0 10px 6px 0;
  border-bottom: 1px solid var(--line);
}
.words td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}
.w-th { width: 28%; font-size: 21px; font-weight: 600; line-height: 1.5; }
.w-rom { width: 24%; font-size: 14px; color: var(--ink-3); font-weight: 600; }
.w-en { font-size: 16px; }
.w-note {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-3);
}

/* The sentences the words are used in. They sit under the table of the same
   words, so they keep the table's three columns: Thai, pronunciation,
   meaning read straight down the page instead of restarting in a column of
   their own. The gold rule hangs into the left gutter (the negative margin
   cancels its own indent) so the Thai starts exactly where the Thai above
   it starts. */
.sentences { list-style: none; margin: 16px 0 0; padding: 0; }
.sentences li {
  display: grid;
  grid-template-columns: 28% 24% 1fr;
  align-items: baseline;
  margin: 0 0 2px -15px;
  padding: 7px 0 7px 13px;
  border-left: 2px solid var(--gold-l);
}
.s-th { padding-right: 10px; font-size: 19px; font-weight: 600; line-height: 1.5; }
.s-rom { padding-right: 10px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.s-en { font-size: 15px; color: var(--ink-2); }

.w-foot {
  max-width: 828px;
  margin: 28px auto 0;
  padding: 18px 34px 0;
  box-sizing: border-box;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-3);
}
.w-foot a { color: var(--ink-2); }

@media (max-width: 560px) {
  /* The sheet keeps its margin off the screen edge but gives the text back
     the room the padding was taking. */
  .wordlist { padding: 24px 16px 28px; }
  .w-nav, .w-foot { padding-left: 16px; padding-right: 16px; }

  /* Three columns in 375px gives the Thai about 100px, which is not enough
     to read a word you are still learning to read. The row becomes two
     lines instead, and the header row goes with the layout it labelled. */
  .words thead { display: none; }
  .words, .words tbody, .words tr, .words td { display: block; width: auto; }
  .words tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .words td { padding: 0; border: 0; }
  .w-th { font-size: 23px; }
  .w-rom { display: inline-block; margin-right: 10px; }
  .w-en { display: inline; font-size: 15px; }
  .w-note { margin-top: 4px; }

  /* Same reason, same answer: the sentence stacks instead of splitting a
     narrow screen into three. */
  .sentences li {
    display: block;
    margin-left: 0;
    padding: 9px 0 9px 13px;
    margin-bottom: 7px;
  }
  .s-th { display: block; padding-right: 0; font-size: 21px; }
  .s-rom { display: block; padding-right: 0; }
  .s-en { display: block; }
}

/* The topic links below the contents. Same box, but a list of eleven
   sentences rather than ten numbered units, so no numbers and more room
   between the lines. */
.toc.topics { border-left-color: var(--silk); }
.toc.topics ul { list-style: none; margin: 0; padding: 0; }
.toc.topics li {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}
.toc.topics li:last-child { border-bottom: 0; padding-bottom: 0; }
