/* Template card of the Unisson model (section « Gabarits »): its rules copied from the model, colours read from the
   --pack-* tokens. The host is the grid item of bythium-pack-templates; the card fills it. */
:host {
  display: grid;
  min-inline-size: 0;
  color: var(--pack-ink);
  font:
    16px / 1.6 Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}
:host([hidden]) {
  display: none;
}
[part="heading"],
p {
  margin: 0;
}

/* .tpl, with the glow border and the spotlight of the model. Stretch and no minimum height undo the base sheet's link. */
.tpl {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-block-size: 0;
  gap: 14px;
  text-decoration: none;
  color: var(--pack-ink);
}
.glow {
  position: relative;
  border-radius: 18px;
  background: var(--pack-panel);
  border: 1px solid var(--pack-line);
  box-shadow: var(--pack-shadow);
}
.glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--pack-c1), transparent 35%, transparent 65%, var(--pack-c2));
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(var(--pack-ink) 0 0) content-box,
    linear-gradient(var(--pack-ink) 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(var(--pack-ink) 0 0) content-box exclude,
    linear-gradient(var(--pack-ink) 0 0);
}
.spot {
  overflow: hidden;
}
.spot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--pack-a1), var(--pack-a2) 45%, transparent 75%);
}
.spot:hover::before {
  opacity: 0.55;
}
.spot > * {
  position: relative;
}
a.tpl:focus-visible {
  outline: 2px solid var(--pack-focus);
  outline-offset: 3px;
}

/* The miniature screen and its blocks. */
.scr {
  block-size: 170px;
  border-radius: 12px;
  border: 1px solid var(--pack-line);
  background: var(--pack-code);
  padding: 12px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}
.sk {
  border-radius: 7px;
  background: var(--pack-panel2);
  box-shadow: 0 0 0 1px var(--pack-line) inset;
}
.sk.g {
  background: linear-gradient(120deg, var(--pack-a1), var(--pack-a2));
}

/* The drawings: the three of the model (tableau, reglages, auth), three more in the same blocks. */
.scr[data-kind="tableau"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 34px 1fr;
}
.scr[data-kind="tableau"] > :first-child {
  grid-column: 1 / -1;
}
.scr[data-kind="reglages"] {
  grid-template-rows: 20px 22px 22px 22px 1fr;
}
.scr[data-kind="reglages"] > :first-child {
  inline-size: 50%;
}
.scr[data-kind="reglages"] > :last-child {
  inline-size: 40%;
}
.scr[data-kind="auth"] {
  place-content: center;
  grid-template-columns: 70%;
}
.scr[data-kind="auth"] > * {
  block-size: 20px;
}
.scr[data-kind="auth"] > :last-child {
  block-size: 24px;
}
.scr[data-kind="conversation"] {
  align-content: end;
}
.scr[data-kind="conversation"] > * {
  inline-size: 62%;
  block-size: 22px;
}
.scr[data-kind="conversation"] > :nth-child(2) {
  inline-size: 54%;
  justify-self: end;
}
.scr[data-kind="conversation"] > :last-child {
  inline-size: 100%;
  block-size: 28px;
  margin-block-start: 6px;
}
.scr[data-kind="liste"] {
  align-content: start;
  grid-template-rows: 20px;
  grid-auto-rows: 18px;
}
.scr[data-kind="erreur"] {
  place-content: center;
  justify-items: center;
  grid-template-columns: 70%;
}
.scr[data-kind="erreur"] > :first-child {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
}
.scr[data-kind="erreur"] > :nth-child(2) {
  inline-size: 80%;
  block-size: 14px;
}
.scr[data-kind="erreur"] > :last-child {
  inline-size: 44%;
  block-size: 24px;
}

/* Copy of the card. */
[part="heading"] {
  font:
    700 18px Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}
p {
  font-size: 14px;
  color: var(--pack-mut);
}
.more {
  margin-block-start: auto;
  font:
    600 13px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  color: var(--pack-link);
}
/* The mark sits at the end of the heading's line: card padding, drawing and gap above it. */
.tpl .mark {
  position: absolute;
  inset-block-start: 202px;
  inset-inline-end: 16px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--pack-c2);
  background: var(--pack-panel);
  font:
    600 11px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  color: var(--pack-ink);
}

.mark + [part="heading"] {
  padding-inline-end: 56px;
}

@media (prefers-reduced-motion: no-preference) {
  .spot::before {
    transition: opacity 0.3s;
  }
}

/* Forced colours: the decorative lights go, the card and its blocks keep a system border. */
@media (forced-colors: active) {
  .glow::after,
  .spot::before {
    display: none;
  }
  .glow,
  .scr {
    border-color: CanvasText;
  }
  .sk {
    border: 1px solid CanvasText;
  }
}
