/* ─────────────────────────────────────────────────────────────
   Laesi · Leaf
   Styling for the "Laesi Demo" note type.

   Nothing exotic here: border-radius, a two-layer shadow, a
   border. Renders the same on Anki desktop, AnkiDroid,
   AnkiMobile and AnkiWeb.

   Keep the literal string ".night_mode" in this file. AnkiDroid
   falls back to a heuristic colour inversion when it can't find
   it anywhere in the stylesheet, and your colours get ignored.
   ───────────────────────────────────────────────────────────── */

:root { color-scheme: light dark; }   /* stops Android WebView
                                         darkening on top of us */

.card {
  color-scheme: light;
  --bg:#EFEFE9; --pane:#FFFFFF; --edge:#E2E1D7; --hair:#E2E1D7;
  --ink:#22303A; --ink-soft:#63727B; --ink-faint:#98A3A9;
  --ask:#2B6E72;                       /* fjord teal — question side */
  --tell:#C4703F;                      /* terracotta — answer side   */
  --cue:#3F6FD0; --cue-wash:rgba(63,111,208,.11);
  --ask-wash:rgba(43,110,114,.13); --tell-wash:rgba(196,112,63,.15);
  --mark:rgba(196,112,63,.20);
  --chip-bg:#F5F4EF; --chip-edge:#E2E1D7;
  --lift: 0 1px 2px rgba(34,48,58,.07), 0 12px 30px -14px rgba(34,48,58,.24);

  margin: 0;
  padding: 24px 14px 44px;
  background-color: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 17px; line-height: 1.5;
  text-align: left;                    /* sentences, not single words */
  -webkit-font-smoothing: antialiased;
}

.card.nightMode,
.card.night_mode {
  color-scheme: dark;
  --bg:#1E1E22; --pane:#292930; --edge:#383840; --hair:#383840;
  --ink:#E8E6E1; --ink-soft:#A8A79F; --ink-faint:#75746F;
  --ask:#5FA8A5; --tell:#D4805A;
  --cue:#7FA9F0; --cue-wash:rgba(127,169,240,.14);
  --ask-wash:rgba(95,168,165,.19); --tell-wash:rgba(212,128,90,.22);
  --mark:rgba(212,128,90,.26);
  --chip-bg:#32323A; --chip-edge:#43434D;
  --lift: 0 1px 2px rgba(0,0,0,.40), 0 14px 34px -16px rgba(0,0,0,.70);
}

/* One spine colour per card template, so you know which
   direction you're being tested in before reading a word. */
.card2 { --ask: #5B8DEE; }
.card3 { --ask: #5FC28F; }

/* ── panels ────────────────────────────────────────────────── */
.pane {
  position: relative; overflow: hidden;
  max-width: 34em; margin: 0 auto 14px;
  padding: 20px 24px 22px 26px;
  background: var(--pane);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: var(--lift);
}
.pane::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--ask);
}
.pane--tell::before { background: var(--tell); }

/* Zero height but still in the flow — Anki scrolls to #answer on
   long cards, so don't display:none it. */
hr#answer { border: 0; height: 0; margin: 0; }

/* ── type ──────────────────────────────────────────────────── */
.tag {
  font: 500 10.5px/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 11px;
}
.pane--tell .tag { color: var(--tell); }

.expression {
  font-family: Spectral, Charter, "Iowan Old Style", Georgia, serif;
  font-size: 26px; line-height: 1.34; color: var(--ink);
  text-wrap: balance;
}
.meaning { font-size: 20px; line-height: 1.42; color: var(--ink); }
.meaning--prompt { font-size: 24px; }
.meaning--sub { font-size: 16px; color: var(--ink-soft); margin-top: 8px; }
.answer {
  font-family: Spectral, Charter, "Iowan Old Style", Georgia, serif;
  font-size: 27px; color: var(--tell);
}
.notes { margin-top: 11px; font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); }

/* ── cloze blank ───────────────────────────────────────────────
   This deck emits <span class="cue">[hint]</span>, so CSS owns
   the colour. The second rule catches notes that carry a
   hand-applied inline colour instead — inline styles beat
   stylesheets, hence !important.                               */
