/* A quiet, printed-page theme: parchment, one rubric red, and colour used
   only to tell one grammatical category from another.

   Every chip colour is a pair of custom properties set by the category class,
   so the dark scheme redefines the pairs and nothing else. */

:root {
  --paper:        #fbf8f2;
  --paper-raised: #fffdf8;
  --paper-sunk:   #f3eee3;
  --ink:          #241f1a;
  --ink-soft:     #6d6357;
  --ink-faint:    #96897a;
  --rule:         #ded4c2;
  --rule-soft:    #ebe3d5;
  --rubric:       #8a2f26;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --cat-pos:    #3f4c6e; --cat-pos-bg:    #e7eaf3;
  --cat-case:   #2f4f74; --cat-case-bg:   #e3ecf3;
  --cat-number: #5b5348; --cat-number-bg: #ece7dd;
  --cat-gender: #6c3e60; --cat-gender-bg: #f2e8ef;
  --cat-person: #6a4a2c; --cat-person-bg: #f1e7d9;
  --cat-tense:  #7a5716; --cat-tense-bg:  #f6edd7;
  --cat-voice:  #1f5b5b; --cat-voice-bg:  #e0eded;
  --cat-mood:   #405f2c; --cat-mood-bg:   #e8efe0;
  --cat-degree: #4e3a75; --cat-degree-bg: #ece7f6;
  --cat-sort:   #4e3a75; --cat-sort-bg:   #ece7f6;
  --cat-plain:  #5b5348; --cat-plain-bg:  #ece7dd;

  --json-key:    #7a3f2e;
  --json-string: #3c5f3c;
  --json-number: #2f4f74;
  --json-bool:   #6c3e60;
  --json-null:   #96897a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #16150f;
    --paper-raised: #1d1b15;
    --paper-sunk:   #12110c;
    --ink:          #e8e0d2;
    --ink-soft:     #a79c8b;
    --ink-faint:    #7d7365;
    --rule:         #3a352b;
    --rule-soft:    #2b271f;
    --rubric:       #cf7a68;

    --cat-pos:    #a8b6d8; --cat-pos-bg:    #23283a;
    --cat-case:   #9dc0dd; --cat-case-bg:   #1d2833;
    --cat-number: #c3b8a5; --cat-number-bg: #27231b;
    --cat-gender: #d3a8c6; --cat-gender-bg: #2e2029;
    --cat-person: #d7ad82; --cat-person-bg: #2c231a;
    --cat-tense:  #dcbc72; --cat-tense-bg:  #2e2716;
    --cat-voice:  #8dc4c1; --cat-voice-bg:  #182726;
    --cat-mood:   #a9c98d; --cat-mood-bg:   #202a1a;
    --cat-degree: #b6a6dd; --cat-degree-bg: #24202f;
    --cat-sort:   #b6a6dd; --cat-sort-bg:   #24202f;
    --cat-plain:  #c3b8a5; --cat-plain-bg:  #27231b;

    --json-key:    #d99a80;
    --json-string: #a3c48f;
    --json-number: #9dc0dd;
    --json-bool:   #d3a8c6;
    --json-null:   #7d7365;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: 2.2rem 0 1.4rem;
  margin-bottom: 2rem;
}

.masthead h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead h1 a { color: var(--ink); text-decoration: none; }

.standfirst {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-style: italic;
}

/* ------------------------------------------------------------- form */

.ask label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.field { display: flex; gap: 0.6rem; }

.ask input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.ask input:focus {
  outline: 2px solid var(--rubric);
  outline-offset: -1px;
}

.ask button {
  font-family: var(--serif);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 0 1.2rem;
  color: var(--paper-raised);
  background: var(--rubric);
  border: 1px solid var(--rubric);
  border-radius: 2px;
  cursor: pointer;
}

.ask button:hover { filter: brightness(1.1); }

