/* ─────────────────────────────────────────────────────────────
   Laesi · Fjord — frosted glass.

   Glass needs something behind it to refract, so the body carries
   two soft radial washes in the Laesi accents and the pane blurs
   what's underneath. Remove the gradients and the backdrop-filter
   has nothing to do — the pane goes flat.

   ".night_mode" must stay literally present for AnkiDroid.
   ───────────────────────────────────────────────────────────── */

:root { color-scheme: light dark; }

.card {
  color-scheme: light;
  --ink:#1B2A32; --ink-soft:#52646E; --ink-faint:#84949C;
  --hair:rgba(27,42,50,.15);
  --ask:#235B5F; --tell:#B0623A;
  --cue:#2F5FC0; --cue-wash:rgba(47,95,192,.13);
  --ask-wash:rgba(35,91,95,.14); --tell-wash:rgba(176,98,58,.17);
  --mark:rgba(176,98,58,.22);
  --pane:#E4EAE9;
  --glass:rgba(255,255,255,.58); --glass-edge:rgba(255,255,255,.80);
  --spec:rgba(255,255,255,.85);
  --chip-bg:rgba(255,255,255,.45); --chip-edge:rgba(255,255,255,.65);

  margin: 0;
  padding: 26px 14px 46px;
  color: var(--ink);
  background-color: #E4EAE9;
  background-image:
    radial-gradient(760px 520px at 10% -14%, rgba(43,110,114,.30), transparent 62%),
    radial-gradient(640px 480px at 96% 112%, rgba(212,128,90,.26), transparent 64%);
  background-attachment: fixed;
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 17px; line-height: 1.5;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.card.nightMode,
.card.night_mode {
  color-scheme: dark;
  --ink:#EAE8E3; --ink-soft:#ADB6BA; --ink-faint:#7C8489;
  --hair:rgba(255,255,255,.11);
  --ask:#7FC9C4; --tell:#E39468;
  --cue:#8FB6F5; --cue-wash:rgba(143,182,245,.15);
  --ask-wash:rgba(127,201,196,.16); --tell-wash:rgba(227,148,104,.22);
  --mark:rgba(227,148,104,.24);
  --pane:#15181B;
  --glass:rgba(255,255,255,.055); --glass-edge:rgba(255,255,255,.11);
  --spec:rgba(255,255,255,.17);
  --chip-bg:rgba(255,255,255,.07); --chip-edge:rgba(255,255,255,.14);

  background-color: #15181B;
  background-image:
    radial-gradient(780px 540px at 8% -14%, rgba(52,132,136,.46), transparent 62%),
    radial-gradient(660px 500px at 98% 112%, rgba(190,106,68,.36), transparent 64%);
}

.pane {
  position: relative;
  max-width: 34em; margin: 0 auto 16px;
  padding: 21px 25px 23px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
          backdrop-filter: blur(20px) saturate(160%);
  /* The inset top highlight is what actually reads as glass —
     it's the specular edge. Without it this is just a tint. */
  box-shadow:
    inset 0 1px 0 var(--spec),
    inset 0 -1px 0 rgba(0,0,0,.12),
    0 18px 44px -20px rgba(0,0,0,.55);
}

/* Old Android System WebView — common on Boox and other e-ink
   Android devices — has no backdrop-filter. Fall back to opaque. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card       .pane { background: rgba(255,255,255,.88); }
  .night_mode .pane,
  .nightMode  .pane { background: rgba(30,34,38,.92); }
}

hr#answer { border: 0; height: 0; margin: 0; }

.tag {
  font: 500 10.5px/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 11px;
}
.pane--ask  .tag { color: var(--ask); }
.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 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;
}

@media (max-width: 500px) {
  .card { padding: 14px 9px 32px; font-size: 16px; }
  .pane { padding: 17px 18px 19px; border-radius: 18px; }
  .expression { font-size: 22px; }
  .meaning { font-size: 18px; }
  .meaning--prompt { font-size: 21px; }
  .answer { font-size: 23px; }
}

/* ── 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, 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 ─────────────────────────────────────── */
.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 ───────────────────────────────────────────── */
.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);
}
/* Laesi's four provenance colours, ready but unused — nothing
   currently sets these classes. See the templates panel. */
.src-chip.src-wikt   { color: #8FB6F5;   border-color: #8FB6F5; }
.src-chip.src-google { color: #7FC9C4; border-color: #7FC9C4; }
.src-chip.src-llm    { color: #E3B168;    border-color: #E3B168; }
.src-chip.src-user   { color: var(--ink-soft); }

/* ── media ─────────────────────────────────────────────────────
   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: 12px;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 38vh !important;
}

.clip { margin-top: 16px; }
.clip video {
  display: block;
  border-radius: 12px;
  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; }

@media (max-width: 500px) {
  .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; }
}