.cloze .cue,
.cloze span {
  color: var(--cue) !important;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .68em; font-weight: 500;
  padding: .12em .4em; border-radius: 6px;
  background: var(--cue-wash);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ── the word this card is about ───────────────────────────────
   Wrapped at export time. Without it the target is invisible on
   a sentence card — you can read the whole line and never learn
   which word you were being asked about. Takes the accent of
   whichever side it appears on, same logic as the spine.       */
.target, .counterpart {
  color: var(--ink);
  background: var(--target-wash);
  border-bottom: 2px solid var(--target-line);
  border-radius: 3px 3px 0 0;
  padding: 0 .08em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.pane--ask  .target, .pane--ask  .counterpart, .pane--ask  .partner { --target-wash: var(--ask-wash);  --target-line: var(--ask); }
.pane--tell .target, .pane--tell .counterpart, .pane--tell .partner { --target-wash: var(--tell-wash); --target-line: var(--tell); }

/* Words that form one expression with the target (op in står op) are
   wrapped in .partner at export time: the target's line, dotted, no wash. */
.partner {
  border-bottom: 2px dotted var(--target-line);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ── gloss ─────────────────────────────────────────────────────
   The English words that translate the target are wrapped in
   .counterpart at export time and take its look. On the backs
   that test meaning, the word and its cloze hint sit on one line:
   ClozeExpression is printed whole and every part but the hint is
   set to nothing. A ClozeExpression without a cue span (a plain-text
   import) hides the line instead.                              */
.gloss { margin-top: 12px; font-size: 16px; line-height: 1.4; }
.gloss:not(:has(.cue)) { display: none; }
.gloss-word { font-family: Spectral, Charter, "Iowan Old Style", Georgia, serif; font-size: 18px; color: var(--ink); margin-right: .4em; }
.gloss-cue:has(.cue) { font-size: 0; }
.gloss-cue .cue { font-size: 16px; color: var(--ink-soft); }

/* ── dictionary identity ───────────────────────────────────────
   Serif is target-language throughout this stylesheet, sans is
   English — so the lemma is serif and the grammar note isn't.
   Margins sit on the children so an empty row has no height.   */
.ident { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 11px; }
.lemma {
  margin-top: 12px;
  font-family: Spectral, Charter, "Iowan Old Style", Georgia, serif;
  font-size: 18px; color: var(--ink);
}
.grammar {
  margin-top: 12px;
  font: 500 11px/1.45 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .06em; color: var(--ink-faint);
}

/* ── context paragraph ─────────────────────────────────────────
   Prose, so it gets the prose face. The sentence you were just
   tested on is wrapped in <mark> at export time and lifts back
   to full ink; everything around it stays subordinate.         */
.reading {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--hair);
  font-family: Spectral, Charter, "Iowan Old Style", Georgia, serif;
  font-size: 15.5px; line-height: 1.62;
  color: var(--ink-soft);
}
.reading mark {
  background: var(--mark); color: var(--ink);
  padding: .06em .18em; border-radius: 3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ── attribution ─────────────────────────────────────────────
   Two different claims, so two chips: where the definition came
   from, and where the sentence was found.                     */
.src { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.src-item { display: flex; align-items: center; gap: 7px; margin-top: 15px; }
.src-label {
  font: 500 9.5px/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .17em; text-transform: uppercase; color: var(--ink-faint);
}
.src-chip {
  font-size: 12.5px; line-height: 1.4; color: var(--ink-soft);
  padding: 3px 10px; border-radius: 999px;
  background: var(--chip-bg); border: 1px solid var(--chip-edge);
}

/* ── media ─────────────────────────────────────────────────────
   Nothing in this deck fills these, but the note type has the
   fields, so the styling is here for anyone who does.

   Two replay-button markups exist: desktop and AnkiMobile emit
   a.replay-button wrapping svg > circle + path, AnkiDroid emits
   a.replaybutton — no hyphen — wrapping an svg polygon. Style
   both; the absent one costs nothing.                          */
.audio { margin-top: 15px; }
.replay-button svg        { width: 30px; height: 30px; }
.replay-button svg circle { fill: var(--ask); stroke: none; }
.replay-button svg path   { fill: var(--pane); stroke: var(--pane); }
.replaybutton svg         { width: 30px; height: 30px; }
.replaybutton svg polygon { fill: var(--ask); stroke: var(--ask); }
.replaybutton svg circle  { fill: var(--ask); stroke: none; }

/* Scoped to .shot, not bare img — a bare img selector also hits
   the star on marked cards. !important because AnkiDroid has
   ignored image dimension CSS without it. */
.shot { margin-top: 16px; }
.shot img {
  display: block; margin: 0; border-radius: 10px;
  width: auto !important; height: auto !important;
  max-width: 100% !important; max-height: 38vh !important;
}
.clip { margin-top: 16px; }
.clip video {
  display: block; border-radius: 10px;
  max-width: 100% !important; height: auto !important;
}

/* ── annotation ───────────────────────────────────────────────
   A reading, romanization or morpheme breakdown of the target, set
   as ruby over it on the answer side. Latin script, so the UI sans.
   Empty on the Danish decks; the template omits it entirely then. */
.annotation, .annotation-rt {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400; font-style: normal; color: var(--ink-soft);
}
.annotation { font-size: 14px; line-height: 1.4; margin: 0 0 8px; }
.annotation-rt { font-size: 0.5em; letter-spacing: 0.02em; ruby-align: center; }

/* ── phones ────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .card { padding: 14px 10px 32px; font-size: 16px; }
  .pane { padding: 17px 18px 19px 20px; border-radius: 15px; }
  .expression { font-size: 22px; }
  .meaning { font-size: 18px; }
  .meaning--prompt { font-size: 21px; }
  .answer { font-size: 23px; }
  .lemma { font-size: 17px; }
  .reading { font-size: 15px; }
  .annotation { font-size: 13px; }
  .gloss-word { font-size: 17px; }
  .gloss-cue .cue { font-size: 15px; }
  .shot img { max-height: 30vh !important; }
}