.examples {
  margin: 0.6rem 0 2rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.examples a { color: var(--ink-soft); }

a { color: var(--rubric); }

/* ------------------------------------------------------------ intro */

.intro {
  border-left: 2px solid var(--rule);
  padding-left: 1.1rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------------- word card */

.word {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1.2rem 1.4rem 1rem;
  margin-bottom: 1.6rem;
}

.word-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.word-head h2 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
  font-style: italic;
}

.tally, .normalized {
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.badge {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--rubric);
  border: 1px solid var(--rubric);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  cursor: help;
}

.empty {
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
}

/* ---------------------------------------------------------- groups */

.group + .group {
  border-top: 1px solid var(--rule-soft);
  margin-top: 1.1rem;
  padding-top: 1.1rem;
}

.group-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.headword {
  font-weight: 600;
  font-size: 1.1rem;
}

.entry-id {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  cursor: help;
}

.paradigm {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.aside {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-style: italic;
}

.deferred { margin: 0.3rem 0 0; }

/* --------------------------------------------------------- readings */

.readings {
  list-style: none;
  margin: 0;
  padding: 0;
}

.readings li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.22rem 0;
  border-bottom: 1px dotted var(--rule-soft);
}

.readings li:last-child { border-bottom: none; }

.form {
  font-family: var(--mono);
  font-size: 0.88rem;
  min-width: 9.5rem;
}

.stem { color: var(--ink); }

.ending {
  color: var(--rubric);
  border-bottom: 1px solid currentColor;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.chip {
  font-family: var(--serif);
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.05rem 0.5rem;
  border-radius: 2px;
  white-space: nowrap;
  cursor: help;
  background: var(--cat-plain-bg);
  color: var(--cat-plain);
}

.cat-plain  { background: var(--cat-plain-bg);  color: var(--cat-plain); }
.cat-pos    { background: var(--cat-pos-bg);    color: var(--cat-pos); }
.cat-case   { background: var(--cat-case-bg);   color: var(--cat-case); }
.cat-number { background: var(--cat-number-bg); color: var(--cat-number); }
.cat-gender { background: var(--cat-gender-bg); color: var(--cat-gender); }
.cat-person { background: var(--cat-person-bg); color: var(--cat-person); }
.cat-tense  { background: var(--cat-tense-bg);  color: var(--cat-tense); }
.cat-voice  { background: var(--cat-voice-bg);  color: var(--cat-voice); }
.cat-mood   { background: var(--cat-mood-bg);   color: var(--cat-mood); }
.cat-degree { background: var(--cat-degree-bg); color: var(--cat-degree); }
.cat-sort   { background: var(--cat-sort-bg);   color: var(--cat-sort); }

.chip-muted { opacity: 0.6; text-decoration: underline dotted; }

.chip-flag, .chip-quiet {
  background: transparent;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
}

/* A lexeme's own properties -- a noun's gender, a verb's deponency -- are not
   features of the form on this line, so they are outlined rather than filled. */
.group-head .chip.cat-plain {
  background: transparent;
  border: 1px dotted var(--rule);
  color: var(--ink-soft);
  font-style: italic;
}

/* -------------------------------------------- records under a headword */

/* A block with one record reads as one paragraph; a block with several files
   them as an indented list, so the shared heading above stays the heading. */
.sense-filed {
  border-left: 2px solid var(--rule-soft);
  padding-left: 0.85rem;
  margin: 0.55rem 0 0;
}

.sense-body {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.sense-body > *:last-child { flex: 1 1 auto; }

.shift { margin: 0.45rem 0 0.1rem; }

/* ---------------------------------------------------------- senses */

.senses {
  margin: 0.4rem 0 0.4rem;
  padding-left: 1.1rem;
  color: var(--ink);
}

.senses li { margin: 0.1rem 0; }

.senses-plain { margin: 0.6rem 0 0.4rem; }

.provenance {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0 0;
}

/* ------------------------------------------------------------ JSON */

.payload h2 {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
}

.payload code { font-family: var(--mono); }

pre.json {
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  max-height: 34rem;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
  tab-size: 2;
}

.json-key    { color: var(--json-key); }
.json-string { color: var(--json-string); }
.json-number { color: var(--json-number); }
.json-bool   { color: var(--json-bool); }
.json-null   { color: var(--json-null); font-style: italic; }

/* ---------------------------------------------------------- footer */

footer {
  margin: 3rem auto 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .form { min-width: 100%; }
}
